@onekeyfe/hd-core 1.1.27-patch.1 → 1.2.0-alpha.0
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/__tests__/evmLedgerLegacySafety.test.ts +15 -4
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/logBlockEvent.test.ts +37 -0
- package/__tests__/protocol-v2.test.ts +3025 -0
- package/dist/api/BaseMethod.d.ts +1 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +10 -0
- package/dist/api/DirList.d.ts.map +1 -0
- package/dist/api/DirMake.d.ts +9 -0
- package/dist/api/DirMake.d.ts.map +1 -0
- package/dist/api/DirRemove.d.ts +9 -0
- package/dist/api/DirRemove.d.ts.map +1 -0
- package/dist/api/FileDelete.d.ts +9 -0
- package/dist/api/FileDelete.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts +19 -0
- package/dist/api/FileRead.d.ts.map +1 -0
- package/dist/api/FileWrite.d.ts +24 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +35 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceInfo.d.ts +9 -0
- package/dist/api/GetDeviceInfo.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +6 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +10 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +2 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +5 -8
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +2 -9
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -11
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -15
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -11
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getAddress.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getPublicKey.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signMessage.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/verifyMessage.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts +3 -0
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
- package/dist/api/helpers/filesystemValidation.d.ts +7 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/index.d.ts +32 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +4 -0
- package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts +2 -8
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +9 -12
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +3 -0
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/networks.d.ts +3 -0
- package/dist/api/polkadot/networks.d.ts.map +1 -1
- package/dist/api/protocol-v2/DevReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DevReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +29 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +13 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +8 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +34 -0
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
- package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +1 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +3 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +3 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +6 -0
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +2 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +3 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +3 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +3 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +5 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +3 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +5 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +3 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +3 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +4 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +4 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +7 -4
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/MessagesConfig.d.ts +2 -2
- package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +5 -4
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +36 -10
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +9 -9
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +2 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts +22 -0
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -0
- package/dist/deviceProfile/index.d.ts +3 -0
- package/dist/deviceProfile/index.d.ts.map +1 -0
- package/dist/deviceProfile/legacyFeaturesView.d.ts +5 -0
- package/dist/deviceProfile/legacyFeaturesView.d.ts.map +1 -0
- package/dist/events/logBlockEvent.d.ts +1 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +8 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +720 -382
- package/dist/index.js +17634 -1201
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +93 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +13 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +4 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +27 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +85 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
- package/dist/types/api/getPassphraseState.d.ts +10 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +37 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +103 -0
- package/dist/types/api/protocolV2.d.ts.map +1 -0
- package/dist/types/api/searchDevices.d.ts +2 -2
- package/dist/types/api/searchDevices.d.ts.map +1 -1
- package/dist/types/device.d.ts +10 -3
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +6 -8
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +1 -0
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +26 -22
- package/src/api/DirList.ts +31 -0
- package/src/api/DirMake.ts +23 -0
- package/src/api/DirRemove.ts +23 -0
- package/src/api/FileDelete.ts +23 -0
- package/src/api/FileRead.ts +167 -0
- package/src/api/FileWrite.ts +216 -0
- package/src/api/FirmwareUpdate.ts +13 -5
- package/src/api/FirmwareUpdateV2.ts +21 -25
- package/src/api/FirmwareUpdateV3.ts +17 -4
- package/src/api/FirmwareUpdateV4.ts +827 -0
- package/src/api/GetDeviceInfo.ts +152 -0
- package/src/api/GetFeatures.ts +5 -2
- package/src/api/GetOnekeyFeatures.ts +95 -3
- package/src/api/GetPassphraseState.ts +16 -10
- package/src/api/PathInfo.ts +39 -0
- package/src/api/PromptWebDeviceAccess.ts +11 -1
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -1
- package/src/api/alephium/AlephiumSignTransaction.ts +15 -4
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +21 -13
- package/src/api/aptos/AptosGetAddress.ts +2 -3
- package/src/api/benfen/BenfenGetAddress.ts +11 -7
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -1
- package/src/api/benfen/BenfenSignTransaction.ts +6 -1
- package/src/api/btc/BTCGetPublicKey.ts +3 -2
- package/src/api/btc/BTCSignPsbt.ts +1 -2
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignTransaction.ts +2 -4
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -2
- package/src/api/device/DeviceFullyUploadResource.ts +3 -3
- package/src/api/device/DeviceLock.ts +1 -3
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/device/DeviceSupportFeatures.ts +2 -13
- package/src/api/device/DeviceUpdateBootloader.ts +4 -4
- package/src/api/device/DeviceUploadResource.ts +4 -5
- package/src/api/device/DeviceVerify.ts +1 -2
- package/src/api/dynex/DnxGetAddress.ts +6 -0
- package/src/api/dynex/DnxSignTransaction.ts +6 -0
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +3 -4
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +32 -18
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/evm/latest/signTypedHash.ts +2 -4
- package/src/api/evm/legacyV1/getAddress.ts +5 -3
- package/src/api/evm/legacyV1/getPublicKey.ts +5 -3
- package/src/api/evm/legacyV1/signMessage.ts +5 -3
- package/src/api/evm/legacyV1/signTypedData.ts +9 -8
- package/src/api/evm/legacyV1/signTypedHash.ts +7 -7
- package/src/api/evm/legacyV1/verifyMessage.ts +5 -3
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +8 -8
- package/src/api/firmware/uploadFirmware.ts +3 -10
- package/src/api/helpers/batchGetPublickeys.ts +51 -6
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/index.ts +34 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +4 -5
- package/src/api/lightning/LnurlAuth.ts +4 -0
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -1
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +14 -4
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +11 -12
- package/src/api/polkadot/networks.ts +9 -0
- package/src/api/protocol-v2/DevReboot.ts +24 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +63 -0
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +118 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +20 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +16 -0
- package/src/api/protocol-v2/DeviceReboot.ts +24 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +29 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +20 -0
- package/src/api/protocol-v2/FilesystemDiskControl.ts +50 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +16 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +16 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +16 -0
- package/src/api/protocol-v2/Ping.ts +18 -0
- package/src/api/protocol-v2/helpers.ts +207 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -1
- package/src/api/scdo/ScdoSignTransaction.ts +6 -2
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +3 -0
- package/src/api/solana/SolSignOffchainMessage.ts +3 -0
- package/src/api/solana/SolSignTransaction.ts +6 -0
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -1
- package/src/api/sui/SuiGetAddress.ts +5 -3
- package/src/api/sui/SuiGetPublicKey.ts +3 -0
- package/src/api/sui/SuiSignMessage.ts +3 -0
- package/src/api/sui/SuiSignTransaction.ts +14 -12
- package/src/api/ton/TonGetAddress.ts +3 -0
- package/src/api/ton/TonSignData.ts +10 -3
- package/src/api/ton/TonSignMessage.ts +6 -5
- package/src/api/ton/TonSignProof.ts +3 -0
- package/src/api/tron/TronSignMessage.ts +5 -1
- package/src/api/tron/TronSignTransaction.ts +4 -0
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/core/index.ts +87 -55
- package/src/data/messages/messages-protocol-v2.json +13369 -0
- package/src/data-manager/DataManager.ts +12 -7
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/device/Device.ts +538 -61
- package/src/device/DeviceCommands.ts +195 -29
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +7 -7
- package/src/deviceProfile/buildDeviceProfile.ts +387 -0
- package/src/deviceProfile/index.ts +2 -0
- package/src/deviceProfile/legacyFeaturesView.ts +123 -0
- package/src/events/logBlockEvent.ts +23 -0
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +52 -1
- package/src/protocols/protocol-v2/features.ts +180 -0
- package/src/protocols/protocol-v2/firmware.ts +43 -0
- package/src/protocols/protocol-v2/index.ts +16 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +49 -0
- package/src/types/api/getDeviceInfo.ts +99 -0
- package/src/types/api/getPassphraseState.ts +13 -2
- package/src/types/api/index.ts +88 -1
- package/src/types/api/protocolV2.ts +201 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +37 -3
- package/src/types/params.ts +7 -0
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +70 -70
- package/src/utils/deviceInfoUtils.ts +15 -8
- package/src/utils/index.ts +1 -0
package/src/core/index.ts
CHANGED
|
@@ -17,11 +17,8 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
LoggerNames,
|
|
19
19
|
enableLog,
|
|
20
|
-
getDeviceBLEFirmwareVersion,
|
|
21
|
-
getDeviceFirmwareVersion,
|
|
22
|
-
getFirmwareType,
|
|
23
20
|
getLogger,
|
|
24
|
-
|
|
21
|
+
isMethodVersionRangeUnsupported,
|
|
25
22
|
setLoggerPostMessage,
|
|
26
23
|
wait,
|
|
27
24
|
} from '../utils';
|
|
@@ -29,7 +26,6 @@ import {
|
|
|
29
26
|
findDefectiveBatchDevice,
|
|
30
27
|
getDefectiveDeviceInfo,
|
|
31
28
|
} from '../utils/findDefectiveBatchDevice';
|
|
32
|
-
import { supportNewPassphrase } from '../utils/deviceFeaturesUtils';
|
|
33
29
|
import {
|
|
34
30
|
cleanupSdkInstance,
|
|
35
31
|
completeRequestContext,
|
|
@@ -102,6 +98,7 @@ const parseInitOptions = (method?: BaseMethod): InitOptions => ({
|
|
|
102
98
|
passphraseState: method?.payload.passphraseState,
|
|
103
99
|
deviceId: method?.payload.deviceId,
|
|
104
100
|
deriveCardano: method && hasDeriveCardano(method),
|
|
101
|
+
connectProtocol: method?.payload.connectProtocol,
|
|
105
102
|
});
|
|
106
103
|
|
|
107
104
|
let _core: Core;
|
|
@@ -420,13 +417,24 @@ const onCallDevice = async (
|
|
|
420
417
|
await waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
421
418
|
|
|
422
419
|
const inner = async (): Promise<void> => {
|
|
420
|
+
// Protocol V2 专属方法统一守卫:协议在 acquire/initialize 后已确定,
|
|
421
|
+
// 非 V2 设备直接抛出明确的 NotSupport 错误(见 BaseMethod.requireProtocolV2)。
|
|
422
|
+
if (method.requireProtocolV2 && !device.isProtocolV2()) {
|
|
423
|
+
throw createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
424
|
+
}
|
|
425
|
+
|
|
423
426
|
// check firmware version
|
|
424
|
-
const versionRange =
|
|
425
|
-
device.features,
|
|
427
|
+
const versionRange = device.getCurrentMethodVersionRange(
|
|
426
428
|
type => method.getVersionRange()[type]
|
|
427
429
|
);
|
|
428
|
-
|
|
429
|
-
|
|
430
|
+
const currentFirmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
431
|
+
const currentBleVersion = device.getCurrentBLEFirmwareVersionString() ?? '0.0.0';
|
|
432
|
+
const deviceFirmwareType = device.getCurrentFirmwareType();
|
|
433
|
+
let newVersionStatus: ReturnType<typeof DataManager.getFirmwareStatus> | undefined;
|
|
434
|
+
|
|
435
|
+
// 故障批次检测与远端强制升级门禁基于 V1 features/remote config,
|
|
436
|
+
// Pro2(V2) 暂不参与:profile 版的 firmwareStatus 需要 DataManager 支持后再接入。
|
|
437
|
+
if (device.features && !device.isProtocolV2()) {
|
|
430
438
|
await DataManager.checkAndReloadData();
|
|
431
439
|
|
|
432
440
|
// 检测故障固件设备
|
|
@@ -443,12 +451,9 @@ const onCallDevice = async (
|
|
|
443
451
|
}
|
|
444
452
|
}
|
|
445
453
|
|
|
446
|
-
|
|
447
|
-
const newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
|
|
454
|
+
newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
|
|
448
455
|
const bleVersionStatus = DataManager.getBLEFirmwareStatus(device.features);
|
|
449
456
|
|
|
450
|
-
const currentFirmwareVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
451
|
-
const currentBleVersion = getDeviceBLEFirmwareVersion(device.features).join('.');
|
|
452
457
|
if (
|
|
453
458
|
(newVersionStatus === 'required' || bleVersionStatus === 'required') &&
|
|
454
459
|
method.skipForceUpdateCheck === false
|
|
@@ -474,42 +479,43 @@ const onCallDevice = async (
|
|
|
474
479
|
currentVersions
|
|
475
480
|
);
|
|
476
481
|
}
|
|
482
|
+
}
|
|
477
483
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
semver.lt(currentFirmwareVersion, versionRange.min)
|
|
482
|
-
) {
|
|
483
|
-
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
484
|
-
throw createNewFirmwareUnReleaseHardwareError({
|
|
485
|
-
currentVersion: currentFirmwareVersion,
|
|
486
|
-
requireVersion: versionRange.min,
|
|
487
|
-
methodName: method.name,
|
|
488
|
-
firmwareType: getFirmwareType(device.features),
|
|
489
|
-
});
|
|
490
|
-
}
|
|
484
|
+
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
485
|
+
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
486
|
+
}
|
|
491
487
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
versionRange.max &&
|
|
503
|
-
semver.valid(versionRange.max) &&
|
|
504
|
-
semver.gte(currentFirmwareVersion, versionRange.max)
|
|
505
|
-
) {
|
|
506
|
-
return Promise.reject(
|
|
507
|
-
createDeprecatedHardwareError(currentFirmwareVersion, versionRange.max, method.name)
|
|
508
|
-
);
|
|
488
|
+
if (versionRange) {
|
|
489
|
+
if (semver.valid(versionRange.min) && semver.lt(currentFirmwareVersion, versionRange.min)) {
|
|
490
|
+
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
491
|
+
throw createNewFirmwareUnReleaseHardwareError({
|
|
492
|
+
currentVersion: currentFirmwareVersion,
|
|
493
|
+
requireVersion: versionRange.min,
|
|
494
|
+
methodName: method.name,
|
|
495
|
+
firmwareType: deviceFirmwareType,
|
|
496
|
+
});
|
|
509
497
|
}
|
|
510
|
-
|
|
511
|
-
|
|
498
|
+
|
|
499
|
+
return Promise.reject(
|
|
500
|
+
createNeedUpgradeFirmwareHardwareError({
|
|
501
|
+
currentVersion: currentFirmwareVersion,
|
|
502
|
+
requireVersion: versionRange.min,
|
|
503
|
+
methodName: method.name,
|
|
504
|
+
firmwareType: deviceFirmwareType,
|
|
505
|
+
})
|
|
506
|
+
);
|
|
512
507
|
}
|
|
508
|
+
if (
|
|
509
|
+
versionRange.max &&
|
|
510
|
+
semver.valid(versionRange.max) &&
|
|
511
|
+
semver.gte(currentFirmwareVersion, versionRange.max)
|
|
512
|
+
) {
|
|
513
|
+
return Promise.reject(
|
|
514
|
+
createDeprecatedHardwareError(currentFirmwareVersion, versionRange.max, method.name)
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
} else if (method.strictCheckDeviceSupport) {
|
|
518
|
+
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
513
519
|
}
|
|
514
520
|
|
|
515
521
|
// check call method mode
|
|
@@ -547,16 +553,16 @@ const onCallDevice = async (
|
|
|
547
553
|
method.checkDeviceSupportFeature();
|
|
548
554
|
|
|
549
555
|
// reconfigure messages
|
|
550
|
-
if (_deviceList) {
|
|
556
|
+
if (_deviceList && device.features && !device.isProtocolV2()) {
|
|
551
557
|
await TransportManager.reconfigure(device.features);
|
|
552
558
|
}
|
|
553
559
|
|
|
554
560
|
// Check to see if it is safe to use Passphrase
|
|
555
561
|
checkPassphraseEnableState(method, device.features);
|
|
556
562
|
|
|
557
|
-
if (
|
|
563
|
+
if (shouldCheckPassphraseState(method, device)) {
|
|
558
564
|
// check version
|
|
559
|
-
const support = supportNewPassphrase(
|
|
565
|
+
const support = device.supportNewPassphrase();
|
|
560
566
|
if (!support.support) {
|
|
561
567
|
return Promise.reject(
|
|
562
568
|
ERRORS.TypedError(
|
|
@@ -723,7 +729,7 @@ function initDevice(method: BaseMethod) {
|
|
|
723
729
|
let device: Device | typeof undefined;
|
|
724
730
|
const allDevices = _deviceList.allDevices();
|
|
725
731
|
|
|
726
|
-
if (method.payload?.detectBootloaderDevice && allDevices.some(d => d.
|
|
732
|
+
if (method.payload?.detectBootloaderDevice && allDevices.some(d => d.isBootloader())) {
|
|
727
733
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceDetectInBootloaderMode);
|
|
728
734
|
}
|
|
729
735
|
|
|
@@ -734,6 +740,7 @@ function initDevice(method: BaseMethod) {
|
|
|
734
740
|
} else if (allDevices.length > 1) {
|
|
735
741
|
throw ERRORS.TypedError(
|
|
736
742
|
[
|
|
743
|
+
'firmwareUpdateV4',
|
|
737
744
|
'firmwareUpdateV3',
|
|
738
745
|
'firmwareUpdateV2',
|
|
739
746
|
'checkFirmwareRelease',
|
|
@@ -796,8 +803,8 @@ function canSkipInitialize(method: BaseMethod, device: Device): boolean {
|
|
|
796
803
|
if (!method.connectId) reasons.push('connectId.missing');
|
|
797
804
|
// passphrase state must match the pre-initialize
|
|
798
805
|
if (!device.isPreInitializeMetaMatch(method.payload)) reasons.push('meta.mismatch');
|
|
799
|
-
// device must have been initialized before
|
|
800
|
-
if (
|
|
806
|
+
// device must have been initialized before.
|
|
807
|
+
if (device.isUnacquired()) reasons.push('deviceInfo.missing');
|
|
801
808
|
// within pre-initialize TTL
|
|
802
809
|
if (!device.isPreInitializedValid(PRE_INITIALIZE_TTL_MS)) reasons.push('ttl.expired');
|
|
803
810
|
|
|
@@ -813,13 +820,23 @@ function canSkipInitialize(method: BaseMethod, device: Device): boolean {
|
|
|
813
820
|
return true;
|
|
814
821
|
}
|
|
815
822
|
|
|
823
|
+
function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown) {
|
|
824
|
+
const message = error instanceof Error ? error.message : String(error ?? '');
|
|
825
|
+
return (
|
|
826
|
+
method.payload.connectProtocol === 'V2' &&
|
|
827
|
+
message.includes('Device protocol mismatch') &&
|
|
828
|
+
message.includes('expected V2') &&
|
|
829
|
+
message.includes('did not respond to expected protocol')
|
|
830
|
+
);
|
|
831
|
+
}
|
|
832
|
+
|
|
816
833
|
/**
|
|
817
834
|
* If the Bluetooth connection times out, retry up to 6 times
|
|
818
835
|
* @param retryCount - Current retry count (default 0)
|
|
819
836
|
*/
|
|
820
837
|
async function connectDeviceForBle(method: BaseMethod, device: Device, retryCount = 0) {
|
|
821
838
|
try {
|
|
822
|
-
await device.acquire();
|
|
839
|
+
await device.acquire(method.payload.connectProtocol);
|
|
823
840
|
if (method.payload?.onlyConnectBleDevice) {
|
|
824
841
|
return;
|
|
825
842
|
}
|
|
@@ -832,7 +849,12 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
832
849
|
});
|
|
833
850
|
}
|
|
834
851
|
} catch (err) {
|
|
835
|
-
if (
|
|
852
|
+
if (
|
|
853
|
+
(err.errorCode === HardwareErrorCode.BleTimeoutError ||
|
|
854
|
+
err.errorCode === HardwareErrorCode.BleConnectedError ||
|
|
855
|
+
isRetryableBleProtocolV2ProbeError(method, err)) &&
|
|
856
|
+
retryCount < 6
|
|
857
|
+
) {
|
|
836
858
|
const nextRetry = retryCount + 1;
|
|
837
859
|
Log.debug(`Bluetooth connect timeout and will retry, retry count: ${nextRetry}`);
|
|
838
860
|
await wait(3000);
|
|
@@ -1091,7 +1113,11 @@ export const cancel = (context: CoreContext, connectId?: string) => {
|
|
|
1091
1113
|
const checkPassphraseEnableState = (method: BaseMethod, features?: Features) => {
|
|
1092
1114
|
if (!method.useDevicePassphraseState) return;
|
|
1093
1115
|
|
|
1094
|
-
|
|
1116
|
+
const passphraseProtection = method.device
|
|
1117
|
+
? method.device.getCurrentPassphraseProtection()
|
|
1118
|
+
: features?.passphrase_protection;
|
|
1119
|
+
|
|
1120
|
+
if (passphraseProtection === true) {
|
|
1095
1121
|
const hasNoPassphraseState =
|
|
1096
1122
|
method.payload.passphraseState == null || method.payload.passphraseState === '';
|
|
1097
1123
|
const shouldRequirePassphrase =
|
|
@@ -1103,12 +1129,18 @@ const checkPassphraseEnableState = (method: BaseMethod, features?: Features) =>
|
|
|
1103
1129
|
}
|
|
1104
1130
|
}
|
|
1105
1131
|
|
|
1106
|
-
if (
|
|
1132
|
+
if (passphraseProtection === false && method.payload.passphraseState) {
|
|
1107
1133
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
1108
1134
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceNotOpenedPassphrase);
|
|
1109
1135
|
}
|
|
1110
1136
|
};
|
|
1111
1137
|
|
|
1138
|
+
const shouldCheckPassphraseState = (method: BaseMethod, device: Device) => {
|
|
1139
|
+
if (!method.useDevicePassphraseState) return false;
|
|
1140
|
+
|
|
1141
|
+
return device.hasUsePassphrase();
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1112
1144
|
const cleanup = () => {
|
|
1113
1145
|
_uiPromises = [];
|
|
1114
1146
|
Log.debug('Cleanup...');
|