@onekeyfe/hd-transport 1.2.0-alpha.21 → 1.2.0-alpha.23
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__/messages.test.js +24 -3
- package/__tests__/protocol-v2-link-manager.test.js +27 -9
- package/__tests__/protocol-v2.test.js +226 -28
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +81 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -58
- package/dist/protocols/index.d.ts +5 -1
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/decode.d.ts +11 -0
- package/dist/protocols/v2/decode.d.ts.map +1 -1
- package/dist/protocols/v2/errors.d.ts +8 -0
- package/dist/protocols/v2/errors.d.ts.map +1 -0
- package/dist/protocols/v2/frame-assembler.d.ts.map +1 -1
- package/dist/protocols/v2/index.d.ts +1 -0
- package/dist/protocols/v2/index.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +4 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +21 -2
- package/dist/types/messages.d.ts.map +1 -1
- package/messages-protocol-v2.json +35 -1
- package/package.json +2 -2
- package/scripts/protobuf-types.js +7 -1
- package/src/constants.ts +8 -0
- package/src/protocols/index.ts +11 -2
- package/src/protocols/v2/decode.ts +49 -12
- package/src/protocols/v2/errors.ts +23 -0
- package/src/protocols/v2/frame-assembler.ts +6 -4
- package/src/protocols/v2/index.ts +1 -0
- package/src/protocols/v2/session.ts +125 -68
- package/src/types/messages.ts +25 -2
package/dist/index.js
CHANGED
|
@@ -277,6 +277,7 @@ const PROTOCOL_V2_CHANNEL_USB = 0;
|
|
|
277
277
|
const PROTOCOL_V2_CHANNEL_BLE_UART = 1;
|
|
278
278
|
const PROTOCOL_V2_CHANNEL_SOCKET = 2;
|
|
279
279
|
const PROTOCOL_V2_PACKET_SRC_COMMAND = 0;
|
|
280
|
+
const PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS = 5 * 60 * 1000;
|
|
280
281
|
|
|
281
282
|
function encodeEnvelope(data, options) {
|
|
282
283
|
const { addTrezorHeaders, chunked, messageTypeId } = options;
|
|
@@ -450,7 +451,7 @@ function encodeProtobufFrame(messageTypeId, pbPayload, packetSrc, router, seq) {
|
|
|
450
451
|
return encodeFrame(payload, packetSrc, router, seq);
|
|
451
452
|
}
|
|
452
453
|
|
|
453
|
-
function
|
|
454
|
+
function inspectFrameHeader(data) {
|
|
454
455
|
if (data.length < PROTO_HEAD_CRC_SIZE) {
|
|
455
456
|
throw new Error(`Protocol V2 frame too short: ${data.length} bytes`);
|
|
456
457
|
}
|
|
@@ -458,8 +459,8 @@ function validateFrame(data) {
|
|
|
458
459
|
throw new Error(`Invalid SOF byte: expected 0x5A, got 0x${data[0].toString(16).padStart(2, '0')}`);
|
|
459
460
|
}
|
|
460
461
|
const frameLen = data[1] + data[2] * 256;
|
|
461
|
-
if (data.length
|
|
462
|
-
throw new Error(`
|
|
462
|
+
if (data.length !== frameLen) {
|
|
463
|
+
throw new Error(`Protocol V2 frame length mismatch: expected ${frameLen} bytes, got ${data.length}`);
|
|
463
464
|
}
|
|
464
465
|
const expectedHeaderCrc = crc8(data, 3);
|
|
465
466
|
if (data[3] !== expectedHeaderCrc) {
|
|
@@ -473,29 +474,53 @@ function validateFrame(data) {
|
|
|
473
474
|
.toString(16)
|
|
474
475
|
.padStart(2, '0')}, got 0x${data[frameLen - 1].toString(16).padStart(2, '0')}`);
|
|
475
476
|
}
|
|
476
|
-
|
|
477
|
+
const dataType = data[5] & 0x03;
|
|
478
|
+
const packetSrc = (data[5] >> 2) & 0x0f;
|
|
479
|
+
const seq = data[6];
|
|
480
|
+
if (seq === 0) {
|
|
481
|
+
throw new Error('Invalid Protocol V2 sequence: 0 is reserved');
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
frameLen,
|
|
485
|
+
router: data[4],
|
|
486
|
+
packetSrc,
|
|
487
|
+
dataType,
|
|
488
|
+
seq,
|
|
489
|
+
};
|
|
477
490
|
}
|
|
478
491
|
function isAckFrame(data) {
|
|
479
492
|
if (data.length < 6 || (data[5] & 0x03) !== PROTO_DATA_TYPE_ACK) {
|
|
480
493
|
return false;
|
|
481
494
|
}
|
|
482
|
-
const
|
|
483
|
-
if (frameLen !== PROTO_HEAD_CRC_SIZE) {
|
|
484
|
-
throw new Error(`Invalid Protocol V2 ACK frame length: ${frameLen}`);
|
|
495
|
+
const header = inspectFrameHeader(data);
|
|
496
|
+
if (header.frameLen !== PROTO_HEAD_CRC_SIZE) {
|
|
497
|
+
throw new Error(`Invalid Protocol V2 ACK frame length: ${header.frameLen}`);
|
|
485
498
|
}
|
|
486
499
|
return true;
|
|
487
500
|
}
|
|
488
501
|
function decodeFrame(data) {
|
|
489
|
-
const frameLen =
|
|
490
|
-
|
|
502
|
+
const { frameLen, router, packetSrc, dataType, seq } = inspectFrameHeader(data);
|
|
503
|
+
if (dataType !== PROTO_DATA_TYPE_PACKET) {
|
|
504
|
+
throw new Error(`Invalid Protocol V2 data type: expected packet, got ${dataType}`);
|
|
505
|
+
}
|
|
491
506
|
const payloadData = data.slice(7, frameLen - 1);
|
|
492
507
|
if (payloadData.length < 2) {
|
|
493
508
|
throw new Error(`Protocol V2 payload too short (need >=2 bytes for messageTypeId)`);
|
|
494
509
|
}
|
|
495
510
|
const messageTypeId = payloadData[0] + payloadData[1] * 256;
|
|
496
511
|
const pbPayload = payloadData.slice(2);
|
|
497
|
-
return { messageTypeId, pbPayload, seq };
|
|
512
|
+
return { messageTypeId, pbPayload, seq, router, packetSrc, dataType };
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
class ProtocolV2LinkError extends Error {
|
|
516
|
+
constructor(code, message, cause) {
|
|
517
|
+
super(message);
|
|
518
|
+
this.name = 'ProtocolV2LinkError';
|
|
519
|
+
this.code = code;
|
|
520
|
+
this.cause = cause;
|
|
521
|
+
}
|
|
498
522
|
}
|
|
523
|
+
const isProtocolV2LinkError = (error) => error instanceof ProtocolV2LinkError;
|
|
499
524
|
|
|
500
525
|
function concatUint8Arrays(arrays) {
|
|
501
526
|
const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
|
|
@@ -540,23 +565,23 @@ class ProtocolV2FrameAssembler {
|
|
|
540
565
|
return undefined;
|
|
541
566
|
if (this.buffer[0] !== PROTO_HEAD_SOF) {
|
|
542
567
|
this.reset();
|
|
543
|
-
throw new
|
|
568
|
+
throw new ProtocolV2LinkError('frame', 'Invalid Protocol V2 SOF');
|
|
544
569
|
}
|
|
545
570
|
const expectedLen = this.buffer[1] + this.buffer[2] * 256;
|
|
546
571
|
if (expectedLen < PROTO_HEAD_CRC_SIZE) {
|
|
547
572
|
this.reset();
|
|
548
|
-
throw new
|
|
573
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 frame length too small: ${expectedLen}`);
|
|
549
574
|
}
|
|
550
575
|
if (expectedLen > this.maxFrameBytes) {
|
|
551
576
|
this.reset();
|
|
552
|
-
throw new
|
|
577
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 frame too large: ${expectedLen}`);
|
|
553
578
|
}
|
|
554
579
|
if (this.buffer.length < PROTO_PRE_HEAD_SIZE)
|
|
555
580
|
return undefined;
|
|
556
581
|
const expectedHeaderCrc = crc8(this.buffer, 3);
|
|
557
582
|
if (this.buffer[3] !== expectedHeaderCrc) {
|
|
558
583
|
this.reset();
|
|
559
|
-
throw new
|
|
584
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 header CRC mismatch: expected 0x${expectedHeaderCrc
|
|
560
585
|
.toString(16)
|
|
561
586
|
.padStart(2, '0')}`);
|
|
562
587
|
}
|
|
@@ -582,8 +607,11 @@ var protocolV2Codec = /*#__PURE__*/Object.freeze({
|
|
|
582
607
|
nextProtoSeq: nextProtoSeq,
|
|
583
608
|
encodeFrame: encodeFrame,
|
|
584
609
|
encodeProtobufFrame: encodeProtobufFrame,
|
|
610
|
+
inspectFrameHeader: inspectFrameHeader,
|
|
585
611
|
isAckFrame: isAckFrame,
|
|
586
612
|
decodeFrame: decodeFrame,
|
|
613
|
+
ProtocolV2LinkError: ProtocolV2LinkError,
|
|
614
|
+
isProtocolV2LinkError: isProtocolV2LinkError,
|
|
587
615
|
concatUint8Arrays: concatUint8Arrays,
|
|
588
616
|
ProtocolV2FrameAssembler: ProtocolV2FrameAssembler
|
|
589
617
|
});
|
|
@@ -634,14 +662,18 @@ const ProtocolV1 = {
|
|
|
634
662
|
};
|
|
635
663
|
const ProtocolV2 = {
|
|
636
664
|
isAckFrame,
|
|
665
|
+
inspectFrameHeader,
|
|
637
666
|
inspectFrame(schemas, frame) {
|
|
638
|
-
const { messageTypeId, pbPayload, seq } = decodeFrame(frame);
|
|
667
|
+
const { messageTypeId, pbPayload, seq, router, packetSrc, dataType } = decodeFrame(frame);
|
|
639
668
|
const { messageName } = createProtocolV2MessageFromType(messageTypeId, schemas);
|
|
640
669
|
return {
|
|
641
670
|
messageName,
|
|
642
671
|
messageTypeId,
|
|
643
672
|
pbPayload,
|
|
644
673
|
seq,
|
|
674
|
+
router,
|
|
675
|
+
packetSrc,
|
|
676
|
+
dataType,
|
|
645
677
|
type: messageName,
|
|
646
678
|
};
|
|
647
679
|
},
|
|
@@ -851,11 +883,12 @@ function getErrorMessage(error) {
|
|
|
851
883
|
}
|
|
852
884
|
return String(error);
|
|
853
885
|
}
|
|
854
|
-
function withProtocolTimeout(promise, timeoutMs, createTimeoutError, onTimeout) {
|
|
886
|
+
function withProtocolTimeout(promise, timeoutMs, createTimeoutError, onTimeout, abortSignal) {
|
|
855
887
|
return __awaiter(this, void 0, void 0, function* () {
|
|
856
888
|
if (!timeoutMs)
|
|
857
889
|
return promise;
|
|
858
890
|
let timer;
|
|
891
|
+
let abortHandler;
|
|
859
892
|
try {
|
|
860
893
|
return yield Promise.race([
|
|
861
894
|
promise,
|
|
@@ -865,11 +898,29 @@ function withProtocolTimeout(promise, timeoutMs, createTimeoutError, onTimeout)
|
|
|
865
898
|
reject(createTimeoutError());
|
|
866
899
|
}, timeoutMs);
|
|
867
900
|
}),
|
|
901
|
+
...(abortSignal
|
|
902
|
+
? [
|
|
903
|
+
new Promise((_, reject) => {
|
|
904
|
+
abortHandler = () => {
|
|
905
|
+
reject(new Error('Protocol V2 operation aborted'));
|
|
906
|
+
};
|
|
907
|
+
if (abortSignal.aborted) {
|
|
908
|
+
abortHandler();
|
|
909
|
+
}
|
|
910
|
+
else {
|
|
911
|
+
abortSignal.addEventListener('abort', abortHandler, { once: true });
|
|
912
|
+
}
|
|
913
|
+
}),
|
|
914
|
+
]
|
|
915
|
+
: []),
|
|
868
916
|
]);
|
|
869
917
|
}
|
|
870
918
|
finally {
|
|
871
919
|
if (timer)
|
|
872
920
|
clearTimeout(timer);
|
|
921
|
+
if (abortHandler) {
|
|
922
|
+
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', abortHandler);
|
|
923
|
+
}
|
|
873
924
|
}
|
|
874
925
|
});
|
|
875
926
|
}
|
|
@@ -887,16 +938,22 @@ class ProtocolV2Session {
|
|
|
887
938
|
return result;
|
|
888
939
|
}
|
|
889
940
|
executeCall(name, data, callOptions) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
941
|
+
const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, prepareCall, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', createTimeoutError, generation = 0, } = this.options;
|
|
942
|
+
const timeoutMs = callOptions.timeoutMs && callOptions.timeoutMs > 0
|
|
943
|
+
? callOptions.timeoutMs
|
|
944
|
+
: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
|
|
945
|
+
const abortController = new AbortController();
|
|
946
|
+
const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
|
|
947
|
+
const baseCallContext = {
|
|
948
|
+
messageName: name,
|
|
949
|
+
timeoutMs,
|
|
950
|
+
highVolume: shouldReduceDebug,
|
|
951
|
+
generation,
|
|
952
|
+
signal: abortController.signal,
|
|
953
|
+
};
|
|
954
|
+
const runCall = () => __awaiter(this, void 0, void 0, function* () {
|
|
955
|
+
var _a, _b, _c, _d;
|
|
956
|
+
yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
|
|
900
957
|
const protoSeq = this.sequenceCursor.next();
|
|
901
958
|
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
902
959
|
packetSrc,
|
|
@@ -906,40 +963,66 @@ class ProtocolV2Session {
|
|
|
906
963
|
if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
|
|
907
964
|
throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
|
|
908
965
|
}
|
|
909
|
-
yield writeFrame(frame,
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
966
|
+
yield writeFrame(frame, baseCallContext);
|
|
967
|
+
while (!abortController.signal.aborted) {
|
|
968
|
+
const rxFrame = yield readFrame(baseCallContext);
|
|
969
|
+
if (abortController.signal.aborted)
|
|
970
|
+
break;
|
|
971
|
+
let header;
|
|
972
|
+
try {
|
|
973
|
+
header = ProtocolV2.inspectFrameHeader(rxFrame);
|
|
974
|
+
}
|
|
975
|
+
catch (cause) {
|
|
976
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 frame validation failed: ${getErrorMessage(cause)}`, cause);
|
|
977
|
+
}
|
|
978
|
+
if (header.router !== router) {
|
|
979
|
+
throw new ProtocolV2LinkError('router', `Protocol V2 router mismatch: expected ${router}, got ${header.router}`);
|
|
980
|
+
}
|
|
981
|
+
if (header.packetSrc !== packetSrc) {
|
|
982
|
+
throw new ProtocolV2LinkError('packet-source', `Protocol V2 packet source mismatch: expected ${packetSrc}, got ${header.packetSrc}`);
|
|
983
|
+
}
|
|
984
|
+
let isAck;
|
|
985
|
+
try {
|
|
986
|
+
isAck = ProtocolV2.isAckFrame(rxFrame);
|
|
987
|
+
}
|
|
988
|
+
catch (cause) {
|
|
989
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 ACK validation failed: ${getErrorMessage(cause)}`, cause);
|
|
990
|
+
}
|
|
991
|
+
if (isAck) {
|
|
992
|
+
if (header.seq !== protoSeq) {
|
|
993
|
+
throw new ProtocolV2LinkError('ack-sequence', `Protocol V2 ACK sequence mismatch: expected ${protoSeq}, got ${header.seq}`);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
let decoded;
|
|
998
|
+
try {
|
|
999
|
+
decoded = ProtocolV2.decodeFrame(schemas, rxFrame);
|
|
1000
|
+
}
|
|
1001
|
+
catch (cause) {
|
|
1002
|
+
throw new ProtocolV2LinkError('frame', `Protocol V2 frame decode failed: ${getErrorMessage(cause)}`, cause);
|
|
1003
|
+
}
|
|
1004
|
+
if (this.lastResponseSequence === decoded.seq) {
|
|
1005
|
+
throw new ProtocolV2LinkError('response-sequence', `Protocol V2 duplicate response sequence: ${decoded.seq}`);
|
|
1006
|
+
}
|
|
1007
|
+
this.lastResponseSequence = decoded.seq;
|
|
1008
|
+
const response = call(decoded);
|
|
1009
|
+
if ((_a = callOptions.intermediateTypes) === null || _a === void 0 ? void 0 : _a.includes(response.type)) {
|
|
1010
|
+
(_b = callOptions.onIntermediateResponse) === null || _b === void 0 ? void 0 : _b.call(callOptions, response);
|
|
917
1011
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
(_b = callOptions.onIntermediateResponse) === null || _b === void 0 ? void 0 : _b.call(callOptions, response);
|
|
924
|
-
}
|
|
925
|
-
else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
926
|
-
return response;
|
|
927
|
-
}
|
|
928
|
-
else if (!shouldReduceDebug) {
|
|
929
|
-
(_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_d = callOptions.expectedTypes) === null || _d === void 0 ? void 0 : _d.join('|')} got=${response.type}`);
|
|
930
|
-
}
|
|
1012
|
+
else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
1013
|
+
return response;
|
|
1014
|
+
}
|
|
1015
|
+
else if (!shouldReduceDebug) {
|
|
1016
|
+
(_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_d = callOptions.expectedTypes) === null || _d === void 0 ? void 0 : _d.join('|')} got=${response.type}`);
|
|
931
1017
|
}
|
|
932
1018
|
}
|
|
933
|
-
|
|
934
|
-
});
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}, () => {
|
|
941
|
-
cancellation.cancelled = true;
|
|
942
|
-
});
|
|
1019
|
+
}
|
|
1020
|
+
throw new Error(`Protocol V2 read loop cancelled after timeout for ${name}`);
|
|
1021
|
+
});
|
|
1022
|
+
return withProtocolTimeout(runCall(), timeoutMs, () => createTimeoutError
|
|
1023
|
+
? createTimeoutError(name, timeoutMs)
|
|
1024
|
+
: new Error(`Protocol V2 response timeout after ${timeoutMs}ms for ${name}`), () => {
|
|
1025
|
+
abortController.abort();
|
|
943
1026
|
});
|
|
944
1027
|
}
|
|
945
1028
|
}
|
|
@@ -949,7 +1032,10 @@ function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', on
|
|
|
949
1032
|
let probeError;
|
|
950
1033
|
try {
|
|
951
1034
|
yield (onBeforeProbe === null || onBeforeProbe === void 0 ? void 0 : onBeforeProbe());
|
|
952
|
-
const response = yield call('Ping', { message: 'protocol-v2-probe' }, {
|
|
1035
|
+
const response = yield call('Ping', { message: 'protocol-v2-probe' }, {
|
|
1036
|
+
timeoutMs,
|
|
1037
|
+
expectedTypes: ['Success'],
|
|
1038
|
+
});
|
|
953
1039
|
if (response.type === 'Success') {
|
|
954
1040
|
return true;
|
|
955
1041
|
}
|
|
@@ -1772,6 +1858,21 @@ exports.DeviceSEState = void 0;
|
|
|
1772
1858
|
DeviceSEState[DeviceSEState["APP_FACTORY"] = 51] = "APP_FACTORY";
|
|
1773
1859
|
DeviceSEState[DeviceSEState["APP"] = 85] = "APP";
|
|
1774
1860
|
})(exports.DeviceSEState || (exports.DeviceSEState = {}));
|
|
1861
|
+
exports.DeviceSessionErrorCode = void 0;
|
|
1862
|
+
(function (DeviceSessionErrorCode) {
|
|
1863
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_None"] = 0] = "DeviceSessionError_None";
|
|
1864
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_UserCancelled"] = 1] = "DeviceSessionError_UserCancelled";
|
|
1865
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_InvalidSession"] = 2] = "DeviceSessionError_InvalidSession";
|
|
1866
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_AttachPinUnavailable"] = 3] = "DeviceSessionError_AttachPinUnavailable";
|
|
1867
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_PassphraseDisabled"] = 4] = "DeviceSessionError_PassphraseDisabled";
|
|
1868
|
+
DeviceSessionErrorCode[DeviceSessionErrorCode["DeviceSessionError_Busy"] = 5] = "DeviceSessionError_Busy";
|
|
1869
|
+
})(exports.DeviceSessionErrorCode || (exports.DeviceSessionErrorCode = {}));
|
|
1870
|
+
exports.DeviceSessionPinType = void 0;
|
|
1871
|
+
(function (DeviceSessionPinType) {
|
|
1872
|
+
DeviceSessionPinType[DeviceSessionPinType["Any"] = 1] = "Any";
|
|
1873
|
+
DeviceSessionPinType[DeviceSessionPinType["Main"] = 2] = "Main";
|
|
1874
|
+
DeviceSessionPinType[DeviceSessionPinType["AttachToPin"] = 3] = "AttachToPin";
|
|
1875
|
+
})(exports.DeviceSessionPinType || (exports.DeviceSessionPinType = {}));
|
|
1775
1876
|
exports.DeviceSessionAskPin_FailureSubCodes = void 0;
|
|
1776
1877
|
(function (DeviceSessionAskPin_FailureSubCodes) {
|
|
1777
1878
|
DeviceSessionAskPin_FailureSubCodes[DeviceSessionAskPin_FailureSubCodes["UserCancel"] = 1] = "UserCancel";
|
|
@@ -1924,6 +2025,8 @@ var messages = /*#__PURE__*/Object.freeze({
|
|
|
1924
2025
|
get DeviceType () { return exports.DeviceType; },
|
|
1925
2026
|
get DeviceSeType () { return exports.DeviceSeType; },
|
|
1926
2027
|
get DeviceSEState () { return exports.DeviceSEState; },
|
|
2028
|
+
get DeviceSessionErrorCode () { return exports.DeviceSessionErrorCode; },
|
|
2029
|
+
get DeviceSessionPinType () { return exports.DeviceSessionPinType; },
|
|
1927
2030
|
get DeviceSessionAskPin_FailureSubCodes () { return exports.DeviceSessionAskPin_FailureSubCodes; },
|
|
1928
2031
|
get DevOnboardingStep () { return exports.DevOnboardingStep; },
|
|
1929
2032
|
get DevOnboardingPhase () { return exports.DevOnboardingPhase; },
|
|
@@ -1973,6 +2076,7 @@ exports.PROTOCOL_V2_BLE_FRAME_MAX_BYTES = PROTOCOL_V2_BLE_FRAME_MAX_BYTES;
|
|
|
1973
2076
|
exports.PROTOCOL_V2_CHANNEL_BLE_UART = PROTOCOL_V2_CHANNEL_BLE_UART;
|
|
1974
2077
|
exports.PROTOCOL_V2_CHANNEL_SOCKET = PROTOCOL_V2_CHANNEL_SOCKET;
|
|
1975
2078
|
exports.PROTOCOL_V2_CHANNEL_USB = PROTOCOL_V2_CHANNEL_USB;
|
|
2079
|
+
exports.PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS = PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
|
|
1976
2080
|
exports.PROTOCOL_V2_FILE_CHUNK_SIZE = PROTOCOL_V2_FILE_CHUNK_SIZE;
|
|
1977
2081
|
exports.PROTOCOL_V2_FRAME_MAX_BYTES = PROTOCOL_V2_FRAME_MAX_BYTES;
|
|
1978
2082
|
exports.PROTOCOL_V2_PACKET_SRC_COMMAND = PROTOCOL_V2_PACKET_SRC_COMMAND;
|
|
@@ -1981,6 +2085,7 @@ exports.PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE = PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
|
|
|
1981
2085
|
exports.ProtocolV1 = ProtocolV1;
|
|
1982
2086
|
exports.ProtocolV2 = ProtocolV2;
|
|
1983
2087
|
exports.ProtocolV2FrameAssembler = ProtocolV2FrameAssembler;
|
|
2088
|
+
exports.ProtocolV2LinkError = ProtocolV2LinkError;
|
|
1984
2089
|
exports.ProtocolV2LinkManager = ProtocolV2LinkManager;
|
|
1985
2090
|
exports.ProtocolV2SequenceCursor = ProtocolV2SequenceCursor;
|
|
1986
2091
|
exports.ProtocolV2Session = ProtocolV2Session;
|
|
@@ -1990,6 +2095,7 @@ exports.concatUint8Arrays = concatUint8Arrays;
|
|
|
1990
2095
|
exports["default"] = index;
|
|
1991
2096
|
exports.getErrorMessage = getErrorMessage;
|
|
1992
2097
|
exports.hexToBytes = hexToBytes;
|
|
2098
|
+
exports.isProtocolV2LinkError = isProtocolV2LinkError;
|
|
1993
2099
|
exports.probeProtocolV2 = probeProtocolV2;
|
|
1994
2100
|
exports.protocolV1 = index$1;
|
|
1995
2101
|
exports.protocolV2 = protocolV2Codec;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import ByteBuffer from 'bytebuffer';
|
|
3
3
|
import { encodeEnvelopeMessage } from './v1/packets';
|
|
4
4
|
import { decodeMessage as decodeV1Message } from './v1/receive';
|
|
5
|
-
import { isAckFrame } from './v2';
|
|
5
|
+
import { inspectFrameHeader, isAckFrame } from './v2';
|
|
6
6
|
import type { Root } from 'protobufjs/light';
|
|
7
7
|
export declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
8
8
|
type ProtocolV2Schemas = {
|
|
@@ -27,11 +27,15 @@ export declare const ProtocolV1: {
|
|
|
27
27
|
};
|
|
28
28
|
export declare const ProtocolV2: {
|
|
29
29
|
isAckFrame: typeof isAckFrame;
|
|
30
|
+
inspectFrameHeader: typeof inspectFrameHeader;
|
|
30
31
|
inspectFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
31
32
|
messageName: string;
|
|
32
33
|
messageTypeId: number;
|
|
33
34
|
pbPayload: Uint8Array;
|
|
34
35
|
seq: number;
|
|
36
|
+
router: number;
|
|
37
|
+
packetSrc: number;
|
|
38
|
+
dataType: number;
|
|
35
39
|
type: string;
|
|
36
40
|
};
|
|
37
41
|
encodeFrame(schemas: ProtocolV2Schemas, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,EAGL,kBAAkB,EAClB,UAAU,EACX,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAsCF,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAC;AAEF,eAAO,MAAM,UAAU;;;0BAIC,iBAAiB,SAAS,UAAU;;;;;;;;;;yBAgB/C,iBAAiB,QACpB,MAAM,QACN,OAAO,MAAM,EAAE,OAAO,CAAC,YACpB,sBAAsB;yBAkBZ,iBAAiB,SAAS,UAAU;;;;;;;;;;CA0B1D,CAAC"}
|
|
@@ -2,7 +2,18 @@ export interface ProtoV2Frame {
|
|
|
2
2
|
messageTypeId: number;
|
|
3
3
|
pbPayload: Uint8Array;
|
|
4
4
|
seq: number;
|
|
5
|
+
router: number;
|
|
6
|
+
packetSrc: number;
|
|
7
|
+
dataType: number;
|
|
5
8
|
}
|
|
9
|
+
export type ProtoV2FrameHeader = {
|
|
10
|
+
frameLen: number;
|
|
11
|
+
router: number;
|
|
12
|
+
packetSrc: number;
|
|
13
|
+
dataType: number;
|
|
14
|
+
seq: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function inspectFrameHeader(data: Uint8Array): ProtoV2FrameHeader;
|
|
6
17
|
export declare function isAckFrame(data: Uint8Array): boolean;
|
|
7
18
|
export declare function decodeFrame(data: Uint8Array): ProtoV2Frame;
|
|
8
19
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAE3B,aAAa,EAAE,MAAM,CAAC;IAEtB,SAAS,EAAE,UAAU,CAAC;IAEtB,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,CAqDvE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWpD;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAgB1D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ProtocolV2LinkErrorCode = 'response-timeout' | 'router' | 'packet-source' | 'ack-sequence' | 'response-sequence' | 'frame';
|
|
2
|
+
export declare class ProtocolV2LinkError extends Error {
|
|
3
|
+
readonly code: ProtocolV2LinkErrorCode;
|
|
4
|
+
readonly cause?: unknown;
|
|
5
|
+
constructor(code: ProtocolV2LinkErrorCode, message: string, cause?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare const isProtocolV2LinkError: (error: unknown) => error is ProtocolV2LinkError;
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,QAAQ,GACR,eAAe,GACf,cAAc,GACd,mBAAmB,GACnB,OAAO,CAAC;AAEZ,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IAEvC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEb,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM5E;AAED,eAAO,MAAM,qBAAqB,UAAW,OAAO,iCACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-assembler.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/frame-assembler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frame-assembler.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/frame-assembler.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CASlE;AAED,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAqB;IAEnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,aAAa,SAA8B;IAIvD,KAAK;IAIL,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS;IAU/C,KAAK,CAAC,KAAK,GAAE,UAA8B,GAAG,UAAU,EAAE;IAW1D,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,YAAY;CA2CrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { ProtocolV2FrameAssembler, concatUint8Arrays } from './frame-assembler';
|
|
|
2
2
|
import { ProtocolV2SequenceCursor } from './sequence-cursor';
|
|
3
3
|
import type { Root } from 'protobufjs/light';
|
|
4
4
|
import type { MessageFromOneKey } from '../../types';
|
|
5
|
+
export * from './errors';
|
|
5
6
|
export type ProtocolV2Schemas = {
|
|
6
7
|
protocolV1: Root;
|
|
7
8
|
protocolV2: Root;
|
|
@@ -11,6 +12,7 @@ export type ProtocolV2CallContext = {
|
|
|
11
12
|
timeoutMs?: number;
|
|
12
13
|
highVolume: boolean;
|
|
13
14
|
generation: number;
|
|
15
|
+
signal: AbortSignal;
|
|
14
16
|
};
|
|
15
17
|
type ProtocolLogger = {
|
|
16
18
|
debug?: (...args: any[]) => void;
|
|
@@ -41,11 +43,12 @@ export { ProtocolV2SequenceCursor };
|
|
|
41
43
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
42
44
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
43
45
|
export declare function getErrorMessage(error: unknown): string;
|
|
44
|
-
export declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void): Promise<T>;
|
|
46
|
+
export declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void, abortSignal?: AbortSignal): Promise<T>;
|
|
45
47
|
export declare class ProtocolV2Session {
|
|
46
48
|
private readonly options;
|
|
47
49
|
private readonly sequenceCursor;
|
|
48
50
|
private pendingCall;
|
|
51
|
+
private lastResponseSequence?;
|
|
49
52
|
constructor(options: ProtocolV2SessionOptions);
|
|
50
53
|
call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
|
|
51
54
|
private executeCall;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"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"}
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -3551,7 +3551,9 @@ export type ViewVerifyPage = {
|
|
|
3551
3551
|
derive_type?: string;
|
|
3552
3552
|
value_key?: number;
|
|
3553
3553
|
};
|
|
3554
|
-
export type ProtocolInfoRequest = {
|
|
3554
|
+
export type ProtocolInfoRequest = {
|
|
3555
|
+
eventless_wallet_session?: boolean;
|
|
3556
|
+
};
|
|
3555
3557
|
export type ProtocolInfo = {
|
|
3556
3558
|
version: number;
|
|
3557
3559
|
supported_messages: number[];
|
|
@@ -3782,6 +3784,14 @@ export type ProtocolV2DeviceInfo = {
|
|
|
3782
3784
|
se4?: DeviceSEInfo;
|
|
3783
3785
|
status?: DeviceStatus;
|
|
3784
3786
|
};
|
|
3787
|
+
export declare enum DeviceSessionErrorCode {
|
|
3788
|
+
DeviceSessionError_None = 0,
|
|
3789
|
+
DeviceSessionError_UserCancelled = 1,
|
|
3790
|
+
DeviceSessionError_InvalidSession = 2,
|
|
3791
|
+
DeviceSessionError_AttachPinUnavailable = 3,
|
|
3792
|
+
DeviceSessionError_PassphraseDisabled = 4,
|
|
3793
|
+
DeviceSessionError_Busy = 5
|
|
3794
|
+
}
|
|
3785
3795
|
export type DeviceSessionGet = {
|
|
3786
3796
|
session_id?: string;
|
|
3787
3797
|
};
|
|
@@ -3789,7 +3799,15 @@ export type DeviceSession = {
|
|
|
3789
3799
|
session_id?: string;
|
|
3790
3800
|
btc_test_address?: string;
|
|
3791
3801
|
};
|
|
3792
|
-
export
|
|
3802
|
+
export declare enum DeviceSessionPinType {
|
|
3803
|
+
Any = 1,
|
|
3804
|
+
Main = 2,
|
|
3805
|
+
AttachToPin = 3
|
|
3806
|
+
}
|
|
3807
|
+
export type DeviceSessionAskPin = {
|
|
3808
|
+
type?: DeviceSessionPinType;
|
|
3809
|
+
};
|
|
3810
|
+
export type DeviceSessionAskPassphrase = {};
|
|
3793
3811
|
export declare enum DeviceSessionAskPin_FailureSubCodes {
|
|
3794
3812
|
UserCancel = 1
|
|
3795
3813
|
}
|
|
@@ -4567,6 +4585,7 @@ export type MessageType = {
|
|
|
4567
4585
|
DeviceSessionGet: DeviceSessionGet;
|
|
4568
4586
|
DeviceSession: DeviceSession;
|
|
4569
4587
|
DeviceSessionAskPin: DeviceSessionAskPin;
|
|
4588
|
+
DeviceSessionAskPassphrase: DeviceSessionAskPassphrase;
|
|
4570
4589
|
DeviceStatus: DeviceStatus;
|
|
4571
4590
|
DeviceStatusGet: DeviceStatusGet;
|
|
4572
4591
|
DevOnboardingSetupStatus: DevOnboardingSetupStatus;
|