@onekeyfe/hd-transport 1.2.8 → 1.2.10-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -276,6 +276,7 @@ const PROTOCOL_V2_BLE_FILE_CHUNK_SIZE = 1800;
276
276
  const PROTOCOL_V2_BLE_FIRMWARE_FILE_CHUNK_SIZE = 1960;
277
277
  const PROTOCOL_V2_BLE_FILE_READ_CHUNK_SIZE = 900;
278
278
  const PROTOCOL_V2_BLE_FRAME_MAX_BYTES = 2048;
279
+ const PROTOCOL_V2_FILE_WRITE_PIPELINE_WINDOW = 2;
279
280
  const PROTOCOL_V2_FILE_CHUNK_SIZE = PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
280
281
  const PROTOCOL_V2_CHANNEL_USB = 0;
281
282
  const PROTOCOL_V2_CHANNEL_BLE_UART = 1;
@@ -1107,6 +1108,24 @@ function withProtocolTimeout(promise, timeoutMs, createTimeoutError, onTimeout,
1107
1108
  }
1108
1109
  });
1109
1110
  }
1111
+ const resolveProtocolV2CallTimeoutMs = (timeoutMs) => timeoutMs && timeoutMs > 0 ? timeoutMs : PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
1112
+ function parseFileWriteChunk(request) {
1113
+ var _a;
1114
+ const file = request.file;
1115
+ const offset = Number(file === null || file === void 0 ? void 0 : file.offset);
1116
+ const totalSize = Number(file === null || file === void 0 ? void 0 : file.total_size);
1117
+ const length = Number((_a = file === null || file === void 0 ? void 0 : file.data) === null || _a === void 0 ? void 0 : _a.byteLength);
1118
+ if (typeof (file === null || file === void 0 ? void 0 : file.path) !== 'string' ||
1119
+ !Number.isSafeInteger(offset) ||
1120
+ offset < 0 ||
1121
+ !Number.isSafeInteger(totalSize) ||
1122
+ !Number.isSafeInteger(length) ||
1123
+ length <= 0 ||
1124
+ offset + length > totalSize) {
1125
+ throw new Error('Protocol V2 file write pipeline chunk is invalid');
1126
+ }
1127
+ return { path: file.path, offset, end: offset + length, totalSize };
1128
+ }
1110
1129
  class ProtocolV2Session {
1111
1130
  constructor(options) {
1112
1131
  var _a;
@@ -1149,43 +1168,47 @@ class ProtocolV2Session {
1149
1168
  this.pendingWrite = result.catch(() => undefined);
1150
1169
  return result;
1151
1170
  }
1171
+ reportWriteCompleted(callOptions, writeStartedAt, frameBytes) {
1172
+ var _a, _b;
1173
+ try {
1174
+ (_a = callOptions.onWriteCompleted) === null || _a === void 0 ? void 0 : _a.call(callOptions, {
1175
+ elapsedMs: Math.max(Date.now() - writeStartedAt, 0),
1176
+ frameBytes,
1177
+ });
1178
+ }
1179
+ catch (error) {
1180
+ const { logger, logPrefix = 'ProtocolV2' } = this.options;
1181
+ (_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, `${logPrefix} write metrics callback failed: ${String(error)}`);
1182
+ }
1183
+ }
1184
+ createCallTimeoutError(name, timeoutMs) {
1185
+ const { createTimeoutError } = this.options;
1186
+ return createTimeoutError
1187
+ ? createTimeoutError(name, timeoutMs)
1188
+ : new Error(`Protocol V2 response timeout after ${timeoutMs}ms for ${name}`);
1189
+ }
1152
1190
  executeCall(name, data, callOptions) {
1153
- const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, prepareCall, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', createTimeoutError, generation = 0, } = this.options;
1154
- const timeoutMs = callOptions.timeoutMs && callOptions.timeoutMs > 0
1155
- ? callOptions.timeoutMs
1156
- : PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
1191
+ if (callOptions.fileWritePipeline) {
1192
+ return this.executeFileWritePipeline(name, data, callOptions, callOptions.fileWritePipeline);
1193
+ }
1194
+ const { prepareCall, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', generation = 0, } = this.options;
1195
+ const timeoutMs = resolveProtocolV2CallTimeoutMs(callOptions.timeoutMs);
1157
1196
  const abortController = new AbortController();
1158
1197
  const shouldReduceDebug = shouldReduceProtocolV2Debug(name);
1159
1198
  const baseCallContext = Object.assign(Object.assign({ messageName: name, timeoutMs, highThroughput: isProtocolV2HighThroughputCall(name) }, (callOptions.writeWithResponse === undefined
1160
1199
  ? {}
1161
1200
  : { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
1162
1201
  const runCall = () => __awaiter(this, void 0, void 0, function* () {
1163
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1202
+ var _a, _b, _c, _d, _e, _f, _g;
1164
1203
  if (!this.pendingResponseAfterWrite) {
1165
1204
  yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
1166
1205
  }
1167
- const protoSeq = this.sequenceCursor.next();
1168
- const frame = ProtocolV2.encodeFrame(schemas, name, data, {
1169
- packetSrc,
1170
- router,
1171
- seq: protoSeq,
1172
- });
1173
- if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
1174
- throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
1175
- }
1206
+ const { seq: protoSeq, frame } = this.encodeRequestFrame(name, data);
1176
1207
  const writeStartedAt = Date.now();
1177
1208
  yield this.serializeWrite(() => writeFrame(frame, baseCallContext));
1178
- try {
1179
- (_a = callOptions.onWriteCompleted) === null || _a === void 0 ? void 0 : _a.call(callOptions, {
1180
- elapsedMs: Math.max(Date.now() - writeStartedAt, 0),
1181
- frameBytes: frame.byteLength,
1182
- });
1183
- }
1184
- catch (error) {
1185
- (_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, `${logPrefix} write metrics callback failed: ${String(error)}`);
1186
- }
1209
+ this.reportWriteCompleted(callOptions, writeStartedAt, frame.byteLength);
1187
1210
  if (callOptions.returnAfterWrite) {
1188
- if ((_c = callOptions.expectedTypes) === null || _c === void 0 ? void 0 : _c.length) {
1211
+ if ((_a = callOptions.expectedTypes) === null || _a === void 0 ? void 0 : _a.length) {
1189
1212
  this.pendingResponseAfterWrite = {
1190
1213
  expectedTypes: new Set(callOptions.expectedTypes),
1191
1214
  onResponse: callOptions.onResponseAfterWrite,
@@ -1197,44 +1220,8 @@ class ProtocolV2Session {
1197
1220
  const rxFrame = yield readFrame(baseCallContext);
1198
1221
  if (abortController.signal.aborted)
1199
1222
  break;
1200
- let header;
1201
- try {
1202
- header = ProtocolV2.inspectFrameHeader(rxFrame);
1203
- }
1204
- catch (cause) {
1205
- throw new ProtocolV2LinkError('frame', `Protocol V2 frame validation failed: ${getErrorMessage(cause)}`, cause);
1206
- }
1207
- if (header.router !== router) {
1208
- throw new ProtocolV2LinkError('router', `Protocol V2 router mismatch: expected ${router}, got ${header.router}`);
1209
- }
1210
- if (header.packetSrc !== packetSrc) {
1211
- throw new ProtocolV2LinkError('packet-source', `Protocol V2 packet source mismatch: expected ${packetSrc}, got ${header.packetSrc}`);
1212
- }
1213
- let isAck;
1214
- try {
1215
- isAck = ProtocolV2.isAckFrame(rxFrame);
1216
- }
1217
- catch (cause) {
1218
- throw new ProtocolV2LinkError('frame', `Protocol V2 ACK validation failed: ${getErrorMessage(cause)}`, cause);
1219
- }
1220
- if (isAck) {
1221
- if (header.seq !== protoSeq) {
1222
- throw new ProtocolV2LinkError('ack-sequence', `Protocol V2 ACK sequence mismatch: expected ${protoSeq}, got ${header.seq}`);
1223
- }
1224
- }
1225
- else {
1226
- let decoded;
1227
- try {
1228
- decoded = ProtocolV2.decodeFrame(schemas, rxFrame);
1229
- }
1230
- catch (cause) {
1231
- throw new ProtocolV2LinkError('frame', `Protocol V2 frame decode failed: ${getErrorMessage(cause)}`, cause);
1232
- }
1233
- if (this.lastResponseSequence === decoded.seq) {
1234
- throw new ProtocolV2LinkError('response-sequence', `Protocol V2 duplicate response sequence: ${decoded.seq}`);
1235
- }
1236
- this.lastResponseSequence = decoded.seq;
1237
- const response = call(decoded);
1223
+ const response = this.parseResponseFrame(rxFrame, [protoSeq]);
1224
+ if (response) {
1238
1225
  const { pendingResponseAfterWrite } = this;
1239
1226
  let belongsToWriteOnlyCall = false;
1240
1227
  if (pendingResponseAfterWrite) {
@@ -1243,34 +1230,194 @@ class ProtocolV2Session {
1243
1230
  this.pendingResponseAfterWrite = undefined;
1244
1231
  if (belongsToWriteOnlyCall) {
1245
1232
  try {
1246
- (_d = pendingResponseAfterWrite.onResponse) === null || _d === void 0 ? void 0 : _d.call(pendingResponseAfterWrite, response);
1233
+ (_b = pendingResponseAfterWrite.onResponse) === null || _b === void 0 ? void 0 : _b.call(pendingResponseAfterWrite, response);
1247
1234
  }
1248
1235
  catch (error) {
1249
- (_e = logger === null || logger === void 0 ? void 0 : logger.error) === null || _e === void 0 ? void 0 : _e.call(logger, `${logPrefix} delayed response callback failed: ${String(error)}`);
1236
+ (_c = logger === null || logger === void 0 ? void 0 : logger.error) === null || _c === void 0 ? void 0 : _c.call(logger, `${logPrefix} delayed response callback failed: ${String(error)}`);
1250
1237
  }
1251
1238
  }
1252
1239
  }
1253
1240
  }
1254
1241
  if (belongsToWriteOnlyCall) ;
1255
- else if ((_f = callOptions.intermediateTypes) === null || _f === void 0 ? void 0 : _f.includes(response.type)) {
1256
- (_g = callOptions.onIntermediateResponse) === null || _g === void 0 ? void 0 : _g.call(callOptions, response);
1242
+ else if ((_d = callOptions.intermediateTypes) === null || _d === void 0 ? void 0 : _d.includes(response.type)) {
1243
+ (_e = callOptions.onIntermediateResponse) === null || _e === void 0 ? void 0 : _e.call(callOptions, response);
1257
1244
  }
1258
1245
  else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
1259
1246
  return response;
1260
1247
  }
1261
1248
  else if (!shouldReduceDebug) {
1262
- (_h = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _h === void 0 ? void 0 : _h.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_j = callOptions.expectedTypes) === null || _j === void 0 ? void 0 : _j.join('|')} got=${response.type}`);
1249
+ (_f = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _f === void 0 ? void 0 : _f.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_g = callOptions.expectedTypes) === null || _g === void 0 ? void 0 : _g.join('|')} got=${response.type}`);
1263
1250
  }
1264
1251
  }
1265
1252
  }
1266
1253
  throw new Error(`Protocol V2 read loop cancelled after timeout for ${name}`);
1267
1254
  });
1268
- return withProtocolTimeout(runCall(), timeoutMs, () => createTimeoutError
1269
- ? createTimeoutError(name, timeoutMs)
1270
- : new Error(`Protocol V2 response timeout after ${timeoutMs}ms for ${name}`), () => {
1255
+ return withProtocolTimeout(runCall(), timeoutMs, () => this.createCallTimeoutError(name, timeoutMs), () => {
1271
1256
  abortController.abort();
1272
1257
  });
1273
1258
  }
1259
+ encodeRequestFrame(name, data) {
1260
+ const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, } = this.options;
1261
+ const seq = this.sequenceCursor.next();
1262
+ const frame = ProtocolV2.encodeFrame(schemas, name, data, { packetSrc, router, seq });
1263
+ if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
1264
+ throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
1265
+ }
1266
+ return { seq, frame };
1267
+ }
1268
+ parseResponseFrame(rxFrame, ackSequences) {
1269
+ const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND } = this.options;
1270
+ let header;
1271
+ try {
1272
+ header = ProtocolV2.inspectFrameHeader(rxFrame);
1273
+ }
1274
+ catch (cause) {
1275
+ throw new ProtocolV2LinkError('frame', `Protocol V2 frame validation failed: ${getErrorMessage(cause)}`, cause);
1276
+ }
1277
+ if (header.router !== router) {
1278
+ throw new ProtocolV2LinkError('router', `Protocol V2 router mismatch: expected ${router}, got ${header.router}`);
1279
+ }
1280
+ if (header.packetSrc !== packetSrc) {
1281
+ throw new ProtocolV2LinkError('packet-source', `Protocol V2 packet source mismatch: expected ${packetSrc}, got ${header.packetSrc}`);
1282
+ }
1283
+ let isAck;
1284
+ try {
1285
+ isAck = ProtocolV2.isAckFrame(rxFrame);
1286
+ }
1287
+ catch (cause) {
1288
+ throw new ProtocolV2LinkError('frame', `Protocol V2 ACK validation failed: ${getErrorMessage(cause)}`, cause);
1289
+ }
1290
+ if (isAck) {
1291
+ if (!ackSequences.includes(header.seq)) {
1292
+ throw new ProtocolV2LinkError('ack-sequence', `Protocol V2 ACK sequence mismatch: expected ${ackSequences.join('|')}, got ${header.seq}`);
1293
+ }
1294
+ return undefined;
1295
+ }
1296
+ let decoded;
1297
+ try {
1298
+ decoded = ProtocolV2.decodeFrame(schemas, rxFrame);
1299
+ }
1300
+ catch (cause) {
1301
+ throw new ProtocolV2LinkError('frame', `Protocol V2 frame decode failed: ${getErrorMessage(cause)}`, cause);
1302
+ }
1303
+ if (this.lastResponseSequence === decoded.seq) {
1304
+ throw new ProtocolV2LinkError('response-sequence', `Protocol V2 duplicate response sequence: ${decoded.seq}`);
1305
+ }
1306
+ this.lastResponseSequence = decoded.seq;
1307
+ return call(decoded);
1308
+ }
1309
+ executeFileWritePipeline(name, data, callOptions, pipeline) {
1310
+ return __awaiter(this, void 0, void 0, function* () {
1311
+ if (name !== 'FilesystemFileWrite') {
1312
+ throw new Error(`Protocol V2 file write pipeline does not support ${name}`);
1313
+ }
1314
+ if (this.pendingResponseAfterWrite) {
1315
+ throw new Error('Protocol V2 file write pipeline cannot start while a response is pending');
1316
+ }
1317
+ const { prepareCall, writeFrame, readFrame, generation = 0 } = this.options;
1318
+ const timeoutMs = resolveProtocolV2CallTimeoutMs(callOptions.timeoutMs);
1319
+ const abortController = new AbortController();
1320
+ const context = Object.assign(Object.assign({ messageName: name, timeoutMs, highThroughput: true }, (callOptions.writeWithResponse === undefined
1321
+ ? {}
1322
+ : { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
1323
+ let transportFailure;
1324
+ const withStepTimeout = (promise, stepTimeoutMs = timeoutMs) => withProtocolTimeout(promise, stepTimeoutMs, () => this.createCallTimeoutError(name, timeoutMs), () => {
1325
+ abortController.abort();
1326
+ }).catch((error) => {
1327
+ transportFailure = error;
1328
+ throw error;
1329
+ });
1330
+ let progressDeadline = 0;
1331
+ const markProgress = () => {
1332
+ progressDeadline = Date.now() + timeoutMs;
1333
+ };
1334
+ const inFlight = [];
1335
+ let path;
1336
+ let totalSize;
1337
+ let nextOffset;
1338
+ let sourceDone = false;
1339
+ let failure;
1340
+ let lastConfirmed;
1341
+ const sendChunk = (request) => __awaiter(this, void 0, void 0, function* () {
1342
+ const chunk = parseFileWriteChunk(request);
1343
+ if (path !== undefined && (chunk.path !== path || chunk.totalSize !== totalSize)) {
1344
+ throw new Error('Protocol V2 file write pipeline chunk belongs to a different file');
1345
+ }
1346
+ if (nextOffset !== undefined && chunk.offset !== nextOffset) {
1347
+ throw new Error(`Protocol V2 file write pipeline chunk out of order: expected offset ${nextOffset}, got ${chunk.offset}`);
1348
+ }
1349
+ path = chunk.path;
1350
+ totalSize = chunk.totalSize;
1351
+ nextOffset = chunk.end;
1352
+ const { seq, frame } = this.encodeRequestFrame(name, request);
1353
+ const writeStartedAt = Date.now();
1354
+ yield withStepTimeout(this.serializeWrite(() => writeFrame(frame, context)));
1355
+ inFlight.push({ seq, offset: chunk.offset, end: chunk.end });
1356
+ markProgress();
1357
+ this.reportWriteCompleted(callOptions, writeStartedAt, frame.byteLength);
1358
+ });
1359
+ const sendNextChunk = () => __awaiter(this, void 0, void 0, function* () {
1360
+ const request = yield pipeline.next();
1361
+ if (!request) {
1362
+ sourceDone = true;
1363
+ return;
1364
+ }
1365
+ yield sendChunk(request);
1366
+ });
1367
+ yield withStepTimeout(Promise.resolve().then(() => prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(context)));
1368
+ try {
1369
+ yield sendChunk(data);
1370
+ while (!sourceDone && inFlight.length < PROTOCOL_V2_FILE_WRITE_PIPELINE_WINDOW) {
1371
+ yield sendNextChunk();
1372
+ }
1373
+ while (inFlight.length > 0) {
1374
+ const rxFrame = yield withStepTimeout(readFrame(context), Math.max(progressDeadline - Date.now(), 1));
1375
+ const response = this.parseResponseFrame(rxFrame, inFlight.map(item => item.seq));
1376
+ if (!response) {
1377
+ }
1378
+ else if (response.type === 'FilesystemFile') {
1379
+ const [expected] = inFlight;
1380
+ const { message } = response;
1381
+ if (Number(message.processed_byte) !== expected.end ||
1382
+ message.path !== path ||
1383
+ Number(message.offset) !== expected.offset ||
1384
+ Number(message.total_size) !== totalSize) {
1385
+ throw new ProtocolV2LinkError('frame', `Protocol V2 file write response does not match chunk ${expected.offset}-${expected.end}: got offset ${String(message.offset)} processed_byte ${String(message.processed_byte)}`);
1386
+ }
1387
+ inFlight.shift();
1388
+ markProgress();
1389
+ if (!failure) {
1390
+ lastConfirmed = response;
1391
+ pipeline.onResponse(response);
1392
+ if (!sourceDone) {
1393
+ yield sendNextChunk();
1394
+ }
1395
+ }
1396
+ }
1397
+ else if (response.type === 'Failure') {
1398
+ inFlight.shift();
1399
+ markProgress();
1400
+ failure = failure !== null && failure !== void 0 ? failure : response;
1401
+ sourceDone = true;
1402
+ }
1403
+ else if (COMMON_TERMINAL_RESPONSE_TYPES.has(response.type)) {
1404
+ throw new ProtocolV2LinkError('frame', `Protocol V2 file write pipeline received unexpected ${response.type}`);
1405
+ }
1406
+ }
1407
+ }
1408
+ catch (error) {
1409
+ if (inFlight.length === 0 || error === transportFailure || isProtocolV2LinkError(error)) {
1410
+ throw error;
1411
+ }
1412
+ throw new ProtocolV2LinkError('frame', `Protocol V2 file write pipeline aborted with chunks in flight: ${getErrorMessage(error)}`, error);
1413
+ }
1414
+ const terminal = failure !== null && failure !== void 0 ? failure : lastConfirmed;
1415
+ if (!terminal) {
1416
+ throw new ProtocolV2LinkError('frame', 'Protocol V2 file write pipeline ended unconfirmed');
1417
+ }
1418
+ return terminal;
1419
+ });
1420
+ }
1274
1421
  }
1275
1422
  function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, shouldRethrow, }) {
1276
1423
  var _a, _b, _c;
@@ -2105,6 +2252,13 @@ exports.CommandFlags = void 0;
2105
2252
  CommandFlags[CommandFlags["Default"] = 0] = "Default";
2106
2253
  CommandFlags[CommandFlags["Factory_Only"] = 1] = "Factory_Only";
2107
2254
  })(exports.CommandFlags || (exports.CommandFlags = {}));
2255
+ exports.Enum_CanonicalBitcoinNetwork = void 0;
2256
+ (function (Enum_CanonicalBitcoinNetwork) {
2257
+ Enum_CanonicalBitcoinNetwork[Enum_CanonicalBitcoinNetwork["BITCOIN_MAINNET"] = 0] = "BITCOIN_MAINNET";
2258
+ Enum_CanonicalBitcoinNetwork[Enum_CanonicalBitcoinNetwork["BITCOIN_TESTNET"] = 1] = "BITCOIN_TESTNET";
2259
+ Enum_CanonicalBitcoinNetwork[Enum_CanonicalBitcoinNetwork["BITCOIN_SIGNET"] = 2] = "BITCOIN_SIGNET";
2260
+ Enum_CanonicalBitcoinNetwork[Enum_CanonicalBitcoinNetwork["BITCOIN_REGTEST"] = 3] = "BITCOIN_REGTEST";
2261
+ })(exports.Enum_CanonicalBitcoinNetwork || (exports.Enum_CanonicalBitcoinNetwork = {}));
2108
2262
  exports.MoneroNetworkType = void 0;
2109
2263
  (function (MoneroNetworkType) {
2110
2264
  MoneroNetworkType[MoneroNetworkType["MAINNET"] = 0] = "MAINNET";
@@ -2297,6 +2451,17 @@ exports.ViewSignLayout = void 0;
2297
2451
  ViewSignLayout[ViewSignLayout["LayoutFlat"] = 4] = "LayoutFlat";
2298
2452
  ViewSignLayout[ViewSignLayout["LayoutEthApprove"] = 5] = "LayoutEthApprove";
2299
2453
  })(exports.ViewSignLayout || (exports.ViewSignLayout = {}));
2454
+ exports.ZcashAddressType = void 0;
2455
+ (function (ZcashAddressType) {
2456
+ ZcashAddressType[ZcashAddressType["UNIFIED_ORCHARD_P2PKH"] = 0] = "UNIFIED_ORCHARD_P2PKH";
2457
+ ZcashAddressType[ZcashAddressType["TRANSPARENT_P2PKH"] = 1] = "TRANSPARENT_P2PKH";
2458
+ ZcashAddressType[ZcashAddressType["UNIFIED_ORCHARD"] = 2] = "UNIFIED_ORCHARD";
2459
+ })(exports.ZcashAddressType || (exports.ZcashAddressType = {}));
2460
+ exports.ZcashAddressScope = void 0;
2461
+ (function (ZcashAddressScope) {
2462
+ ZcashAddressScope[ZcashAddressScope["EXTERNAL"] = 0] = "EXTERNAL";
2463
+ ZcashAddressScope[ZcashAddressScope["INTERNAL"] = 1] = "INTERNAL";
2464
+ })(exports.ZcashAddressScope || (exports.ZcashAddressScope = {}));
2300
2465
  exports.ProtocolV2FailureType = void 0;
2301
2466
  (function (ProtocolV2FailureType) {
2302
2467
  ProtocolV2FailureType[ProtocolV2FailureType["Failure_InvalidMessage"] = 1] = "Failure_InvalidMessage";
@@ -2393,6 +2558,7 @@ var messages = /*#__PURE__*/Object.freeze({
2393
2558
  get TronResourceCode () { return exports.TronResourceCode; },
2394
2559
  get TronMessageType () { return exports.TronMessageType; },
2395
2560
  get CommandFlags () { return exports.CommandFlags; },
2561
+ get Enum_CanonicalBitcoinNetwork () { return exports.Enum_CanonicalBitcoinNetwork; },
2396
2562
  get MoneroNetworkType () { return exports.MoneroNetworkType; },
2397
2563
  get UiAnimationType () { return exports.UiAnimationType; },
2398
2564
  get UiAnimationCommand () { return exports.UiAnimationCommand; },
@@ -2417,6 +2583,8 @@ var messages = /*#__PURE__*/Object.freeze({
2417
2583
  get OnboardingSetupMethod () { return exports.OnboardingSetupMethod; },
2418
2584
  get ViewTipType () { return exports.ViewTipType; },
2419
2585
  get ViewSignLayout () { return exports.ViewSignLayout; },
2586
+ get ZcashAddressType () { return exports.ZcashAddressType; },
2587
+ get ZcashAddressScope () { return exports.ZcashAddressScope; },
2420
2588
  get ProtocolV2FailureType () { return exports.ProtocolV2FailureType; },
2421
2589
  get Enum_ProtocolV2Capability () { return exports.Enum_ProtocolV2Capability; }
2422
2590
  });
@@ -2424,28 +2592,39 @@ var messages = /*#__PURE__*/Object.freeze({
2424
2592
  const REDACTED = '[REDACTED]';
2425
2593
  const SENSITIVE_LOG_KEYS = new Set([
2426
2594
  'accesstoken',
2595
+ 'additionaltxpubkeys',
2427
2596
  'address',
2428
2597
  'apikey',
2429
2598
  'connectid',
2599
+ 'datachunk',
2430
2600
  'devicestate',
2431
2601
  'deviceid',
2602
+ 'enckey',
2432
2603
  'entropy',
2433
2604
  'expectedpassphrasestate',
2434
2605
  'mnemonic',
2606
+ 'outkey',
2435
2607
  'passphrase',
2436
2608
  'passphrasestate',
2437
2609
  'password',
2610
+ 'pczt',
2438
2611
  'pin',
2439
2612
  'privatekey',
2440
2613
  'publickey',
2441
2614
  'seed',
2615
+ 'secret',
2616
+ 'seedfingerprint',
2442
2617
  'serialnumber',
2443
2618
  'session',
2444
2619
  'sessionid',
2445
2620
  'signature',
2621
+ 'signedpczt',
2446
2622
  'token',
2623
+ 'txpubkey',
2624
+ 'ufvk',
2447
2625
  'uuid',
2448
2626
  'walletsessionid',
2627
+ 'watchkey',
2449
2628
  'xprv',
2450
2629
  'xpub',
2451
2630
  ]);
@@ -2458,7 +2637,8 @@ const isSensitiveLogKey = (key) => {
2458
2637
  normalizedKey.endsWith('publickey') ||
2459
2638
  normalizedKey.endsWith('signature'));
2460
2639
  };
2461
- const isSigningMessage = (messageName) => Boolean(messageName && /(?:sign|txack|transaction)/i.test(messageName));
2640
+ const isSigningMessage = (messageName) => Boolean(messageName && /(?:sign|txack|transaction|pczt)/i.test(messageName));
2641
+ const isMoneroSecretMessage = (messageName) => Boolean(messageName && /^Monero(?:KeyImage|GetTxKey|LiveRefresh)/.test(messageName));
2462
2642
  const redactLogValue = (value, seen) => {
2463
2643
  if (ArrayBuffer.isView(value)) {
2464
2644
  return `[BINARY:${value.byteLength}]`;
@@ -2486,7 +2666,7 @@ const redactLogValue = (value, seen) => {
2486
2666
  return redacted;
2487
2667
  };
2488
2668
  function getSafeTransportLogPayload(value, messageName) {
2489
- if (isSigningMessage(messageName)) {
2669
+ if (isSigningMessage(messageName) || isMoneroSecretMessage(messageName)) {
2490
2670
  return REDACTED;
2491
2671
  }
2492
2672
  return redactLogValue(value, new WeakSet());
@@ -2546,6 +2726,7 @@ exports.PROTOCOL_V2_CHANNEL_SOCKET = PROTOCOL_V2_CHANNEL_SOCKET;
2546
2726
  exports.PROTOCOL_V2_CHANNEL_USB = PROTOCOL_V2_CHANNEL_USB;
2547
2727
  exports.PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS = PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
2548
2728
  exports.PROTOCOL_V2_FILE_CHUNK_SIZE = PROTOCOL_V2_FILE_CHUNK_SIZE;
2729
+ exports.PROTOCOL_V2_FILE_WRITE_PIPELINE_WINDOW = PROTOCOL_V2_FILE_WRITE_PIPELINE_WINDOW;
2549
2730
  exports.PROTOCOL_V2_FRAME_MAX_BYTES = PROTOCOL_V2_FRAME_MAX_BYTES;
2550
2731
  exports.PROTOCOL_V2_PACKET_SRC_COMMAND = PROTOCOL_V2_PACKET_SRC_COMMAND;
2551
2732
  exports.PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = PROTOCOL_V2_SYS_MESSAGE_THRESHOLD;
@@ -1,7 +1,7 @@
1
1
  import { ProtocolV2FrameAssembler, concatUint8Arrays } from './frame-assembler';
2
2
  import { ProtocolV2SequenceCursor } from './sequence-cursor';
3
3
  import type { Root } from 'protobufjs/light';
4
- import type { MessageFromOneKey, TransportWriteMetrics } from '../../types';
4
+ import type { MessageFromOneKey, ProtocolV2FileWritePipeline, TransportWriteMetrics } from '../../types';
5
5
  export * from './errors';
6
6
  export type ProtocolV2Schemas = {
7
7
  protocolV1: Root;
@@ -42,6 +42,7 @@ export type ProtocolV2CallOptions = {
42
42
  returnAfterWrite?: boolean;
43
43
  onResponseAfterWrite?: (response: MessageFromOneKey) => void;
44
44
  writeWithResponse?: boolean;
45
+ fileWritePipeline?: ProtocolV2FileWritePipeline;
45
46
  };
46
47
  export { concatUint8Arrays, ProtocolV2FrameAssembler };
47
48
  export { ProtocolV2SequenceCursor };
@@ -66,7 +67,12 @@ export declare class ProtocolV2Session {
66
67
  call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
67
68
  sendFlowControl(name: string, data: Record<string, unknown>): Promise<MessageFromOneKey>;
68
69
  private serializeWrite;
70
+ private reportWriteCompleted;
71
+ private createCallTimeoutError;
69
72
  private executeCall;
73
+ private encodeRequestFrame;
74
+ private parseResponseFrame;
75
+ private executeFileWritePipeline;
70
76
  }
71
77
  export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, shouldRethrow, }: {
72
78
  call: (name: string, data: Record<string, unknown>, options?: ProtocolV2CallOptions) => Promise<MessageFromOneKey>;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAW7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,cAAc,UAAU,CAAC;AAEzB,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,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,KAAK,cAAc,GAA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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;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7C,oBAiCA"}
@@ -3416,6 +3416,23 @@ export declare enum CommandFlags {
3416
3416
  Default = 0,
3417
3417
  Factory_Only = 1
3418
3418
  }
3419
+ export declare enum Enum_CanonicalBitcoinNetwork {
3420
+ BITCOIN_MAINNET = 0,
3421
+ BITCOIN_TESTNET = 1,
3422
+ BITCOIN_SIGNET = 2,
3423
+ BITCOIN_REGTEST = 3
3424
+ }
3425
+ export type CanonicalBitcoinNetwork = keyof typeof Enum_CanonicalBitcoinNetwork;
3426
+ export type BabylonDeriveContextHash = {
3427
+ address_n: number[];
3428
+ script_type: InputScriptType;
3429
+ app_name: string;
3430
+ context: string;
3431
+ network: CanonicalBitcoinNetwork;
3432
+ };
3433
+ export type BabylonDerivedContextHash = {
3434
+ secret: string;
3435
+ };
3419
3436
  export type TextMemo = {
3420
3437
  text: string;
3421
3438
  };
@@ -3491,6 +3508,23 @@ export type UiAnimationRequest = {
3491
3508
  command: UiAnimationCommand;
3492
3509
  type?: UiAnimationType;
3493
3510
  };
3511
+ export type ZcashSignPczt = {
3512
+ pczt_length: number;
3513
+ pczt_initial_chunk: string;
3514
+ };
3515
+ export type ZcashPcztChunkRequest = {
3516
+ chunk_length: number;
3517
+ };
3518
+ export type ZcashPcztChunkAck = {
3519
+ data_chunk: string;
3520
+ };
3521
+ export type ZcashSignedPczt = {
3522
+ pczt_length: number;
3523
+ pczt_initial_chunk: string;
3524
+ };
3525
+ export type ZcashSignedPcztChunkRequest = {
3526
+ chunk_length: number;
3527
+ };
3494
3528
  export type experimental_message = {};
3495
3529
  export type experimental_field = {};
3496
3530
  export type ProtocolInfoRequest = {
@@ -4010,6 +4044,29 @@ export type ViewVerifyPage = {
4010
4044
  chain_id?: number;
4011
4045
  content?: ViewContentPreview;
4012
4046
  };
4047
+ export declare enum ZcashAddressType {
4048
+ UNIFIED_ORCHARD_P2PKH = 0,
4049
+ TRANSPARENT_P2PKH = 1,
4050
+ UNIFIED_ORCHARD = 2
4051
+ }
4052
+ export declare enum ZcashAddressScope {
4053
+ EXTERNAL = 0,
4054
+ INTERNAL = 1
4055
+ }
4056
+ export type ZcashGetAddress = {
4057
+ address_n: number[];
4058
+ show_display?: boolean;
4059
+ include_seed_fingerprint?: boolean;
4060
+ include_ufvk?: boolean;
4061
+ diversifier_index?: number;
4062
+ address_type?: ZcashAddressType;
4063
+ scope?: ZcashAddressScope;
4064
+ };
4065
+ export type ZcashAddress = {
4066
+ address: string;
4067
+ ufvk?: string;
4068
+ seed_fingerprint?: string;
4069
+ };
4013
4070
  export declare enum ProtocolV2FailureType {
4014
4071
  Failure_InvalidMessage = 1,
4015
4072
  Failure_UndefinedError = 2,
@@ -4604,6 +4661,8 @@ export type MessageType = {
4604
4661
  TronSignMessage: TronSignMessage;
4605
4662
  TronMessageSignature: TronMessageSignature;
4606
4663
  facotry: facotry;
4664
+ BabylonDeriveContextHash: BabylonDeriveContextHash;
4665
+ BabylonDerivedContextHash: BabylonDerivedContextHash;
4607
4666
  TextMemo: TextMemo;
4608
4667
  RefundMemo: RefundMemo;
4609
4668
  CoinPurchaseMemo: CoinPurchaseMemo;
@@ -4619,6 +4678,11 @@ export type MessageType = {
4619
4678
  UnlockPath: UnlockPath;
4620
4679
  UnlockedPathRequest: UnlockedPathRequest;
4621
4680
  UiAnimationRequest: UiAnimationRequest;
4681
+ ZcashSignPczt: ZcashSignPczt;
4682
+ ZcashPcztChunkRequest: ZcashPcztChunkRequest;
4683
+ ZcashPcztChunkAck: ZcashPcztChunkAck;
4684
+ ZcashSignedPczt: ZcashSignedPczt;
4685
+ ZcashSignedPcztChunkRequest: ZcashSignedPcztChunkRequest;
4622
4686
  experimental_message: experimental_message;
4623
4687
  experimental_field: experimental_field;
4624
4688
  ProtocolInfoRequest: ProtocolInfoRequest;
@@ -4695,6 +4759,8 @@ export type MessageType = {
4695
4759
  ViewSignPage: ViewSignPage;
4696
4760
  ViewWarningPage: ViewWarningPage;
4697
4761
  ViewVerifyPage: ViewVerifyPage;
4762
+ ZcashGetAddress: ZcashGetAddress;
4763
+ ZcashAddress: ZcashAddress;
4698
4764
  };
4699
4765
  export type MessageKey = keyof MessageType;
4700
4766
  export type MessageResponse<T extends MessageKey> = {