@onekeyfe/hd-core 1.2.0-alpha.101 → 1.2.0-alpha.102
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__/bridgeBinaryPayload.test.ts +173 -0
- package/__tests__/check-all-firmware-release-protocol-v2.test.ts +2 -0
- package/__tests__/device-pool-state.test.ts +29 -0
- package/__tests__/get-device-state.test.ts +102 -13
- package/__tests__/protocol-v2-legacy-recovery.test.ts +29 -0
- package/__tests__/protocol-v2.test.ts +234 -1
- package/__tests__/refresh-device-state.test.ts +4 -1
- package/__tests__/search-devices.test.ts +2 -0
- package/__tests__/ton-sign-message.test.ts +84 -0
- package/dist/api/FirmwareUpdateV4.d.ts +3 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceState.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/firmware/protocolV2Release.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/protocolV2LegacyRecovery.d.ts +5 -0
- package/dist/core/protocolV2LegacyRecovery.d.ts.map +1 -0
- package/dist/device/Device.d.ts +9 -2
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DevicePool.d.ts +1 -1
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +243 -60
- package/dist/protocols/protocol-v2/features.d.ts +8 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +2 -2
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/getDeviceState.d.ts +1 -0
- package/dist/types/api/getDeviceState.d.ts.map +1 -1
- package/dist/utils/bridgeBinaryPayload.d.ts +3 -0
- package/dist/utils/bridgeBinaryPayload.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +70 -23
- package/src/api/GetDeviceState.ts +1 -0
- package/src/api/SearchDevices.ts +2 -0
- package/src/api/firmware/protocolV2Release.ts +1 -0
- package/src/api/ton/TonSignMessage.ts +5 -3
- package/src/api/utils.ts +5 -2
- package/src/core/index.ts +4 -0
- package/src/core/protocolV2LegacyRecovery.ts +12 -0
- package/src/device/Device.ts +78 -20
- package/src/device/DevicePool.ts +17 -5
- package/src/protocols/protocol-v2/features.ts +10 -0
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/topLevelInject.ts +4 -2
- package/src/types/api/getDeviceState.ts +2 -0
- package/src/utils/bridgeBinaryPayload.ts +137 -0
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var sha256 = require('@noble/hashes/sha256');
|
|
|
7
7
|
var utils = require('@noble/hashes/utils');
|
|
8
8
|
var semver = require('semver');
|
|
9
9
|
var hdTransport = require('@onekeyfe/hd-transport');
|
|
10
|
+
var buffer = require('buffer');
|
|
10
11
|
var axios = require('axios');
|
|
11
12
|
var lodash = require('lodash');
|
|
12
13
|
var ByteBuffer = require('bytebuffer');
|
|
@@ -15,7 +16,6 @@ var BigNumber = require('bignumber.js');
|
|
|
15
16
|
var JSZip = require('jszip');
|
|
16
17
|
var sha3 = require('@noble/hashes/sha3');
|
|
17
18
|
var blake2b = require('@noble/hashes/blake2b');
|
|
18
|
-
var buffer = require('buffer');
|
|
19
19
|
|
|
20
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
21
|
|
|
@@ -2219,14 +2219,132 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
2219
2219
|
}
|
|
2220
2220
|
}
|
|
2221
2221
|
|
|
2222
|
+
const BRIDGE_BINARY_PAYLOAD_MARKER = '__onekey_hd_bridge_binary_payload__';
|
|
2223
|
+
const BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
2224
|
+
const invalidBinaryPayload = (message) => hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, message);
|
|
2225
|
+
function isPlainObject(value) {
|
|
2226
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
2227
|
+
return false;
|
|
2228
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2229
|
+
return prototype === Object.prototype || prototype === null;
|
|
2230
|
+
}
|
|
2231
|
+
function isArrayBufferValue(value) {
|
|
2232
|
+
return Boolean(typeof ArrayBuffer !== 'undefined' &&
|
|
2233
|
+
(value instanceof ArrayBuffer ||
|
|
2234
|
+
Object.prototype.toString.call(value) === '[object ArrayBuffer]'));
|
|
2235
|
+
}
|
|
2236
|
+
function isBlobValue(value) {
|
|
2237
|
+
return Boolean(typeof Blob !== 'undefined' &&
|
|
2238
|
+
(value instanceof Blob || Object.prototype.toString.call(value) === '[object Blob]') &&
|
|
2239
|
+
typeof value.arrayBuffer === 'function');
|
|
2240
|
+
}
|
|
2241
|
+
function readBinaryPayload(value) {
|
|
2242
|
+
if (!isPlainObject(value) || !(BRIDGE_BINARY_PAYLOAD_MARKER in value))
|
|
2243
|
+
return undefined;
|
|
2244
|
+
const payload = value;
|
|
2245
|
+
if (payload[BRIDGE_BINARY_PAYLOAD_MARKER] !== 1 ||
|
|
2246
|
+
(payload.type !== 'array-buffer' && payload.type !== 'uint8-array') ||
|
|
2247
|
+
typeof payload.data !== 'string') {
|
|
2248
|
+
throw invalidBinaryPayload('Invalid bridge binary payload');
|
|
2249
|
+
}
|
|
2250
|
+
return payload;
|
|
2251
|
+
}
|
|
2252
|
+
function bytesToPayload(bytes, type) {
|
|
2253
|
+
return {
|
|
2254
|
+
[BRIDGE_BINARY_PAYLOAD_MARKER]: 1,
|
|
2255
|
+
data: buffer.Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64'),
|
|
2256
|
+
type,
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
function payloadToBytes(payload) {
|
|
2260
|
+
if (payload.data.length % 4 !== 0 || !BASE64_PATTERN.test(payload.data)) {
|
|
2261
|
+
throw invalidBinaryPayload('Invalid bridge binary payload data');
|
|
2262
|
+
}
|
|
2263
|
+
const decoded = buffer.Buffer.from(payload.data, 'base64');
|
|
2264
|
+
if (decoded.toString('base64') !== payload.data) {
|
|
2265
|
+
throw invalidBinaryPayload('Invalid bridge binary payload data');
|
|
2266
|
+
}
|
|
2267
|
+
return Uint8Array.from(decoded);
|
|
2268
|
+
}
|
|
2269
|
+
function encodeValue(value, seen) {
|
|
2270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2271
|
+
if (isArrayBufferValue(value)) {
|
|
2272
|
+
return bytesToPayload(new Uint8Array(value), 'array-buffer');
|
|
2273
|
+
}
|
|
2274
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView(value)) {
|
|
2275
|
+
return bytesToPayload(new Uint8Array(value.buffer, value.byteOffset, value.byteLength), 'uint8-array');
|
|
2276
|
+
}
|
|
2277
|
+
if (isBlobValue(value)) {
|
|
2278
|
+
return bytesToPayload(new Uint8Array(yield value.arrayBuffer()), 'uint8-array');
|
|
2279
|
+
}
|
|
2280
|
+
const encodedPayload = readBinaryPayload(value);
|
|
2281
|
+
if (encodedPayload)
|
|
2282
|
+
return encodedPayload;
|
|
2283
|
+
if (Array.isArray(value)) {
|
|
2284
|
+
if (seen.has(value))
|
|
2285
|
+
throw invalidBinaryPayload('Circular bridge payload');
|
|
2286
|
+
seen.add(value);
|
|
2287
|
+
try {
|
|
2288
|
+
const encoded = [];
|
|
2289
|
+
for (const item of value) {
|
|
2290
|
+
encoded.push(yield encodeValue(item, seen));
|
|
2291
|
+
}
|
|
2292
|
+
return encoded.some((item, index) => item !== value[index]) ? encoded : value;
|
|
2293
|
+
}
|
|
2294
|
+
finally {
|
|
2295
|
+
seen.delete(value);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
if (!isPlainObject(value))
|
|
2299
|
+
return value;
|
|
2300
|
+
if (seen.has(value))
|
|
2301
|
+
throw invalidBinaryPayload('Circular bridge payload');
|
|
2302
|
+
seen.add(value);
|
|
2303
|
+
try {
|
|
2304
|
+
const entries = [];
|
|
2305
|
+
for (const [key, item] of Object.entries(value)) {
|
|
2306
|
+
entries.push([key, yield encodeValue(item, seen)]);
|
|
2307
|
+
}
|
|
2308
|
+
return entries.some(([key, item]) => item !== value[key]) ? Object.fromEntries(entries) : value;
|
|
2309
|
+
}
|
|
2310
|
+
finally {
|
|
2311
|
+
seen.delete(value);
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
function decodeValue(value) {
|
|
2316
|
+
const payload = readBinaryPayload(value);
|
|
2317
|
+
if (payload) {
|
|
2318
|
+
const bytes = payloadToBytes(payload);
|
|
2319
|
+
return payload.type === 'array-buffer' ? bytes.buffer : bytes;
|
|
2320
|
+
}
|
|
2321
|
+
if (Array.isArray(value)) {
|
|
2322
|
+
const decoded = value.map(decodeValue);
|
|
2323
|
+
return decoded.some((item, index) => item !== value[index]) ? decoded : value;
|
|
2324
|
+
}
|
|
2325
|
+
if (!isPlainObject(value))
|
|
2326
|
+
return value;
|
|
2327
|
+
const entries = Object.entries(value).map(([key, item]) => [key, decodeValue(item)]);
|
|
2328
|
+
return entries.some(([key, item]) => item !== value[key]) ? Object.fromEntries(entries) : value;
|
|
2329
|
+
}
|
|
2330
|
+
function encodeBridgeBinaryPayload(value) {
|
|
2331
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2332
|
+
return encodeValue(value, new WeakSet());
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
function decodeBridgeBinaryPayload(value) {
|
|
2336
|
+
return decodeValue(value);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2222
2339
|
const eventEmitter = new events.exports();
|
|
2223
2340
|
const topLevelInject = () => {
|
|
2224
2341
|
let lowLevelApi;
|
|
2225
|
-
const call = (params) => {
|
|
2342
|
+
const call = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2226
2343
|
if (!lowLevelApi)
|
|
2227
2344
|
return Promise.resolve(undefined);
|
|
2228
|
-
|
|
2229
|
-
|
|
2345
|
+
const encodedParams = yield encodeBridgeBinaryPayload(params);
|
|
2346
|
+
return lowLevelApi.call(encodedParams);
|
|
2347
|
+
});
|
|
2230
2348
|
const protocolAwareCall = createProtocolAwareCall(call);
|
|
2231
2349
|
const api = Object.assign(Object.assign({ on: (type, fn) => {
|
|
2232
2350
|
eventEmitter.on(type, fn);
|
|
@@ -43242,7 +43360,7 @@ class DevicePool extends events.exports {
|
|
|
43242
43360
|
try {
|
|
43243
43361
|
yield device.initialize(initOptions);
|
|
43244
43362
|
if ((initOptions === null || initOptions === void 0 ? void 0 : initOptions.refreshRuntimeState) && device.isProtocolV2()) {
|
|
43245
|
-
yield this._refreshProtocolV2DiscoveryState(device);
|
|
43363
|
+
yield this._refreshProtocolV2DiscoveryState(device, initOptions);
|
|
43246
43364
|
}
|
|
43247
43365
|
}
|
|
43248
43366
|
finally {
|
|
@@ -43259,26 +43377,28 @@ class DevicePool extends events.exports {
|
|
|
43259
43377
|
let refreshError;
|
|
43260
43378
|
yield device.run(() => __awaiter(this, void 0, void 0, function* () {
|
|
43261
43379
|
try {
|
|
43262
|
-
yield this._refreshProtocolV2DiscoveryState(device);
|
|
43380
|
+
yield this._refreshProtocolV2DiscoveryState(device, initOptions);
|
|
43263
43381
|
}
|
|
43264
43382
|
catch (error) {
|
|
43265
43383
|
refreshError = error;
|
|
43266
43384
|
}
|
|
43267
|
-
}), {
|
|
43268
|
-
|
|
43269
|
-
|
|
43270
|
-
});
|
|
43385
|
+
}), Object.assign({ connectProtocol: initOptions.connectProtocol, forceProtocolDetection: initOptions.forceProtocolDetection }, (initOptions.allowLegacyProtocolV2ProtocolInfo
|
|
43386
|
+
? { allowLegacyProtocolV2ProtocolInfo: true }
|
|
43387
|
+
: {})));
|
|
43271
43388
|
if (refreshError instanceof Error)
|
|
43272
43389
|
throw refreshError;
|
|
43273
43390
|
if (refreshError)
|
|
43274
43391
|
throw new Error(String(refreshError));
|
|
43275
43392
|
});
|
|
43276
43393
|
}
|
|
43277
|
-
static _refreshProtocolV2DiscoveryState(device) {
|
|
43394
|
+
static _refreshProtocolV2DiscoveryState(device, initOptions) {
|
|
43278
43395
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43279
|
-
|
|
43396
|
+
const stateReadOptions = (initOptions === null || initOptions === void 0 ? void 0 : initOptions.allowLegacyProtocolV2ProtocolInfo)
|
|
43397
|
+
? { allowLegacyProtocolV2ProtocolInfo: true }
|
|
43398
|
+
: {};
|
|
43399
|
+
yield device.getDeviceState(Object.assign({ refreshSections: ['status'] }, stateReadOptions));
|
|
43280
43400
|
try {
|
|
43281
|
-
yield device.getDeviceState({ refreshSections: ['settings'] });
|
|
43401
|
+
yield device.getDeviceState(Object.assign({ refreshSections: ['settings'] }, stateReadOptions));
|
|
43282
43402
|
}
|
|
43283
43403
|
catch (error) {
|
|
43284
43404
|
Log$j.debug('Unable to refresh Protocol V2 device label during discovery', error);
|
|
@@ -44226,6 +44346,7 @@ const getProtocolV2SeState = (se) => {
|
|
|
44226
44346
|
}
|
|
44227
44347
|
};
|
|
44228
44348
|
const getProtocolV2SeType = (se) => normalizeEnumValue(hdTransport.DeviceSeType, se === null || se === void 0 ? void 0 : se.type);
|
|
44349
|
+
const isLegacyProtocolV2ProtocolInfo = (protocolInfo) => Object.prototype.hasOwnProperty.call(protocolInfo, 'protobuf_definition');
|
|
44229
44350
|
const parseProtocolV2BuildFingerprint = (buildFingerprint) => {
|
|
44230
44351
|
if (!buildFingerprint)
|
|
44231
44352
|
return null;
|
|
@@ -45641,7 +45762,9 @@ class Device extends events.exports {
|
|
|
45641
45762
|
commands: this.commands,
|
|
45642
45763
|
timeoutMs: options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs,
|
|
45643
45764
|
});
|
|
45644
|
-
const features =
|
|
45765
|
+
const features = (options === null || options === void 0 ? void 0 : options.allowLegacyProtocolV2ProtocolInfo)
|
|
45766
|
+
? yield this.probeProtocolV2RuntimeState(deviceInfo, options.protocolV2DeviceInfoTimeoutMs, { allowLegacyProtocolV2ProtocolInfo: true })
|
|
45767
|
+
: yield this.probeProtocolV2RuntimeState(deviceInfo, options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs);
|
|
45645
45768
|
Log$g.debug('Protocol V2 features:', features);
|
|
45646
45769
|
}
|
|
45647
45770
|
catch (error) {
|
|
@@ -45664,7 +45787,7 @@ class Device extends events.exports {
|
|
|
45664
45787
|
});
|
|
45665
45788
|
}
|
|
45666
45789
|
getDeviceState(params = {}) {
|
|
45667
|
-
var _a, _b, _c;
|
|
45790
|
+
var _a, _b, _c, _d;
|
|
45668
45791
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45669
45792
|
const refresh = new Set((_a = params.refreshSections) !== null && _a !== void 0 ? _a : []);
|
|
45670
45793
|
const getProtocolV2DeviceInfoRequest = () => {
|
|
@@ -45682,7 +45805,14 @@ class Device extends events.exports {
|
|
|
45682
45805
|
commands: this.commands,
|
|
45683
45806
|
request: getProtocolV2DeviceInfoRequest(),
|
|
45684
45807
|
});
|
|
45685
|
-
|
|
45808
|
+
if (params.allowLegacyProtocolV2ProtocolInfo) {
|
|
45809
|
+
yield this.probeProtocolV2RuntimeState(deviceInfo, undefined, {
|
|
45810
|
+
allowLegacyProtocolV2ProtocolInfo: true,
|
|
45811
|
+
});
|
|
45812
|
+
}
|
|
45813
|
+
else {
|
|
45814
|
+
yield this.probeProtocolV2RuntimeState(deviceInfo);
|
|
45815
|
+
}
|
|
45686
45816
|
refreshedDeviceInfo = deviceInfo;
|
|
45687
45817
|
initializedWithDeviceInfo = true;
|
|
45688
45818
|
}
|
|
@@ -45712,9 +45842,12 @@ class Device extends events.exports {
|
|
|
45712
45842
|
}
|
|
45713
45843
|
}
|
|
45714
45844
|
if (refresh.has('status') && !initializedWithDeviceInfo) {
|
|
45715
|
-
|
|
45845
|
+
const cachedMode = (_c = this.state) === null || _c === void 0 ? void 0 : _c.status.mode;
|
|
45846
|
+
yield this.probeProtocolV2RuntimeState(refreshedDeviceInfo, undefined, Object.assign({ forceRuntimeContextRefresh: cachedMode === 'bootloader' || cachedMode === 'romloader' }, (params.allowLegacyProtocolV2ProtocolInfo
|
|
45847
|
+
? { allowLegacyProtocolV2ProtocolInfo: true }
|
|
45848
|
+
: {})));
|
|
45716
45849
|
}
|
|
45717
|
-
if (refresh.has('settings') && ((
|
|
45850
|
+
if (refresh.has('settings') && ((_d = this.state) === null || _d === void 0 ? void 0 : _d.status.mode) === 'normal') {
|
|
45718
45851
|
const { message } = yield this.commands.typedCall('DeviceSettingsGet', 'DeviceSettings', {});
|
|
45719
45852
|
this.updateState(mapDeviceSettingsToState(message), 'settings-read');
|
|
45720
45853
|
}
|
|
@@ -45772,18 +45905,27 @@ class Device extends events.exports {
|
|
|
45772
45905
|
this.updateState(mapFeaturesToState(normalized), source);
|
|
45773
45906
|
return this.features;
|
|
45774
45907
|
}
|
|
45775
|
-
ensureProtocolV2RuntimeContext(timeoutMs) {
|
|
45908
|
+
ensureProtocolV2RuntimeContext(timeoutMs, options) {
|
|
45776
45909
|
var _a, _b, _c, _d;
|
|
45777
45910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45778
|
-
const
|
|
45779
|
-
|
|
45780
|
-
|
|
45911
|
+
const assertProtocolInfoAllowed = (protocolInfo) => {
|
|
45912
|
+
if (isLegacyProtocolV2ProtocolInfo(protocolInfo) &&
|
|
45913
|
+
(options === null || options === void 0 ? void 0 : options.allowLegacyProtocolV2ProtocolInfo) !== true) {
|
|
45914
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, 'Legacy Protocol V2 ProtocolInfo is supported only during device discovery and firmware update.');
|
|
45915
|
+
}
|
|
45916
|
+
return protocolInfo;
|
|
45917
|
+
};
|
|
45918
|
+
const cachedProtocolInfo = (options === null || options === void 0 ? void 0 : options.forceRefresh) === true
|
|
45919
|
+
? undefined
|
|
45920
|
+
: (_a = this.protocolV2RuntimeContext) !== null && _a !== void 0 ? _a : (!this.protocolV2StateNeedsReload
|
|
45921
|
+
? (_d = (_c = (_b = this.state) === null || _b === void 0 ? void 0 : _b.raw) === null || _c === void 0 ? void 0 : _c.protocolV2ProtocolInfo) !== null && _d !== void 0 ? _d : undefined
|
|
45922
|
+
: undefined);
|
|
45781
45923
|
if (cachedProtocolInfo) {
|
|
45782
45924
|
this.protocolV2RuntimeContext = cachedProtocolInfo;
|
|
45783
|
-
return cachedProtocolInfo;
|
|
45925
|
+
return assertProtocolInfoAllowed(cachedProtocolInfo);
|
|
45784
45926
|
}
|
|
45785
45927
|
if (this.protocolV2RuntimeContextPromise) {
|
|
45786
|
-
return this.protocolV2RuntimeContextPromise;
|
|
45928
|
+
return assertProtocolInfoAllowed(yield this.protocolV2RuntimeContextPromise);
|
|
45787
45929
|
}
|
|
45788
45930
|
const requestToken = {};
|
|
45789
45931
|
const pendingRequest = (() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -45800,7 +45942,7 @@ class Device extends events.exports {
|
|
|
45800
45942
|
this.protocolV2RuntimeContextRequestToken = requestToken;
|
|
45801
45943
|
this.protocolV2RuntimeContextPromise = pendingRequest;
|
|
45802
45944
|
try {
|
|
45803
|
-
return yield pendingRequest;
|
|
45945
|
+
return assertProtocolInfoAllowed(yield pendingRequest);
|
|
45804
45946
|
}
|
|
45805
45947
|
finally {
|
|
45806
45948
|
if (this.protocolV2RuntimeContextPromise === pendingRequest) {
|
|
@@ -45812,11 +45954,15 @@ class Device extends events.exports {
|
|
|
45812
45954
|
}
|
|
45813
45955
|
});
|
|
45814
45956
|
}
|
|
45815
|
-
probeProtocolV2RuntimeState(deviceInfo, timeoutMs) {
|
|
45957
|
+
probeProtocolV2RuntimeState(deviceInfo, timeoutMs, options) {
|
|
45816
45958
|
var _a, _b, _c;
|
|
45817
45959
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45818
|
-
const protocolInfo = yield this.ensureProtocolV2RuntimeContext(timeoutMs
|
|
45960
|
+
const protocolInfo = yield this.ensureProtocolV2RuntimeContext(timeoutMs, {
|
|
45961
|
+
forceRefresh: options === null || options === void 0 ? void 0 : options.forceRuntimeContextRefresh,
|
|
45962
|
+
allowLegacyProtocolV2ProtocolInfo: options === null || options === void 0 ? void 0 : options.allowLegacyProtocolV2ProtocolInfo,
|
|
45963
|
+
});
|
|
45819
45964
|
const runtimeMode = getProtocolV2RuntimeMode(protocolInfo);
|
|
45965
|
+
const legacyProtocolInfo = isLegacyProtocolV2ProtocolInfo(protocolInfo);
|
|
45820
45966
|
const runtimeDeviceInfo = deviceInfo !== null && deviceInfo !== void 0 ? deviceInfo : (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.raw) === null || _b === void 0 ? void 0 : _b.protocolV2DeviceInfo;
|
|
45821
45967
|
const protocolV2DeviceType = runtimeDeviceInfo
|
|
45822
45968
|
? resolveProtocolV2DeviceIdentity((_c = runtimeDeviceInfo.hw) === null || _c === void 0 ? void 0 : _c.Device_type).deviceType
|
|
@@ -45826,7 +45972,8 @@ class Device extends events.exports {
|
|
|
45826
45972
|
protocolV2DeviceType !== hdShared.EDeviceType.Neo) {
|
|
45827
45973
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, 'Protocol V2 romloader mode is only supported for Pro2 and Neo.');
|
|
45828
45974
|
}
|
|
45829
|
-
const deviceStatusSupported =
|
|
45975
|
+
const deviceStatusSupported = legacyProtocolInfo ||
|
|
45976
|
+
supportsProtocolV2Message(protocolInfo, PROTOCOL_V2_DEVICE_STATUS_GET_MESSAGE_TYPE);
|
|
45830
45977
|
if (runtimeMode === 'bootloader' || runtimeMode === 'romloader') {
|
|
45831
45978
|
return this.updateProtocolV2Features(deviceInfo, null, runtimeMode, protocolInfo);
|
|
45832
45979
|
}
|
|
@@ -46078,6 +46225,7 @@ class Device extends events.exports {
|
|
|
46078
46225
|
var _a, _b;
|
|
46079
46226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46080
46227
|
const error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInterruptedFromUser);
|
|
46228
|
+
this.markTransportDisconnected();
|
|
46081
46229
|
yield ((_a = this.cancelableAction) === null || _a === void 0 ? void 0 : _a.call(this, error));
|
|
46082
46230
|
yield ((_b = this.commands) === null || _b === void 0 ? void 0 : _b.cancel());
|
|
46083
46231
|
if (this.runPromise) {
|
|
@@ -46832,6 +46980,7 @@ class SearchDevices extends BaseMethod {
|
|
|
46832
46980
|
connectProtocol: undefined,
|
|
46833
46981
|
forceProtocolDetection: true,
|
|
46834
46982
|
refreshRuntimeState: true,
|
|
46983
|
+
allowLegacyProtocolV2ProtocolInfo: true,
|
|
46835
46984
|
});
|
|
46836
46985
|
deviceList.push(...result.deviceList);
|
|
46837
46986
|
}
|
|
@@ -46915,9 +47064,7 @@ class GetDeviceState extends BaseMethod {
|
|
|
46915
47064
|
}
|
|
46916
47065
|
run() {
|
|
46917
47066
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46918
|
-
const state = yield this.device.getDeviceState({
|
|
46919
|
-
refreshSections: SCOPE_SECTIONS[this.params.scope],
|
|
46920
|
-
});
|
|
47067
|
+
const state = yield this.device.getDeviceState(Object.assign({ refreshSections: SCOPE_SECTIONS[this.params.scope] }, (this.params.scope === 'firmware' ? { allowLegacyProtocolV2ProtocolInfo: true } : {})));
|
|
46921
47068
|
if (this.params.scope === 'settings' &&
|
|
46922
47069
|
this.device.isProtocolV2() &&
|
|
46923
47070
|
isLoaderMode(state.status.mode)) {
|
|
@@ -47456,6 +47603,7 @@ function loadProtocolV2FirmwareReleaseContext({ device, firmwareType: firmwareTy
|
|
|
47456
47603
|
refreshSections: checkFirmwareHash
|
|
47457
47604
|
? ['identity', 'versions', 'verification']
|
|
47458
47605
|
: ['identity', 'versions'],
|
|
47606
|
+
allowLegacyProtocolV2ProtocolInfo: true,
|
|
47459
47607
|
});
|
|
47460
47608
|
if (state.identity.deviceType !== 'pro2' && state.identity.deviceType !== 'neo') {
|
|
47461
47609
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportMethod, `${methodName} requires a Pro2 or Neo device for Protocol V2`);
|
|
@@ -51819,6 +51967,10 @@ const isProtocolV2FirmwareStatusEndpointUnavailable = (error) => {
|
|
|
51819
51967
|
message.includes('message handler not found') ||
|
|
51820
51968
|
message.includes('unsupported message'));
|
|
51821
51969
|
};
|
|
51970
|
+
const isProtocolV2FirmwareUpdateEndpointUnavailable = (error) => {
|
|
51971
|
+
const message = getProtocolV2UnknownErrorText(error).toLowerCase();
|
|
51972
|
+
return (message.includes('handler not registered') || message.includes('message handler not found'));
|
|
51973
|
+
};
|
|
51822
51974
|
const isProtocolV2TerminalInstallStatusError = (error) => {
|
|
51823
51975
|
var _a;
|
|
51824
51976
|
return error instanceof hdShared.HardwareError &&
|
|
@@ -51951,6 +52103,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
51951
52103
|
this.protocolV2HasExplicitTargetSelection = false;
|
|
51952
52104
|
this.protocolV2PreparedSources = [];
|
|
51953
52105
|
this.protocolV2ExecutionInLoader = false;
|
|
52106
|
+
this.protocolV2LegacyDirectUpdate = false;
|
|
51954
52107
|
this.protocolV2BootResourceStagingSafe = false;
|
|
51955
52108
|
this.protocolV2CompletedTargetVersions = new Map();
|
|
51956
52109
|
this.protocolV2FinalStatusVerified = false;
|
|
@@ -53056,19 +53209,13 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53056
53209
|
}
|
|
53057
53210
|
return ((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.mode) === 'romloader';
|
|
53058
53211
|
}
|
|
53059
|
-
|
|
53212
|
+
isLegacyProtocolV2Runtime() {
|
|
53213
|
+
var _a, _b;
|
|
53214
|
+
const protocolInfo = (_b = (_a = this.device.state) === null || _a === void 0 ? void 0 : _a.raw) === null || _b === void 0 ? void 0 : _b.protocolV2ProtocolInfo;
|
|
53215
|
+
return protocolInfo ? isLegacyProtocolV2ProtocolInfo(protocolInfo) : false;
|
|
53216
|
+
}
|
|
53217
|
+
rebootProtocolV2ToBootloader() {
|
|
53060
53218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53061
|
-
if (this.isProtocolV2RomloaderMode()) {
|
|
53062
|
-
Log$6.debug('Protocol V2 device is in romloader mode; start firmware update directly');
|
|
53063
|
-
this.protocolV2ExecutionInLoader = true;
|
|
53064
|
-
return false;
|
|
53065
|
-
}
|
|
53066
|
-
if (this.isProtocolV2BootloaderMode()) {
|
|
53067
|
-
Log$6.debug('Protocol V2 device is already in bootloader mode, skip reboot');
|
|
53068
|
-
this.protocolV2ExecutionInLoader = true;
|
|
53069
|
-
this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
|
|
53070
|
-
return false;
|
|
53071
|
-
}
|
|
53072
53219
|
try {
|
|
53073
53220
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.AutoRebootToBootloader);
|
|
53074
53221
|
yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Bootloader);
|
|
@@ -53087,6 +53234,25 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53087
53234
|
}
|
|
53088
53235
|
});
|
|
53089
53236
|
}
|
|
53237
|
+
enterProtocolV2BootloaderMode() {
|
|
53238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53239
|
+
this.protocolV2LegacyDirectUpdate = false;
|
|
53240
|
+
if (this.isProtocolV2RomloaderMode()) {
|
|
53241
|
+
Log$6.debug('Protocol V2 device is in romloader mode; start firmware update directly');
|
|
53242
|
+
this.protocolV2LegacyDirectUpdate = this.isLegacyProtocolV2Runtime();
|
|
53243
|
+
this.protocolV2ExecutionInLoader = true;
|
|
53244
|
+
return false;
|
|
53245
|
+
}
|
|
53246
|
+
if (this.isProtocolV2BootloaderMode()) {
|
|
53247
|
+
Log$6.debug('Protocol V2 device is already in bootloader mode, skip reboot');
|
|
53248
|
+
this.protocolV2LegacyDirectUpdate = this.isLegacyProtocolV2Runtime();
|
|
53249
|
+
this.protocolV2ExecutionInLoader = true;
|
|
53250
|
+
this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
|
|
53251
|
+
return false;
|
|
53252
|
+
}
|
|
53253
|
+
return this.rebootProtocolV2ToBootloader();
|
|
53254
|
+
});
|
|
53255
|
+
}
|
|
53090
53256
|
waitForProtocolV2BootloaderMode(timeout = PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT, retryInterval = 1000) {
|
|
53091
53257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53092
53258
|
const startTime = Date.now();
|
|
@@ -53103,7 +53269,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53103
53269
|
timeoutMs: this.getProtocolV2DeviceInfoTimeout(),
|
|
53104
53270
|
});
|
|
53105
53271
|
this.assertProtocolV2DeviceInfoIdentity(deviceInfo);
|
|
53106
|
-
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT);
|
|
53272
|
+
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT, { allowLegacyProtocolV2ProtocolInfo: true });
|
|
53107
53273
|
if ((features === null || features === void 0 ? void 0 : features.mode) === 'bootloader') {
|
|
53108
53274
|
return features;
|
|
53109
53275
|
}
|
|
@@ -53597,7 +53763,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53597
53763
|
}
|
|
53598
53764
|
probeProtocolV2NormalMode(deviceInfo) {
|
|
53599
53765
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53600
|
-
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT);
|
|
53766
|
+
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT, { allowLegacyProtocolV2ProtocolInfo: true });
|
|
53601
53767
|
return features.mode === 'normal' && !features.bootloaderMode;
|
|
53602
53768
|
});
|
|
53603
53769
|
}
|
|
@@ -53650,7 +53816,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53650
53816
|
request: PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
53651
53817
|
});
|
|
53652
53818
|
this.assertProtocolV2DeviceInfoIdentity(deviceInfo);
|
|
53653
|
-
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT);
|
|
53819
|
+
const features = yield this.device.probeProtocolV2RuntimeState(deviceInfo, PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT, { allowLegacyProtocolV2ProtocolInfo: true });
|
|
53654
53820
|
if (features.mode === 'normal' && !features.bootloaderMode) {
|
|
53655
53821
|
return features;
|
|
53656
53822
|
}
|
|
@@ -53777,7 +53943,22 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53777
53943
|
protocolV2StartFirmwareUpdate({ targets, }) {
|
|
53778
53944
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53779
53945
|
const commands = this.device.getCommands();
|
|
53780
|
-
const
|
|
53946
|
+
const startUpdate = () => commands.typedCall('DeviceFirmwareUpdateRequest', 'Success', { targets }, { timeoutMs: PROTOCOL_V2_START_UPDATE_TIMEOUT });
|
|
53947
|
+
let response;
|
|
53948
|
+
try {
|
|
53949
|
+
response = yield startUpdate();
|
|
53950
|
+
}
|
|
53951
|
+
catch (error) {
|
|
53952
|
+
if (!this.protocolV2LegacyDirectUpdate ||
|
|
53953
|
+
!isProtocolV2FirmwareUpdateEndpointUnavailable(error)) {
|
|
53954
|
+
throw error;
|
|
53955
|
+
}
|
|
53956
|
+
this.protocolV2LegacyDirectUpdate = false;
|
|
53957
|
+
Log$6.debug('[FirmwareUpdateV4] legacy App does not expose DeviceFirmwareUpdateRequest; rebooting to bootloader');
|
|
53958
|
+
yield this.rebootProtocolV2ToBootloader();
|
|
53959
|
+
response = yield startUpdate();
|
|
53960
|
+
}
|
|
53961
|
+
this.protocolV2LegacyDirectUpdate = false;
|
|
53781
53962
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FirmwareUpdating);
|
|
53782
53963
|
this.postProgressMessage(0, 'installingFirmware');
|
|
53783
53964
|
return response;
|
|
@@ -63230,11 +63411,13 @@ class TonSignMessage extends BaseMethod {
|
|
|
63230
63411
|
super(...arguments);
|
|
63231
63412
|
this.initState = null;
|
|
63232
63413
|
this.processTxRequest = (request, data) => __awaiter(this, void 0, void 0, function* () {
|
|
63414
|
+
var _a;
|
|
63233
63415
|
if (!request.init_data_length) {
|
|
63234
63416
|
const deviceType = this.device.getCurrentDeviceType();
|
|
63235
63417
|
const hasClassic = DeviceModelToTypes.model_classic1s.includes(deviceType);
|
|
63236
|
-
const
|
|
63237
|
-
|
|
63418
|
+
const signingMessage = (_a = request.signing_message) !== null && _a !== void 0 ? _a : request.signning_message;
|
|
63419
|
+
const shouldSkipValidation = signingMessage == null;
|
|
63420
|
+
return Promise.resolve(Object.assign(Object.assign({}, request), { signing_message: signingMessage, skip_validate: hasClassic || shouldSkipValidation }));
|
|
63238
63421
|
}
|
|
63239
63422
|
const [first, rest] = cutString(data, request.init_data_length * 2);
|
|
63240
63423
|
const response = yield this.device.commands.typedCall('TonTxAck', 'TonSignedMessage', {
|
|
@@ -64358,13 +64541,15 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
64358
64541
|
|
|
64359
64542
|
const publicMethodRegistry = ApiMethods;
|
|
64360
64543
|
function findMethod(message) {
|
|
64361
|
-
const
|
|
64544
|
+
const payload = decodeBridgeBinaryPayload(message.payload);
|
|
64545
|
+
const normalizedMessage = payload === message.payload ? message : Object.assign(Object.assign({}, message), { payload });
|
|
64546
|
+
const { method } = payload;
|
|
64362
64547
|
if (typeof method !== 'string') {
|
|
64363
64548
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
|
|
64364
64549
|
}
|
|
64365
64550
|
const MethodConstructor = publicMethodRegistry[method];
|
|
64366
64551
|
if (MethodConstructor) {
|
|
64367
|
-
return new MethodConstructor(
|
|
64552
|
+
return new MethodConstructor(normalizedMessage);
|
|
64368
64553
|
}
|
|
64369
64554
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Method ${method} is not set`);
|
|
64370
64555
|
}
|
|
@@ -64739,6 +64924,10 @@ const createUiProgressMessageFilter = (intervalMs = DEFAULT_UI_PROGRESS_INTERVAL
|
|
|
64739
64924
|
};
|
|
64740
64925
|
};
|
|
64741
64926
|
|
|
64927
|
+
const isLegacyProtocolV2FirmwareRecoveryMethod = (method) => (method === null || method === void 0 ? void 0 : method.name) === 'firmwareUpdateV4' ||
|
|
64928
|
+
(method === null || method === void 0 ? void 0 : method.name) === 'checkAllFirmwareRelease' ||
|
|
64929
|
+
((method === null || method === void 0 ? void 0 : method.name) === 'getDeviceState' && method.payload.scope === 'firmware');
|
|
64930
|
+
|
|
64742
64931
|
const Log = getLogger(exports.LoggerNames.Core);
|
|
64743
64932
|
const PRE_INITIALIZE_TTL_MS = 60 * 1000;
|
|
64744
64933
|
const preWarmInflight = new Map();
|
|
@@ -64753,15 +64942,9 @@ function hasDeriveCardano(method) {
|
|
|
64753
64942
|
}
|
|
64754
64943
|
return method.name.startsWith('cardano') || ((_a = method.payload) === null || _a === void 0 ? void 0 : _a.deriveCardano);
|
|
64755
64944
|
}
|
|
64756
|
-
const parseInitOptions = (method) => ({
|
|
64757
|
-
|
|
64758
|
-
|
|
64759
|
-
deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId,
|
|
64760
|
-
deriveCardano: method && hasDeriveCardano(method),
|
|
64761
|
-
connectProtocol: method === null || method === void 0 ? void 0 : method.payload.connectProtocol,
|
|
64762
|
-
forceProtocolDetection: method === null || method === void 0 ? void 0 : method.payload.forceProtocolDetection,
|
|
64763
|
-
protocolV2DeviceInfoTimeoutMs: method === null || method === void 0 ? void 0 : method.payload.protocolV2DeviceInfoTimeoutMs,
|
|
64764
|
-
});
|
|
64945
|
+
const parseInitOptions = (method) => (Object.assign({ initSession: method === null || method === void 0 ? void 0 : method.payload.initSession, passphraseState: (method === null || method === void 0 ? void 0 : method.payload.useEmptyPassphrase) ? undefined : method === null || method === void 0 ? void 0 : method.payload.passphraseState, deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId, deriveCardano: method && hasDeriveCardano(method), connectProtocol: method === null || method === void 0 ? void 0 : method.payload.connectProtocol, forceProtocolDetection: method === null || method === void 0 ? void 0 : method.payload.forceProtocolDetection, protocolV2DeviceInfoTimeoutMs: method === null || method === void 0 ? void 0 : method.payload.protocolV2DeviceInfoTimeoutMs }, (isLegacyProtocolV2FirmwareRecoveryMethod(method)
|
|
64946
|
+
? { allowLegacyProtocolV2ProtocolInfo: true }
|
|
64947
|
+
: {})));
|
|
64765
64948
|
let _core;
|
|
64766
64949
|
let _deviceList;
|
|
64767
64950
|
let _connector;
|
|
@@ -7,6 +7,14 @@ export type ProtocolV2SeStateLabel = 'BOOT' | 'APP_FACTORY' | 'APP';
|
|
|
7
7
|
export declare const getProtocolV2SeState: (se?: DeviceSEInfo) => ProtocolV2SeStateLabel | null;
|
|
8
8
|
export declare const getProtocolV2SeType: (se?: DeviceSEInfo) => string | null;
|
|
9
9
|
export type ProtocolV2RuntimeMode = 'normal' | 'bootloader' | 'romloader';
|
|
10
|
+
export type ProtocolV2ProtocolInfo = ProtocolInfo & {
|
|
11
|
+
protobuf_definition?: string | null;
|
|
12
|
+
};
|
|
13
|
+
export declare const isLegacyProtocolV2ProtocolInfo: (protocolInfo: ProtocolInfo) => protocolInfo is ProtocolInfo & {
|
|
14
|
+
protobuf_definition?: string | null | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
protobuf_definition: string | null;
|
|
17
|
+
};
|
|
10
18
|
export type ProtocolV2BuildFingerprint = {
|
|
11
19
|
binary: 'application' | 'bootloader' | 'romloader';
|
|
12
20
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/features.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AACrC,YAAY,EAAE,uBAAuB,IAAI,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrG,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC;AAoBpE,eAAO,MAAM,oBAAoB,QAAS,YAAY,KAAG,sBAAsB,GAAG,IAYjF,CAAC;AAKF,eAAO,MAAM,mBAAmB,QAAS,YAAY,KAAG,MAAM,GAAG,IACrB,CAAC;AAE7C,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/features.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AACrC,YAAY,EAAE,uBAAuB,IAAI,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrG,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC;AAoBpE,eAAO,MAAM,oBAAoB,QAAS,YAAY,KAAG,sBAAsB,GAAG,IAYjF,CAAC;AAKF,eAAO,MAAM,mBAAmB,QAAS,YAAY,KAAG,MAAM,GAAG,IACrB,CAAC;AAE7C,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG;IAElD,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,8BAA8B,iBAC3B,YAAY;;;yBACuC,MAAM,GAAG,IAAI;CACL,CAAC;AAM5E,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,aAAa,GAAG,YAAY,GAAG,WAAW,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,+BAA+B,qBACxB,MAAM,GAAG,IAAI,GAAG,SAAS,KAC1C,0BAA0B,GAAG,IAc/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,iBACrB,YAAY,KACzB,qBAAqB,GAAG,SAI1B,CAAC;AAGF,eAAO,MAAM,0CAA0C,QAAQ,CAAC;AAEhE,eAAO,MAAM,yBAAyB,iBACtB,YAAY,eACb,MAAM,KAClB,OAAgE,CAAC;AAEpE,eAAO,MAAM,wCAAwC;;;;;;;;;;CAUpD,CAAC;AAMF,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;CAcpD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;CAgBhD,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;CAAuC,CAAC;AACpF,eAAO,MAAM,kCAAkC,QAAY,CAAC;AAE5D,wBAAsB,6BAA6B,CAAC,EAClD,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CAaxB;AAED,wBAAsB,2BAA2B,CAAC,EAChD,QAAQ,EACR,SAA8C,EAC9C,OAAkD,GACnD,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAMhC;AAED,wBAAsB,6BAA6B,CAAC,EAClD,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,YAAY,CAAC,CAOxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { PROTOCOL_V2_DEVICE_INFO_REQUEST, PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS, PROTOCOL_V2_DEVICE_STATUS_GET_MESSAGE_TYPE, PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST, PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST, getProtocolV2RuntimeMode, getProtocolV2SeState, getProtocolV2SeType, parseProtocolV2BuildFingerprint, requestProtocolV2ProtocolInfo, supportsProtocolV2Message, } from './features';
|
|
2
|
-
export type { ProtocolV2BuildFingerprint, ProtocolV2DeviceInfo, ProtocolV2FirmwareImageInfo, ProtocolV2SEInfo, ProtocolV2SeStateLabel, ProtocolV2RuntimeMode, } from './features';
|
|
1
|
+
export { PROTOCOL_V2_DEVICE_INFO_REQUEST, PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS, PROTOCOL_V2_DEVICE_STATUS_GET_MESSAGE_TYPE, PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST, PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST, getProtocolV2RuntimeMode, getProtocolV2SeState, getProtocolV2SeType, isLegacyProtocolV2ProtocolInfo, parseProtocolV2BuildFingerprint, requestProtocolV2ProtocolInfo, supportsProtocolV2Message, } from './features';
|
|
2
|
+
export type { ProtocolV2BuildFingerprint, ProtocolV2DeviceInfo, ProtocolV2FirmwareImageInfo, ProtocolV2SEInfo, ProtocolV2SeStateLabel, ProtocolV2RuntimeMode, ProtocolV2ProtocolInfo, } from './features';
|
|
3
3
|
export * from './firmware';
|
|
4
4
|
export * from './walletSession';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,0CAA0C,EAC1C,wCAAwC,EACxC,wCAAwC,EACxC,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,0CAA0C,EAC1C,wCAAwC,EACxC,wCAAwC,EACxC,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC9B,+BAA+B,EAC/B,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topLevelInject.d.ts","sourceRoot":"","sources":["../src/topLevelInject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topLevelInject.d.ts","sourceRoot":"","sources":["../src/topLevelInject.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACvB;AAID,eAAO,MAAM,cAAc,eAqD1B,CAAC"}
|
|
@@ -7,6 +7,7 @@ export type GetDeviceStateParams = CommonParams & {
|
|
|
7
7
|
export type DeviceStateReadOptions = {
|
|
8
8
|
refreshSections?: DeviceStateSection[];
|
|
9
9
|
includeRaw?: boolean;
|
|
10
|
+
allowLegacyProtocolV2ProtocolInfo?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare function getDeviceState(connectId?: string, params?: GetDeviceStateParams): Response<DeviceState>;
|
|
12
13
|
//# sourceMappingURL=getDeviceState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDeviceState.d.ts","sourceRoot":"","sources":["../../../src/types/api/getDeviceState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG;IAChD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"getDeviceState.d.ts","sourceRoot":"","sources":["../../../src/types/api/getDeviceState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnE,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG;IAChD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,iCAAiC,CAAC,EAAE,OAAO,CAAC;CAC7C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,oBAAoB,GAC5B,QAAQ,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridgeBinaryPayload.d.ts","sourceRoot":"","sources":["../../src/utils/bridgeBinaryPayload.ts"],"names":[],"mappings":"AAkIA,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEhF;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.102",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
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.2.0-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.102",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.102",
|
|
30
30
|
"axios": "1.15.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/w3c-web-usb": "^1.0.10",
|
|
45
45
|
"@types/web-bluetooth": "^0.0.21"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "49f939a3fa496be9bd6763737a98b3ade81a2a45"
|
|
48
48
|
}
|