@trezor/connect 10.0.0-alpha.1 → 10.0.0-beta.2
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/CHANGELOG.md +159 -63
- package/README.md +5 -3
- package/lib/exports.d.ts +1 -0
- package/lib/exports.js +1 -0
- package/lib/impl/core-in-module-native.d.ts +7 -0
- package/lib/impl/core-in-module-native.js +11 -0
- package/lib/impl/core-in-module-node.d.ts +8 -0
- package/lib/impl/core-in-module-node.js +12 -0
- package/lib/impl/core-in-module-web.d.ts +9 -0
- package/lib/impl/core-in-module-web.js +26 -0
- package/lib/index.browser.d.ts +7 -0
- package/lib/index.browser.js +10 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/index.native.d.ts +4 -0
- package/lib/index.native.js +5 -0
- package/package.json +30 -83
- package/libESM/api/applyFlags.d.mts +0 -20
- package/libESM/api/applyFlags.mjs +0 -36
- package/libESM/api/applySettings.d.mts +0 -20
- package/libESM/api/applySettings.mjs +0 -55
- package/libESM/api/authenticateDevice.d.mts +0 -9
- package/libESM/api/authenticateDevice.mjs +0 -108
- package/libESM/api/authorizeCoinjoin.d.mts +0 -11
- package/libESM/api/authorizeCoinjoin.mjs +0 -44
- package/libESM/api/backupDevice.d.mts +0 -19
- package/libESM/api/backupDevice.mjs +0 -36
- package/libESM/api/bitcoin/TransactionComposer.d.mts +0 -46
- package/libESM/api/bitcoin/TransactionComposer.mjs +0 -139
- package/libESM/api/bitcoin/createPendingTx.d.mts +0 -33
- package/libESM/api/bitcoin/createPendingTx.mjs +0 -54
- package/libESM/api/bitcoin/enhanceSignTx.d.mts +0 -2
- package/libESM/api/bitcoin/enhanceSignTx.mjs +0 -23
- package/libESM/api/bitcoin/index.d.mts +0 -9
- package/libESM/api/bitcoin/index.mjs +0 -9
- package/libESM/api/bitcoin/inputs.d.mts +0 -6
- package/libESM/api/bitcoin/inputs.mjs +0 -75
- package/libESM/api/bitcoin/outputs.d.mts +0 -5
- package/libESM/api/bitcoin/outputs.mjs +0 -128
- package/libESM/api/bitcoin/refTx.d.mts +0 -17
- package/libESM/api/bitcoin/refTx.mjs +0 -252
- package/libESM/api/bitcoin/signtx.d.mts +0 -22
- package/libESM/api/bitcoin/signtx.mjs +0 -213
- package/libESM/api/bitcoin/signtxLegacy.d.mts +0 -3
- package/libESM/api/bitcoin/signtxLegacy.mjs +0 -179
- package/libESM/api/bitcoin/signtxVerify.d.mts +0 -12
- package/libESM/api/bitcoin/signtxVerify.mjs +0 -86
- package/libESM/api/bitcoin/transactionBytes.d.mts +0 -3
- package/libESM/api/bitcoin/transactionBytes.mjs +0 -65
- package/libESM/api/bleUnpair.d.mts +0 -11
- package/libESM/api/bleUnpair.mjs +0 -35
- package/libESM/api/blockchainDisconnect.d.mts +0 -16
- package/libESM/api/blockchainDisconnect.mjs +0 -39
- package/libESM/api/blockchainEstimateFee.d.mts +0 -14
- package/libESM/api/blockchainEstimateFee.mjs +0 -106
- package/libESM/api/blockchainEvmRpcCall.d.mts +0 -17
- package/libESM/api/blockchainEvmRpcCall.mjs +0 -61
- package/libESM/api/blockchainGetAccountBalanceHistory.d.mts +0 -14
- package/libESM/api/blockchainGetAccountBalanceHistory.mjs +0 -64
- package/libESM/api/blockchainGetContractInfo.d.mts +0 -14
- package/libESM/api/blockchainGetContractInfo.mjs +0 -50
- package/libESM/api/blockchainGetCurrentFiatRates.d.mts +0 -18
- package/libESM/api/blockchainGetCurrentFiatRates.mjs +0 -53
- package/libESM/api/blockchainGetFiatRatesForTimestamps.d.mts +0 -21
- package/libESM/api/blockchainGetFiatRatesForTimestamps.mjs +0 -59
- package/libESM/api/blockchainGetInfo.d.mts +0 -13
- package/libESM/api/blockchainGetInfo.mjs +0 -41
- package/libESM/api/blockchainGetTransactions.d.mts +0 -15
- package/libESM/api/blockchainGetTransactions.mjs +0 -47
- package/libESM/api/blockchainSetCustomBackend.d.mts +0 -13
- package/libESM/api/blockchainSetCustomBackend.mjs +0 -41
- package/libESM/api/blockchainSubscribe.d.mts +0 -17
- package/libESM/api/blockchainSubscribe.mjs +0 -68
- package/libESM/api/blockchainSubscribeFiatRates.d.mts +0 -17
- package/libESM/api/blockchainSubscribeFiatRates.mjs +0 -47
- package/libESM/api/blockchainUnsubscribe.d.mts +0 -17
- package/libESM/api/blockchainUnsubscribe.mjs +0 -68
- package/libESM/api/blockchainUnsubscribeFiatRates.d.mts +0 -15
- package/libESM/api/blockchainUnsubscribeFiatRates.mjs +0 -41
- package/libESM/api/blockchainValidateEvmRpcUrl.d.mts +0 -17
- package/libESM/api/blockchainValidateEvmRpcUrl.mjs +0 -54
- package/libESM/api/cancelCoinjoinAuthorization.d.mts +0 -11
- package/libESM/api/cancelCoinjoinAuthorization.mjs +0 -31
- package/libESM/api/cardano/api/cardanoComposeTransaction.d.mts +0 -10
- package/libESM/api/cardano/api/cardanoComposeTransaction.mjs +0 -79
- package/libESM/api/cardano/api/cardanoGetAddress.d.mts +0 -30
- package/libESM/api/cardano/api/cardanoGetAddress.mjs +0 -116
- package/libESM/api/cardano/api/cardanoGetNativeScriptHash.d.mts +0 -12
- package/libESM/api/cardano/api/cardanoGetNativeScriptHash.mjs +0 -66
- package/libESM/api/cardano/api/cardanoGetPublicKey.d.mts +0 -20
- package/libESM/api/cardano/api/cardanoGetPublicKey.mjs +0 -72
- package/libESM/api/cardano/api/cardanoSignMessage.d.mts +0 -27
- package/libESM/api/cardano/api/cardanoSignMessage.mjs +0 -96
- package/libESM/api/cardano/api/cardanoSignTransaction.d.mts +0 -81
- package/libESM/api/cardano/api/cardanoSignTransaction.mjs +0 -298
- package/libESM/api/cardano/api/index.d.mts +0 -6
- package/libESM/api/cardano/api/index.mjs +0 -6
- package/libESM/api/cardano/cardanoAddressParameters.d.mts +0 -6
- package/libESM/api/cardano/cardanoAddressParameters.mjs +0 -79
- package/libESM/api/cardano/cardanoAuxiliaryData.d.mts +0 -4
- package/libESM/api/cardano/cardanoAuxiliaryData.mjs +0 -74
- package/libESM/api/cardano/cardanoCertificate.d.mts +0 -13
- package/libESM/api/cardano/cardanoCertificate.mjs +0 -142
- package/libESM/api/cardano/cardanoInputs.d.mts +0 -25
- package/libESM/api/cardano/cardanoInputs.mjs +0 -39
- package/libESM/api/cardano/cardanoOutputs.d.mts +0 -40
- package/libESM/api/cardano/cardanoOutputs.mjs +0 -70
- package/libESM/api/cardano/cardanoTokenBundle.d.mts +0 -12
- package/libESM/api/cardano/cardanoTokenBundle.mjs +0 -21
- package/libESM/api/cardano/cardanoUtils.d.mts +0 -9
- package/libESM/api/cardano/cardanoUtils.mjs +0 -101
- package/libESM/api/cardano/cardanoWitnesses.d.mts +0 -4
- package/libESM/api/cardano/cardanoWitnesses.mjs +0 -47
- package/libESM/api/changeLanguage.d.mts +0 -18
- package/libESM/api/changeLanguage.mjs +0 -47
- package/libESM/api/changePin.d.mts +0 -11
- package/libESM/api/changePin.mjs +0 -25
- package/libESM/api/changeWipeCode.d.mts +0 -11
- package/libESM/api/changeWipeCode.mjs +0 -27
- package/libESM/api/cipherKeyValue.d.mts +0 -15
- package/libESM/api/cipherKeyValue.mjs +0 -51
- package/libESM/api/common/AbstractMiscGetAddress.d.mts +0 -35
- package/libESM/api/common/AbstractMiscGetAddress.mjs +0 -102
- package/libESM/api/common/Discovery.d.mts +0 -33
- package/libESM/api/common/Discovery.mjs +0 -116
- package/libESM/api/common/paramsValidator.d.mts +0 -23
- package/libESM/api/common/paramsValidator.mjs +0 -134
- package/libESM/api/common/requestExistingAccounts.d.mts +0 -9
- package/libESM/api/common/requestExistingAccounts.mjs +0 -20
- package/libESM/api/composeTransaction.d.mts +0 -36
- package/libESM/api/composeTransaction.mjs +0 -386
- package/libESM/api/discoverAccounts.d.mts +0 -38
- package/libESM/api/discoverAccounts.mjs +0 -363
- package/libESM/api/ethereum/api/ethereumGetAddress.d.mts +0 -28
- package/libESM/api/ethereum/api/ethereumGetAddress.mjs +0 -135
- package/libESM/api/ethereum/api/ethereumGetPublicKey.d.mts +0 -48
- package/libESM/api/ethereum/api/ethereumGetPublicKey.mjs +0 -90
- package/libESM/api/ethereum/api/ethereumSignMessage.d.mts +0 -27
- package/libESM/api/ethereum/api/ethereumSignMessage.mjs +0 -64
- package/libESM/api/ethereum/api/ethereumSignTransaction.d.mts +0 -83
- package/libESM/api/ethereum/api/ethereumSignTransaction.mjs +0 -148
- package/libESM/api/ethereum/api/ethereumSignTypedData.d.mts +0 -116
- package/libESM/api/ethereum/api/ethereumSignTypedData.mjs +0 -202
- package/libESM/api/ethereum/api/ethereumVerifyMessage.d.mts +0 -12
- package/libESM/api/ethereum/api/ethereumVerifyMessage.mjs +0 -33
- package/libESM/api/ethereum/api/index.d.mts +0 -6
- package/libESM/api/ethereum/api/index.mjs +0 -6
- package/libESM/api/ethereum/ethereumDefinitions.d.mts +0 -46
- package/libESM/api/ethereum/ethereumDefinitions.mjs +0 -103
- package/libESM/api/ethereum/ethereumSignTx.d.mts +0 -20
- package/libESM/api/ethereum/ethereumSignTx.mjs +0 -131
- package/libESM/api/ethereum/ethereumSignTypedData.d.mts +0 -32
- package/libESM/api/ethereum/ethereumSignTypedData.mjs +0 -169
- package/libESM/api/evoluGetDelegatedIdentityKey.d.mts +0 -14
- package/libESM/api/evoluGetDelegatedIdentityKey.mjs +0 -26
- package/libESM/api/evoluGetNode.d.mts +0 -13
- package/libESM/api/evoluGetNode.mjs +0 -27
- package/libESM/api/evoluSignRegistrationRequest.d.mts +0 -15
- package/libESM/api/evoluSignRegistrationRequest.mjs +0 -31
- package/libESM/api/firmware/calculateFirmwareHash.d.mts +0 -13
- package/libESM/api/firmware/calculateFirmwareHash.mjs +0 -56
- package/libESM/api/firmware/calculateXPubHash.d.mts +0 -10
- package/libESM/api/firmware/calculateXPubHash.mjs +0 -14
- package/libESM/api/firmware/getBinary.d.mts +0 -10
- package/libESM/api/firmware/getBinary.mjs +0 -33
- package/libESM/api/firmware/index.d.mts +0 -6
- package/libESM/api/firmware/index.mjs +0 -6
- package/libESM/api/firmware/modifyFirmware.d.mts +0 -3
- package/libESM/api/firmware/modifyFirmware.mjs +0 -13
- package/libESM/api/firmware/parseFirmwareHeaders.d.mts +0 -4
- package/libESM/api/firmware/parseFirmwareHeaders.mjs +0 -26
- package/libESM/api/firmware/uploadFirmware.d.mts +0 -19
- package/libESM/api/firmware/uploadFirmware.mjs +0 -99
- package/libESM/api/firmware/verifyEntropy.d.mts +0 -18
- package/libESM/api/firmware/verifyEntropy.mjs +0 -107
- package/libESM/api/getAccountInfo.d.mts +0 -94
- package/libESM/api/getAccountInfo.mjs +0 -385
- package/libESM/api/getAddress.d.mts +0 -39
- package/libESM/api/getAddress.mjs +0 -142
- package/libESM/api/getCoinInfo.d.mts +0 -148
- package/libESM/api/getCoinInfo.mjs +0 -29
- package/libESM/api/getDeviceState.d.mts +0 -8
- package/libESM/api/getDeviceState.mjs +0 -16
- package/libESM/api/getFeatures.d.mts +0 -70
- package/libESM/api/getFeatures.mjs +0 -20
- package/libESM/api/getFirmwareHash.d.mts +0 -11
- package/libESM/api/getFirmwareHash.mjs +0 -27
- package/libESM/api/getNonce.d.mts +0 -10
- package/libESM/api/getNonce.mjs +0 -16
- package/libESM/api/getOwnershipId.d.mts +0 -15
- package/libESM/api/getOwnershipId.mjs +0 -79
- package/libESM/api/getOwnershipProof.d.mts +0 -15
- package/libESM/api/getOwnershipProof.mjs +0 -86
- package/libESM/api/getPublicKey.d.mts +0 -50
- package/libESM/api/getPublicKey.mjs +0 -88
- package/libESM/api/getSettings.d.mts +0 -8
- package/libESM/api/getSettings.mjs +0 -15
- package/libESM/api/index.d.mts +0 -59
- package/libESM/api/index.mjs +0 -59
- package/libESM/api/loadDevice.d.mts +0 -16
- package/libESM/api/loadDevice.mjs +0 -44
- package/libESM/api/monero/api/index.d.mts +0 -4
- package/libESM/api/monero/api/index.mjs +0 -4
- package/libESM/api/monero/api/moneroGetAddress.d.mts +0 -30
- package/libESM/api/monero/api/moneroGetAddress.mjs +0 -109
- package/libESM/api/monero/api/moneroGetWatchKey.d.mts +0 -14
- package/libESM/api/monero/api/moneroGetWatchKey.mjs +0 -44
- package/libESM/api/monero/api/moneroKeyImageSync.d.mts +0 -17
- package/libESM/api/monero/api/moneroKeyImageSync.mjs +0 -127
- package/libESM/api/monero/api/moneroSignTransaction.d.mts +0 -17
- package/libESM/api/monero/api/moneroSignTransaction.mjs +0 -202
- package/libESM/api/pingDevice.d.mts +0 -11
- package/libESM/api/pingDevice.mjs +0 -27
- package/libESM/api/pushTransaction.d.mts +0 -17
- package/libESM/api/pushTransaction.mjs +0 -42
- package/libESM/api/recoveryDevice.d.mts +0 -20
- package/libESM/api/recoveryDevice.mjs +0 -50
- package/libESM/api/requestLogin.d.mts +0 -14
- package/libESM/api/requestLogin.mjs +0 -48
- package/libESM/api/resetDevice.d.mts +0 -22
- package/libESM/api/resetDevice.mjs +0 -131
- package/libESM/api/ripple/api/index.d.mts +0 -2
- package/libESM/api/ripple/api/index.mjs +0 -2
- package/libESM/api/ripple/api/rippleGetAddress.d.mts +0 -15
- package/libESM/api/ripple/api/rippleGetAddress.mjs +0 -22
- package/libESM/api/ripple/api/rippleSignTransaction.d.mts +0 -13
- package/libESM/api/ripple/api/rippleSignTransaction.mjs +0 -52
- package/libESM/api/setBrightness.d.mts +0 -12
- package/libESM/api/setBrightness.mjs +0 -26
- package/libESM/api/setBusy.d.mts +0 -11
- package/libESM/api/setBusy.mjs +0 -32
- package/libESM/api/showDeviceTutorial.d.mts +0 -11
- package/libESM/api/showDeviceTutorial.mjs +0 -21
- package/libESM/api/signMessage.d.mts +0 -25
- package/libESM/api/signMessage.mjs +0 -71
- package/libESM/api/signTransaction.d.mts +0 -197
- package/libESM/api/signTransaction.mjs +0 -334
- package/libESM/api/solana/api/index.d.mts +0 -4
- package/libESM/api/solana/api/index.mjs +0 -4
- package/libESM/api/solana/api/solanaComposeTransaction.d.mts +0 -31
- package/libESM/api/solana/api/solanaComposeTransaction.mjs +0 -76
- package/libESM/api/solana/api/solanaGetAddress.d.mts +0 -15
- package/libESM/api/solana/api/solanaGetAddress.mjs +0 -22
- package/libESM/api/solana/api/solanaGetPublicKey.d.mts +0 -28
- package/libESM/api/solana/api/solanaGetPublicKey.mjs +0 -67
- package/libESM/api/solana/api/solanaSignTransaction.d.mts +0 -41
- package/libESM/api/solana/api/solanaSignTransaction.mjs +0 -203
- package/libESM/api/solana/solanaDefinitions.d.mts +0 -7
- package/libESM/api/solana/solanaDefinitions.mjs +0 -33
- package/libESM/api/stellar/api/index.d.mts +0 -2
- package/libESM/api/stellar/api/index.mjs +0 -2
- package/libESM/api/stellar/api/stellarGetAddress.d.mts +0 -15
- package/libESM/api/stellar/api/stellarGetAddress.mjs +0 -22
- package/libESM/api/stellar/api/stellarSignTransaction.d.mts +0 -26
- package/libESM/api/stellar/api/stellarSignTransaction.mjs +0 -66
- package/libESM/api/stellar/stellarSignTx.d.mts +0 -7
- package/libESM/api/stellar/stellarSignTx.mjs +0 -191
- package/libESM/api/telemetryGet.d.mts +0 -14
- package/libESM/api/telemetryGet.mjs +0 -24
- package/libESM/api/tezos/api/index.d.mts +0 -3
- package/libESM/api/tezos/api/index.mjs +0 -3
- package/libESM/api/tezos/api/tezosGetAddress.d.mts +0 -15
- package/libESM/api/tezos/api/tezosGetAddress.mjs +0 -22
- package/libESM/api/tezos/api/tezosGetPublicKey.d.mts +0 -24
- package/libESM/api/tezos/api/tezosGetPublicKey.mjs +0 -66
- package/libESM/api/tezos/api/tezosSignTransaction.d.mts +0 -14
- package/libESM/api/tezos/api/tezosSignTransaction.mjs +0 -30
- package/libESM/api/tezos/tezosSignTx.d.mts +0 -71
- package/libESM/api/tezos/tezosSignTx.mjs +0 -204
- package/libESM/api/thpGetCredentials.d.mts +0 -13
- package/libESM/api/thpGetCredentials.mjs +0 -28
- package/libESM/api/thpRemoveCredentials.d.mts +0 -15
- package/libESM/api/thpRemoveCredentials.mjs +0 -42
- package/libESM/api/tron/api/index.d.mts +0 -3
- package/libESM/api/tron/api/index.mjs +0 -3
- package/libESM/api/tron/api/tronComposeTransaction.d.mts +0 -17
- package/libESM/api/tron/api/tronComposeTransaction.mjs +0 -51
- package/libESM/api/tron/api/tronGetAddress.d.mts +0 -15
- package/libESM/api/tron/api/tronGetAddress.mjs +0 -20
- package/libESM/api/tron/api/tronSignTransaction.d.mts +0 -19
- package/libESM/api/tron/api/tronSignTransaction.mjs +0 -129
- package/libESM/api/tron/tronEncode.d.mts +0 -12
- package/libESM/api/tron/tronEncode.mjs +0 -77
- package/libESM/api/tron/tronProtobuf.d.mts +0 -5
- package/libESM/api/tron/tronProtobuf.mjs +0 -28
- package/libESM/api/unlockPath.d.mts +0 -12
- package/libESM/api/unlockPath.mjs +0 -31
- package/libESM/api/verifyMessage.d.mts +0 -16
- package/libESM/api/verifyMessage.mjs +0 -46
- package/libESM/api/wipeDevice.d.mts +0 -21
- package/libESM/api/wipeDevice.mjs +0 -47
- package/libESM/backend/BackendManager.d.mts +0 -24
- package/libESM/backend/BackendManager.mjs +0 -137
- package/libESM/backend/Blockchain.d.mts +0 -81
- package/libESM/backend/Blockchain.mjs +0 -232
- package/libESM/backend/BlockchainLink.d.mts +0 -9
- package/libESM/backend/BlockchainLink.mjs +0 -13
- package/libESM/backend/fees/BitcoinFeeLevels.d.mts +0 -19
- package/libESM/backend/fees/BitcoinFeeLevels.mjs +0 -43
- package/libESM/backend/fees/EthereumFeeLevels.d.mts +0 -17
- package/libESM/backend/fees/EthereumFeeLevels.mjs +0 -52
- package/libESM/backend/fees/MiscFeeLevels.d.mts +0 -18
- package/libESM/backend/fees/MiscFeeLevels.mjs +0 -25
- package/libESM/backend/fees/index.d.mts +0 -5
- package/libESM/backend/fees/index.mjs +0 -30
- package/libESM/core/AbstractMethod.d.mts +0 -65
- package/libESM/core/AbstractMethod.mjs +0 -153
- package/libESM/core/index.d.mts +0 -27
- package/libESM/core/index.mjs +0 -795
- package/libESM/core/method.d.mts +0 -3
- package/libESM/core/method.mjs +0 -19
- package/libESM/core/method.native.d.mts +0 -2
- package/libESM/core/method.native.mjs +0 -29
- package/libESM/core/onCallFirmwareUpdate.d.mts +0 -39
- package/libESM/core/onCallFirmwareUpdate.mjs +0 -436
- package/libESM/data/coinInfo.d.mts +0 -374
- package/libESM/data/coinInfo.mjs +0 -183
- package/libESM/data/config.d.mts +0 -8
- package/libESM/data/config.mjs +0 -265
- package/libESM/data/defaultFeeLevels.d.mts +0 -18
- package/libESM/data/defaultFeeLevels.mjs +0 -174
- package/libESM/data/firmwareInfo.d.mts +0 -41
- package/libESM/data/firmwareInfo.mjs +0 -411
- package/libESM/data/firmwareReleaseStore.d.mts +0 -10
- package/libESM/data/firmwareReleaseStore.mjs +0 -16
- package/libESM/data/localFirmwareStore.d.mts +0 -3
- package/libESM/data/localFirmwareStore.mjs +0 -8
- package/libESM/data/protobufLoader.d.mts +0 -1
- package/libESM/data/protobufLoader.mjs +0 -29
- package/libESM/data/settingsStore.d.mts +0 -6
- package/libESM/data/settingsStore.mjs +0 -21
- package/libESM/device/Device.d.mts +0 -237
- package/libESM/device/Device.mjs +0 -729
- package/libESM/device/DeviceCommands.d.mts +0 -77
- package/libESM/device/DeviceCommands.mjs +0 -245
- package/libESM/device/DeviceCurrentSession.d.mts +0 -3208
- package/libESM/device/DeviceCurrentSession.mjs +0 -240
- package/libESM/device/DeviceList.d.mts +0 -68
- package/libESM/device/DeviceList.mjs +0 -246
- package/libESM/device/TransportList.d.mts +0 -9
- package/libESM/device/TransportList.mjs +0 -41
- package/libESM/device/TransportManager.d.mts +0 -30
- package/libESM/device/TransportManager.mjs +0 -142
- package/libESM/device/calculateRevisionForDevice.d.mts +0 -7
- package/libESM/device/calculateRevisionForDevice.mjs +0 -19
- package/libESM/device/checkFirmwareRevision.d.mts +0 -12
- package/libESM/device/checkFirmwareRevision.mjs +0 -75
- package/libESM/device/resolveDescriptorForTaproot.d.mts +0 -14
- package/libESM/device/resolveDescriptorForTaproot.mjs +0 -25
- package/libESM/device/thp/handshake.d.mts +0 -3
- package/libESM/device/thp/handshake.mjs +0 -100
- package/libESM/device/thp/index.d.mts +0 -5
- package/libESM/device/thp/index.mjs +0 -65
- package/libESM/device/thp/pairing.d.mts +0 -16
- package/libESM/device/thp/pairing.mjs +0 -237
- package/libESM/device/thp/session.d.mts +0 -2
- package/libESM/device/thp/session.mjs +0 -27
- package/libESM/device/thp/thpCall.d.mts +0 -40
- package/libESM/device/thp/thpCall.mjs +0 -58
- package/libESM/device/validateMessageSize.d.mts +0 -2
- package/libESM/device/validateMessageSize.mjs +0 -9
- package/libESM/device/workflow/changeLanguage.d.mts +0 -14
- package/libESM/device/workflow/changeLanguage.mjs +0 -59
- package/libESM/device/workflow/checkFirmwareHash.d.mts +0 -9
- package/libESM/device/workflow/checkFirmwareHash.mjs +0 -86
- package/libESM/device/workflow/checkFirmwareHashWithRetries.d.mts +0 -8
- package/libESM/device/workflow/checkFirmwareHashWithRetries.mjs +0 -36
- package/libESM/device/workflow/handshake.d.mts +0 -9
- package/libESM/device/workflow/handshake.mjs +0 -55
- package/libESM/device/workflow/trezorPushNotification.d.mts +0 -2
- package/libESM/device/workflow/trezorPushNotification.mjs +0 -73
- package/libESM/device/workflow/validateState.d.mts +0 -2
- package/libESM/device/workflow/validateState.mjs +0 -153
- package/libESM/events/ui-promise.d.mts +0 -22
- package/libESM/events/ui-promise.mjs +0 -1
- package/libESM/exports.d.mts +0 -3
- package/libESM/exports.mjs +0 -3
- package/libESM/impl/core-in-module.d.mts +0 -27
- package/libESM/impl/core-in-module.mjs +0 -173
- package/libESM/index.browser.d.mts +0 -9
- package/libESM/index.browser.mjs +0 -50
- package/libESM/index.d.mts +0 -6
- package/libESM/index.mjs +0 -32
- package/libESM/index.renderer.d.mts +0 -6
- package/libESM/index.renderer.mjs +0 -19
- package/libESM/tsconfig.libESM.tsbuildinfo +0 -1
- package/libESM/types/idevice.d.mts +0 -109
- package/libESM/types/idevice.mjs +0 -1
- package/libESM/types/typed-call-provider.d.mts +0 -29
- package/libESM/types/typed-call-provider.mjs +0 -1
- package/libESM/types/workflow.d.mts +0 -16
- package/libESM/types/workflow.mjs +0 -1
- package/libESM/utils/accountUtils.d.mts +0 -10
- package/libESM/utils/accountUtils.mjs +0 -83
- package/libESM/utils/addressUtils.d.mts +0 -2
- package/libESM/utils/addressUtils.mjs +0 -24
- package/libESM/utils/assetUtils.d.mts +0 -13
- package/libESM/utils/assetUtils.mjs +0 -56
- package/libESM/utils/assets.browser.d.mts +0 -1
- package/libESM/utils/assets.browser.mjs +0 -1
- package/libESM/utils/assets.d.mts +0 -2
- package/libESM/utils/assets.mjs +0 -13
- package/libESM/utils/assets.native.d.mts +0 -2
- package/libESM/utils/assets.native.mjs +0 -23
- package/libESM/utils/assetsTypes.d.mts +0 -5
- package/libESM/utils/assetsTypes.mjs +0 -1
- package/libESM/utils/buildOutputDescriptor.d.mts +0 -12
- package/libESM/utils/buildOutputDescriptor.mjs +0 -67
- package/libESM/utils/deviceFeaturesUtils.d.mts +0 -7
- package/libESM/utils/deviceFeaturesUtils.mjs +0 -109
- package/libESM/utils/ethereumUtils.d.mts +0 -3
- package/libESM/utils/ethereumUtils.mjs +0 -7
- package/libESM/utils/firmwareReleaseConfigUtils.d.mts +0 -19
- package/libESM/utils/firmwareReleaseConfigUtils.mjs +0 -131
- package/libESM/utils/firmwareUtils.d.mts +0 -13
- package/libESM/utils/firmwareUtils.mjs +0 -54
- package/libESM/utils/formatUtils.d.mts +0 -15
- package/libESM/utils/formatUtils.mjs +0 -45
- package/libESM/utils/hdnodeUtils.d.mts +0 -6
- package/libESM/utils/hdnodeUtils.mjs +0 -62
- package/libESM/utils/pathUtils.d.mts +0 -17
- package/libESM/utils/pathUtils.mjs +0 -141
- package/libESM/utils/paymentRequest.d.mts +0 -8
- package/libESM/utils/paymentRequest.mjs +0 -25
- package/libESM/utils/uiPromiseManager.d.mts +0 -8
- package/libESM/utils/uiPromiseManager.mjs +0 -51
- package/libESM/workers/workers.browser.d.mts +0 -10
- package/libESM/workers/workers.browser.mjs +0 -16
- package/libESM/workers/workers.d.mts +0 -10
- package/libESM/workers/workers.mjs +0 -8
- package/libESM/workers/workers.native.d.mts +0 -7
- package/libESM/workers/workers.native.mjs +0 -7
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { blake2s } from "@noble/hashes/blake2.js";
|
|
2
|
-
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
3
|
-
import { DeviceModelInternal } from "@trezor/device-utils";
|
|
4
|
-
import { versionUtils } from "@trezor/utils";
|
|
5
|
-
const SIZE_T1B1 = (7 * 128 + 64) * 1024;
|
|
6
|
-
const SIZE_T2T1 = 13 * 128 * 1024;
|
|
7
|
-
const SIZE_T2B1 = 13 * 128 * 1024;
|
|
8
|
-
const SIZE_T3B1 = 208 * 8 * 1024;
|
|
9
|
-
const SIZE_T3T1 = 208 * 8 * 1024;
|
|
10
|
-
const SIZE_T3W1 = 417 * 8 * 1024;
|
|
11
|
-
const firmwareSizeMap = {
|
|
12
|
-
[DeviceModelInternal.T1B1]: SIZE_T1B1,
|
|
13
|
-
[DeviceModelInternal.T2T1]: SIZE_T2T1,
|
|
14
|
-
[DeviceModelInternal.T2B1]: SIZE_T2B1,
|
|
15
|
-
[DeviceModelInternal.T3B1]: SIZE_T3B1,
|
|
16
|
-
[DeviceModelInternal.T3T1]: SIZE_T3T1,
|
|
17
|
-
[DeviceModelInternal.T3W1]: SIZE_T3W1
|
|
18
|
-
};
|
|
19
|
-
const getSizeForModel = ({
|
|
20
|
-
internal_model,
|
|
21
|
-
firmwareVersion
|
|
22
|
-
}) => {
|
|
23
|
-
const size = firmwareSizeMap[internal_model] ?? SIZE_T1B1;
|
|
24
|
-
if (firmwareVersion !== undefined && internal_model === DeviceModelInternal.T3W1 && versionUtils.isEqual(firmwareVersion, [2, 9, 3])) {
|
|
25
|
-
return size - 16 * 1024;
|
|
26
|
-
}
|
|
27
|
-
return size;
|
|
28
|
-
};
|
|
29
|
-
export const calculateFirmwareHash = ({
|
|
30
|
-
internal_model,
|
|
31
|
-
firmwareVersion,
|
|
32
|
-
fw,
|
|
33
|
-
key
|
|
34
|
-
}) => {
|
|
35
|
-
const size = getSizeForModel({
|
|
36
|
-
internal_model,
|
|
37
|
-
firmwareVersion
|
|
38
|
-
});
|
|
39
|
-
const padding = size - fw.byteLength;
|
|
40
|
-
if (padding < 0) {
|
|
41
|
-
throw new Error('Firmware too big');
|
|
42
|
-
}
|
|
43
|
-
const data = new Uint8Array(new ArrayBuffer(size));
|
|
44
|
-
data.set(new Uint8Array(fw));
|
|
45
|
-
if (padding > 0) {
|
|
46
|
-
const zeroBytes = Buffer.alloc(padding);
|
|
47
|
-
zeroBytes.fill(Buffer.from('ff', 'hex'));
|
|
48
|
-
data.set(zeroBytes, fw.byteLength);
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
hash: key && key.length > 0 ? bytesToHex(blake2s(data, {
|
|
52
|
-
key
|
|
53
|
-
})) : bytesToHex(blake2s(data)),
|
|
54
|
-
challenge: key ? key.toString('hex') : ''
|
|
55
|
-
};
|
|
56
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { XPubHashesPerBip43Path } from '@trezor/connect-common';
|
|
2
|
-
export declare const calculateXPubHash: (xpub: string) => string;
|
|
3
|
-
export declare const calculateXPubHashes: (xpubs: Record<string, string>) => XPubHashesPerBip43Path;
|
|
4
|
-
type CheckXPubWithHashesParams = {
|
|
5
|
-
xpub: string;
|
|
6
|
-
path: string;
|
|
7
|
-
knownXPubHashes: XPubHashesPerBip43Path;
|
|
8
|
-
};
|
|
9
|
-
export declare const checkXPubWithHashes: ({ xpub, path, knownXPubHashes, }: CheckXPubWithHashesParams) => boolean;
|
|
10
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createHash } from "crypto";
|
|
2
|
-
export const calculateXPubHash = xpub => createHash('sha256').update(xpub, 'utf8').digest('hex');
|
|
3
|
-
export const calculateXPubHashes = xpubs => {
|
|
4
|
-
const hashes = {};
|
|
5
|
-
Object.keys(xpubs).forEach(path => {
|
|
6
|
-
hashes[path] = calculateXPubHash(xpubs[path]);
|
|
7
|
-
});
|
|
8
|
-
return hashes;
|
|
9
|
-
};
|
|
10
|
-
export const checkXPubWithHashes = ({
|
|
11
|
-
xpub,
|
|
12
|
-
path,
|
|
13
|
-
knownXPubHashes
|
|
14
|
-
}) => knownXPubHashes[path] === undefined || knownXPubHashes[path] === calculateXPubHash(xpub);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { BinaryInfo } from '@trezor/connect-common';
|
|
2
|
-
import type { FirmwareRelease } from '@trezor/device-utils';
|
|
3
|
-
interface GetBinaryParams {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
path: string;
|
|
6
|
-
release: FirmwareRelease;
|
|
7
|
-
}
|
|
8
|
-
export declare const getBinary: ({ baseUrl, path, release, }: GetBinaryParams) => Promise<BinaryInfo>;
|
|
9
|
-
export declare const getBinaryOptional: (params: GetBinaryParams) => Promise<BinaryInfo | null>;
|
|
10
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
2
|
-
import { removeTrailingSlashes } from "@trezor/utils";
|
|
3
|
-
import { parseFirmwareHeaders } from "./parseFirmwareHeaders.mjs";
|
|
4
|
-
import { httpRequest } from "../../utils/assets.mjs";
|
|
5
|
-
const MIN_FIRMWARE_SIZE_BYTES = 200;
|
|
6
|
-
export const getBinary = async ({
|
|
7
|
-
baseUrl,
|
|
8
|
-
path,
|
|
9
|
-
release
|
|
10
|
-
}) => {
|
|
11
|
-
const sanitizedBaseUrl = removeTrailingSlashes(baseUrl);
|
|
12
|
-
const url = `${sanitizedBaseUrl}/${path}`;
|
|
13
|
-
const binaryArrayBuffer = await httpRequest(url, 'binary');
|
|
14
|
-
if (binaryArrayBuffer.byteLength < MIN_FIRMWARE_SIZE_BYTES) {
|
|
15
|
-
throw ERRORS.TypedError('Runtime', 'Firmware binary is too small');
|
|
16
|
-
}
|
|
17
|
-
const firmwareBuffer = Buffer.from(binaryArrayBuffer);
|
|
18
|
-
const {
|
|
19
|
-
version: binaryVersion
|
|
20
|
-
} = parseFirmwareHeaders(firmwareBuffer);
|
|
21
|
-
return {
|
|
22
|
-
binary: binaryArrayBuffer,
|
|
23
|
-
binaryVersion,
|
|
24
|
-
release
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export const getBinaryOptional = async params => {
|
|
28
|
-
try {
|
|
29
|
-
return await getBinary(params);
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { getBinary, getBinaryOptional } from './getBinary';
|
|
2
|
-
export { shouldStripFwHeaders, stripFwHeaders } from './modifyFirmware';
|
|
3
|
-
export { uploadFirmware } from './uploadFirmware';
|
|
4
|
-
export { calculateFirmwareHash } from './calculateFirmwareHash';
|
|
5
|
-
export { parseFirmwareHeaders } from './parseFirmwareHeaders';
|
|
6
|
-
export { calculateXPubHash, calculateXPubHashes, checkXPubWithHashes } from './calculateXPubHash';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { getBinary, getBinaryOptional } from "./getBinary.mjs";
|
|
2
|
-
export { shouldStripFwHeaders, stripFwHeaders } from "./modifyFirmware.mjs";
|
|
3
|
-
export { uploadFirmware } from "./uploadFirmware.mjs";
|
|
4
|
-
export { calculateFirmwareHash } from "./calculateFirmwareHash.mjs";
|
|
5
|
-
export { parseFirmwareHeaders } from "./parseFirmwareHeaders.mjs";
|
|
6
|
-
export { calculateXPubHash, calculateXPubHashes, checkXPubWithHashes } from "./calculateXPubHash.mjs";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getFirmwareOrBootloaderVersionArray } from "@trezor/device-utils";
|
|
2
|
-
import { versionUtils } from "@trezor/utils";
|
|
3
|
-
export const shouldStripFwHeaders = features => {
|
|
4
|
-
if (features.major_version === 2) return false;
|
|
5
|
-
return versionUtils.isNewerOrEqual(getFirmwareOrBootloaderVersionArray(features), [1, 8, 0]);
|
|
6
|
-
};
|
|
7
|
-
export const stripFwHeaders = fw => {
|
|
8
|
-
const fwView = new Uint8Array(fw);
|
|
9
|
-
if (String.fromCharCode(...Array.from(fwView.slice(0, 4))) === 'TRZR' && String.fromCharCode(...Array.from(fwView.slice(256, 260))) === 'TRZF') {
|
|
10
|
-
return fw.slice(256);
|
|
11
|
-
}
|
|
12
|
-
return fw;
|
|
13
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const parseFirmwareHeaders = buff => {
|
|
2
|
-
const vendorHeader = buff.subarray(0, 4).toString('utf8');
|
|
3
|
-
let trezorImageHeader = '';
|
|
4
|
-
let restbuff;
|
|
5
|
-
if (vendorHeader === 'TRZV') {
|
|
6
|
-
const vendorHeaderLength = buff.readUInt32LE(4);
|
|
7
|
-
trezorImageHeader = buff.subarray(vendorHeaderLength, vendorHeaderLength + 4).toString('utf8');
|
|
8
|
-
restbuff = buff.subarray(vendorHeaderLength + 4);
|
|
9
|
-
} else if (vendorHeader === 'TRZR') {
|
|
10
|
-
restbuff = buff.subarray(256 + 4);
|
|
11
|
-
trezorImageHeader = buff.subarray(256, 256 + 4).toString('utf8');
|
|
12
|
-
} else {
|
|
13
|
-
restbuff = buff.subarray(4);
|
|
14
|
-
trezorImageHeader = buff.subarray(0, 4).toString('utf8');
|
|
15
|
-
}
|
|
16
|
-
if (trezorImageHeader !== 'TRZF') {
|
|
17
|
-
throw new Error(`unexpected header ${vendorHeader}`);
|
|
18
|
-
}
|
|
19
|
-
const version_major = restbuff.readInt8(12);
|
|
20
|
-
const version_minor = restbuff.readInt8(13);
|
|
21
|
-
const version_patch = restbuff.readInt8(14);
|
|
22
|
-
const version = [version_major, version_minor, version_patch];
|
|
23
|
-
return {
|
|
24
|
-
version
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { CoreEventMessage, FirmwareUpdateFlowType, PROTO } from '@trezor/connect-common';
|
|
2
|
-
import type { TypedCall } from '../../device/DeviceCommands';
|
|
3
|
-
import type { IDevice } from '../../types/idevice';
|
|
4
|
-
type UploadFirmwareProps = {
|
|
5
|
-
typedCall: TypedCall;
|
|
6
|
-
postMessage: (message: CoreEventMessage) => void;
|
|
7
|
-
device: IDevice;
|
|
8
|
-
firmwareUploadRequest: PROTO.FirmwareUpload;
|
|
9
|
-
updateFlowType: FirmwareUpdateFlowType;
|
|
10
|
-
};
|
|
11
|
-
export declare const uploadFirmware: ({ typedCall, postMessage, device, firmwareUploadRequest: { payload }, updateFlowType, }: UploadFirmwareProps) => Promise<{
|
|
12
|
-
type: "Success";
|
|
13
|
-
message: {
|
|
14
|
-
message: string;
|
|
15
|
-
};
|
|
16
|
-
} | {
|
|
17
|
-
message: string;
|
|
18
|
-
}>;
|
|
19
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { DEVICE, UI_REQUEST, createUiMessage } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
3
|
-
import { getFirmwareVersionArray } from "@trezor/device-utils";
|
|
4
|
-
import { TRANSPORT } from "@trezor/transport";
|
|
5
|
-
import { isWithinRange } from "@trezor/utils/libESM/versionUtils.mjs";
|
|
6
|
-
const postConfirmationMessage = (device, updateFlowType) => {
|
|
7
|
-
const freshInstall = device.features.firmware_present === false;
|
|
8
|
-
if (freshInstall || updateFlowType === 'reboot_and_upgrade') return;
|
|
9
|
-
device.emit(DEVICE.BUTTON, {
|
|
10
|
-
device,
|
|
11
|
-
payload: {
|
|
12
|
-
code: 'ButtonRequest_FirmwareUpdate'
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
const postProgressMessage = (device, progress, postMessage) => {
|
|
17
|
-
postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
|
|
18
|
-
device: device.toMessageObject(),
|
|
19
|
-
operation: 'flashing',
|
|
20
|
-
progress
|
|
21
|
-
}));
|
|
22
|
-
};
|
|
23
|
-
const FIRMWARE_ERASE_TIMEOUT_MILLISECONDS = 15_000;
|
|
24
|
-
const TIMEOUT_MIN_FW_VERSION = '1.12.1';
|
|
25
|
-
const TIMEOUT_MAX_FW_VERSION = '1.13.0';
|
|
26
|
-
export const uploadFirmware = async ({
|
|
27
|
-
typedCall,
|
|
28
|
-
postMessage,
|
|
29
|
-
device,
|
|
30
|
-
firmwareUploadRequest: {
|
|
31
|
-
payload
|
|
32
|
-
},
|
|
33
|
-
updateFlowType
|
|
34
|
-
}) => {
|
|
35
|
-
if (device.features.major_version === 1) {
|
|
36
|
-
postConfirmationMessage(device, updateFlowType);
|
|
37
|
-
const timeoutId = setTimeout(() => {
|
|
38
|
-
const version = getFirmwareVersionArray(device.toMessageObject());
|
|
39
|
-
if (version === null) return;
|
|
40
|
-
if (isWithinRange(version, TIMEOUT_MIN_FW_VERSION, TIMEOUT_MAX_FW_VERSION)) {
|
|
41
|
-
postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS_UNEXPECTED_DELAY, {}));
|
|
42
|
-
}
|
|
43
|
-
}, FIRMWARE_ERASE_TIMEOUT_MILLISECONDS);
|
|
44
|
-
await typedCall('FirmwareErase', 'Success', {});
|
|
45
|
-
clearTimeout(timeoutId);
|
|
46
|
-
postProgressMessage(device, 0, postMessage);
|
|
47
|
-
let i = 0;
|
|
48
|
-
const progressTimer = setInterval(() => {
|
|
49
|
-
i++;
|
|
50
|
-
postProgressMessage(device, Math.min(i * 2, 99), postMessage);
|
|
51
|
-
}, 300);
|
|
52
|
-
const message = await typedCall('FirmwareUpload', 'Success', {
|
|
53
|
-
payload
|
|
54
|
-
}).finally(() => {
|
|
55
|
-
clearInterval(progressTimer);
|
|
56
|
-
});
|
|
57
|
-
postProgressMessage(device, 100, postMessage);
|
|
58
|
-
return message;
|
|
59
|
-
}
|
|
60
|
-
if (device.features.major_version === 2) {
|
|
61
|
-
postConfirmationMessage(device, updateFlowType);
|
|
62
|
-
const length = payload.byteLength;
|
|
63
|
-
let progress = 0;
|
|
64
|
-
let response = await typedCall('FirmwareErase', ['FirmwareRequest', 'Success'], {
|
|
65
|
-
length
|
|
66
|
-
});
|
|
67
|
-
postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
|
|
68
|
-
device: device.toMessageObject(),
|
|
69
|
-
operation: 'start-flashing',
|
|
70
|
-
progress
|
|
71
|
-
}));
|
|
72
|
-
while (response.type !== 'Success') {
|
|
73
|
-
const start = response.message.offset;
|
|
74
|
-
const end = response.message.offset + response.message.length;
|
|
75
|
-
const chunk = payload.slice(start, end);
|
|
76
|
-
const progressStart = Math.round(start / length * 100);
|
|
77
|
-
const progressEnd = Math.round(end / length * 100);
|
|
78
|
-
const progressDiff = progressEnd - progressStart;
|
|
79
|
-
device.transport.on(TRANSPORT.SEND_MESSAGE_PROGRESS, p => {
|
|
80
|
-
const newProgress = progressStart + Math.floor(progressDiff * p);
|
|
81
|
-
if (start > 0 && newProgress > progress) {
|
|
82
|
-
progress = newProgress;
|
|
83
|
-
postProgressMessage(device, progress, postMessage);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
if (start > 0) {
|
|
87
|
-
postProgressMessage(device, progressStart, postMessage);
|
|
88
|
-
}
|
|
89
|
-
response = await typedCall('FirmwareUpload', ['FirmwareRequest', 'Success'], {
|
|
90
|
-
payload: chunk
|
|
91
|
-
}).finally(() => {
|
|
92
|
-
device.transport.removeAllListeners(TRANSPORT.SEND_MESSAGE_PROGRESS);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
postProgressMessage(device, 100, postMessage);
|
|
96
|
-
return response.message;
|
|
97
|
-
}
|
|
98
|
-
throw ERRORS.TypedError('Runtime', 'uploadFirmware: unknown major_version');
|
|
99
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
2
|
-
export declare const generateEntropy: (len: number) => Buffer<ArrayBuffer>;
|
|
3
|
-
type VerifyEntropyOptions = {
|
|
4
|
-
type?: PROTO.Enum_BackupType;
|
|
5
|
-
strength?: number;
|
|
6
|
-
commitment?: string;
|
|
7
|
-
hostEntropy: string;
|
|
8
|
-
trezorEntropy?: string;
|
|
9
|
-
xpubs: Record<string, string>;
|
|
10
|
-
};
|
|
11
|
-
export declare const verifyEntropy: ({ type, strength, trezorEntropy, hostEntropy, commitment, xpubs, }: VerifyEntropyOptions) => Promise<{
|
|
12
|
-
success: true;
|
|
13
|
-
error?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
success: false;
|
|
16
|
-
error: any;
|
|
17
|
-
}>;
|
|
18
|
-
export {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { hmac } from "@noble/hashes/hmac.js";
|
|
2
|
-
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3
|
-
import { randomBytes } from "@noble/hashes/utils.js";
|
|
4
|
-
import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39";
|
|
5
|
-
import { bip39 } from "@trezor/crypto-utils";
|
|
6
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
7
|
-
import { bip32 } from "@trezor/utxo-lib";
|
|
8
|
-
export const generateEntropy = len => {
|
|
9
|
-
try {
|
|
10
|
-
return Buffer.from(randomBytes(len));
|
|
11
|
-
} catch {
|
|
12
|
-
throw new Error('generateEntropy: Environment does not support crypto random');
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const BASE_ITERATION_COUNT = 10000;
|
|
16
|
-
const ROUND_COUNT = 4;
|
|
17
|
-
const roundFunction = async (i, passphrase, e, salt, r) => {
|
|
18
|
-
const data = Buffer.concat([Buffer.from([i]), passphrase]);
|
|
19
|
-
const iterations = Math.floor((BASE_ITERATION_COUNT << e) / ROUND_COUNT);
|
|
20
|
-
const {
|
|
21
|
-
subtle
|
|
22
|
-
} = crypto;
|
|
23
|
-
const key = await subtle.importKey('raw', data, 'PBKDF2', false, ['deriveBits']);
|
|
24
|
-
const bits = await subtle.deriveBits({
|
|
25
|
-
name: 'PBKDF2',
|
|
26
|
-
hash: 'SHA-256',
|
|
27
|
-
salt: Buffer.concat([salt, r]),
|
|
28
|
-
iterations
|
|
29
|
-
}, key, r.length * 8);
|
|
30
|
-
return Buffer.from(bits);
|
|
31
|
-
};
|
|
32
|
-
const xor = (a, b) => {
|
|
33
|
-
if (a.length !== b.length) {
|
|
34
|
-
throw new Error('Buffers must be of equal length to XOR.');
|
|
35
|
-
}
|
|
36
|
-
const result = Buffer.alloc(a.length);
|
|
37
|
-
for (let i = 0; i < a.length; i++) {
|
|
38
|
-
result[i] = a[i] ^ b[i];
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
const entropyToSeedSlip39 = async encryptedSecret => {
|
|
43
|
-
const iterationExponent = 1;
|
|
44
|
-
const passphrase = Buffer.from('', 'utf-8');
|
|
45
|
-
const salt = Buffer.alloc(0);
|
|
46
|
-
const half = Math.floor(encryptedSecret.length / 2);
|
|
47
|
-
let l = encryptedSecret.subarray(0, half);
|
|
48
|
-
let r = encryptedSecret.subarray(half);
|
|
49
|
-
for (let round = ROUND_COUNT - 1; round >= 0; round--) {
|
|
50
|
-
const f = await roundFunction(round, passphrase, iterationExponent, salt, r);
|
|
51
|
-
const rr = xor(l, f);
|
|
52
|
-
l = r;
|
|
53
|
-
r = rr;
|
|
54
|
-
}
|
|
55
|
-
return Buffer.concat([r, l]);
|
|
56
|
-
};
|
|
57
|
-
const getEntropy = (trezorEntropy, hostEntropy, strength) => {
|
|
58
|
-
const data = Buffer.concat([Buffer.from(trezorEntropy, 'hex'), Buffer.from(hostEntropy, 'hex')]);
|
|
59
|
-
const entropy = sha256(data);
|
|
60
|
-
return Buffer.from(entropy.subarray(0, Math.floor(strength / 8)));
|
|
61
|
-
};
|
|
62
|
-
const computeSeed = (type, secret) => {
|
|
63
|
-
const BackupType = PROTO.Enum_BackupType;
|
|
64
|
-
if (type && [BackupType.Slip39_Basic, BackupType.Slip39_Advanced, BackupType.Slip39_Single_Extendable, BackupType.Slip39_Basic_Extendable, BackupType.Slip39_Advanced_Extendable].includes(type)) {
|
|
65
|
-
return entropyToSeedSlip39(secret);
|
|
66
|
-
}
|
|
67
|
-
return mnemonicToSeed(entropyToMnemonic(secret, [...bip39])).then(seed => Buffer.from(seed));
|
|
68
|
-
};
|
|
69
|
-
const verifyCommitment = (entropy, commitment) => {
|
|
70
|
-
const hmacDigest = hmac(sha256, Buffer.from(entropy, 'hex'), Buffer.alloc(0));
|
|
71
|
-
if (!Buffer.from(hmacDigest).equals(Buffer.from(commitment, 'hex'))) {
|
|
72
|
-
throw new Error('Invalid entropy commitment');
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
export const verifyEntropy = async ({
|
|
76
|
-
type,
|
|
77
|
-
strength,
|
|
78
|
-
trezorEntropy,
|
|
79
|
-
hostEntropy,
|
|
80
|
-
commitment,
|
|
81
|
-
xpubs
|
|
82
|
-
}) => {
|
|
83
|
-
try {
|
|
84
|
-
if (!trezorEntropy || !commitment || !strength || Object.keys(xpubs).length < 1) {
|
|
85
|
-
throw new Error('Missing verifyEntropy data');
|
|
86
|
-
}
|
|
87
|
-
verifyCommitment(trezorEntropy, commitment);
|
|
88
|
-
const secret = getEntropy(trezorEntropy, hostEntropy, strength);
|
|
89
|
-
const seed = await computeSeed(type, secret);
|
|
90
|
-
const node = bip32.fromSeed(seed);
|
|
91
|
-
Object.keys(xpubs).forEach(path => {
|
|
92
|
-
const pubKey = node.derivePath(path);
|
|
93
|
-
const xpub = pubKey.neutered().toBase58();
|
|
94
|
-
if (xpub !== xpubs[path]) {
|
|
95
|
-
throw new Error('verifyEntropy xpub mismatch');
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
return {
|
|
99
|
-
success: true
|
|
100
|
-
};
|
|
101
|
-
} catch (error) {
|
|
102
|
-
return {
|
|
103
|
-
success: false,
|
|
104
|
-
error: error.message
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { AccountInfo, AccountUtxo, CoinInfo, GetAccountInfo as GetAccountInfoParams, MethodPermission } from '@trezor/connect-common';
|
|
2
|
-
import type { MethodContext, MethodMessage } from '../core/AbstractMethod';
|
|
3
|
-
import { AbstractMethod } from '../core/AbstractMethod';
|
|
4
|
-
import { Discovery } from './common/Discovery';
|
|
5
|
-
type Request = GetAccountInfoParams & {
|
|
6
|
-
address_n: number[];
|
|
7
|
-
coinInfo: CoinInfo;
|
|
8
|
-
};
|
|
9
|
-
export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Request[]> {
|
|
10
|
-
disposed: boolean;
|
|
11
|
-
hasBundle?: boolean;
|
|
12
|
-
discovery?: Discovery;
|
|
13
|
-
constructor(message: MethodMessage<'getAccountInfo'>);
|
|
14
|
-
get requiredPermissions(): MethodPermission[];
|
|
15
|
-
get info(): string;
|
|
16
|
-
get confirmation(): {
|
|
17
|
-
view: "export-account-info";
|
|
18
|
-
label: string;
|
|
19
|
-
customConfirmButton: {
|
|
20
|
-
label: string;
|
|
21
|
-
className: string;
|
|
22
|
-
};
|
|
23
|
-
} | {
|
|
24
|
-
view: "export-account-info";
|
|
25
|
-
label: string;
|
|
26
|
-
customConfirmButton?: undefined;
|
|
27
|
-
};
|
|
28
|
-
run(context: MethodContext): Promise<AccountInfo | (AccountInfo | null)[] | {
|
|
29
|
-
utxo: AccountUtxo[] | undefined;
|
|
30
|
-
descriptor: string;
|
|
31
|
-
balance: string;
|
|
32
|
-
availableBalance: string;
|
|
33
|
-
empty: boolean;
|
|
34
|
-
tokens?: import("@trezor/blockchain-link-types").TokenInfo[];
|
|
35
|
-
addresses?: import("@trezor/blockchain-link-types").AccountAddresses;
|
|
36
|
-
history: {
|
|
37
|
-
total: number;
|
|
38
|
-
tokens?: number;
|
|
39
|
-
unconfirmed: number;
|
|
40
|
-
transactions?: import("@trezor/blockchain-link-types").Transaction[];
|
|
41
|
-
txids?: string[];
|
|
42
|
-
addrTxCount?: number;
|
|
43
|
-
};
|
|
44
|
-
misc?: {
|
|
45
|
-
nonce?: string;
|
|
46
|
-
contractInfo?: import("@trezor/blockchain-link-types").ContractInfo;
|
|
47
|
-
stakingPools?: import("@trezor/blockchain-link-types").StakingPool[];
|
|
48
|
-
addressAliases?: {
|
|
49
|
-
[key: string]: import("@trezor/blockchain-link-types").AddressAlias;
|
|
50
|
-
};
|
|
51
|
-
sequence?: number;
|
|
52
|
-
stellarSequence?: string;
|
|
53
|
-
reserve?: string;
|
|
54
|
-
rewards?: string;
|
|
55
|
-
staking?: {
|
|
56
|
-
address: string;
|
|
57
|
-
isActive: boolean;
|
|
58
|
-
rewards: string;
|
|
59
|
-
poolId: string | null;
|
|
60
|
-
drep: {
|
|
61
|
-
drep_id: string;
|
|
62
|
-
hex: string;
|
|
63
|
-
amount: string;
|
|
64
|
-
active: boolean;
|
|
65
|
-
active_epoch: number | null;
|
|
66
|
-
has_script: boolean;
|
|
67
|
-
} | null;
|
|
68
|
-
};
|
|
69
|
-
owner?: string;
|
|
70
|
-
rent?: number;
|
|
71
|
-
solStakingAccounts?: import("@trezor/blockchain-link-types").SolanaStakingAccount[];
|
|
72
|
-
solExternalStakingAccounts?: import("@trezor/blockchain-link-types").SolanaStakingAccount[];
|
|
73
|
-
solEpoch?: number;
|
|
74
|
-
tronResources?: import("@trezor/blockchain-link-types").TronAccountExtraData;
|
|
75
|
-
};
|
|
76
|
-
page?: {
|
|
77
|
-
index: number;
|
|
78
|
-
size: number;
|
|
79
|
-
total: number;
|
|
80
|
-
};
|
|
81
|
-
marker?: {
|
|
82
|
-
ledger: number;
|
|
83
|
-
seq: number;
|
|
84
|
-
};
|
|
85
|
-
stellarCursor?: string;
|
|
86
|
-
path: string;
|
|
87
|
-
}>;
|
|
88
|
-
private discover;
|
|
89
|
-
private selectExistingAccount;
|
|
90
|
-
private runDiscovery;
|
|
91
|
-
private fetchAccountInfo;
|
|
92
|
-
dispose(): void;
|
|
93
|
-
}
|
|
94
|
-
export {};
|