@onekeyfe/hd-transport 1.2.0-alpha.11 → 1.2.0-alpha.13
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 +21 -9
- package/__tests__/protocol-v2.test.js +100 -27
- package/dist/index.d.ts +83 -47
- package/dist/index.js +82 -174
- package/dist/protocols/index.d.ts +8 -5
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/decode.d.ts +1 -2
- package/dist/protocols/v2/decode.d.ts.map +1 -1
- package/dist/protocols/v2/encode.d.ts +2 -3
- package/dist/protocols/v2/encode.d.ts.map +1 -1
- package/dist/protocols/v2/index.d.ts +0 -1
- package/dist/protocols/v2/index.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/types/messages.d.ts +49 -7
- package/dist/types/messages.d.ts.map +1 -1
- package/messages-protocol-v2.json +422 -16
- package/package.json +3 -3
- package/scripts/protobuf-build.sh +20 -232
- package/scripts/protobuf-types.js +9 -0
- package/src/protocols/index.ts +15 -38
- package/src/protocols/v2/decode.ts +1 -23
- package/src/protocols/v2/encode.ts +1 -27
- package/src/protocols/v2/index.ts +0 -1
- package/src/protocols/v2/session.ts +19 -147
- package/src/types/messages.ts +50 -7
- package/dist/protocols/v2/debug.d.ts +0 -13
- package/dist/protocols/v2/debug.d.ts.map +0 -1
- package/src/protocols/v2/debug.ts +0 -26
package/dist/index.js
CHANGED
|
@@ -411,16 +411,11 @@ function crc8(data, len) {
|
|
|
411
411
|
return crc;
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
function logProtocolV2Debug(options, stage, details) {
|
|
415
|
-
var _a, _b, _c;
|
|
416
|
-
(_b = (_a = options === null || options === void 0 ? void 0 : options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `[${(_c = options.logPrefix) !== null && _c !== void 0 ? _c : 'ProtocolV2'}] ${stage}`, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.context ? { context: options.context } : {})), (options.messageName ? { messageName: options.messageName } : {})), (options.messageTypeId !== undefined ? { messageTypeId: options.messageTypeId } : {})), (options.pbPayloadLength !== undefined ? { pbPayloadLength: options.pbPayloadLength } : {})), details));
|
|
417
|
-
}
|
|
418
|
-
|
|
419
414
|
const PROTO_SEQ_DEFAULT = 1;
|
|
420
415
|
function nextProtoSeq(current) {
|
|
421
416
|
return current >= 255 ? 1 : current + 1;
|
|
422
417
|
}
|
|
423
|
-
function encodeFrame(payload, packetSrc, router,
|
|
418
|
+
function encodeFrame(payload, packetSrc, router, seq) {
|
|
424
419
|
const resolvedPacketSrc = packetSrc !== null && packetSrc !== void 0 ? packetSrc : 0;
|
|
425
420
|
const resolvedRouter = router !== null && router !== void 0 ? router : 0;
|
|
426
421
|
const resolvedSeq = seq !== null && seq !== void 0 ? seq : PROTO_SEQ_DEFAULT;
|
|
@@ -445,24 +440,14 @@ function encodeFrame(payload, packetSrc, router, debugOptions, seq) {
|
|
|
445
440
|
frame.set(payload, 7);
|
|
446
441
|
}
|
|
447
442
|
frame[frameLen - 1] = crc8(frame, frameLen - 1);
|
|
448
|
-
logProtocolV2Debug(debugOptions, 'encode raw frame', {
|
|
449
|
-
frameLen,
|
|
450
|
-
payloadLen,
|
|
451
|
-
packetSrc: resolvedPacketSrc,
|
|
452
|
-
router: frame[4],
|
|
453
|
-
attr: frame[5],
|
|
454
|
-
seq: frame[6],
|
|
455
|
-
headerCrc: frame[3],
|
|
456
|
-
frameCrc: frame[frameLen - 1],
|
|
457
|
-
});
|
|
458
443
|
return frame;
|
|
459
444
|
}
|
|
460
|
-
function encodeProtobufFrame(messageTypeId, pbPayload, packetSrc, router,
|
|
445
|
+
function encodeProtobufFrame(messageTypeId, pbPayload, packetSrc, router, seq) {
|
|
461
446
|
const payload = new Uint8Array(2 + pbPayload.length);
|
|
462
447
|
payload[0] = messageTypeId % 256;
|
|
463
448
|
payload[1] = Math.floor(messageTypeId / 256) % 256;
|
|
464
449
|
payload.set(pbPayload, 2);
|
|
465
|
-
return encodeFrame(payload, packetSrc, router,
|
|
450
|
+
return encodeFrame(payload, packetSrc, router, seq);
|
|
466
451
|
}
|
|
467
452
|
|
|
468
453
|
function validateFrame(data) {
|
|
@@ -500,10 +485,8 @@ function isAckFrame(data) {
|
|
|
500
485
|
}
|
|
501
486
|
return true;
|
|
502
487
|
}
|
|
503
|
-
function decodeFrame(data
|
|
488
|
+
function decodeFrame(data) {
|
|
504
489
|
const frameLen = validateFrame(data);
|
|
505
|
-
const expectedHeaderCrc = data[3];
|
|
506
|
-
const expectedFrameCrc = data[frameLen - 1];
|
|
507
490
|
const seq = data[6];
|
|
508
491
|
const payloadData = data.slice(7, frameLen - 1);
|
|
509
492
|
if (payloadData.length < 2) {
|
|
@@ -511,19 +494,6 @@ function decodeFrame(data, debugOptions) {
|
|
|
511
494
|
}
|
|
512
495
|
const messageTypeId = payloadData[0] + payloadData[1] * 256;
|
|
513
496
|
const pbPayload = payloadData.slice(2);
|
|
514
|
-
logProtocolV2Debug(debugOptions, 'decode raw frame', {
|
|
515
|
-
frameLen,
|
|
516
|
-
dataLength: data.length,
|
|
517
|
-
router: data[4],
|
|
518
|
-
attr: data[5],
|
|
519
|
-
seq,
|
|
520
|
-
headerCrc: data[3],
|
|
521
|
-
expectedHeaderCrc,
|
|
522
|
-
frameCrc: data[frameLen - 1],
|
|
523
|
-
expectedFrameCrc,
|
|
524
|
-
messageTypeId,
|
|
525
|
-
pbPayloadLength: pbPayload.length,
|
|
526
|
-
});
|
|
527
497
|
return { messageTypeId, pbPayload, seq };
|
|
528
498
|
}
|
|
529
499
|
|
|
@@ -609,7 +579,6 @@ var protocolV2Codec = /*#__PURE__*/Object.freeze({
|
|
|
609
579
|
PROTO_DATA_TYPE_ACK: PROTO_DATA_TYPE_ACK,
|
|
610
580
|
CRC8_TABLE: CRC8_TABLE,
|
|
611
581
|
crc8: crc8,
|
|
612
|
-
logProtocolV2Debug: logProtocolV2Debug,
|
|
613
582
|
nextProtoSeq: nextProtoSeq,
|
|
614
583
|
encodeFrame: encodeFrame,
|
|
615
584
|
encodeProtobufFrame: encodeProtobufFrame,
|
|
@@ -665,46 +634,31 @@ const ProtocolV1 = {
|
|
|
665
634
|
};
|
|
666
635
|
const ProtocolV2 = {
|
|
667
636
|
isAckFrame,
|
|
637
|
+
inspectFrame(schemas, frame) {
|
|
638
|
+
const { messageTypeId, pbPayload, seq } = decodeFrame(frame);
|
|
639
|
+
const { messageName } = createProtocolV2MessageFromType(messageTypeId, schemas);
|
|
640
|
+
return {
|
|
641
|
+
messageName,
|
|
642
|
+
messageTypeId,
|
|
643
|
+
pbPayload,
|
|
644
|
+
seq,
|
|
645
|
+
type: messageName,
|
|
646
|
+
};
|
|
647
|
+
},
|
|
668
648
|
encodeFrame(schemas, name, data, options = {}) {
|
|
669
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
670
649
|
const encodeMessages = resolveProtocolV2EncodeSchema(name, schemas);
|
|
671
650
|
const { Message, messageTypeId } = createMessageFromName(encodeMessages, name);
|
|
672
651
|
const pbBuffer = encode(Message, data);
|
|
673
652
|
pbBuffer.reset();
|
|
674
653
|
const rawPbBuffer = pbBuffer.toBuffer();
|
|
675
654
|
const pbBytes = new Uint8Array(rawPbBuffer);
|
|
676
|
-
|
|
677
|
-
context: (_d = options.context) !== null && _d !== void 0 ? _d : `encode:${name}`,
|
|
678
|
-
messageName: name,
|
|
679
|
-
messageTypeId,
|
|
680
|
-
pbPayloadLength: pbBytes.length,
|
|
681
|
-
packetSrc: (_e = options.packetSrc) !== null && _e !== void 0 ? _e : 0,
|
|
682
|
-
router: (_f = options.router) !== null && _f !== void 0 ? _f : 0,
|
|
683
|
-
});
|
|
684
|
-
return encodeProtobufFrame(messageTypeId, pbBytes, options.packetSrc, options.router, {
|
|
685
|
-
logger: options.logger,
|
|
686
|
-
logPrefix: options.logPrefix,
|
|
687
|
-
context: (_g = options.context) !== null && _g !== void 0 ? _g : `encode:${name}`,
|
|
688
|
-
messageName: name,
|
|
689
|
-
}, options.seq);
|
|
655
|
+
return encodeProtobufFrame(messageTypeId, pbBytes, options.packetSrc, options.router, options.seq);
|
|
690
656
|
},
|
|
691
|
-
decodeFrame(schemas, frame
|
|
692
|
-
|
|
693
|
-
const {
|
|
694
|
-
logger: options.logger,
|
|
695
|
-
logPrefix: options.logPrefix,
|
|
696
|
-
context: (_a = options.context) !== null && _a !== void 0 ? _a : 'decode',
|
|
697
|
-
});
|
|
698
|
-
const { Message, messageName } = createProtocolV2MessageFromType(messageTypeId, schemas);
|
|
657
|
+
decodeFrame(schemas, frame) {
|
|
658
|
+
const { messageTypeId, pbPayload, seq, messageName } = this.inspectFrame(schemas, frame);
|
|
659
|
+
const { Message } = createProtocolV2MessageFromType(messageTypeId, schemas);
|
|
699
660
|
const rxByteBuffer = ByteBuffer__default["default"].wrap(Buffer.from(pbPayload));
|
|
700
661
|
const message = decode(Message, rxByteBuffer);
|
|
701
|
-
(_c = (_b = options.logger) === null || _b === void 0 ? void 0 : _b.debug) === null || _c === void 0 ? void 0 : _c.call(_b, `[${(_d = options.logPrefix) !== null && _d !== void 0 ? _d : 'ProtocolV2'}] decode protobuf`, {
|
|
702
|
-
context: (_e = options.context) !== null && _e !== void 0 ? _e : `decode:${messageName}`,
|
|
703
|
-
messageName,
|
|
704
|
-
messageTypeId,
|
|
705
|
-
pbPayloadLength: pbPayload.length,
|
|
706
|
-
seq,
|
|
707
|
-
});
|
|
708
662
|
return {
|
|
709
663
|
message,
|
|
710
664
|
messageName,
|
|
@@ -853,11 +807,6 @@ function bytesToHex(bytes) {
|
|
|
853
807
|
.map(b => b.toString(16).padStart(2, '0'))
|
|
854
808
|
.join('');
|
|
855
809
|
}
|
|
856
|
-
const PROTOCOL_V2_DEBUG_HEADER_BYTES = 7;
|
|
857
|
-
const PROTOCOL_V2_DEBUG_ARRAY_ITEMS_LIMIT = 20;
|
|
858
|
-
const PROTOCOL_V2_DEBUG_OBJECT_KEYS_LIMIT = 40;
|
|
859
|
-
const PROTOCOL_V2_DEBUG_STRING_LIMIT = 512;
|
|
860
|
-
const PROTOCOL_V2_DEBUG_DEPTH_LIMIT = 4;
|
|
861
810
|
const HIGH_VOLUME_PROTOCOL_V2_CALLS = new Set([
|
|
862
811
|
...LogBlockCommand,
|
|
863
812
|
'FilesystemFileRead',
|
|
@@ -867,80 +816,6 @@ const HIGH_VOLUME_PROTOCOL_V2_CALLS = new Set([
|
|
|
867
816
|
function shouldReduceProtocolV2Debug(name) {
|
|
868
817
|
return HIGH_VOLUME_PROTOCOL_V2_CALLS.has(name);
|
|
869
818
|
}
|
|
870
|
-
function frameHeaderDebugHex(frame) {
|
|
871
|
-
return bytesToHex(frame.slice(0, PROTOCOL_V2_DEBUG_HEADER_BYTES));
|
|
872
|
-
}
|
|
873
|
-
function getBinaryByteLength(value) {
|
|
874
|
-
if (value instanceof ArrayBuffer) {
|
|
875
|
-
return value.byteLength;
|
|
876
|
-
}
|
|
877
|
-
if (ArrayBuffer.isView(value)) {
|
|
878
|
-
return value.byteLength;
|
|
879
|
-
}
|
|
880
|
-
if (typeof Blob !== 'undefined' && value instanceof Blob) {
|
|
881
|
-
return value.size;
|
|
882
|
-
}
|
|
883
|
-
return undefined;
|
|
884
|
-
}
|
|
885
|
-
function summarizeRedactedData(value) {
|
|
886
|
-
const byteLength = getBinaryByteLength(value);
|
|
887
|
-
if (byteLength !== undefined) {
|
|
888
|
-
return `[redacted data: ${byteLength} bytes]`;
|
|
889
|
-
}
|
|
890
|
-
if (typeof value === 'string') {
|
|
891
|
-
return `[redacted data: string length=${value.length}]`;
|
|
892
|
-
}
|
|
893
|
-
if (Array.isArray(value)) {
|
|
894
|
-
return `[redacted data: array length=${value.length}]`;
|
|
895
|
-
}
|
|
896
|
-
if (value && typeof value === 'object') {
|
|
897
|
-
return `[redacted data: object keys=${Object.keys(value).length}]`;
|
|
898
|
-
}
|
|
899
|
-
return `[redacted data: ${typeof value}]`;
|
|
900
|
-
}
|
|
901
|
-
function sanitizeProtocolV2DebugPayload(value, key = '', depth = 0) {
|
|
902
|
-
if (/^(data|payload)$/i.test(key) && value !== null && value !== undefined) {
|
|
903
|
-
return summarizeRedactedData(value);
|
|
904
|
-
}
|
|
905
|
-
if (/(passphrase|pin|mnemonic|seed|private)/i.test(key)) {
|
|
906
|
-
return '[redacted sensitive value]';
|
|
907
|
-
}
|
|
908
|
-
const byteLength = getBinaryByteLength(value);
|
|
909
|
-
if (byteLength !== undefined) {
|
|
910
|
-
return `[binary: ${byteLength} bytes]`;
|
|
911
|
-
}
|
|
912
|
-
if (typeof value === 'string') {
|
|
913
|
-
return value.length > PROTOCOL_V2_DEBUG_STRING_LIMIT
|
|
914
|
-
? `${value.slice(0, PROTOCOL_V2_DEBUG_STRING_LIMIT)}... (len=${value.length})`
|
|
915
|
-
: value;
|
|
916
|
-
}
|
|
917
|
-
if (!value || typeof value !== 'object') {
|
|
918
|
-
return value;
|
|
919
|
-
}
|
|
920
|
-
if (depth >= PROTOCOL_V2_DEBUG_DEPTH_LIMIT) {
|
|
921
|
-
return Array.isArray(value)
|
|
922
|
-
? `[array length=${value.length}]`
|
|
923
|
-
: `[object keys=${Object.keys(value).length}]`;
|
|
924
|
-
}
|
|
925
|
-
if (Array.isArray(value)) {
|
|
926
|
-
const items = value
|
|
927
|
-
.slice(0, PROTOCOL_V2_DEBUG_ARRAY_ITEMS_LIMIT)
|
|
928
|
-
.map(item => sanitizeProtocolV2DebugPayload(item, key, depth + 1));
|
|
929
|
-
if (value.length > PROTOCOL_V2_DEBUG_ARRAY_ITEMS_LIMIT) {
|
|
930
|
-
items.push(`... (${value.length - PROTOCOL_V2_DEBUG_ARRAY_ITEMS_LIMIT} more)`);
|
|
931
|
-
}
|
|
932
|
-
return items;
|
|
933
|
-
}
|
|
934
|
-
const entries = Object.entries(value).slice(0, PROTOCOL_V2_DEBUG_OBJECT_KEYS_LIMIT);
|
|
935
|
-
const sanitized = {};
|
|
936
|
-
entries.forEach(([entryKey, entryValue]) => {
|
|
937
|
-
sanitized[entryKey] = sanitizeProtocolV2DebugPayload(entryValue, entryKey, depth + 1);
|
|
938
|
-
});
|
|
939
|
-
if (Object.keys(value).length > PROTOCOL_V2_DEBUG_OBJECT_KEYS_LIMIT) {
|
|
940
|
-
sanitized.__truncated__ = `${Object.keys(value).length - PROTOCOL_V2_DEBUG_OBJECT_KEYS_LIMIT} more keys`;
|
|
941
|
-
}
|
|
942
|
-
return sanitized;
|
|
943
|
-
}
|
|
944
819
|
const COMMON_TERMINAL_RESPONSE_TYPES = new Set([
|
|
945
820
|
'Failure',
|
|
946
821
|
'ButtonRequest',
|
|
@@ -1003,7 +878,7 @@ class ProtocolV2Session {
|
|
|
1003
878
|
return result;
|
|
1004
879
|
}
|
|
1005
880
|
executeCall(name, data, callOptions) {
|
|
1006
|
-
var _a
|
|
881
|
+
var _a;
|
|
1007
882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1008
883
|
const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, prepareCall, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', createTimeoutError, generation = 0, } = this.options;
|
|
1009
884
|
const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
|
|
@@ -1019,58 +894,51 @@ class ProtocolV2Session {
|
|
|
1019
894
|
packetSrc,
|
|
1020
895
|
router,
|
|
1021
896
|
seq: protoSeq,
|
|
1022
|
-
logger: shouldReduceDebug ? undefined : logger,
|
|
1023
|
-
logPrefix,
|
|
1024
|
-
context: `tx:${name}`,
|
|
1025
897
|
});
|
|
1026
|
-
const
|
|
898
|
+
const txMetadata = ProtocolV2.inspectFrame(schemas, frame);
|
|
1027
899
|
if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
|
|
1028
900
|
throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
|
|
1029
901
|
}
|
|
1030
902
|
if (!shouldReduceDebug) {
|
|
1031
|
-
(_a = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _a === void 0 ? void 0 : _a.call(logger, `[${logPrefix}] TX
|
|
1032
|
-
|
|
903
|
+
(_a = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _a === void 0 ? void 0 : _a.call(logger, `[${logPrefix}] TX`, {
|
|
904
|
+
method: name,
|
|
905
|
+
type: name,
|
|
906
|
+
typeId: txMetadata.messageTypeId,
|
|
907
|
+
seq: txMetadata.seq,
|
|
908
|
+
bytes: frame.length,
|
|
909
|
+
});
|
|
1033
910
|
}
|
|
1034
911
|
yield withProtocolTimeout(writeFrame(frame, callContext), PROTOCOL_V2_WRITE_WATCHDOG_TIMEOUT_MS, () => new Error(`Protocol V2 write timeout after ${PROTOCOL_V2_WRITE_WATCHDOG_TIMEOUT_MS}ms for ${name}`));
|
|
1035
912
|
const cancellation = { cancelled: false };
|
|
1036
913
|
const readResponse = () => __awaiter(this, void 0, void 0, function* () {
|
|
1037
|
-
var _c, _d, _e, _f
|
|
914
|
+
var _b, _c, _d, _e, _f;
|
|
1038
915
|
while (!cancellation.cancelled) {
|
|
1039
916
|
const rxFrame = yield readFrame(callContext);
|
|
1040
917
|
if (cancellation.cancelled) {
|
|
1041
918
|
break;
|
|
1042
919
|
}
|
|
1043
|
-
if (!shouldReduceDebug) {
|
|
1044
|
-
(_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] RX frame len=${rxFrame.length} router=${rxFrame[4]} attr=${rxFrame[5]} seq=${rxFrame[6]} headerHex=${frameHeaderDebugHex(rxFrame)}`);
|
|
1045
|
-
}
|
|
1046
920
|
const isAck = ProtocolV2.isAckFrame(rxFrame);
|
|
1047
|
-
if (isAck) {
|
|
1048
|
-
if (!shouldReduceDebug) {
|
|
1049
|
-
(_d = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _d === void 0 ? void 0 : _d.call(logger, `[${logPrefix}] skip Proto Link ACK seq=${rxFrame[6]}`);
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
921
|
if (!isAck) {
|
|
1053
|
-
const
|
|
1054
|
-
logger: shouldReduceDebug ? undefined : logger,
|
|
1055
|
-
logPrefix,
|
|
1056
|
-
context: `rx:${name}`,
|
|
1057
|
-
});
|
|
1058
|
-
if (!shouldReduceDebug && decoded.seq !== expectedSeq) {
|
|
1059
|
-
(_e = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _e === void 0 ? void 0 : _e.call(logger, `[${logPrefix}] seq differs for ${name}: tx=${expectedSeq}, rx=${decoded.seq}`);
|
|
1060
|
-
}
|
|
922
|
+
const rxMetadata = ProtocolV2.inspectFrame(schemas, rxFrame);
|
|
1061
923
|
if (!shouldReduceDebug) {
|
|
1062
|
-
(
|
|
1063
|
-
|
|
924
|
+
(_b = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _b === void 0 ? void 0 : _b.call(logger, `[${logPrefix}] RX`, {
|
|
925
|
+
method: name,
|
|
926
|
+
type: rxMetadata.type,
|
|
927
|
+
typeId: rxMetadata.messageTypeId,
|
|
928
|
+
seq: rxMetadata.seq,
|
|
929
|
+
bytes: rxFrame.length,
|
|
930
|
+
});
|
|
1064
931
|
}
|
|
932
|
+
const decoded = ProtocolV2.decodeFrame(schemas, rxFrame);
|
|
1065
933
|
const response = call(decoded);
|
|
1066
|
-
if ((
|
|
1067
|
-
(
|
|
934
|
+
if ((_c = callOptions.intermediateTypes) === null || _c === void 0 ? void 0 : _c.includes(response.type)) {
|
|
935
|
+
(_d = callOptions.onIntermediateResponse) === null || _d === void 0 ? void 0 : _d.call(callOptions, response);
|
|
1068
936
|
}
|
|
1069
937
|
else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
1070
938
|
return response;
|
|
1071
939
|
}
|
|
1072
940
|
else if (!shouldReduceDebug) {
|
|
1073
|
-
(
|
|
941
|
+
(_e = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _e === void 0 ? void 0 : _e.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_f = callOptions.expectedTypes) === null || _f === void 0 ? void 0 : _f.join('|')} got=${response.type}`);
|
|
1074
942
|
}
|
|
1075
943
|
}
|
|
1076
944
|
}
|
|
@@ -1812,6 +1680,9 @@ exports.ViewSignLayout = void 0;
|
|
|
1812
1680
|
(function (ViewSignLayout) {
|
|
1813
1681
|
ViewSignLayout[ViewSignLayout["LayoutDefault"] = 0] = "LayoutDefault";
|
|
1814
1682
|
ViewSignLayout[ViewSignLayout["LayoutSafeTxCreate"] = 1] = "LayoutSafeTxCreate";
|
|
1683
|
+
ViewSignLayout[ViewSignLayout["LayoutFinalConfirm"] = 2] = "LayoutFinalConfirm";
|
|
1684
|
+
ViewSignLayout[ViewSignLayout["Layout7702"] = 3] = "Layout7702";
|
|
1685
|
+
ViewSignLayout[ViewSignLayout["LayoutFlat"] = 4] = "LayoutFlat";
|
|
1815
1686
|
})(exports.ViewSignLayout || (exports.ViewSignLayout = {}));
|
|
1816
1687
|
exports.DeviceErrorCode = void 0;
|
|
1817
1688
|
(function (DeviceErrorCode) {
|
|
@@ -1894,6 +1765,10 @@ exports.DeviceSEState = void 0;
|
|
|
1894
1765
|
DeviceSEState[DeviceSEState["APP_FACTORY"] = 51] = "APP_FACTORY";
|
|
1895
1766
|
DeviceSEState[DeviceSEState["APP"] = 85] = "APP";
|
|
1896
1767
|
})(exports.DeviceSEState || (exports.DeviceSEState = {}));
|
|
1768
|
+
exports.DeviceSessionAskPin_FailureSubCodes = void 0;
|
|
1769
|
+
(function (DeviceSessionAskPin_FailureSubCodes) {
|
|
1770
|
+
DeviceSessionAskPin_FailureSubCodes[DeviceSessionAskPin_FailureSubCodes["UserCancel"] = 1] = "UserCancel";
|
|
1771
|
+
})(exports.DeviceSessionAskPin_FailureSubCodes || (exports.DeviceSessionAskPin_FailureSubCodes = {}));
|
|
1897
1772
|
exports.DevOnboardingStage = void 0;
|
|
1898
1773
|
(function (DevOnboardingStage) {
|
|
1899
1774
|
DevOnboardingStage[DevOnboardingStage["DEV_ONBOARDING_STAGE_UNKNOWN"] = 0] = "DEV_ONBOARDING_STAGE_UNKNOWN";
|
|
@@ -1910,6 +1785,36 @@ exports.DevOnboardingStage = void 0;
|
|
|
1910
1785
|
DevOnboardingStage[DevOnboardingStage["DEV_ONBOARDING_STAGE_SEEDCARD_BACKUP"] = 11] = "DEV_ONBOARDING_STAGE_SEEDCARD_BACKUP";
|
|
1911
1786
|
DevOnboardingStage[DevOnboardingStage["DEV_ONBOARDING_STAGE_DONE"] = 12] = "DEV_ONBOARDING_STAGE_DONE";
|
|
1912
1787
|
})(exports.DevOnboardingStage || (exports.DevOnboardingStage = {}));
|
|
1788
|
+
exports.ProtocolV2FailureType = void 0;
|
|
1789
|
+
(function (ProtocolV2FailureType) {
|
|
1790
|
+
ProtocolV2FailureType[ProtocolV2FailureType["Failure_InvalidMessage"] = 1] = "Failure_InvalidMessage";
|
|
1791
|
+
ProtocolV2FailureType[ProtocolV2FailureType["Failure_UndefinedError"] = 2] = "Failure_UndefinedError";
|
|
1792
|
+
ProtocolV2FailureType[ProtocolV2FailureType["Failure_UsageError"] = 3] = "Failure_UsageError";
|
|
1793
|
+
ProtocolV2FailureType[ProtocolV2FailureType["Failure_DataError"] = 4] = "Failure_DataError";
|
|
1794
|
+
ProtocolV2FailureType[ProtocolV2FailureType["Failure_ProcessError"] = 5] = "Failure_ProcessError";
|
|
1795
|
+
})(exports.ProtocolV2FailureType || (exports.ProtocolV2FailureType = {}));
|
|
1796
|
+
exports.Enum_ProtocolV2Capability = void 0;
|
|
1797
|
+
(function (Enum_ProtocolV2Capability) {
|
|
1798
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Bitcoin"] = 1] = "Capability_Bitcoin";
|
|
1799
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Bitcoin_like"] = 2] = "Capability_Bitcoin_like";
|
|
1800
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Binance"] = 3] = "Capability_Binance";
|
|
1801
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Cardano"] = 4] = "Capability_Cardano";
|
|
1802
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Crypto"] = 5] = "Capability_Crypto";
|
|
1803
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_EOS"] = 6] = "Capability_EOS";
|
|
1804
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Ethereum"] = 7] = "Capability_Ethereum";
|
|
1805
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Lisk"] = 8] = "Capability_Lisk";
|
|
1806
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Monero"] = 9] = "Capability_Monero";
|
|
1807
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_NEM"] = 10] = "Capability_NEM";
|
|
1808
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Ripple"] = 11] = "Capability_Ripple";
|
|
1809
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Stellar"] = 12] = "Capability_Stellar";
|
|
1810
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Tezos"] = 13] = "Capability_Tezos";
|
|
1811
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_U2F"] = 14] = "Capability_U2F";
|
|
1812
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_Shamir"] = 15] = "Capability_Shamir";
|
|
1813
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_ShamirGroups"] = 16] = "Capability_ShamirGroups";
|
|
1814
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_PassphraseEntry"] = 17] = "Capability_PassphraseEntry";
|
|
1815
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_AttachToPin"] = 18] = "Capability_AttachToPin";
|
|
1816
|
+
Enum_ProtocolV2Capability[Enum_ProtocolV2Capability["Capability_EthereumTypedData"] = 1000] = "Capability_EthereumTypedData";
|
|
1817
|
+
})(exports.Enum_ProtocolV2Capability || (exports.Enum_ProtocolV2Capability = {}));
|
|
1913
1818
|
|
|
1914
1819
|
var messages = /*#__PURE__*/Object.freeze({
|
|
1915
1820
|
__proto__: null,
|
|
@@ -1986,7 +1891,10 @@ var messages = /*#__PURE__*/Object.freeze({
|
|
|
1986
1891
|
get DeviceType () { return exports.DeviceType; },
|
|
1987
1892
|
get DeviceSeType () { return exports.DeviceSeType; },
|
|
1988
1893
|
get DeviceSEState () { return exports.DeviceSEState; },
|
|
1989
|
-
get
|
|
1894
|
+
get DeviceSessionAskPin_FailureSubCodes () { return exports.DeviceSessionAskPin_FailureSubCodes; },
|
|
1895
|
+
get DevOnboardingStage () { return exports.DevOnboardingStage; },
|
|
1896
|
+
get ProtocolV2FailureType () { return exports.ProtocolV2FailureType; },
|
|
1897
|
+
get Enum_ProtocolV2Capability () { return exports.Enum_ProtocolV2Capability; }
|
|
1990
1898
|
});
|
|
1991
1899
|
|
|
1992
1900
|
protobuf__namespace.util.Long = Long__default["default"];
|
|
@@ -4,7 +4,6 @@ import { encodeEnvelopeMessage } from './v1/packets';
|
|
|
4
4
|
import { decodeMessage as decodeV1Message } from './v1/receive';
|
|
5
5
|
import { isAckFrame } from './v2';
|
|
6
6
|
import type { Root } from 'protobufjs/light';
|
|
7
|
-
import type { ProtocolV2DebugLogger } from './v2';
|
|
8
7
|
export declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
9
8
|
type ProtocolV2Schemas = {
|
|
10
9
|
protocolV1: Root;
|
|
@@ -14,9 +13,6 @@ type ProtocolV2FrameOptions = {
|
|
|
14
13
|
packetSrc?: number;
|
|
15
14
|
router?: number;
|
|
16
15
|
seq?: number;
|
|
17
|
-
logger?: ProtocolV2DebugLogger;
|
|
18
|
-
logPrefix?: string;
|
|
19
|
-
context?: string;
|
|
20
16
|
};
|
|
21
17
|
export declare const ProtocolV1: {
|
|
22
18
|
encodeEnvelope: typeof encodeEnvelopeMessage;
|
|
@@ -31,8 +27,15 @@ export declare const ProtocolV1: {
|
|
|
31
27
|
};
|
|
32
28
|
export declare const ProtocolV2: {
|
|
33
29
|
isAckFrame: typeof isAckFrame;
|
|
30
|
+
inspectFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
31
|
+
messageName: string;
|
|
32
|
+
messageTypeId: number;
|
|
33
|
+
pbPayload: Uint8Array;
|
|
34
|
+
seq: number;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
34
37
|
encodeFrame(schemas: ProtocolV2Schemas, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
35
|
-
decodeFrame(schemas: ProtocolV2Schemas, frame: Uint8Array
|
|
38
|
+
decodeFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
36
39
|
message: {
|
|
37
40
|
[key: string]: any;
|
|
38
41
|
};
|
|
@@ -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,EAAqD,UAAU,EAAE,MAAM,MAAM,CAAC;AAErF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
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,EAAqD,UAAU,EAAE,MAAM,MAAM,CAAC;AAErF,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;;0BAGC,iBAAiB,SAAS,UAAU;;;;;;;yBAa/C,iBAAiB,QACpB,MAAM,QACN,OAAO,MAAM,EAAE,OAAO,CAAC,YACpB,sBAAsB;yBAkBZ,iBAAiB,SAAS,UAAU;;;;;;;;;;CAe1D,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ProtocolV2FrameDebugOptions } from './debug';
|
|
2
1
|
export interface ProtoV2Frame {
|
|
3
2
|
messageTypeId: number;
|
|
4
3
|
pbPayload: Uint8Array;
|
|
5
4
|
seq: number;
|
|
6
5
|
}
|
|
7
6
|
export declare function isAckFrame(data: Uint8Array): boolean;
|
|
8
|
-
export declare function decodeFrame(data: Uint8Array
|
|
7
|
+
export declare function decodeFrame(data: Uint8Array): ProtoV2Frame;
|
|
9
8
|
//# 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":"AAGA,MAAM,WAAW,YAAY;IAE3B,aAAa,EAAE,MAAM,CAAC;IAEtB,SAAS,EAAE,UAAU,CAAC;IAEtB,GAAG,EAAE,MAAM,CAAC;CACb;AAwCD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWpD;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAe1D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ProtocolV2FrameDebugOptions } from './debug';
|
|
2
1
|
export declare function nextProtoSeq(current: number): number;
|
|
3
|
-
export declare function encodeFrame(payload: Uint8Array | null, packetSrc?: number, router?: number,
|
|
4
|
-
export declare function encodeProtobufFrame(messageTypeId: number, pbPayload: Uint8Array, packetSrc?: number, router?: number,
|
|
2
|
+
export declare function encodeFrame(payload: Uint8Array | null, packetSrc?: number, router?: number, seq?: number): Uint8Array;
|
|
3
|
+
export declare function encodeProtobufFrame(messageTypeId: number, pbPayload: Uint8Array, packetSrc?: number, router?: number, seq?: number): Uint8Array;
|
|
5
4
|
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/encode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/encode.ts"],"names":[],"mappings":"AAYA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAgBD,wBAAgB,WAAW,CACzB,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,GACX,UAAU,CAiCZ;AASD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,UAAU,EACrB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,GACX,UAAU,CAMZ"}
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAK7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MA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,GAAE,qBAA0B,GACtC,OAAO,CAAC,iBAAiB,CAAC;YASf,WAAW;CA6H1B;AAED,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAwB,EACxB,aAAa,EACb,aAAa,GACd,EAAE;IACD,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D,oBAoBA"}
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -1827,6 +1827,19 @@ export type Features = {
|
|
|
1827
1827
|
onekey_se04_state?: string | null;
|
|
1828
1828
|
attach_to_pin_user?: boolean;
|
|
1829
1829
|
unlocked_attach_pin?: boolean;
|
|
1830
|
+
coprocessor_bt_name?: string;
|
|
1831
|
+
coprocessor_version?: string;
|
|
1832
|
+
coprocessor_bt_enable?: boolean;
|
|
1833
|
+
romloader_version?: string;
|
|
1834
|
+
onekey_romloader_version?: string;
|
|
1835
|
+
onekey_romloader_hash?: string;
|
|
1836
|
+
onekey_bootloader_version?: string;
|
|
1837
|
+
onekey_bootloader_hash?: string;
|
|
1838
|
+
onekey_bootloader_build_id?: string;
|
|
1839
|
+
onekey_coprocessor_bt_name?: string;
|
|
1840
|
+
onekey_coprocessor_version?: string;
|
|
1841
|
+
onekey_coprocessor_build_id?: string;
|
|
1842
|
+
onekey_coprocessor_hash?: string;
|
|
1830
1843
|
};
|
|
1831
1844
|
export type OnekeyFeatures = {
|
|
1832
1845
|
onekey_device_type?: OneKeyDeviceType;
|
|
@@ -3440,7 +3453,10 @@ export type ViewRawData = {
|
|
|
3440
3453
|
};
|
|
3441
3454
|
export declare enum ViewSignLayout {
|
|
3442
3455
|
LayoutDefault = 0,
|
|
3443
|
-
LayoutSafeTxCreate = 1
|
|
3456
|
+
LayoutSafeTxCreate = 1,
|
|
3457
|
+
LayoutFinalConfirm = 2,
|
|
3458
|
+
Layout7702 = 3,
|
|
3459
|
+
LayoutFlat = 4
|
|
3444
3460
|
}
|
|
3445
3461
|
export type ViewSignPage = {
|
|
3446
3462
|
title: string;
|
|
@@ -3696,11 +3712,9 @@ export type DeviceSession = {
|
|
|
3696
3712
|
btc_test_address?: string;
|
|
3697
3713
|
};
|
|
3698
3714
|
export type DeviceSessionAskPin = {};
|
|
3699
|
-
export
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
passphrase_protection?: boolean;
|
|
3703
|
-
};
|
|
3715
|
+
export declare enum DeviceSessionAskPin_FailureSubCodes {
|
|
3716
|
+
UserCancel = 1
|
|
3717
|
+
}
|
|
3704
3718
|
export type DeviceStatus = {
|
|
3705
3719
|
device_id?: string;
|
|
3706
3720
|
unlocked?: boolean;
|
|
@@ -3793,6 +3807,35 @@ export type FilesystemFormat = {
|
|
|
3793
3807
|
user: boolean;
|
|
3794
3808
|
};
|
|
3795
3809
|
export type PortfolioUpdate = {};
|
|
3810
|
+
export declare enum ProtocolV2FailureType {
|
|
3811
|
+
Failure_InvalidMessage = 1,
|
|
3812
|
+
Failure_UndefinedError = 2,
|
|
3813
|
+
Failure_UsageError = 3,
|
|
3814
|
+
Failure_DataError = 4,
|
|
3815
|
+
Failure_ProcessError = 5
|
|
3816
|
+
}
|
|
3817
|
+
export declare enum Enum_ProtocolV2Capability {
|
|
3818
|
+
Capability_Bitcoin = 1,
|
|
3819
|
+
Capability_Bitcoin_like = 2,
|
|
3820
|
+
Capability_Binance = 3,
|
|
3821
|
+
Capability_Cardano = 4,
|
|
3822
|
+
Capability_Crypto = 5,
|
|
3823
|
+
Capability_EOS = 6,
|
|
3824
|
+
Capability_Ethereum = 7,
|
|
3825
|
+
Capability_Lisk = 8,
|
|
3826
|
+
Capability_Monero = 9,
|
|
3827
|
+
Capability_NEM = 10,
|
|
3828
|
+
Capability_Ripple = 11,
|
|
3829
|
+
Capability_Stellar = 12,
|
|
3830
|
+
Capability_Tezos = 13,
|
|
3831
|
+
Capability_U2F = 14,
|
|
3832
|
+
Capability_Shamir = 15,
|
|
3833
|
+
Capability_ShamirGroups = 16,
|
|
3834
|
+
Capability_PassphraseEntry = 17,
|
|
3835
|
+
Capability_AttachToPin = 18,
|
|
3836
|
+
Capability_EthereumTypedData = 1000
|
|
3837
|
+
}
|
|
3838
|
+
export type ProtocolV2Capability = keyof typeof Enum_ProtocolV2Capability;
|
|
3796
3839
|
export type MessageType = {
|
|
3797
3840
|
AlephiumGetAddress: AlephiumGetAddress;
|
|
3798
3841
|
AlephiumAddress: AlephiumAddress;
|
|
@@ -4411,7 +4454,6 @@ export type MessageType = {
|
|
|
4411
4454
|
DeviceSessionGet: DeviceSessionGet;
|
|
4412
4455
|
DeviceSession: DeviceSession;
|
|
4413
4456
|
DeviceSessionAskPin: DeviceSessionAskPin;
|
|
4414
|
-
DeviceSessionPinResult: DeviceSessionPinResult;
|
|
4415
4457
|
DeviceStatus: DeviceStatus;
|
|
4416
4458
|
DeviceStatusGet: DeviceStatusGet;
|
|
4417
4459
|
DevGetOnboardingStatus: DevGetOnboardingStatus;
|