@onekeyfe/hd-core 0.1.8 → 0.1.9
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/api/CipherKeyValue.d.ts +1 -1
- package/dist/api/CipherKeyValue.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts +1 -3
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts +1 -47
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +2 -5
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +2 -4
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/signtx.d.ts +1 -1
- package/dist/api/btc/helpers/signtx.d.ts.map +1 -1
- package/dist/api/btc/helpers/signtxLegacy.d.ts +1 -1
- package/dist/api/btc/helpers/signtxLegacy.d.ts.map +1 -1
- package/dist/api/device/DeviceBackup.d.ts +2 -4
- package/dist/api/device/DeviceBackup.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts +2 -4
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceFlags.d.ts +2 -4
- package/dist/api/device/DeviceFlags.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts +2 -4
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRecovery.d.ts +2 -4
- package/dist/api/device/DeviceRecovery.d.ts.map +1 -1
- package/dist/api/device/DeviceReset.d.ts +2 -4
- package/dist/api/device/DeviceReset.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts +2 -4
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateReboot.d.ts +2 -4
- package/dist/api/device/DeviceUpdateReboot.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts +8 -0
- package/dist/api/device/DeviceVerify.d.ts.map +1 -0
- package/dist/api/device/DeviceWipe.d.ts +2 -4
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/evm/EVMGetAddress.d.ts +1 -1
- package/dist/api/evm/EVMGetAddress.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts +2 -5
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -5
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +6 -5
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/EVMVerifyMessage.d.ts +2 -4
- package/dist/api/evm/EVMVerifyMessage.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts +1 -3
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/helpers/pathUtils.d.ts +1 -1
- package/dist/api/helpers/pathUtils.d.ts.map +1 -1
- package/dist/api/helpers/typeNameUtils.d.ts +1 -1
- package/dist/api/helpers/typeNameUtils.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/nem/NEMGetAddress.d.ts +1 -1
- package/dist/api/nem/NEMGetAddress.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +1 -1
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetAddress.d.ts +1 -1
- package/dist/api/starcoin/StarcoinGetAddress.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts +1 -1
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts +2 -5
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts +2 -5
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts +2 -4
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/index.d.ts +14 -50
- package/dist/index.js +240 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/btcGetAddress.d.ts +1 -1
- package/dist/types/api/btcGetAddress.d.ts.map +1 -1
- package/dist/types/api/btcGetPublicKey.d.ts +1 -1
- package/dist/types/api/btcGetPublicKey.d.ts.map +1 -1
- package/dist/types/api/btcSignMessage.d.ts +1 -1
- package/dist/types/api/btcSignMessage.d.ts.map +1 -1
- package/dist/types/api/btcSignTransaction.d.ts +1 -1
- package/dist/types/api/btcSignTransaction.d.ts.map +1 -1
- package/dist/types/api/btcVerifyMessage.d.ts +1 -1
- package/dist/types/api/btcVerifyMessage.d.ts.map +1 -1
- package/dist/types/api/cipherKeyValue.d.ts +1 -1
- package/dist/types/api/cipherKeyValue.d.ts.map +1 -1
- package/dist/types/api/deviceBackup.d.ts +1 -1
- package/dist/types/api/deviceBackup.d.ts.map +1 -1
- package/dist/types/api/deviceChangePin.d.ts +1 -1
- package/dist/types/api/deviceChangePin.d.ts.map +1 -1
- package/dist/types/api/deviceFlags.d.ts +1 -1
- package/dist/types/api/deviceFlags.d.ts.map +1 -1
- package/dist/types/api/deviceRebootToBootloader.d.ts +1 -1
- package/dist/types/api/deviceRebootToBootloader.d.ts.map +1 -1
- package/dist/types/api/deviceRecovery.d.ts +1 -1
- package/dist/types/api/deviceRecovery.d.ts.map +1 -1
- package/dist/types/api/deviceReset.d.ts +1 -1
- package/dist/types/api/deviceReset.d.ts.map +1 -1
- package/dist/types/api/deviceSettings.d.ts +1 -1
- package/dist/types/api/deviceSettings.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateReboot.d.ts +1 -1
- package/dist/types/api/deviceUpdateReboot.d.ts.map +1 -1
- package/dist/types/api/deviceVerify.d.ts +11 -0
- package/dist/types/api/deviceVerify.d.ts.map +1 -0
- package/dist/types/api/deviceWipe.d.ts +1 -1
- package/dist/types/api/deviceWipe.d.ts.map +1 -1
- package/dist/types/api/evmGetPublicKey.d.ts +1 -1
- package/dist/types/api/evmGetPublicKey.d.ts.map +1 -1
- package/dist/types/api/evmSignMessage.d.ts +1 -1
- package/dist/types/api/evmSignMessage.d.ts.map +1 -1
- package/dist/types/api/evmSignMessageEIP712.d.ts +1 -1
- package/dist/types/api/evmSignMessageEIP712.d.ts.map +1 -1
- package/dist/types/api/evmSignTypedData.d.ts +1 -1
- package/dist/types/api/evmSignTypedData.d.ts.map +1 -1
- package/dist/types/api/evmVerifyMessage.d.ts +1 -1
- package/dist/types/api/evmVerifyMessage.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/nemGetAddress.d.ts +1 -1
- package/dist/types/api/nemGetAddress.d.ts.map +1 -1
- package/dist/types/api/nemSignTransaction.d.ts +1 -1
- package/dist/types/api/nemSignTransaction.d.ts.map +1 -1
- package/dist/types/api/solGetAddress.d.ts +1 -1
- package/dist/types/api/solGetAddress.d.ts.map +1 -1
- package/dist/types/api/solSignTransaction.d.ts +1 -1
- package/dist/types/api/solSignTransaction.d.ts.map +1 -1
- package/dist/types/api/starcoinGetAddress.d.ts +1 -1
- package/dist/types/api/starcoinGetAddress.d.ts.map +1 -1
- package/dist/types/api/starcoinGetPublicKey.d.ts +1 -1
- package/dist/types/api/starcoinGetPublicKey.d.ts.map +1 -1
- package/dist/types/api/starcoinSignMessage.d.ts +1 -1
- package/dist/types/api/starcoinSignMessage.d.ts.map +1 -1
- package/dist/types/api/starcoinSignTransaction.d.ts +1 -1
- package/dist/types/api/starcoinSignTransaction.d.ts.map +1 -1
- package/dist/types/api/starcoinVerifyMessage.d.ts +1 -1
- package/dist/types/api/starcoinVerifyMessage.d.ts.map +1 -1
- package/dist/types/api/stellarGetAddress.d.ts +1 -1
- package/dist/types/api/stellarGetAddress.d.ts.map +1 -1
- package/dist/types/api/stellarSignTransaction.d.ts +1 -1
- package/dist/types/api/stellarSignTransaction.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +3 -94
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CipherKeyValue.ts +1 -1
- package/src/api/btc/BTCGetAddress.ts +1 -1
- package/src/api/btc/BTCGetPublicKey.ts +1 -1
- package/src/api/btc/BTCSignMessage.ts +1 -1
- package/src/api/btc/BTCSignTransaction.ts +1 -1
- package/src/api/btc/BTCVerifyMessage.ts +1 -1
- package/src/api/btc/helpers/signtx.ts +1 -1
- package/src/api/btc/helpers/signtxLegacy.ts +1 -1
- package/src/api/device/DeviceBackup.ts +1 -1
- package/src/api/device/DeviceChangePin.ts +1 -1
- package/src/api/device/DeviceFlags.ts +1 -1
- package/src/api/device/DeviceRebootToBootloader.ts +1 -1
- package/src/api/device/DeviceRecovery.ts +1 -1
- package/src/api/device/DeviceReset.ts +1 -1
- package/src/api/device/DeviceSettings.ts +1 -1
- package/src/api/device/DeviceUpdateReboot.ts +1 -1
- package/src/api/device/DeviceVerify.ts +55 -0
- package/src/api/device/DeviceWipe.ts +1 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -5
- package/src/api/evm/EVMSignTypedData.ts +119 -124
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/helpers/pathUtils.ts +1 -1
- package/src/api/helpers/typeNameUtils.ts +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/nem/NEMGetAddress.ts +1 -1
- package/src/api/nem/NEMSignTransaction.ts +1 -1
- package/src/api/solana/SolGetAddress.ts +3 -1
- package/src/api/solana/SolSignTransaction.ts +3 -1
- package/src/api/starcoin/StarcoinGetAddress.ts +1 -1
- package/src/api/starcoin/StarcoinGetPublicKey.ts +1 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -1
- package/src/api/starcoin/StarcoinVerifyMessage.ts +1 -1
- package/src/api/stellar/StellarGetAddress.ts +1 -1
- package/src/api/stellar/StellarSignTransaction.ts +1 -1
- package/src/device/Device.ts +4 -1
- package/src/inject.ts +1 -0
- package/src/types/api/btcGetAddress.ts +1 -1
- package/src/types/api/btcGetPublicKey.ts +1 -1
- package/src/types/api/btcSignMessage.ts +1 -1
- package/src/types/api/btcSignTransaction.ts +1 -1
- package/src/types/api/btcVerifyMessage.ts +1 -1
- package/src/types/api/cipherKeyValue.ts +1 -1
- package/src/types/api/deviceBackup.ts +1 -1
- package/src/types/api/deviceChangePin.ts +1 -1
- package/src/types/api/deviceFlags.ts +1 -1
- package/src/types/api/deviceRebootToBootloader.ts +1 -1
- package/src/types/api/deviceRecovery.ts +1 -1
- package/src/types/api/deviceReset.ts +1 -1
- package/src/types/api/deviceSettings.ts +1 -1
- package/src/types/api/deviceUpdateReboot.ts +1 -1
- package/src/types/api/deviceVerify.ts +15 -0
- package/src/types/api/deviceWipe.ts +1 -1
- package/src/types/api/evmGetPublicKey.ts +1 -1
- package/src/types/api/evmSignMessage.ts +1 -1
- package/src/types/api/evmSignMessageEIP712.ts +1 -1
- package/src/types/api/evmSignTypedData.ts +1 -1
- package/src/types/api/evmVerifyMessage.ts +1 -1
- package/src/types/api/export.ts +1 -0
- package/src/types/api/index.ts +2 -0
- package/src/types/api/nemGetAddress.ts +1 -1
- package/src/types/api/nemSignTransaction.ts +1 -1
- package/src/types/api/solGetAddress.ts +1 -1
- package/src/types/api/solSignTransaction.ts +1 -1
- package/src/types/api/starcoinGetAddress.ts +1 -1
- package/src/types/api/starcoinGetPublicKey.ts +1 -1
- package/src/types/api/starcoinSignMessage.ts +1 -1
- package/src/types/api/starcoinSignTransaction.ts +1 -1
- package/src/types/api/starcoinVerifyMessage.ts +1 -1
- package/src/types/api/stellarGetAddress.ts +1 -1
- package/src/types/api/stellarSignTransaction.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +11 -0
|
@@ -1,98 +1,7 @@
|
|
|
1
1
|
import type { Features, IVersionArray, IDeviceType, IDeviceModel } from '../types';
|
|
2
|
-
export declare const getDeviceModel: (features?:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
se_ver: string;
|
|
6
|
-
serial_no: string;
|
|
7
|
-
onekey_version: string;
|
|
8
|
-
ble_name: string;
|
|
9
|
-
ble_ver: string;
|
|
10
|
-
ble_enable: boolean;
|
|
11
|
-
major_version: number;
|
|
12
|
-
minor_version: number;
|
|
13
|
-
patch_version: number;
|
|
14
|
-
bootloader_mode: boolean | null;
|
|
15
|
-
device_id: string | null;
|
|
16
|
-
pin_protection: boolean | null;
|
|
17
|
-
passphrase_protection: boolean | null;
|
|
18
|
-
language: string | null;
|
|
19
|
-
label: string | null;
|
|
20
|
-
initialized: boolean | null;
|
|
21
|
-
revision: string | null;
|
|
22
|
-
bootloader_hash: string | null;
|
|
23
|
-
imported: boolean | null;
|
|
24
|
-
unlocked: boolean | null;
|
|
25
|
-
_passphrase_cached?: boolean | undefined;
|
|
26
|
-
firmware_present: boolean | null;
|
|
27
|
-
needs_backup: boolean | null;
|
|
28
|
-
flags: number | null;
|
|
29
|
-
model: string;
|
|
30
|
-
fw_major: number | null;
|
|
31
|
-
fw_minor: number | null;
|
|
32
|
-
fw_patch: number | null;
|
|
33
|
-
fw_vendor: string | null;
|
|
34
|
-
unfinished_backup: boolean | null;
|
|
35
|
-
no_backup: boolean | null;
|
|
36
|
-
recovery_mode: boolean | null;
|
|
37
|
-
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry")[];
|
|
38
|
-
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | null;
|
|
39
|
-
sd_card_present: boolean | null;
|
|
40
|
-
sd_protection: boolean | null;
|
|
41
|
-
wipe_code_protection: boolean | null;
|
|
42
|
-
session_id: string | null;
|
|
43
|
-
passphrase_always_on_device: boolean | null;
|
|
44
|
-
safety_checks: "Strict" | "PromptAlways" | "PromptTemporarily" | null;
|
|
45
|
-
auto_lock_delay_ms: number | null;
|
|
46
|
-
display_rotation: number | null;
|
|
47
|
-
experimental_features: boolean | null;
|
|
48
|
-
} | undefined) => IDeviceModel;
|
|
49
|
-
export declare const getDeviceType: (features?: {
|
|
50
|
-
vendor: string;
|
|
51
|
-
onekey_serial: string;
|
|
52
|
-
se_ver: string;
|
|
53
|
-
serial_no: string;
|
|
54
|
-
onekey_version: string;
|
|
55
|
-
ble_name: string;
|
|
56
|
-
ble_ver: string;
|
|
57
|
-
ble_enable: boolean;
|
|
58
|
-
major_version: number;
|
|
59
|
-
minor_version: number;
|
|
60
|
-
patch_version: number;
|
|
61
|
-
bootloader_mode: boolean | null;
|
|
62
|
-
device_id: string | null;
|
|
63
|
-
pin_protection: boolean | null;
|
|
64
|
-
passphrase_protection: boolean | null;
|
|
65
|
-
language: string | null;
|
|
66
|
-
label: string | null;
|
|
67
|
-
initialized: boolean | null;
|
|
68
|
-
revision: string | null;
|
|
69
|
-
bootloader_hash: string | null;
|
|
70
|
-
imported: boolean | null;
|
|
71
|
-
unlocked: boolean | null;
|
|
72
|
-
_passphrase_cached?: boolean | undefined;
|
|
73
|
-
firmware_present: boolean | null;
|
|
74
|
-
needs_backup: boolean | null;
|
|
75
|
-
flags: number | null;
|
|
76
|
-
model: string;
|
|
77
|
-
fw_major: number | null;
|
|
78
|
-
fw_minor: number | null;
|
|
79
|
-
fw_patch: number | null;
|
|
80
|
-
fw_vendor: string | null;
|
|
81
|
-
unfinished_backup: boolean | null;
|
|
82
|
-
no_backup: boolean | null;
|
|
83
|
-
recovery_mode: boolean | null;
|
|
84
|
-
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry")[];
|
|
85
|
-
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | null;
|
|
86
|
-
sd_card_present: boolean | null;
|
|
87
|
-
sd_protection: boolean | null;
|
|
88
|
-
wipe_code_protection: boolean | null;
|
|
89
|
-
session_id: string | null;
|
|
90
|
-
passphrase_always_on_device: boolean | null;
|
|
91
|
-
safety_checks: "Strict" | "PromptAlways" | "PromptTemporarily" | null;
|
|
92
|
-
auto_lock_delay_ms: number | null;
|
|
93
|
-
display_rotation: number | null;
|
|
94
|
-
experimental_features: boolean | null;
|
|
95
|
-
} | undefined) => IDeviceType;
|
|
2
|
+
export declare const getDeviceModel: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceModel;
|
|
3
|
+
export declare const getDeviceType: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceType;
|
|
4
|
+
export declare const getDeviceTypeOnBootloader: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceType;
|
|
96
5
|
export declare const getDeviceTypeByBleName: (name?: string | undefined) => IDeviceType | null;
|
|
97
6
|
export declare const getDeviceTypeByDeviceId: (deviceId?: string | undefined) => IDeviceType;
|
|
98
7
|
export declare const getDeviceUUID: (features: Features) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEnF,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEnF,eAAO,MAAM,cAAc,4EAA0B,YAUpD,CAAC;AAEF,eAAO,MAAM,aAAa,4EAA0B,WAUnD,CAAC;AAEF,eAAO,MAAM,yBAAyB,4EAA0B,WAS/D,CAAC;AAEF,eAAO,MAAM,sBAAsB,iCAAoB,WAAW,GAAG,IAKpE,CAAC;AAEF,eAAO,MAAM,uBAAuB,qCAAwB,WAQ3D,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,WAM/C,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,WAOhD,CAAC;AAKF,eAAO,MAAM,wBAAwB,aAAc,QAAQ,GAAG,SAAS,kBAOtE,CAAC;AAKF,eAAO,MAAM,2BAA2B,aAAc,QAAQ,KAAG,aAAa,GAAG,IAKhF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "^0.1.
|
|
29
|
-
"@onekeyfe/hd-transport": "^0.1.
|
|
28
|
+
"@onekeyfe/hd-shared": "^0.1.9",
|
|
29
|
+
"@onekeyfe/hd-transport": "^0.1.9",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"parse-uri": "^1.0.7",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"@types/parse-uri": "^1.0.0",
|
|
37
37
|
"@types/semver": "^7.3.9"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "6abdc58c1614920bf941d7e56f2768aa76f56932"
|
|
40
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CipherKeyValue as HardwareCipherKeyValue } from '@onekeyfe/hd-transport
|
|
1
|
+
import { CipherKeyValue as HardwareCipherKeyValue } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../constants/ui-request';
|
|
3
3
|
import { serializedPath, validatePath } from './helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from './BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetAddress } from '@onekeyfe/hd-transport
|
|
1
|
+
import { GetAddress } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { getScriptType, serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetPublicKey } from '@onekeyfe/hd-transport
|
|
1
|
+
import { GetPublicKey } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { getScriptType, serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignMessage } from '@onekeyfe/hd-transport
|
|
1
|
+
import { SignMessage } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TxInputType, TxOutputType } from '@onekeyfe/hd-transport
|
|
1
|
+
import { TxInputType, TxOutputType } from '@onekeyfe/hd-transport';
|
|
2
2
|
|
|
3
3
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BixinVerifyDeviceRequest } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
+
import { formatAnyHex } from '../helpers/hexUtils';
|
|
4
|
+
import { BaseMethod } from '../BaseMethod';
|
|
5
|
+
import { validateParams } from '../helpers/paramsValidator';
|
|
6
|
+
import { getDeviceType } from '../../utils';
|
|
7
|
+
import type { DeviceVerifySignature } from '../../types';
|
|
8
|
+
|
|
9
|
+
export default class DeviceVerify extends BaseMethod<BixinVerifyDeviceRequest> {
|
|
10
|
+
init() {
|
|
11
|
+
// check payload
|
|
12
|
+
validateParams(this.payload, [{ name: 'dataHex', type: 'hexString' }]);
|
|
13
|
+
|
|
14
|
+
// init params
|
|
15
|
+
this.params = {
|
|
16
|
+
data: formatAnyHex(this.payload.dataHex),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async run() {
|
|
21
|
+
// For Classic、Mini device we use EthereumSignTypedData
|
|
22
|
+
const deviceType = getDeviceType(this.device.features);
|
|
23
|
+
let response: DeviceVerifySignature | undefined;
|
|
24
|
+
|
|
25
|
+
if (deviceType === 'classic') {
|
|
26
|
+
const res = await this.device.commands.typedCall(
|
|
27
|
+
'BixinVerifyDeviceRequest',
|
|
28
|
+
'BixinVerifyDeviceAck',
|
|
29
|
+
{
|
|
30
|
+
...this.params,
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
response = res.message;
|
|
34
|
+
} else if (deviceType === 'mini') {
|
|
35
|
+
const signatureRes = await this.device.commands.typedCall(
|
|
36
|
+
'SESignMessage',
|
|
37
|
+
'SEMessageSignature',
|
|
38
|
+
{
|
|
39
|
+
message: this.params.data,
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
const certRes = await this.device.commands.typedCall('ReadSEPublicCert', 'SEPublicCert');
|
|
43
|
+
response = {
|
|
44
|
+
cert: certRes.message.public_cert,
|
|
45
|
+
signature: signatureRes.message.signature,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (response) return Promise.resolve(response);
|
|
50
|
+
|
|
51
|
+
return Promise.reject(
|
|
52
|
+
ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Device not support verify')
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGetAddress } from '@onekeyfe/hd-transport
|
|
1
|
+
import { EthereumGetAddress } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumGetPublicKey } from '@onekeyfe/hd-transport
|
|
1
|
+
import { EthereumGetPublicKey } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumSignMessage } from '@onekeyfe/hd-transport
|
|
1
|
+
import { EthereumSignMessage } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumSignMessageEIP712 } from '@onekeyfe/hd-transport
|
|
1
|
+
import { EthereumSignMessageEIP712 } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EthereumSignTx,
|
|
3
|
-
EthereumSignTxEIP1559,
|
|
4
|
-
EthereumTxRequest,
|
|
5
|
-
} from '@onekeyfe/hd-transport/src/types/messages';
|
|
1
|
+
import { EthereumSignTx, EthereumSignTxEIP1559, EthereumTxRequest } from '@onekeyfe/hd-transport';
|
|
6
2
|
|
|
7
3
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
8
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
+
import type {
|
|
4
4
|
EthereumTypedDataSignature,
|
|
5
5
|
EthereumTypedDataStructAck,
|
|
6
|
-
|
|
7
|
-
} from '@onekeyfe/hd-transport/src/types/messages';
|
|
8
|
-
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
6
|
+
} from '@onekeyfe/hd-transport';
|
|
9
7
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
10
8
|
import { validatePath } from '../helpers/pathUtils';
|
|
11
9
|
import { BaseMethod } from '../BaseMethod';
|
|
12
10
|
import { validateParams } from '../helpers/paramsValidator';
|
|
13
11
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
14
12
|
import { encodeData, getFieldType, parseArrayType } from '../helpers/typeNameUtils';
|
|
15
|
-
import {
|
|
13
|
+
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils/deviceFeaturesUtils';
|
|
14
|
+
import type {
|
|
16
15
|
EthereumSignTypedDataMessage,
|
|
17
16
|
EthereumSignTypedDataTypes,
|
|
18
17
|
} from '../../types/api/evmSignTypedData';
|
|
19
|
-
import { getDeviceFirmwareVersion, getDeviceType } from '../../utils/deviceFeaturesUtils';
|
|
20
|
-
import { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
21
18
|
|
|
22
19
|
export type EVMSignTypedDataParams = {
|
|
23
20
|
addressN: number[];
|
|
@@ -62,120 +59,119 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// }
|
|
62
|
+
async signTypedData() {
|
|
63
|
+
const { commands } = this.device;
|
|
64
|
+
const { addressN, data, metamaskV4Compat } = this.params;
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
types,
|
|
68
|
+
primaryType,
|
|
69
|
+
domain,
|
|
70
|
+
message,
|
|
71
|
+
}: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes> = data;
|
|
72
|
+
|
|
73
|
+
let response = await commands.typedCall(
|
|
74
|
+
'EthereumSignTypedData',
|
|
75
|
+
[
|
|
76
|
+
'EthereumTypedDataStructRequest',
|
|
77
|
+
'EthereumTypedDataValueRequest',
|
|
78
|
+
'EthereumTypedDataSignature',
|
|
79
|
+
],
|
|
80
|
+
{
|
|
81
|
+
address_n: addressN,
|
|
82
|
+
primary_type: primaryType as string,
|
|
83
|
+
metamask_v4_compat: metamaskV4Compat,
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
while (response.type === 'EthereumTypedDataStructRequest') {
|
|
88
|
+
const { name: typeDefinitionName } = response.message;
|
|
89
|
+
const typeDefinition = types[typeDefinitionName];
|
|
90
|
+
if (typeDefinition === undefined) {
|
|
91
|
+
throw ERRORS.TypedError(
|
|
92
|
+
'Runtime',
|
|
93
|
+
`Type ${typeDefinitionName} was not defined in types object`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const dataStruckAck: EthereumTypedDataStructAck = {
|
|
98
|
+
members: typeDefinition.map(({ name, type: typeName }) => ({
|
|
99
|
+
name,
|
|
100
|
+
type: getFieldType(typeName, types),
|
|
101
|
+
})),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
response = await commands.typedCall(
|
|
105
|
+
'EthereumTypedDataStructAck',
|
|
106
|
+
[
|
|
107
|
+
'EthereumTypedDataStructRequest',
|
|
108
|
+
'EthereumTypedDataValueRequest',
|
|
109
|
+
'EthereumTypedDataSignature',
|
|
110
|
+
],
|
|
111
|
+
dataStruckAck
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
while (response.type === 'EthereumTypedDataValueRequest') {
|
|
116
|
+
const { member_path } = response.message;
|
|
117
|
+
|
|
118
|
+
let memberData;
|
|
119
|
+
let memberTypeName: string;
|
|
120
|
+
|
|
121
|
+
const [rootIndex, ...nestedMemberPath] = member_path;
|
|
122
|
+
switch (rootIndex) {
|
|
123
|
+
case 0:
|
|
124
|
+
memberData = domain;
|
|
125
|
+
memberTypeName = 'EIP712Domain';
|
|
126
|
+
break;
|
|
127
|
+
case 1:
|
|
128
|
+
memberData = message;
|
|
129
|
+
memberTypeName = primaryType as string;
|
|
130
|
+
break;
|
|
131
|
+
default:
|
|
132
|
+
throw ERRORS.TypedError('Runtime', 'Root index can only be 0 or 1');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
for (const index of nestedMemberPath) {
|
|
136
|
+
if (Array.isArray(memberData)) {
|
|
137
|
+
memberTypeName = parseArrayType(memberTypeName).entryTypeName;
|
|
138
|
+
memberData = memberData[index];
|
|
139
|
+
} else if (typeof memberData === 'object' && memberData !== null) {
|
|
140
|
+
const memberTypeDefinition = types[memberTypeName][index];
|
|
141
|
+
memberTypeName = memberTypeDefinition.type;
|
|
142
|
+
memberData = memberData[memberTypeDefinition.name];
|
|
143
|
+
} else {
|
|
144
|
+
// TODO
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let encodedData;
|
|
149
|
+
if (Array.isArray(memberData)) {
|
|
150
|
+
// Sending the length as uint16
|
|
151
|
+
encodedData = encodeData('uint16', memberData.length);
|
|
152
|
+
} else {
|
|
153
|
+
encodedData = encodeData(memberTypeName, memberData);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
response = await commands.typedCall(
|
|
157
|
+
'EthereumTypedDataValueAck',
|
|
158
|
+
['EthereumTypedDataValueRequest', 'EthereumTypedDataSignature'],
|
|
159
|
+
{
|
|
160
|
+
value: encodedData,
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (response.type !== 'EthereumTypedDataSignature') {
|
|
166
|
+
throw ERRORS.TypedError('Runtime', 'Unexpected response type');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const { address, signature }: EthereumTypedDataSignature = response.message;
|
|
170
|
+
return {
|
|
171
|
+
address,
|
|
172
|
+
signature,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
179
175
|
|
|
180
176
|
getVersionRange() {
|
|
181
177
|
return {
|
|
@@ -246,7 +242,6 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
246
242
|
}
|
|
247
243
|
|
|
248
244
|
// For Touch、Pro we use EthereumSignTypedData
|
|
249
|
-
|
|
250
|
-
return Promise.resolve(ERRORS.TypedError('Runtime', 'Not implemented'));
|
|
245
|
+
return this.signTypedData();
|
|
251
246
|
}
|
|
252
247
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthereumVerifyMessage } from '@onekeyfe/hd-transport
|
|
1
|
+
import { EthereumVerifyMessage } from '@onekeyfe/hd-transport';
|
|
2
2
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
3
|
import { BaseMethod } from '../BaseMethod';
|
|
4
4
|
import { validateParams } from '../helpers/paramsValidator';
|