@onekeyfe/hwk-adapter-core 1.1.29-alpha.3 → 1.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +292 -610
- package/dist/index.d.ts +292 -610
- package/dist/index.js +368 -452
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -400
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -22
- package/dist/chunk-6JWUE3GT.mjs +0 -151
- package/dist/chunk-6JWUE3GT.mjs.map +0 -1
- package/dist/chunk-D5OZT7RZ.mjs +0 -138
- package/dist/chunk-D5OZT7RZ.mjs.map +0 -1
- package/dist/chunk-LYVS67EX.js +0 -151
- package/dist/chunk-LYVS67EX.js.map +0 -1
- package/dist/chunk-QD4EQWQA.js +0 -138
- package/dist/chunk-QD4EQWQA.js.map +0 -1
- package/dist/errors.d.mts +0 -164
- package/dist/errors.d.ts +0 -164
- package/dist/errors.js +0 -13
- package/dist/errors.js.map +0 -1
- package/dist/errors.mjs +0 -13
- package/dist/errors.mjs.map +0 -1
- package/dist/ui-events-BzkI1wZk.d.mts +0 -132
- package/dist/ui-events-BzkI1wZk.d.ts +0 -132
- package/dist/ui-events.d.mts +0 -1
- package/dist/ui-events.d.ts +0 -1
- package/dist/ui-events.js +0 -21
- package/dist/ui-events.js.map +0 -1
- package/dist/ui-events.mjs +0 -21
- package/dist/ui-events.mjs.map +0 -1
package/dist/errors.d.mts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HWK HardwareErrorCode — independent namespace from the legacy
|
|
3
|
-
* `@onekeyfe/shared` HardwareErrorCode (which occupies 0-902).
|
|
4
|
-
*
|
|
5
|
-
* All HWK codes are 5-digit (>= 10000) so the two tables never collide
|
|
6
|
-
* even if either side grows. Each sub-category gets a 100-slot block.
|
|
7
|
-
*
|
|
8
|
-
* 10000-10099 Generic / cross-cutting primitives
|
|
9
|
-
* 10100-10199 Device state
|
|
10
|
-
* 10200-10299 Firmware
|
|
11
|
-
* 10300-10399 Transport + OS-level permission
|
|
12
|
-
* 10400-10499 PIN / Passphrase
|
|
13
|
-
* 10500-10599 App lifecycle (wrong app, not open, too old)
|
|
14
|
-
* 10600-10999 RESERVED — future adapter-level categories
|
|
15
|
-
*
|
|
16
|
-
* 11000-11099 EVM APDU (reactive mapping)
|
|
17
|
-
* 11100-11199 Solana APDU
|
|
18
|
-
* 11200-11299 Tron APDU
|
|
19
|
-
* 11300-11399 BTC APDU
|
|
20
|
-
* 11400-11999 RESERVED — future chain APDU blocks (100 per chain)
|
|
21
|
-
*
|
|
22
|
-
* 12000-99999 RESERVED — future major categories
|
|
23
|
-
*/
|
|
24
|
-
declare enum HardwareErrorCode {
|
|
25
|
-
UnknownError = 10000,
|
|
26
|
-
UserRejected = 10001,
|
|
27
|
-
InvalidParams = 10002,
|
|
28
|
-
OperationTimeout = 10003,
|
|
29
|
-
MethodNotSupported = 10004,
|
|
30
|
-
/** User dismissed in-app cancel UI. Distinct from UserRejected (on-device). */
|
|
31
|
-
UserAborted = 10005,
|
|
32
|
-
DeviceNotFound = 10100,
|
|
33
|
-
DeviceDisconnected = 10101,
|
|
34
|
-
DeviceBusy = 10102,
|
|
35
|
-
DeviceLocked = 10103,
|
|
36
|
-
DeviceNotInitialized = 10104,
|
|
37
|
-
DeviceInBootloader = 10105,
|
|
38
|
-
DeviceMismatch = 10106,
|
|
39
|
-
/** Chain app wedged (e.g. Ledger BTC 0x6901). User must exit app on device. */
|
|
40
|
-
DeviceAppStuck = 10107,
|
|
41
|
-
/** Vendor (Ledger / Trezor) doesn't support the chain at all. */
|
|
42
|
-
ChainNotSupported = 10108,
|
|
43
|
-
/** Current operation supports only one connected device. */
|
|
44
|
-
DeviceOneDeviceOnly = 10109,
|
|
45
|
-
FirmwareTooOld = 10200,
|
|
46
|
-
FirmwareUpdateRequired = 10201,
|
|
47
|
-
TransportError = 10300,
|
|
48
|
-
BridgeNotFound = 10301,
|
|
49
|
-
TransportNotAvailable = 10302,
|
|
50
|
-
/**
|
|
51
|
-
* OS-level permission (Bluetooth / USB / etc.) — denied, blocked,
|
|
52
|
-
* unavailable, or dismissed. Consumers surface a single "please grant
|
|
53
|
-
* permission" toast and let the user retry manually.
|
|
54
|
-
*/
|
|
55
|
-
DevicePermissionDenied = 10303,
|
|
56
|
-
/**
|
|
57
|
-
* BLE SMP pairing did not complete within the GATT bonding window.
|
|
58
|
-
* GATT connected but the device didn't acknowledge SMP — typically
|
|
59
|
-
* because the user didn't confirm the passkey on the device, or the
|
|
60
|
-
* device went out of range mid-pairing. Distinct from OperationTimeout
|
|
61
|
-
* (generic) and from DeviceLocked (Secure Element actually locked).
|
|
62
|
-
*/
|
|
63
|
-
BlePairingTimeout = 10304,
|
|
64
|
-
/** Remote network failure reaching a vendor's servers (HTTP/WS). Distinct from TransportError (local USB/BLE link). */
|
|
65
|
-
NetworkError = 10305,
|
|
66
|
-
/**
|
|
67
|
-
* Host-managed pairing handshake failed (Trezor THP). The device rejected the
|
|
68
|
-
* pairing exchange — e.g. CodeEntry: the user mistyped the code shown on the
|
|
69
|
-
* device, so the CPace tag didn't match ("Unexpected Code Entry Tag").
|
|
70
|
-
* Recoverable: the user re-pairs and re-enters the code. Distinct from
|
|
71
|
-
* BlePairingTimeout (BLE SMP bonding window) and UserRejected (on-device
|
|
72
|
-
* reject button).
|
|
73
|
-
*/
|
|
74
|
-
ThpPairingFailed = 10306,
|
|
75
|
-
/**
|
|
76
|
-
* The OS-level BLE bond is stale/invalid, so the device rejected link
|
|
77
|
-
* encryption: Android GATT_INSUF_AUTHENTICATION (status 5) or iOS "Peer
|
|
78
|
-
* removed pairing information". Happens after the device is wiped/re-flashed
|
|
79
|
-
* or unpaired elsewhere while the host still holds an old bond. The SDK cannot
|
|
80
|
-
* remove an OS bond — the user must forget the device in system Bluetooth
|
|
81
|
-
* settings and re-pair. Distinct from BlePairingTimeout (SMP window) and
|
|
82
|
-
* ThpPairingFailed (THP code mismatch).
|
|
83
|
-
*/
|
|
84
|
-
BleBondInvalid = 10307,
|
|
85
|
-
PinInvalid = 10400,
|
|
86
|
-
PinCancelled = 10401,
|
|
87
|
-
PassphraseRejected = 10402,
|
|
88
|
-
/**
|
|
89
|
-
* The passphrase entered produced a different wallet (`passphraseState`) than
|
|
90
|
-
* the one the caller asked to operate on. Trezor-only: the host pins a wallet
|
|
91
|
-
* by its derived state and the SDK refuses to sign with a mismatched
|
|
92
|
-
* passphrase session. Surfaced by TrezorAdapter.getPassphraseState.
|
|
93
|
-
*/
|
|
94
|
-
PassphraseStateMismatch = 10403,
|
|
95
|
-
/** Chain app NOT INSTALLED on device. User must install via Ledger Live. */
|
|
96
|
-
AppNotInstalled = 10500,
|
|
97
|
-
WrongApp = 10501,
|
|
98
|
-
/** 0x911c Command code not supported — app predates current SDK. */
|
|
99
|
-
AppTooOld = 10502,
|
|
100
|
-
/** Not enough free storage for install/update; user must uninstall apps first. */
|
|
101
|
-
DeviceOutOfMemory = 10503,
|
|
102
|
-
/** 0x6a80 Invalid data — observed on blindSignTransactionFallback when the
|
|
103
|
-
* user has not enabled Blind signing on the device. */
|
|
104
|
-
EvmBlindSigningRequired = 11000,
|
|
105
|
-
/** 0x6984 Plugin not installed */
|
|
106
|
-
EvmClearSignPluginMissing = 11001,
|
|
107
|
-
/** 0x6a84 Insufficient memory (typical on Nano S with large calldata) */
|
|
108
|
-
EvmDataTooLarge = 11002,
|
|
109
|
-
/** 0x6501 TransactionType not supported (app too old for EIP-1559 / blob / 7702) */
|
|
110
|
-
EvmTxTypeNotSupported = 11003,
|
|
111
|
-
/** 0x6808 Blind signing disabled for this instruction. */
|
|
112
|
-
SolanaBlindSigningRequired = 11100,
|
|
113
|
-
/** 0x6a8d Custom Contracts setting disabled (blocks TRC-20 etc.). */
|
|
114
|
-
TronCustomContractRequired = 11200,
|
|
115
|
-
/** 0x6a8b Transactions Data setting disabled. */
|
|
116
|
-
TronDataSigningRequired = 11201,
|
|
117
|
-
/** 0x6a8c Sign by Hash setting disabled (hash-signing fallback). */
|
|
118
|
-
TronSignByHashRequired = 11202,
|
|
119
|
-
/** 0xb008 Wallet policy HMAC mismatch or not registered. */
|
|
120
|
-
BtcWalletPolicyHmacMismatch = 11300,
|
|
121
|
-
/** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */
|
|
122
|
-
BtcUnexpectedState = 11301
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Device-level failures the SDK cannot self-recover from — affect the entire
|
|
126
|
-
* batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-
|
|
127
|
-
* skip in onboarding). Combined with `accounts.length === 0`, signals
|
|
128
|
-
* genuine orphan. Also reused as the batch-abort whitelist for HWK.
|
|
129
|
-
* Single source of truth.
|
|
130
|
-
*
|
|
131
|
-
* UserRejected (device-side reject) is included: pressing reject is an
|
|
132
|
-
* explicit "I don't consent" — continuing the batch to ask again on the
|
|
133
|
-
* next chain is harassment, not helpful.
|
|
134
|
-
*/
|
|
135
|
-
declare const ORPHAN_ELIGIBLE_ERROR_CODES: number[];
|
|
136
|
-
interface IHwkErrorPayload {
|
|
137
|
-
code: HardwareErrorCode;
|
|
138
|
-
message: string;
|
|
139
|
-
appName?: string;
|
|
140
|
-
_tag?: string;
|
|
141
|
-
params?: Record<string, unknown>;
|
|
142
|
-
}
|
|
143
|
-
type HwkError = Error & {
|
|
144
|
-
code: HardwareErrorCode;
|
|
145
|
-
appName?: string;
|
|
146
|
-
_tag?: string;
|
|
147
|
-
params?: Record<string, unknown>;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Canonical throwable for HWK adapters. Plain Error + canonical extra fields,
|
|
151
|
-
* shape-compatible with `rehydrateConnectorError` so locally-thrown and
|
|
152
|
-
* cross-boundary errors are indistinguishable to downstream classifiers
|
|
153
|
-
* (`err.code` / `err._tag` / `err.appName`). Do NOT mutate caught errors
|
|
154
|
-
* with `Object.assign` — construct a fresh one via this factory.
|
|
155
|
-
*/
|
|
156
|
-
declare function createHwkError(payload: IHwkErrorPayload): HwkError;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Enrich a hardware error message with actionable recovery hints.
|
|
160
|
-
* Shared across adapters (Ledger, Trezor, etc.).
|
|
161
|
-
*/
|
|
162
|
-
declare function enrichErrorMessage(code: HardwareErrorCode, originalMessage: string): string;
|
|
163
|
-
|
|
164
|
-
export { HardwareErrorCode, type HwkError, type IHwkErrorPayload, ORPHAN_ELIGIBLE_ERROR_CODES, createHwkError, enrichErrorMessage };
|
package/dist/errors.d.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HWK HardwareErrorCode — independent namespace from the legacy
|
|
3
|
-
* `@onekeyfe/shared` HardwareErrorCode (which occupies 0-902).
|
|
4
|
-
*
|
|
5
|
-
* All HWK codes are 5-digit (>= 10000) so the two tables never collide
|
|
6
|
-
* even if either side grows. Each sub-category gets a 100-slot block.
|
|
7
|
-
*
|
|
8
|
-
* 10000-10099 Generic / cross-cutting primitives
|
|
9
|
-
* 10100-10199 Device state
|
|
10
|
-
* 10200-10299 Firmware
|
|
11
|
-
* 10300-10399 Transport + OS-level permission
|
|
12
|
-
* 10400-10499 PIN / Passphrase
|
|
13
|
-
* 10500-10599 App lifecycle (wrong app, not open, too old)
|
|
14
|
-
* 10600-10999 RESERVED — future adapter-level categories
|
|
15
|
-
*
|
|
16
|
-
* 11000-11099 EVM APDU (reactive mapping)
|
|
17
|
-
* 11100-11199 Solana APDU
|
|
18
|
-
* 11200-11299 Tron APDU
|
|
19
|
-
* 11300-11399 BTC APDU
|
|
20
|
-
* 11400-11999 RESERVED — future chain APDU blocks (100 per chain)
|
|
21
|
-
*
|
|
22
|
-
* 12000-99999 RESERVED — future major categories
|
|
23
|
-
*/
|
|
24
|
-
declare enum HardwareErrorCode {
|
|
25
|
-
UnknownError = 10000,
|
|
26
|
-
UserRejected = 10001,
|
|
27
|
-
InvalidParams = 10002,
|
|
28
|
-
OperationTimeout = 10003,
|
|
29
|
-
MethodNotSupported = 10004,
|
|
30
|
-
/** User dismissed in-app cancel UI. Distinct from UserRejected (on-device). */
|
|
31
|
-
UserAborted = 10005,
|
|
32
|
-
DeviceNotFound = 10100,
|
|
33
|
-
DeviceDisconnected = 10101,
|
|
34
|
-
DeviceBusy = 10102,
|
|
35
|
-
DeviceLocked = 10103,
|
|
36
|
-
DeviceNotInitialized = 10104,
|
|
37
|
-
DeviceInBootloader = 10105,
|
|
38
|
-
DeviceMismatch = 10106,
|
|
39
|
-
/** Chain app wedged (e.g. Ledger BTC 0x6901). User must exit app on device. */
|
|
40
|
-
DeviceAppStuck = 10107,
|
|
41
|
-
/** Vendor (Ledger / Trezor) doesn't support the chain at all. */
|
|
42
|
-
ChainNotSupported = 10108,
|
|
43
|
-
/** Current operation supports only one connected device. */
|
|
44
|
-
DeviceOneDeviceOnly = 10109,
|
|
45
|
-
FirmwareTooOld = 10200,
|
|
46
|
-
FirmwareUpdateRequired = 10201,
|
|
47
|
-
TransportError = 10300,
|
|
48
|
-
BridgeNotFound = 10301,
|
|
49
|
-
TransportNotAvailable = 10302,
|
|
50
|
-
/**
|
|
51
|
-
* OS-level permission (Bluetooth / USB / etc.) — denied, blocked,
|
|
52
|
-
* unavailable, or dismissed. Consumers surface a single "please grant
|
|
53
|
-
* permission" toast and let the user retry manually.
|
|
54
|
-
*/
|
|
55
|
-
DevicePermissionDenied = 10303,
|
|
56
|
-
/**
|
|
57
|
-
* BLE SMP pairing did not complete within the GATT bonding window.
|
|
58
|
-
* GATT connected but the device didn't acknowledge SMP — typically
|
|
59
|
-
* because the user didn't confirm the passkey on the device, or the
|
|
60
|
-
* device went out of range mid-pairing. Distinct from OperationTimeout
|
|
61
|
-
* (generic) and from DeviceLocked (Secure Element actually locked).
|
|
62
|
-
*/
|
|
63
|
-
BlePairingTimeout = 10304,
|
|
64
|
-
/** Remote network failure reaching a vendor's servers (HTTP/WS). Distinct from TransportError (local USB/BLE link). */
|
|
65
|
-
NetworkError = 10305,
|
|
66
|
-
/**
|
|
67
|
-
* Host-managed pairing handshake failed (Trezor THP). The device rejected the
|
|
68
|
-
* pairing exchange — e.g. CodeEntry: the user mistyped the code shown on the
|
|
69
|
-
* device, so the CPace tag didn't match ("Unexpected Code Entry Tag").
|
|
70
|
-
* Recoverable: the user re-pairs and re-enters the code. Distinct from
|
|
71
|
-
* BlePairingTimeout (BLE SMP bonding window) and UserRejected (on-device
|
|
72
|
-
* reject button).
|
|
73
|
-
*/
|
|
74
|
-
ThpPairingFailed = 10306,
|
|
75
|
-
/**
|
|
76
|
-
* The OS-level BLE bond is stale/invalid, so the device rejected link
|
|
77
|
-
* encryption: Android GATT_INSUF_AUTHENTICATION (status 5) or iOS "Peer
|
|
78
|
-
* removed pairing information". Happens after the device is wiped/re-flashed
|
|
79
|
-
* or unpaired elsewhere while the host still holds an old bond. The SDK cannot
|
|
80
|
-
* remove an OS bond — the user must forget the device in system Bluetooth
|
|
81
|
-
* settings and re-pair. Distinct from BlePairingTimeout (SMP window) and
|
|
82
|
-
* ThpPairingFailed (THP code mismatch).
|
|
83
|
-
*/
|
|
84
|
-
BleBondInvalid = 10307,
|
|
85
|
-
PinInvalid = 10400,
|
|
86
|
-
PinCancelled = 10401,
|
|
87
|
-
PassphraseRejected = 10402,
|
|
88
|
-
/**
|
|
89
|
-
* The passphrase entered produced a different wallet (`passphraseState`) than
|
|
90
|
-
* the one the caller asked to operate on. Trezor-only: the host pins a wallet
|
|
91
|
-
* by its derived state and the SDK refuses to sign with a mismatched
|
|
92
|
-
* passphrase session. Surfaced by TrezorAdapter.getPassphraseState.
|
|
93
|
-
*/
|
|
94
|
-
PassphraseStateMismatch = 10403,
|
|
95
|
-
/** Chain app NOT INSTALLED on device. User must install via Ledger Live. */
|
|
96
|
-
AppNotInstalled = 10500,
|
|
97
|
-
WrongApp = 10501,
|
|
98
|
-
/** 0x911c Command code not supported — app predates current SDK. */
|
|
99
|
-
AppTooOld = 10502,
|
|
100
|
-
/** Not enough free storage for install/update; user must uninstall apps first. */
|
|
101
|
-
DeviceOutOfMemory = 10503,
|
|
102
|
-
/** 0x6a80 Invalid data — observed on blindSignTransactionFallback when the
|
|
103
|
-
* user has not enabled Blind signing on the device. */
|
|
104
|
-
EvmBlindSigningRequired = 11000,
|
|
105
|
-
/** 0x6984 Plugin not installed */
|
|
106
|
-
EvmClearSignPluginMissing = 11001,
|
|
107
|
-
/** 0x6a84 Insufficient memory (typical on Nano S with large calldata) */
|
|
108
|
-
EvmDataTooLarge = 11002,
|
|
109
|
-
/** 0x6501 TransactionType not supported (app too old for EIP-1559 / blob / 7702) */
|
|
110
|
-
EvmTxTypeNotSupported = 11003,
|
|
111
|
-
/** 0x6808 Blind signing disabled for this instruction. */
|
|
112
|
-
SolanaBlindSigningRequired = 11100,
|
|
113
|
-
/** 0x6a8d Custom Contracts setting disabled (blocks TRC-20 etc.). */
|
|
114
|
-
TronCustomContractRequired = 11200,
|
|
115
|
-
/** 0x6a8b Transactions Data setting disabled. */
|
|
116
|
-
TronDataSigningRequired = 11201,
|
|
117
|
-
/** 0x6a8c Sign by Hash setting disabled (hash-signing fallback). */
|
|
118
|
-
TronSignByHashRequired = 11202,
|
|
119
|
-
/** 0xb008 Wallet policy HMAC mismatch or not registered. */
|
|
120
|
-
BtcWalletPolicyHmacMismatch = 11300,
|
|
121
|
-
/** 0xb007 Aborted due to unexpected state (malformed PSBT / missing UTXO). */
|
|
122
|
-
BtcUnexpectedState = 11301
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Device-level failures the SDK cannot self-recover from — affect the entire
|
|
126
|
-
* batch (vs per-chain failures like AppNotInstalled / WrongApp which soft-
|
|
127
|
-
* skip in onboarding). Combined with `accounts.length === 0`, signals
|
|
128
|
-
* genuine orphan. Also reused as the batch-abort whitelist for HWK.
|
|
129
|
-
* Single source of truth.
|
|
130
|
-
*
|
|
131
|
-
* UserRejected (device-side reject) is included: pressing reject is an
|
|
132
|
-
* explicit "I don't consent" — continuing the batch to ask again on the
|
|
133
|
-
* next chain is harassment, not helpful.
|
|
134
|
-
*/
|
|
135
|
-
declare const ORPHAN_ELIGIBLE_ERROR_CODES: number[];
|
|
136
|
-
interface IHwkErrorPayload {
|
|
137
|
-
code: HardwareErrorCode;
|
|
138
|
-
message: string;
|
|
139
|
-
appName?: string;
|
|
140
|
-
_tag?: string;
|
|
141
|
-
params?: Record<string, unknown>;
|
|
142
|
-
}
|
|
143
|
-
type HwkError = Error & {
|
|
144
|
-
code: HardwareErrorCode;
|
|
145
|
-
appName?: string;
|
|
146
|
-
_tag?: string;
|
|
147
|
-
params?: Record<string, unknown>;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Canonical throwable for HWK adapters. Plain Error + canonical extra fields,
|
|
151
|
-
* shape-compatible with `rehydrateConnectorError` so locally-thrown and
|
|
152
|
-
* cross-boundary errors are indistinguishable to downstream classifiers
|
|
153
|
-
* (`err.code` / `err._tag` / `err.appName`). Do NOT mutate caught errors
|
|
154
|
-
* with `Object.assign` — construct a fresh one via this factory.
|
|
155
|
-
*/
|
|
156
|
-
declare function createHwkError(payload: IHwkErrorPayload): HwkError;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Enrich a hardware error message with actionable recovery hints.
|
|
160
|
-
* Shared across adapters (Ledger, Trezor, etc.).
|
|
161
|
-
*/
|
|
162
|
-
declare function enrichErrorMessage(code: HardwareErrorCode, originalMessage: string): string;
|
|
163
|
-
|
|
164
|
-
export { HardwareErrorCode, type HwkError, type IHwkErrorPayload, ORPHAN_ELIGIBLE_ERROR_CODES, createHwkError, enrichErrorMessage };
|
package/dist/errors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkQD4EQWQAjs = require('./chunk-QD4EQWQA.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.HardwareErrorCode = _chunkQD4EQWQAjs.HardwareErrorCode; exports.ORPHAN_ELIGIBLE_ERROR_CODES = _chunkQD4EQWQAjs.ORPHAN_ELIGIBLE_ERROR_CODES; exports.createHwkError = _chunkQD4EQWQAjs.createHwkError; exports.enrichErrorMessage = _chunkQD4EQWQAjs.enrichErrorMessage;
|
|
13
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/errors.js"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACF,+QAAC","file":"/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/errors.js"}
|
package/dist/errors.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HardwareErrorCode,
|
|
3
|
-
ORPHAN_ELIGIBLE_ERROR_CODES,
|
|
4
|
-
createHwkError,
|
|
5
|
-
enrichErrorMessage
|
|
6
|
-
} from "./chunk-D5OZT7RZ.mjs";
|
|
7
|
-
export {
|
|
8
|
-
HardwareErrorCode,
|
|
9
|
-
ORPHAN_ELIGIBLE_ERROR_CODES,
|
|
10
|
-
createHwkError,
|
|
11
|
-
enrichErrorMessage
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=errors.mjs.map
|
package/dist/errors.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
interface QrDisplayData {
|
|
2
|
-
urType: string;
|
|
3
|
-
urData: string;
|
|
4
|
-
animated: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface QrResponseData {
|
|
7
|
-
urType: string;
|
|
8
|
-
urData: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare const UI_EVENT = "UI_EVENT";
|
|
12
|
-
declare const UI_REQUEST: {
|
|
13
|
-
readonly REQUEST_PIN: "ui-request-pin";
|
|
14
|
-
readonly REQUEST_PASSPHRASE: "ui-request-passphrase";
|
|
15
|
-
readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request-passphrase-on-device";
|
|
16
|
-
readonly REQUEST_BUTTON: "ui-request-button";
|
|
17
|
-
readonly REQUEST_QR_DISPLAY: "ui-request-qr-display";
|
|
18
|
-
readonly REQUEST_QR_SCAN: "ui-request-qr-scan";
|
|
19
|
-
readonly REQUEST_DEVICE_PERMISSION: "ui-request-device-permission";
|
|
20
|
-
readonly REQUEST_SELECT_DEVICE: "ui-request-select-device";
|
|
21
|
-
readonly REQUEST_DEVICE_CONNECT: "ui-request-device-connect";
|
|
22
|
-
readonly REQUEST_BTC_HIGH_INDEX_CONFIRM: "ui-request-btc-high-index-confirm";
|
|
23
|
-
readonly REQUEST_INSTALL_APP: "ui-request-install-app";
|
|
24
|
-
readonly REQUEST_PREEMPTION: "ui-request-preemption";
|
|
25
|
-
readonly REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing";
|
|
26
|
-
readonly CLOSE_UI_WINDOW: "ui-close";
|
|
27
|
-
readonly DEVICE_PROGRESS: "ui-device_progress";
|
|
28
|
-
readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
|
|
29
|
-
readonly FIRMWARE_TIP: "ui-firmware-tip";
|
|
30
|
-
};
|
|
31
|
-
declare const UI_RESPONSE: {
|
|
32
|
-
readonly RECEIVE_PIN: "receive-pin";
|
|
33
|
-
readonly RECEIVE_PASSPHRASE: "receive-passphrase";
|
|
34
|
-
readonly RECEIVE_PASSPHRASE_ON_DEVICE: "receive-passphrase-on-device";
|
|
35
|
-
readonly RECEIVE_QR_RESPONSE: "receive-qr-response";
|
|
36
|
-
readonly RECEIVE_SELECT_DEVICE: "receive-select-device";
|
|
37
|
-
readonly RECEIVE_DEVICE_CONNECT: "receive-device-connect";
|
|
38
|
-
readonly RECEIVE_DEVICE_PERMISSION: "receive-device-permission";
|
|
39
|
-
readonly RECEIVE_BTC_HIGH_INDEX_CONFIRM: "receive-btc-high-index-confirm";
|
|
40
|
-
readonly RECEIVE_INSTALL_APP: "receive-install-app";
|
|
41
|
-
readonly RECEIVE_PREEMPTION: "receive-preemption";
|
|
42
|
-
readonly RECEIVE_TREZOR_THP_PAIRING: "receive-trezor-thp-pairing";
|
|
43
|
-
readonly CANCEL: "cancel";
|
|
44
|
-
};
|
|
45
|
-
type DevicePermissionDeniedReason = 'bluetoothTurnedOff' | 'permissionDenied' | (string & Record<never, never>);
|
|
46
|
-
type DevicePermissionResponse = {
|
|
47
|
-
granted: boolean;
|
|
48
|
-
reason?: DevicePermissionDeniedReason;
|
|
49
|
-
message?: string;
|
|
50
|
-
};
|
|
51
|
-
type UiResponseEvent = {
|
|
52
|
-
type: typeof UI_RESPONSE.RECEIVE_PIN;
|
|
53
|
-
payload: string;
|
|
54
|
-
} | {
|
|
55
|
-
type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
|
|
56
|
-
payload: {
|
|
57
|
-
value: string;
|
|
58
|
-
passphraseOnDevice?: boolean;
|
|
59
|
-
save?: boolean;
|
|
60
|
-
};
|
|
61
|
-
} | {
|
|
62
|
-
type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE_ON_DEVICE;
|
|
63
|
-
payload?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;
|
|
66
|
-
payload: QrResponseData;
|
|
67
|
-
} | {
|
|
68
|
-
type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;
|
|
69
|
-
payload: {
|
|
70
|
-
sdkConnectId: string;
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;
|
|
74
|
-
payload: {
|
|
75
|
-
confirmed: boolean;
|
|
76
|
-
};
|
|
77
|
-
} | {
|
|
78
|
-
type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;
|
|
79
|
-
payload: DevicePermissionResponse;
|
|
80
|
-
} | {
|
|
81
|
-
type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;
|
|
82
|
-
payload: {
|
|
83
|
-
confirmed: boolean;
|
|
84
|
-
};
|
|
85
|
-
} | {
|
|
86
|
-
type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;
|
|
87
|
-
payload: {
|
|
88
|
-
confirmed: boolean;
|
|
89
|
-
};
|
|
90
|
-
} | {
|
|
91
|
-
type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;
|
|
92
|
-
payload: {
|
|
93
|
-
confirmed: boolean;
|
|
94
|
-
};
|
|
95
|
-
} | {
|
|
96
|
-
type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;
|
|
97
|
-
payload: {
|
|
98
|
-
selectedMethod?: number | string;
|
|
99
|
-
tag?: string;
|
|
100
|
-
};
|
|
101
|
-
} | {
|
|
102
|
-
type: typeof UI_RESPONSE.CANCEL;
|
|
103
|
-
payload?: undefined;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/** 10 min — every UI request is human-in-the-loop; bias toward "wait long". */
|
|
107
|
-
declare const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600000;
|
|
108
|
-
declare const UI_REQUEST_PREEMPTED_TAG = "UiRequestPreempted";
|
|
109
|
-
declare const UI_REQUEST_CANCELLED_TAG = "UiRequestCancelled";
|
|
110
|
-
declare const UI_REQUEST_TIMEOUT_TAG = "UiRequestTimeout";
|
|
111
|
-
/**
|
|
112
|
-
* Per-type single-slot registry for adapter-level UI requests. A new `wait`
|
|
113
|
-
* of the same type supersedes (rejects) the prior pending entry. With the
|
|
114
|
-
* job queue running globally serially, cross-type collisions don't occur in
|
|
115
|
-
* normal flow — same-type preemption is a defensive measure for callers
|
|
116
|
-
* that fire the same request twice without waiting on the first.
|
|
117
|
-
*
|
|
118
|
-
* Unknown response types are dropped silently so the public `uiResponse`
|
|
119
|
-
* entry never throws.
|
|
120
|
-
*/
|
|
121
|
-
declare class UiRequestRegistry {
|
|
122
|
-
private pending;
|
|
123
|
-
wait<T = unknown>(requestType: string, options?: {
|
|
124
|
-
timeoutMs?: number;
|
|
125
|
-
}): Promise<T>;
|
|
126
|
-
resolve(responseType: string, payload: unknown): void;
|
|
127
|
-
cancel(requestType?: string): void;
|
|
128
|
-
reset(): void;
|
|
129
|
-
hasPending(requestType?: string): boolean;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { type DevicePermissionDeniedReason as D, type QrDisplayData as Q, type UiResponseEvent as U, UI_REQUEST as a, type DevicePermissionResponse as b, type QrResponseData as c, UI_EVENT as d, UI_REQUEST_CANCELLED_TAG as e, UI_REQUEST_DEFAULT_TIMEOUT_MS as f, UI_REQUEST_PREEMPTED_TAG as g, UI_REQUEST_TIMEOUT_TAG as h, UI_RESPONSE as i, UiRequestRegistry as j };
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
interface QrDisplayData {
|
|
2
|
-
urType: string;
|
|
3
|
-
urData: string;
|
|
4
|
-
animated: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface QrResponseData {
|
|
7
|
-
urType: string;
|
|
8
|
-
urData: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare const UI_EVENT = "UI_EVENT";
|
|
12
|
-
declare const UI_REQUEST: {
|
|
13
|
-
readonly REQUEST_PIN: "ui-request-pin";
|
|
14
|
-
readonly REQUEST_PASSPHRASE: "ui-request-passphrase";
|
|
15
|
-
readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request-passphrase-on-device";
|
|
16
|
-
readonly REQUEST_BUTTON: "ui-request-button";
|
|
17
|
-
readonly REQUEST_QR_DISPLAY: "ui-request-qr-display";
|
|
18
|
-
readonly REQUEST_QR_SCAN: "ui-request-qr-scan";
|
|
19
|
-
readonly REQUEST_DEVICE_PERMISSION: "ui-request-device-permission";
|
|
20
|
-
readonly REQUEST_SELECT_DEVICE: "ui-request-select-device";
|
|
21
|
-
readonly REQUEST_DEVICE_CONNECT: "ui-request-device-connect";
|
|
22
|
-
readonly REQUEST_BTC_HIGH_INDEX_CONFIRM: "ui-request-btc-high-index-confirm";
|
|
23
|
-
readonly REQUEST_INSTALL_APP: "ui-request-install-app";
|
|
24
|
-
readonly REQUEST_PREEMPTION: "ui-request-preemption";
|
|
25
|
-
readonly REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing";
|
|
26
|
-
readonly CLOSE_UI_WINDOW: "ui-close";
|
|
27
|
-
readonly DEVICE_PROGRESS: "ui-device_progress";
|
|
28
|
-
readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
|
|
29
|
-
readonly FIRMWARE_TIP: "ui-firmware-tip";
|
|
30
|
-
};
|
|
31
|
-
declare const UI_RESPONSE: {
|
|
32
|
-
readonly RECEIVE_PIN: "receive-pin";
|
|
33
|
-
readonly RECEIVE_PASSPHRASE: "receive-passphrase";
|
|
34
|
-
readonly RECEIVE_PASSPHRASE_ON_DEVICE: "receive-passphrase-on-device";
|
|
35
|
-
readonly RECEIVE_QR_RESPONSE: "receive-qr-response";
|
|
36
|
-
readonly RECEIVE_SELECT_DEVICE: "receive-select-device";
|
|
37
|
-
readonly RECEIVE_DEVICE_CONNECT: "receive-device-connect";
|
|
38
|
-
readonly RECEIVE_DEVICE_PERMISSION: "receive-device-permission";
|
|
39
|
-
readonly RECEIVE_BTC_HIGH_INDEX_CONFIRM: "receive-btc-high-index-confirm";
|
|
40
|
-
readonly RECEIVE_INSTALL_APP: "receive-install-app";
|
|
41
|
-
readonly RECEIVE_PREEMPTION: "receive-preemption";
|
|
42
|
-
readonly RECEIVE_TREZOR_THP_PAIRING: "receive-trezor-thp-pairing";
|
|
43
|
-
readonly CANCEL: "cancel";
|
|
44
|
-
};
|
|
45
|
-
type DevicePermissionDeniedReason = 'bluetoothTurnedOff' | 'permissionDenied' | (string & Record<never, never>);
|
|
46
|
-
type DevicePermissionResponse = {
|
|
47
|
-
granted: boolean;
|
|
48
|
-
reason?: DevicePermissionDeniedReason;
|
|
49
|
-
message?: string;
|
|
50
|
-
};
|
|
51
|
-
type UiResponseEvent = {
|
|
52
|
-
type: typeof UI_RESPONSE.RECEIVE_PIN;
|
|
53
|
-
payload: string;
|
|
54
|
-
} | {
|
|
55
|
-
type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
|
|
56
|
-
payload: {
|
|
57
|
-
value: string;
|
|
58
|
-
passphraseOnDevice?: boolean;
|
|
59
|
-
save?: boolean;
|
|
60
|
-
};
|
|
61
|
-
} | {
|
|
62
|
-
type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE_ON_DEVICE;
|
|
63
|
-
payload?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;
|
|
66
|
-
payload: QrResponseData;
|
|
67
|
-
} | {
|
|
68
|
-
type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;
|
|
69
|
-
payload: {
|
|
70
|
-
sdkConnectId: string;
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;
|
|
74
|
-
payload: {
|
|
75
|
-
confirmed: boolean;
|
|
76
|
-
};
|
|
77
|
-
} | {
|
|
78
|
-
type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;
|
|
79
|
-
payload: DevicePermissionResponse;
|
|
80
|
-
} | {
|
|
81
|
-
type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;
|
|
82
|
-
payload: {
|
|
83
|
-
confirmed: boolean;
|
|
84
|
-
};
|
|
85
|
-
} | {
|
|
86
|
-
type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;
|
|
87
|
-
payload: {
|
|
88
|
-
confirmed: boolean;
|
|
89
|
-
};
|
|
90
|
-
} | {
|
|
91
|
-
type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;
|
|
92
|
-
payload: {
|
|
93
|
-
confirmed: boolean;
|
|
94
|
-
};
|
|
95
|
-
} | {
|
|
96
|
-
type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;
|
|
97
|
-
payload: {
|
|
98
|
-
selectedMethod?: number | string;
|
|
99
|
-
tag?: string;
|
|
100
|
-
};
|
|
101
|
-
} | {
|
|
102
|
-
type: typeof UI_RESPONSE.CANCEL;
|
|
103
|
-
payload?: undefined;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/** 10 min — every UI request is human-in-the-loop; bias toward "wait long". */
|
|
107
|
-
declare const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600000;
|
|
108
|
-
declare const UI_REQUEST_PREEMPTED_TAG = "UiRequestPreempted";
|
|
109
|
-
declare const UI_REQUEST_CANCELLED_TAG = "UiRequestCancelled";
|
|
110
|
-
declare const UI_REQUEST_TIMEOUT_TAG = "UiRequestTimeout";
|
|
111
|
-
/**
|
|
112
|
-
* Per-type single-slot registry for adapter-level UI requests. A new `wait`
|
|
113
|
-
* of the same type supersedes (rejects) the prior pending entry. With the
|
|
114
|
-
* job queue running globally serially, cross-type collisions don't occur in
|
|
115
|
-
* normal flow — same-type preemption is a defensive measure for callers
|
|
116
|
-
* that fire the same request twice without waiting on the first.
|
|
117
|
-
*
|
|
118
|
-
* Unknown response types are dropped silently so the public `uiResponse`
|
|
119
|
-
* entry never throws.
|
|
120
|
-
*/
|
|
121
|
-
declare class UiRequestRegistry {
|
|
122
|
-
private pending;
|
|
123
|
-
wait<T = unknown>(requestType: string, options?: {
|
|
124
|
-
timeoutMs?: number;
|
|
125
|
-
}): Promise<T>;
|
|
126
|
-
resolve(responseType: string, payload: unknown): void;
|
|
127
|
-
cancel(requestType?: string): void;
|
|
128
|
-
reset(): void;
|
|
129
|
-
hasPending(requestType?: string): boolean;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { type DevicePermissionDeniedReason as D, type QrDisplayData as Q, type UiResponseEvent as U, UI_REQUEST as a, type DevicePermissionResponse as b, type QrResponseData as c, UI_EVENT as d, UI_REQUEST_CANCELLED_TAG as e, UI_REQUEST_DEFAULT_TIMEOUT_MS as f, UI_REQUEST_PREEMPTED_TAG as g, UI_REQUEST_TIMEOUT_TAG as h, UI_RESPONSE as i, UiRequestRegistry as j };
|
package/dist/ui-events.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { D as DevicePermissionDeniedReason, b as DevicePermissionResponse, d as UI_EVENT, a as UI_REQUEST, e as UI_REQUEST_CANCELLED_TAG, f as UI_REQUEST_DEFAULT_TIMEOUT_MS, g as UI_REQUEST_PREEMPTED_TAG, h as UI_REQUEST_TIMEOUT_TAG, i as UI_RESPONSE, j as UiRequestRegistry, U as UiResponseEvent } from './ui-events-BzkI1wZk.mjs';
|
package/dist/ui-events.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { D as DevicePermissionDeniedReason, b as DevicePermissionResponse, d as UI_EVENT, a as UI_REQUEST, e as UI_REQUEST_CANCELLED_TAG, f as UI_REQUEST_DEFAULT_TIMEOUT_MS, g as UI_REQUEST_PREEMPTED_TAG, h as UI_REQUEST_TIMEOUT_TAG, i as UI_RESPONSE, j as UiRequestRegistry, U as UiResponseEvent } from './ui-events-BzkI1wZk.js';
|
package/dist/ui-events.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkLYVS67EXjs = require('./chunk-LYVS67EX.js');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
exports.UI_EVENT = _chunkLYVS67EXjs.UI_EVENT; exports.UI_REQUEST = _chunkLYVS67EXjs.UI_REQUEST; exports.UI_REQUEST_CANCELLED_TAG = _chunkLYVS67EXjs.UI_REQUEST_CANCELLED_TAG; exports.UI_REQUEST_DEFAULT_TIMEOUT_MS = _chunkLYVS67EXjs.UI_REQUEST_DEFAULT_TIMEOUT_MS; exports.UI_REQUEST_PREEMPTED_TAG = _chunkLYVS67EXjs.UI_REQUEST_PREEMPTED_TAG; exports.UI_REQUEST_TIMEOUT_TAG = _chunkLYVS67EXjs.UI_REQUEST_TIMEOUT_TAG; exports.UI_RESPONSE = _chunkLYVS67EXjs.UI_RESPONSE; exports.UiRequestRegistry = _chunkLYVS67EXjs.UiRequestRegistry;
|
|
21
|
-
//# sourceMappingURL=ui-events.js.map
|
package/dist/ui-events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/ui-events.js"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ihBAAC","file":"/home/runner/work/hardware-js-sdk/hardware-js-sdk/packages/hwk-adapter-core/dist/ui-events.js"}
|