nam_ledger_proto/status.rs
1/// Device status codes (two bytes, trailing response data)
2///
3/// Replicated from: https://github.com/LedgerHQ/ledger-live/blob/develop/libs/ledgerjs/packages/errors/src/index.ts#L212
4#[derive(Copy, Clone, Debug, displaydoc::Display, num_enum::TryFromPrimitive)]
5#[repr(u16)]
6pub enum StatusCode {
7 /// Access condition not fulfilled
8 AccessConditionNotFulfilled = 0x9804,
9 /// Algorithm not supported
10 AlgorithmNotSupported = 0x9484,
11 /// APDU class not supported
12 ClaNotSupported = 0x6e00,
13 /// Code blocked
14 CodeBlocked = 0x9840,
15 /// Code not initialized
16 CodeNotInitialized = 0x9802,
17 /// Command incompatible file structure
18 CommandIncompatibleFileStructure = 0x6981,
19 /// Conditions of use not satisfied
20 ConditionsOfUseNotSatisfied = 0x6985,
21 /// Contradiction invalidation
22 ContradictionInvalidation = 0x9810,
23 /// Contradiction secret code status
24 ContradictionSecretCodeStatus = 0x9808,
25 /// Custom image bootloader
26 CustomImageBootloader = 0x662f,
27 /// Custom image empty
28 CustomImageEmpty = 0x662e,
29 /// File already exists
30 FileAlreadyExists = 0x6a89,
31 /// File not found
32 FileNotFound = 0x9404,
33 /// GP auth failed
34 GpAuthFailed = 0x6300,
35 /// Device halted
36 Halted = 0x6faa,
37 /// Inconsistent file
38 InconsistentFile = 0x9408,
39 /// Incorrect data
40 IncorrectData = 0x6a80,
41 /// Incorrect length
42 IncorrectLength = 0x6700,
43 /// Incorrect P1 or P2 values
44 IncorrectP1P2 = 0x6b00,
45 /// Instruction not supported
46 InsNotSupported = 0x6d00,
47 /// Device not onboarded
48 DeviceNotOnboarded = 0x6d07,
49 /// Device also not onboarded
50 DeviceNotOnboarded2 = 0x6611,
51 /// Invalid KCV
52 InvalidKcv = 0x9485,
53 /// Invalid offset
54 InvalidOffset = 0x9402,
55 /// Licensing error
56 Licensing = 0x6f42,
57 /// Device locked
58 LockedDevice = 0x5515,
59 /// Max value reached
60 MaxValueReached = 0x9850,
61 /// Memory problem
62 MemoryProblem = 0x9240,
63 /// Missing critical parameter
64 MissingCriticalParameter = 0x6800,
65 /// No EF selected
66 NoEfSelected = 0x9400,
67 /// Not enough memory space
68 NotEnoughMemorySpace = 0x6a84,
69 /// OK
70 Ok = 0x9000,
71 /// Remaining PIN attempts
72 PinRemainingAttempts = 0x63c0,
73 /// Referenced data not found
74 ReferencedDataNotFound = 0x6a88,
75 /// Security status not satisfied
76 SecurityStatusNotSatisfied = 0x6982,
77 /// Technical problem
78 TechnicalProblem = 0x6f00,
79 /// Unknown APDU
80 UnknownApdu = 0x6d02,
81 /// User refused on device
82 UserRefusedOnDevice = 0x5501,
83 /// Not enough space
84 NotEnoughSpace = 0x5102,
85}