@onekeyfe/hd-core
Advanced tools
Comparing version 0.1.51 to 0.1.52
@@ -22,2 +22,3 @@ export { default as searchDevices } from './SearchDevices'; | ||
export { default as requestWebUsbDevice } from './RequestWebUsbDevice'; | ||
export { default as batchGetPublicKey } from './BatchGetPublicKey'; | ||
export { default as cipherKeyValue } from './CipherKeyValue'; | ||
@@ -24,0 +25,0 @@ export { default as btcGetAddress } from './btc/BTCGetAddress'; |
@@ -14,3 +14,2 @@ /// <reference types="node" /> | ||
passphraseState?: string; | ||
skipPassphraseCheck?: boolean; | ||
}; | ||
@@ -47,3 +46,2 @@ export declare type RunOptions = { | ||
passphraseState: string | undefined; | ||
skipPassphraseCheck: boolean | undefined; | ||
constructor(descriptor: DeviceDescriptor); | ||
@@ -50,0 +48,0 @@ static fromDescriptor(originalDescriptor: DeviceDescriptor): Device; |
@@ -25,2 +25,3 @@ import { on, off, removeAllListeners } from './event'; | ||
import { deviceSupportFeatures } from './deviceSupportFeatures'; | ||
import { batchGetPublicKey } from './batchGetPublicKey'; | ||
import { cipherKeyValue } from './cipherKeyValue'; | ||
@@ -92,2 +93,3 @@ import { evmGetAddress } from './evmGetAddress'; | ||
firmwareUpdate: typeof firmwareUpdate; | ||
batchGetPublicKey: typeof batchGetPublicKey; | ||
cipherKeyValue: typeof cipherKeyValue; | ||
@@ -94,0 +96,0 @@ evmGetAddress: typeof evmGetAddress; |
@@ -8,3 +8,2 @@ export interface CommonParams { | ||
initSession?: boolean; | ||
skipPassphraseCheck?: boolean; | ||
} | ||
@@ -11,0 +10,0 @@ export declare type Params<T> = CommonParams & T & { |
{ | ||
"name": "@onekeyfe/hd-core", | ||
"version": "0.1.51", | ||
"version": "0.1.52", | ||
"description": "> TODO: description", | ||
@@ -27,4 +27,4 @@ "author": "OneKey", | ||
"dependencies": { | ||
"@onekeyfe/hd-shared": "^0.1.51", | ||
"@onekeyfe/hd-transport": "^0.1.51", | ||
"@onekeyfe/hd-shared": "^0.1.52", | ||
"@onekeyfe/hd-transport": "^0.1.52", | ||
"axios": "^0.27.2", | ||
@@ -40,3 +40,3 @@ "bignumber.js": "^9.0.2", | ||
}, | ||
"gitHead": "0bc84671cf1fabb0f50339407dd43ad82ff096b8" | ||
"gitHead": "7a53d20af1efe25b5f94c1204bb1679cfeb16666" | ||
} |
@@ -23,2 +23,3 @@ export { default as searchDevices } from './SearchDevices'; | ||
export { default as batchGetPublicKey } from './BatchGetPublicKey'; | ||
export { default as cipherKeyValue } from './CipherKeyValue'; | ||
@@ -25,0 +26,0 @@ |
@@ -47,3 +47,2 @@ import semver from 'semver'; | ||
passphraseState: method?.payload.passphraseState, | ||
skipPassphraseCheck: method?.payload.skipPassphraseCheck, | ||
deviceId: method?.payload.deviceId, | ||
@@ -234,15 +233,13 @@ }); | ||
if (!method.payload.skipPassphraseCheck) { | ||
// Check Device passphrase State | ||
const passphraseState = await device.checkPassphraseState(); | ||
// Check Device passphrase State | ||
const passphraseState = await device.checkPassphraseState(); | ||
// Double check, handles the special case of Touch/Pro | ||
checkPassphraseSafety(method, device.features); | ||
// Double check, handles the special case of Touch/Pro | ||
checkPassphraseSafety(method, device.features); | ||
if (passphraseState) { | ||
DevicePool.clearDeviceCache(method.payload.connectId); | ||
return Promise.reject( | ||
ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError) | ||
); | ||
} | ||
if (passphraseState) { | ||
DevicePool.clearDeviceCache(method.payload.connectId); | ||
return Promise.reject( | ||
ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError) | ||
); | ||
} | ||
@@ -516,5 +513,2 @@ } | ||
// skip check passphrase status | ||
if (method.payload.skipPassphraseCheck) return; | ||
if (features?.passphrase_protection === true && !method.payload.passphraseState) { | ||
@@ -521,0 +515,0 @@ DevicePool.clearDeviceCache(method.payload.connectId); |
@@ -35,3 +35,2 @@ import EventEmitter from 'events'; | ||
passphraseState?: string; | ||
skipPassphraseCheck?: boolean; | ||
}; | ||
@@ -119,4 +118,2 @@ | ||
skipPassphraseCheck: boolean | undefined = false; | ||
constructor(descriptor: DeviceDescriptor) { | ||
@@ -264,4 +261,3 @@ super(); | ||
`features.device_id: ${this.features?.device_id}`, | ||
`passphraseState: ${this.passphraseState}`, | ||
`skipPassphraseCheck: ${this.skipPassphraseCheck}` | ||
`passphraseState: ${this.passphraseState}` | ||
); | ||
@@ -272,3 +268,2 @@ Log.debug('getInternalState session cache: ', deviceSessionCache); | ||
if (!deviceId) return undefined; | ||
if (this.skipPassphraseCheck) return deviceSessionCache[deviceId]; | ||
if (!this.passphraseState) return undefined; | ||
@@ -298,5 +293,3 @@ | ||
if (!this.features) return; | ||
if (!this.skipPassphraseCheck) { | ||
if (!this.passphraseState && !initSession) return; | ||
} | ||
if (!this.passphraseState && !initSession) return; | ||
@@ -331,3 +324,2 @@ let key = `${this.features.device_id}`; | ||
this.passphraseState = options?.passphraseState; | ||
this.skipPassphraseCheck = options?.skipPassphraseCheck; | ||
@@ -334,0 +326,0 @@ if (options?.initSession) { |
@@ -57,2 +57,8 @@ import { EventEmitter } from 'events'; | ||
/** | ||
* 批量获取公钥 | ||
*/ | ||
batchGetPublicKey: (connectId, deviceId, params) => | ||
call({ ...params, connectId, deviceId, method: 'batchGetPublicKey' }), | ||
/** | ||
* 检查固件版本 | ||
@@ -59,0 +65,0 @@ */ |
@@ -29,2 +29,3 @@ import { on, off, removeAllListeners } from './event'; | ||
import { batchGetPublicKey } from './batchGetPublicKey'; | ||
import { cipherKeyValue } from './cipherKeyValue'; | ||
@@ -120,2 +121,3 @@ | ||
batchGetPublicKey: typeof batchGetPublicKey; | ||
cipherKeyValue: typeof cipherKeyValue; | ||
@@ -122,0 +124,0 @@ |
@@ -23,8 +23,2 @@ export interface CommonParams { | ||
initSession?: boolean; | ||
/** | ||
* skip passhprase check | ||
* !! Use with caution, there are safety risks !! | ||
*/ | ||
skipPassphraseCheck?: boolean; | ||
} | ||
@@ -31,0 +25,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1259260
539
38439