@onekeyfe/hd-core 1.0.39-alpha.0 → 1.0.39-alpha.1
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/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +1 -2
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +25 -53
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdate.ts +1 -1
- package/src/api/GetPassphraseState.ts +1 -17
- package/src/api/stellar/StellarSignTransaction.ts +0 -3
- package/src/core/index.ts +3 -0
- package/src/data/messages/messages.json +0 -8
- package/src/device/Device.ts +29 -33
- package/src/device/DeviceCommands.ts +0 -1
- package/src/utils/deviceFeaturesUtils.ts +12 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetPassphraseState.d.ts","sourceRoot":"","sources":["../../src/api/GetPassphraseState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,IAAI;IAKE,GAAG;
|
|
1
|
+
{"version":3,"file":"GetPassphraseState.d.ts","sourceRoot":"","sources":["../../src/api/GetPassphraseState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU;IACxD,IAAI;IAKE,GAAG;CAeV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/stellar/StellarSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoIpC;IAEF,IAAI;IAiDJ,gBAAgB,eAAsB,GAAG,SAAS,MAAM,KAAG,QAAQ,eAAe,CAAC,CAYjF;IAEI,GAAG;CAKV"}
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAY,6BAA6B,EAAoB,MAAM,wBAAwB,CAAC;AA6BnG,OAAO,EAEL,WAAW,EAWZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAMxD,KAAK,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAsCtD,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBA2DvE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAY,6BAA6B,EAAoB,MAAM,wBAAwB,CAAC;AA6BnG,OAAO,EAEL,WAAW,EAWZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAE7D,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAMxD,KAAK,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAsCtD,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBA2DvE,CAAC;AAmiBF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SA2E9D,CAAC;AAwKF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,YAAY,CAAsB;IAG1C,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,iBAAiB,CAAoB;IAE7C,OAAO,CAAC,cAAc;IAWhB,aAAa,CAAC,OAAO,EAAE,WAAW;IAmDxC,OAAO;CAGR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAoBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
|
package/dist/device/Device.d.ts
CHANGED
|
@@ -62,8 +62,7 @@ export declare class Device extends EventEmitter {
|
|
|
62
62
|
getCommands(): DeviceCommands;
|
|
63
63
|
private generateStateKey;
|
|
64
64
|
getInternalState(_deviceId?: string): string | undefined;
|
|
65
|
-
|
|
66
|
-
updateInternalState(state: string, deviceId: string, sessionId?: string | null): void;
|
|
65
|
+
updateInternalState(enablePassphrase: boolean, passphraseState: string | undefined, deviceId: string, sessionId?: string | null, featuresSessionId?: string | null): void;
|
|
67
66
|
private setInternalState;
|
|
68
67
|
clearInternalState(_deviceId?: string): void;
|
|
69
68
|
initialize(options?: InitOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAA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AC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2947,8 +2947,7 @@ declare class Device extends EventEmitter$1 {
|
|
|
2947
2947
|
getCommands(): DeviceCommands;
|
|
2948
2948
|
private generateStateKey;
|
|
2949
2949
|
getInternalState(_deviceId?: string): string | undefined;
|
|
2950
|
-
|
|
2951
|
-
updateInternalState(state: string, deviceId: string, sessionId?: string | null): void;
|
|
2950
|
+
updateInternalState(enablePassphrase: boolean, passphraseState: string | undefined, deviceId: string, sessionId?: string | null, featuresSessionId?: string | null): void;
|
|
2952
2951
|
private setInternalState;
|
|
2953
2952
|
clearInternalState(_deviceId?: string): void;
|
|
2954
2953
|
initialize(options?: InitOptions): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -8895,14 +8895,6 @@ var nested$1 = {
|
|
|
8895
8895
|
passphrase_state: {
|
|
8896
8896
|
type: "string",
|
|
8897
8897
|
id: 1
|
|
8898
|
-
},
|
|
8899
|
-
_only_main_pin: {
|
|
8900
|
-
type: "bool",
|
|
8901
|
-
id: 2
|
|
8902
|
-
},
|
|
8903
|
-
allow_create_attach_pin: {
|
|
8904
|
-
type: "bool",
|
|
8905
|
-
id: 3
|
|
8906
8898
|
}
|
|
8907
8899
|
}
|
|
8908
8900
|
},
|
|
@@ -25012,19 +25004,19 @@ const supportNewPassphrase = (features) => {
|
|
|
25012
25004
|
return { support: semver__default["default"].gte(currentVersion, '2.4.0'), require: '2.4.0' };
|
|
25013
25005
|
};
|
|
25014
25006
|
const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25007
|
+
var _a, _b, _c, _d, _e;
|
|
25015
25008
|
const { features, commands } = device;
|
|
25016
25009
|
const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
|
|
25017
25010
|
const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(features, commands, Object.assign({}, options));
|
|
25018
|
-
if (newSession && passphraseState && (features === null || features === void 0 ? void 0 : features.device_id)) {
|
|
25019
|
-
console.log('=====>>>>>> run updateInternalState newSession:', newSession);
|
|
25020
|
-
device.updateInternalState(passphraseState, features.device_id, newSession);
|
|
25021
|
-
}
|
|
25022
25011
|
const isModeT = getDeviceType(features) === hdShared.EDeviceType.Touch || getDeviceType(features) === hdShared.EDeviceType.Pro;
|
|
25023
25012
|
const needRefreshWithPassphrase = passphraseState && (features === null || features === void 0 ? void 0 : features.passphrase_protection) !== true;
|
|
25024
25013
|
const needRefreshWithLocked = isModeT && locked;
|
|
25025
25014
|
if (needRefreshWithLocked || needRefreshWithPassphrase) {
|
|
25026
25015
|
yield device.getFeatures();
|
|
25027
25016
|
}
|
|
25017
|
+
if (features === null || features === void 0 ? void 0 : features.device_id) {
|
|
25018
|
+
device.updateInternalState((_b = (_a = device.features) === null || _a === void 0 ? void 0 : _a.passphrase_protection) !== null && _b !== void 0 ? _b : false, passphraseState, (_d = (_c = device.features) === null || _c === void 0 ? void 0 : _c.device_id) !== null && _d !== void 0 ? _d : '', newSession, (_e = device.features) === null || _e === void 0 ? void 0 : _e.session_id);
|
|
25019
|
+
}
|
|
25028
25020
|
return { passphraseState, newSession, unlockedAttachPin };
|
|
25029
25021
|
});
|
|
25030
25022
|
const getPassphraseState = (features, commands, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -25032,12 +25024,10 @@ const getPassphraseState = (features, commands, options) => __awaiter(void 0, vo
|
|
|
25032
25024
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
25033
25025
|
const firmwareVersion = getDeviceFirmwareVersion(features);
|
|
25034
25026
|
const deviceType = getDeviceType(features);
|
|
25035
|
-
if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.
|
|
25036
|
-
console.log('=====>>>>>> getPassphraseState begin: ', options === null || options === void 0 ? void 0 : options.onlyMainPin, options === null || options === void 0 ? void 0 : options.expectPassphraseState);
|
|
25027
|
+
if (deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion.join('.'), '4.15.0')) {
|
|
25037
25028
|
const { message, type } = yield commands.typedCall('GetPassphraseState', 'PassphraseState', {
|
|
25038
25029
|
passphrase_state: (options === null || options === void 0 ? void 0 : options.onlyMainPin) ? undefined : options === null || options === void 0 ? void 0 : options.expectPassphraseState,
|
|
25039
25030
|
});
|
|
25040
|
-
console.log('=====>>>>>> getPassphraseState end: result ', message);
|
|
25041
25031
|
if (type === 'CallMethodError') {
|
|
25042
25032
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
25043
25033
|
}
|
|
@@ -26280,7 +26270,6 @@ class DeviceCommands {
|
|
|
26280
26270
|
this.callPromise = promise;
|
|
26281
26271
|
const res = yield promise;
|
|
26282
26272
|
Log$b.debug('[DeviceCommands] [call] Received', res.type);
|
|
26283
|
-
console.log('[DeviceCommands] [call] Received', res.type);
|
|
26284
26273
|
return res;
|
|
26285
26274
|
}
|
|
26286
26275
|
catch (error) {
|
|
@@ -26684,8 +26673,8 @@ class Device extends events.exports {
|
|
|
26684
26673
|
}
|
|
26685
26674
|
getInternalState(_deviceId) {
|
|
26686
26675
|
var _a, _b;
|
|
26687
|
-
Log$a.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
26688
26676
|
Log$a.debug('getInternalState session cache: ', deviceSessionCache);
|
|
26677
|
+
Log$a.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
26689
26678
|
const deviceId = _deviceId || ((_b = this.features) === null || _b === void 0 ? void 0 : _b.device_id);
|
|
26690
26679
|
if (!deviceId)
|
|
26691
26680
|
return undefined;
|
|
@@ -26694,27 +26683,19 @@ class Device extends events.exports {
|
|
|
26694
26683
|
const usePassKey = this.generateStateKey(deviceId, this.passphraseState);
|
|
26695
26684
|
return deviceSessionCache[usePassKey];
|
|
26696
26685
|
}
|
|
26697
|
-
|
|
26698
|
-
Log$a.debug('
|
|
26699
|
-
|
|
26700
|
-
|
|
26701
|
-
|
|
26702
|
-
deviceSessionCache[this.generateStateKey(deviceId, state)] = session;
|
|
26703
|
-
delete deviceSessionCache[key];
|
|
26704
|
-
}
|
|
26705
|
-
else if (sessionId) {
|
|
26706
|
-
deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
|
|
26707
|
-
}
|
|
26708
|
-
Log$a.debug('tryFixInternalState session cache: ', deviceSessionCache);
|
|
26709
|
-
}
|
|
26710
|
-
updateInternalState(state, deviceId, sessionId = null) {
|
|
26711
|
-
Log$a.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `passphraseState: ${state}`, `sessionId: ${sessionId}`);
|
|
26712
|
-
if (sessionId) {
|
|
26713
|
-
deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
|
|
26714
|
-
const oldKey = `${deviceId}`;
|
|
26715
|
-
if (deviceSessionCache[oldKey]) {
|
|
26716
|
-
delete deviceSessionCache[oldKey];
|
|
26686
|
+
updateInternalState(enablePassphrase, passphraseState, deviceId, sessionId = null, featuresSessionId = null) {
|
|
26687
|
+
Log$a.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `enablePassphrase: ${enablePassphrase}`, `passphraseState: ${passphraseState}`, `sessionId: ${sessionId}`, `featuresSessionId: ${featuresSessionId}`);
|
|
26688
|
+
if (enablePassphrase) {
|
|
26689
|
+
if (sessionId) {
|
|
26690
|
+
deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = sessionId;
|
|
26717
26691
|
}
|
|
26692
|
+
else if (featuresSessionId) {
|
|
26693
|
+
deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = featuresSessionId;
|
|
26694
|
+
}
|
|
26695
|
+
}
|
|
26696
|
+
const oldKey = `${deviceId}`;
|
|
26697
|
+
if (deviceSessionCache[oldKey]) {
|
|
26698
|
+
delete deviceSessionCache[oldKey];
|
|
26718
26699
|
}
|
|
26719
26700
|
Log$a.debug('updateInternalState session cache: ', deviceSessionCache);
|
|
26720
26701
|
}
|
|
@@ -26762,10 +26743,11 @@ class Device extends events.exports {
|
|
|
26762
26743
|
payload.derive_cardano = true;
|
|
26763
26744
|
}
|
|
26764
26745
|
payload.passphrase_state = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
26765
|
-
|
|
26746
|
+
Log$a.debug('Initialize device begin:', {
|
|
26766
26747
|
deviceId: options === null || options === void 0 ? void 0 : options.deviceId,
|
|
26767
26748
|
passphraseState: options === null || options === void 0 ? void 0 : options.passphraseState,
|
|
26768
26749
|
initSession: options === null || options === void 0 ? void 0 : options.initSession,
|
|
26750
|
+
InitializePayload: payload,
|
|
26769
26751
|
});
|
|
26770
26752
|
try {
|
|
26771
26753
|
const { message } = yield Promise.race([
|
|
@@ -26776,7 +26758,7 @@ class Device extends events.exports {
|
|
|
26776
26758
|
}, 25 * 1000);
|
|
26777
26759
|
}),
|
|
26778
26760
|
]);
|
|
26779
|
-
|
|
26761
|
+
Log$a.debug('Initialize device end: ', message);
|
|
26780
26762
|
this._updateFeatures(message, options === null || options === void 0 ? void 0 : options.initSession);
|
|
26781
26763
|
yield TransportManager.reconfigure(this.features);
|
|
26782
26764
|
}
|
|
@@ -27047,7 +27029,7 @@ class Device extends events.exports {
|
|
|
27047
27029
|
}
|
|
27048
27030
|
const mainWalletUseAttachPin = unlockedAttachPin && useEmptyPassphraseState;
|
|
27049
27031
|
const useErrorAttachPin = unlockedAttachPin && passphraseState && passphraseState !== newPassphraseState;
|
|
27050
|
-
|
|
27032
|
+
Log$a.debug('Check passphrase state safety: ', {
|
|
27051
27033
|
passphraseState,
|
|
27052
27034
|
newPassphraseState,
|
|
27053
27035
|
unlockedAttachPin,
|
|
@@ -27329,18 +27311,9 @@ class GetPassphraseState extends BaseMethod {
|
|
|
27329
27311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27330
27312
|
if (!this.device.features)
|
|
27331
27313
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
|
|
27332
|
-
const { passphraseState
|
|
27333
|
-
console.log('=====>>>>>> GetPassphraseState run passphraseState: ', passphraseState);
|
|
27334
|
-
console.log('=====>>>>>> GetPassphraseState run newSession: ', newSession);
|
|
27335
|
-
console.log('=====>>>>>> GetPassphraseState run features: ', this.device.features.passphrase_protection);
|
|
27314
|
+
const { passphraseState } = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
|
|
27336
27315
|
const { features } = this.device;
|
|
27337
27316
|
if (features && features.passphrase_protection === true) {
|
|
27338
|
-
if (!newSession) {
|
|
27339
|
-
console.log('=====>>>>>> GetPassphraseState run tryFixInternalState', newSession);
|
|
27340
|
-
if (passphraseState && features.device_id) {
|
|
27341
|
-
this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
|
|
27342
|
-
}
|
|
27343
|
-
}
|
|
27344
27317
|
return Promise.resolve(passphraseState);
|
|
27345
27318
|
}
|
|
27346
27319
|
return Promise.resolve(undefined);
|
|
@@ -28776,7 +28749,7 @@ class FirmwareUpdate extends BaseMethod {
|
|
|
28776
28749
|
if (e instanceof hdShared.HardwareError) {
|
|
28777
28750
|
return Promise.reject(e);
|
|
28778
28751
|
}
|
|
28779
|
-
|
|
28752
|
+
Log$7.log('auto go to bootloader mode failed: ', e);
|
|
28780
28753
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure));
|
|
28781
28754
|
}
|
|
28782
28755
|
}
|
|
@@ -33275,8 +33248,6 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
33275
33248
|
this.operations.push(transformed);
|
|
33276
33249
|
}
|
|
33277
33250
|
});
|
|
33278
|
-
console.log('StellarSignTransactionParams', this.params);
|
|
33279
|
-
console.log('StellarSignTransactionOperations', this.operations);
|
|
33280
33251
|
}
|
|
33281
33252
|
run() {
|
|
33282
33253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -38542,6 +38513,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
38542
38513
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
38543
38514
|
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError));
|
|
38544
38515
|
}
|
|
38516
|
+
postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_WINDOW));
|
|
38545
38517
|
}
|
|
38546
38518
|
try {
|
|
38547
38519
|
yield method.checkSafetyLevelOnTestNet();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE7D,OAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,eAAO,MAAM,wBAAwB,aACzB,QAAQ,GAAG,SAAS,KAC7B;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAiClD,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,QAAQ,KAAG,kBAU9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAAe,QAAQ,KAAG,kBAW1D,CAAC;AAEF,eAAO,MAAM,uCAAuC,WAC1C,MAAM,YACJ;IACR,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;;;;
|
|
1
|
+
{"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.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eAAO,MAAM,2BAA2B,aAC5B,QAAQ,cACN,UAAU,GAAG,KAAK,GAAG,YAAY,KAC5C,CAAC,UAAU,GAAG,KAAK,GAAG,aAAa,GAAG,aAAa,CAAC,EAkCtD,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,UASzC;AAED,eAAO,MAAM,0BAA0B,aAAc,QAAQ,KAAG,QAc/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.0.39-alpha.
|
|
3
|
+
"version": "1.0.39-alpha.1",
|
|
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": "^1.0.39-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "^1.0.39-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "^1.0.39-alpha.1",
|
|
29
|
+
"@onekeyfe/hd-transport": "^1.0.39-alpha.1",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/web-bluetooth": "^0.0.21",
|
|
47
47
|
"ripple-keypairs": "^1.1.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "68ee1f51daddb1fed1193f60a584ccdc97339ce5"
|
|
50
50
|
}
|
|
@@ -166,7 +166,7 @@ export default class FirmwareUpdate extends BaseMethod<Params> {
|
|
|
166
166
|
if (e instanceof HardwareError) {
|
|
167
167
|
return Promise.reject(e);
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
Log.log('auto go to bootloader mode failed: ', e);
|
|
170
170
|
return Promise.reject(
|
|
171
171
|
ERRORS.TypedError(HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure)
|
|
172
172
|
);
|
|
@@ -13,28 +13,12 @@ export default class GetPassphraseState extends BaseMethod {
|
|
|
13
13
|
if (!this.device.features)
|
|
14
14
|
return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceInitializeFailed));
|
|
15
15
|
|
|
16
|
-
const { passphraseState
|
|
17
|
-
this.device
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
console.log('=====>>>>>> GetPassphraseState run passphraseState: ', passphraseState);
|
|
21
|
-
console.log('=====>>>>>> GetPassphraseState run newSession: ', newSession);
|
|
22
|
-
console.log(
|
|
23
|
-
'=====>>>>>> GetPassphraseState run features: ',
|
|
24
|
-
this.device.features.passphrase_protection
|
|
25
|
-
);
|
|
16
|
+
const { passphraseState } = await getPassphraseStateWithRefreshDeviceInfo(this.device);
|
|
26
17
|
|
|
27
18
|
const { features } = this.device;
|
|
28
19
|
|
|
29
20
|
// refresh device info
|
|
30
21
|
if (features && features.passphrase_protection === true) {
|
|
31
|
-
if (!newSession) {
|
|
32
|
-
console.log('=====>>>>>> GetPassphraseState run tryFixInternalState', newSession);
|
|
33
|
-
if (passphraseState && features.device_id) {
|
|
34
|
-
this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
22
|
return Promise.resolve(passphraseState);
|
|
39
23
|
}
|
|
40
24
|
|
|
@@ -194,9 +194,6 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
194
194
|
this.operations.push(transformed);
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
|
-
|
|
198
|
-
console.log('StellarSignTransactionParams', this.params);
|
|
199
|
-
console.log('StellarSignTransactionOperations', this.operations);
|
|
200
197
|
}
|
|
201
198
|
|
|
202
199
|
processTxRequest = async (operations: any, index: number): Promise<StellarSignedTx> => {
|
package/src/core/index.ts
CHANGED
|
@@ -356,6 +356,9 @@ const onCallDevice = async (
|
|
|
356
356
|
ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError)
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
|
+
|
|
360
|
+
// close pin popup window
|
|
361
|
+
postMessage(createUiMessage(UI_REQUEST.CLOSE_UI_WINDOW));
|
|
359
362
|
}
|
|
360
363
|
|
|
361
364
|
// Automatic check safety_check level for Kovan, Ropsten, Rinkeby, Goerli test networks.
|
package/src/device/Device.ts
CHANGED
|
@@ -298,13 +298,13 @@ export class Device extends EventEmitter {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
getInternalState(_deviceId?: string) {
|
|
301
|
+
Log.debug('getInternalState session cache: ', deviceSessionCache);
|
|
301
302
|
Log.debug(
|
|
302
303
|
'getInternalState session param: ',
|
|
303
304
|
`device_id: ${_deviceId}`,
|
|
304
305
|
`features.device_id: ${this.features?.device_id}`,
|
|
305
306
|
`passphraseState: ${this.passphraseState}`
|
|
306
307
|
);
|
|
307
|
-
Log.debug('getInternalState session cache: ', deviceSessionCache);
|
|
308
308
|
|
|
309
309
|
const deviceId = _deviceId || this.features?.device_id;
|
|
310
310
|
if (!deviceId) return undefined;
|
|
@@ -314,42 +314,38 @@ export class Device extends EventEmitter {
|
|
|
314
314
|
return deviceSessionCache[usePassKey];
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
tryFixInternalState(state: string, deviceId: string, sessionId: string | null = null) {
|
|
318
|
-
Log.debug(
|
|
319
|
-
'tryFixInternalState session param: ',
|
|
320
|
-
`device_id: ${deviceId}`,
|
|
321
|
-
`passphraseState: ${state}`,
|
|
322
|
-
`sessionId: ${sessionId}`
|
|
323
|
-
);
|
|
324
|
-
|
|
325
|
-
const key = `${deviceId}`;
|
|
326
|
-
const session = deviceSessionCache[key];
|
|
327
|
-
if (session) {
|
|
328
|
-
deviceSessionCache[this.generateStateKey(deviceId, state)] = session;
|
|
329
|
-
delete deviceSessionCache[key];
|
|
330
|
-
} else if (sessionId) {
|
|
331
|
-
deviceSessionCache[this.generateStateKey(deviceId, state)] = sessionId;
|
|
332
|
-
}
|
|
333
|
-
Log.debug('tryFixInternalState session cache: ', deviceSessionCache);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
317
|
// attach to pin to fix internal state
|
|
337
|
-
updateInternalState(
|
|
318
|
+
updateInternalState(
|
|
319
|
+
enablePassphrase: boolean,
|
|
320
|
+
passphraseState: string | undefined,
|
|
321
|
+
deviceId: string,
|
|
322
|
+
sessionId: string | null = null,
|
|
323
|
+
featuresSessionId: string | null = null
|
|
324
|
+
) {
|
|
338
325
|
Log.debug(
|
|
339
326
|
'updateInternalState session param: ',
|
|
340
327
|
`device_id: ${deviceId}`,
|
|
341
|
-
`
|
|
342
|
-
`
|
|
328
|
+
`enablePassphrase: ${enablePassphrase}`,
|
|
329
|
+
`passphraseState: ${passphraseState}`,
|
|
330
|
+
`sessionId: ${sessionId}`,
|
|
331
|
+
`featuresSessionId: ${featuresSessionId}`
|
|
343
332
|
);
|
|
344
333
|
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (
|
|
350
|
-
|
|
334
|
+
if (enablePassphrase) {
|
|
335
|
+
// update the sessionId
|
|
336
|
+
if (sessionId) {
|
|
337
|
+
deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = sessionId;
|
|
338
|
+
} else if (featuresSessionId) {
|
|
339
|
+
deviceSessionCache[this.generateStateKey(deviceId, passphraseState)] = featuresSessionId;
|
|
351
340
|
}
|
|
352
341
|
}
|
|
342
|
+
|
|
343
|
+
// delete the old sessionId
|
|
344
|
+
const oldKey = `${deviceId}`;
|
|
345
|
+
if (deviceSessionCache[oldKey]) {
|
|
346
|
+
delete deviceSessionCache[oldKey];
|
|
347
|
+
}
|
|
348
|
+
|
|
353
349
|
Log.debug('updateInternalState session cache: ', deviceSessionCache);
|
|
354
350
|
}
|
|
355
351
|
|
|
@@ -410,11 +406,11 @@ export class Device extends EventEmitter {
|
|
|
410
406
|
}
|
|
411
407
|
payload.passphrase_state = options?.passphraseState;
|
|
412
408
|
|
|
413
|
-
|
|
414
|
-
console.log('=====>>>>>> initialize device begin: ', payload, {
|
|
409
|
+
Log.debug('Initialize device begin:', {
|
|
415
410
|
deviceId: options?.deviceId,
|
|
416
411
|
passphraseState: options?.passphraseState,
|
|
417
412
|
initSession: options?.initSession,
|
|
413
|
+
InitializePayload: payload,
|
|
418
414
|
});
|
|
419
415
|
|
|
420
416
|
try {
|
|
@@ -429,7 +425,7 @@ export class Device extends EventEmitter {
|
|
|
429
425
|
}),
|
|
430
426
|
]);
|
|
431
427
|
|
|
432
|
-
|
|
428
|
+
Log.debug('Initialize device end: ', message);
|
|
433
429
|
this._updateFeatures(message, options?.initSession);
|
|
434
430
|
await TransportManager.reconfigure(this.features);
|
|
435
431
|
} catch (error) {
|
|
@@ -756,7 +752,7 @@ export class Device extends EventEmitter {
|
|
|
756
752
|
const useErrorAttachPin =
|
|
757
753
|
unlockedAttachPin && passphraseState && passphraseState !== newPassphraseState;
|
|
758
754
|
|
|
759
|
-
|
|
755
|
+
Log.debug('Check passphrase state safety: ', {
|
|
760
756
|
passphraseState,
|
|
761
757
|
newPassphraseState,
|
|
762
758
|
unlockedAttachPin,
|
|
@@ -218,7 +218,6 @@ export class DeviceCommands {
|
|
|
218
218
|
this.callPromise = promise;
|
|
219
219
|
const res = await promise;
|
|
220
220
|
Log.debug('[DeviceCommands] [call] Received', res.type);
|
|
221
|
-
console.log('[DeviceCommands] [call] Received', res.type);
|
|
222
221
|
return res;
|
|
223
222
|
} catch (error) {
|
|
224
223
|
Log.debug('[DeviceCommands] [call] Received error', error);
|
|
@@ -91,12 +91,6 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
|
|
94
|
-
// Attach to pin try to fix internal state
|
|
95
|
-
if (newSession && passphraseState && features?.device_id) {
|
|
96
|
-
console.log('=====>>>>>> run updateInternalState newSession:', newSession);
|
|
97
|
-
device.updateInternalState(passphraseState, features.device_id, newSession);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
94
|
const isModeT =
|
|
101
95
|
getDeviceType(features) === EDeviceType.Touch || getDeviceType(features) === EDeviceType.Pro;
|
|
102
96
|
|
|
@@ -112,6 +106,17 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
112
106
|
await device.getFeatures();
|
|
113
107
|
}
|
|
114
108
|
|
|
109
|
+
// Attach to pin try to fix internal state
|
|
110
|
+
if (features?.device_id) {
|
|
111
|
+
device.updateInternalState(
|
|
112
|
+
device.features?.passphrase_protection ?? false,
|
|
113
|
+
passphraseState,
|
|
114
|
+
device.features?.device_id ?? '',
|
|
115
|
+
newSession,
|
|
116
|
+
device.features?.session_id
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
115
120
|
return { passphraseState, newSession, unlockedAttachPin };
|
|
116
121
|
};
|
|
117
122
|
|
|
@@ -121,7 +126,6 @@ export const getPassphraseState = async (
|
|
|
121
126
|
options?: {
|
|
122
127
|
expectPassphraseState?: string;
|
|
123
128
|
onlyMainPin?: boolean;
|
|
124
|
-
// createAttachPinWallet?: boolean;
|
|
125
129
|
}
|
|
126
130
|
): Promise<{
|
|
127
131
|
passphraseState: string | undefined;
|
|
@@ -134,21 +138,11 @@ export const getPassphraseState = async (
|
|
|
134
138
|
const firmwareVersion = getDeviceFirmwareVersion(features);
|
|
135
139
|
const deviceType = getDeviceType(features);
|
|
136
140
|
|
|
137
|
-
if (deviceType === EDeviceType.Pro && semver.gte(firmwareVersion.join('.'), '4.
|
|
138
|
-
console.log(
|
|
139
|
-
'=====>>>>>> getPassphraseState begin: ',
|
|
140
|
-
options?.onlyMainPin,
|
|
141
|
-
options?.expectPassphraseState
|
|
142
|
-
);
|
|
143
|
-
|
|
141
|
+
if (deviceType === EDeviceType.Pro && semver.gte(firmwareVersion.join('.'), '4.15.0')) {
|
|
144
142
|
const { message, type } = await commands.typedCall('GetPassphraseState', 'PassphraseState', {
|
|
145
143
|
passphrase_state: options?.onlyMainPin ? undefined : options?.expectPassphraseState,
|
|
146
|
-
// allow_create_attach_pin: options?.createAttachPinWallet,
|
|
147
|
-
// _only_main_pin: options?.onlyMainPin,
|
|
148
144
|
});
|
|
149
145
|
|
|
150
|
-
console.log('=====>>>>>> getPassphraseState end: result ', message);
|
|
151
|
-
|
|
152
146
|
// @ts-expect-error
|
|
153
147
|
if (type === 'CallMethodError') {
|
|
154
148
|
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|