@bitboxswiss/bitbox-api 0.1.0 → 0.1.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.d.ts +334 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +451 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/connect-simulator.d.ts +2 -0
- package/dist/internal/connect-simulator.d.ts.map +1 -0
- package/dist/internal/connect-simulator.js +25 -0
- package/dist/internal/connect-simulator.js.map +1 -0
- package/dist/internal/connect.d.ts +2 -0
- package/dist/internal/connect.d.ts.map +1 -0
- package/dist/internal/connect.js +54 -0
- package/dist/internal/connect.js.map +1 -0
- package/dist/internal/constants.d.ts +2 -0
- package/dist/internal/constants.d.ts.map +1 -0
- package/dist/internal/constants.js +16 -0
- package/dist/internal/constants.js.map +1 -0
- package/dist/internal/device.d.ts +5 -0
- package/dist/internal/device.d.ts.map +1 -0
- package/dist/internal/device.js +40 -0
- package/dist/internal/device.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +220 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/eth/antiklepto.d.ts +5 -0
- package/dist/internal/eth/antiklepto.d.ts.map +1 -0
- package/dist/internal/eth/antiklepto.js +59 -0
- package/dist/internal/eth/antiklepto.js.map +1 -0
- package/dist/internal/eth/eip712.d.ts +25 -0
- package/dist/internal/eth/eip712.d.ts.map +1 -0
- package/dist/internal/eth/eip712.js +303 -0
- package/dist/internal/eth/eip712.js.map +1 -0
- package/dist/internal/eth/keypath.d.ts +4 -0
- package/dist/internal/eth/keypath.d.ts.map +1 -0
- package/dist/internal/eth/keypath.js +47 -0
- package/dist/internal/eth/keypath.js.map +1 -0
- package/dist/internal/eth/methods.d.ts +10 -0
- package/dist/internal/eth/methods.d.ts.map +1 -0
- package/dist/internal/eth/methods.js +250 -0
- package/dist/internal/eth/methods.js.map +1 -0
- package/dist/internal/eth/query.d.ts +7 -0
- package/dist/internal/eth/query.d.ts.map +1 -0
- package/dist/internal/eth/query.js +43 -0
- package/dist/internal/eth/query.js.map +1 -0
- package/dist/internal/eth/streaming.d.ts +4 -0
- package/dist/internal/eth/streaming.d.ts.map +1 -0
- package/dist/internal/eth/streaming.js +21 -0
- package/dist/internal/eth/streaming.js.map +1 -0
- package/dist/internal/eth/version.d.ts +9 -0
- package/dist/internal/eth/version.d.ts.map +1 -0
- package/dist/internal/eth/version.js +10 -0
- package/dist/internal/eth/version.js.map +1 -0
- package/dist/internal/hww.d.ts +2 -0
- package/dist/internal/hww.d.ts.map +1 -0
- package/dist/internal/hww.js +236 -0
- package/dist/internal/hww.js.map +1 -0
- package/dist/internal/message-queue.d.ts +2 -0
- package/dist/internal/message-queue.d.ts.map +1 -0
- package/dist/internal/message-queue.js +29 -0
- package/dist/internal/message-queue.js.map +1 -0
- package/dist/internal/noise-config.d.ts +2 -0
- package/dist/internal/noise-config.d.ts.map +1 -0
- package/dist/internal/noise-config.js +160 -0
- package/dist/internal/noise-config.js.map +1 -0
- package/dist/internal/noise.d.ts +2 -0
- package/dist/internal/noise.d.ts.map +1 -0
- package/dist/internal/noise.js +270 -0
- package/dist/internal/noise.js.map +1 -0
- package/dist/internal/pairing.d.ts +2 -0
- package/dist/internal/pairing.d.ts.map +1 -0
- package/dist/internal/pairing.js +130 -0
- package/dist/internal/pairing.js.map +1 -0
- package/dist/internal/read-write.d.ts +2 -0
- package/dist/internal/read-write.d.ts.map +1 -0
- package/dist/internal/read-write.js +40 -0
- package/dist/internal/read-write.js.map +1 -0
- package/dist/internal/restore.d.ts +3 -0
- package/dist/internal/restore.d.ts.map +1 -0
- package/dist/internal/restore.js +27 -0
- package/dist/internal/restore.js.map +1 -0
- package/dist/internal/transport-bridge.d.ts +2 -0
- package/dist/internal/transport-bridge.d.ts.map +1 -0
- package/dist/internal/transport-bridge.js +97 -0
- package/dist/internal/transport-bridge.js.map +1 -0
- package/dist/internal/transport-simulator.d.ts +2 -0
- package/dist/internal/transport-simulator.d.ts.map +1 -0
- package/dist/internal/transport-simulator.js +83 -0
- package/dist/internal/transport-simulator.js.map +1 -0
- package/dist/internal/transport-webhid.d.ts +2 -0
- package/dist/internal/transport-webhid.d.ts.map +1 -0
- package/dist/internal/transport-webhid.js +69 -0
- package/dist/internal/transport-webhid.js.map +1 -0
- package/dist/internal/u2f-framing.d.ts +2 -0
- package/dist/internal/u2f-framing.d.ts.map +1 -0
- package/dist/internal/u2f-framing.js +155 -0
- package/dist/internal/u2f-framing.js.map +1 -0
- package/dist/internal/utils.d.ts +2 -0
- package/dist/internal/utils.d.ts.map +1 -0
- package/dist/internal/utils.js +71 -0
- package/dist/internal/utils.js.map +1 -0
- package/dist/proto/gen/antiklepto_pb.d.ts +49 -0
- package/dist/proto/gen/antiklepto_pb.d.ts.map +1 -0
- package/dist/proto/gen/antiklepto_pb.js +22 -0
- package/dist/proto/gen/antiklepto_pb.js.map +1 -0
- package/dist/proto/gen/backup_commands_pb.d.ts +124 -0
- package/dist/proto/gen/backup_commands_pb.d.ts.map +1 -0
- package/dist/proto/gen/backup_commands_pb.js +42 -0
- package/dist/proto/gen/backup_commands_pb.js.map +1 -0
- package/dist/proto/gen/backup_pb.d.ts +150 -0
- package/dist/proto/gen/backup_pb.d.ts.map +1 -0
- package/dist/proto/gen/backup_pb.js +46 -0
- package/dist/proto/gen/backup_pb.js.map +1 -0
- package/dist/proto/gen/bitbox02_system_pb.d.ts +207 -0
- package/dist/proto/gen/bitbox02_system_pb.d.ts.map +1 -0
- package/dist/proto/gen/bitbox02_system_pb.js +80 -0
- package/dist/proto/gen/bitbox02_system_pb.js.map +1 -0
- package/dist/proto/gen/bluetooth_pb.d.ts +135 -0
- package/dist/proto/gen/bluetooth_pb.d.ts.map +1 -0
- package/dist/proto/gen/bluetooth_pb.js +42 -0
- package/dist/proto/gen/bluetooth_pb.js.map +1 -0
- package/dist/proto/gen/btc_pb.d.ts +1166 -0
- package/dist/proto/gen/btc_pb.d.ts.map +1 -0
- package/dist/proto/gen/btc_pb.js +442 -0
- package/dist/proto/gen/btc_pb.js.map +1 -0
- package/dist/proto/gen/cardano_pb.d.ts +504 -0
- package/dist/proto/gen/cardano_pb.d.ts.map +1 -0
- package/dist/proto/gen/cardano_pb.js +142 -0
- package/dist/proto/gen/cardano_pb.js.map +1 -0
- package/dist/proto/gen/common_pb.d.ts +129 -0
- package/dist/proto/gen/common_pb.d.ts.map +1 -0
- package/dist/proto/gen/common_pb.js +42 -0
- package/dist/proto/gen/common_pb.js.map +1 -0
- package/dist/proto/gen/eth_pb.d.ts +662 -0
- package/dist/proto/gen/eth_pb.d.ts.map +1 -0
- package/dist/proto/gen/eth_pb.js +221 -0
- package/dist/proto/gen/eth_pb.js.map +1 -0
- package/dist/proto/gen/hww_pb.d.ts +349 -0
- package/dist/proto/gen/hww_pb.d.ts.map +1 -0
- package/dist/proto/gen/hww_pb.js +38 -0
- package/dist/proto/gen/hww_pb.js.map +1 -0
- package/dist/proto/gen/keystore_pb.d.ts +108 -0
- package/dist/proto/gen/keystore_pb.d.ts.map +1 -0
- package/dist/proto/gen/keystore_pb.js +33 -0
- package/dist/proto/gen/keystore_pb.js.map +1 -0
- package/dist/proto/gen/mnemonic_pb.d.ts +48 -0
- package/dist/proto/gen/mnemonic_pb.d.ts.map +1 -0
- package/dist/proto/gen/mnemonic_pb.js +22 -0
- package/dist/proto/gen/mnemonic_pb.js.map +1 -0
- package/dist/proto/gen/perform_attestation_pb.d.ts +57 -0
- package/dist/proto/gen/perform_attestation_pb.d.ts.map +1 -0
- package/dist/proto/gen/perform_attestation_pb.js +17 -0
- package/dist/proto/gen/perform_attestation_pb.js.map +1 -0
- package/dist/proto/gen/system_pb.d.ts +38 -0
- package/dist/proto/gen/system_pb.d.ts.map +1 -0
- package/dist/proto/gen/system_pb.js +30 -0
- package/dist/proto/gen/system_pb.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import * as net from 'node:net';
|
|
3
|
+
import { SIMULATOR_DEFAULT_ENDPOINT } from './constants.js';
|
|
4
|
+
import { MessageQueue } from './message-queue.js';
|
|
5
|
+
import { TransportError, makeCloseGuard } from './read-write.js';
|
|
6
|
+
import { sleep } from './utils.js';
|
|
7
|
+
// Rust's try_connect (simulator.rs:35-43) uses 200 * 10ms = 2s; Node + cold
|
|
8
|
+
// sim starts occasionally exceed that, so give ourselves a 5s window.
|
|
9
|
+
const CONNECT_ATTEMPTS = 500;
|
|
10
|
+
const CONNECT_ATTEMPT_SLEEP_MS = 10;
|
|
11
|
+
function attemptConnect(host, port) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const s = net.createConnection({ host, port });
|
|
14
|
+
const onError = (err) => {
|
|
15
|
+
s.removeListener('connect', onConnect);
|
|
16
|
+
s.destroy();
|
|
17
|
+
reject(err);
|
|
18
|
+
};
|
|
19
|
+
const onConnect = () => {
|
|
20
|
+
s.removeListener('error', onError);
|
|
21
|
+
resolve(s);
|
|
22
|
+
};
|
|
23
|
+
s.once('error', onError);
|
|
24
|
+
s.once('connect', onConnect);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Open a TCP connection to a BitBox02 simulator. Mirrors
|
|
29
|
+
* `bitbox-api-rs/src/simulator.rs` `try_connect` with a ~2s retry window.
|
|
30
|
+
*
|
|
31
|
+
* The simulator speaks raw U2F HID framing over TCP (64-byte reads on the
|
|
32
|
+
* Rust side). Wrap the returned transport in `U2fHidCommunication`.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export async function openSimulator(endpoint = SIMULATOR_DEFAULT_ENDPOINT, onCloseCb) {
|
|
36
|
+
const colon = endpoint.lastIndexOf(':');
|
|
37
|
+
if (colon < 0) {
|
|
38
|
+
throw new TransportError('simulator', `invalid endpoint ${endpoint}`);
|
|
39
|
+
}
|
|
40
|
+
const host = endpoint.slice(0, colon);
|
|
41
|
+
const port = Number(endpoint.slice(colon + 1));
|
|
42
|
+
if (!Number.isFinite(port)) {
|
|
43
|
+
throw new TransportError('simulator', `invalid endpoint port in ${endpoint}`);
|
|
44
|
+
}
|
|
45
|
+
let socket = null;
|
|
46
|
+
for (let i = 0; i < CONNECT_ATTEMPTS; i += 1) {
|
|
47
|
+
try {
|
|
48
|
+
socket = await attemptConnect(host, port);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
await sleep(CONNECT_ATTEMPT_SLEEP_MS);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (socket === null) {
|
|
56
|
+
throw new TransportError('simulator', `could not connect to ${endpoint}`);
|
|
57
|
+
}
|
|
58
|
+
const s = socket;
|
|
59
|
+
const queue = new MessageQueue();
|
|
60
|
+
const guard = makeCloseGuard(onCloseCb);
|
|
61
|
+
s.on('data', (chunk) => {
|
|
62
|
+
queue.push(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
63
|
+
});
|
|
64
|
+
s.on('close', () => { guard(); });
|
|
65
|
+
s.on('end', () => { guard(); });
|
|
66
|
+
s.on('error', () => { guard(); });
|
|
67
|
+
return {
|
|
68
|
+
write(bytes) {
|
|
69
|
+
s.write(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength));
|
|
70
|
+
},
|
|
71
|
+
read() {
|
|
72
|
+
return queue.next();
|
|
73
|
+
},
|
|
74
|
+
close() {
|
|
75
|
+
// RST close (instead of graceful FIN). Avoids leaving the simulator's
|
|
76
|
+
// listening port in TIME_WAIT, which blocks the next test file from
|
|
77
|
+
// rebinding 127.0.0.1:15423 back-to-back.
|
|
78
|
+
s.resetAndDestroy();
|
|
79
|
+
guard();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=transport-simulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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I,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAElC,OAAO;QACL,KAAK,CAAC,KAAiB;YACrB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,IAAI;YACF,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,KAAK;YACH,sEAAsE;YACtE,oEAAoE;YACpE,0CAA0C;YAC1C,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,EAAE,CAAC;QACV,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-webhid.d.ts","sourceRoot":"","sources":["../../src/internal/transport-webhid.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { BITBOX02_PRODUCT_PREFIX, PRODUCT_ID, VENDOR_ID } from './constants.js';
|
|
3
|
+
import { MessageQueue } from './message-queue.js';
|
|
4
|
+
import { TransportError, makeCloseGuard } from './read-write.js';
|
|
5
|
+
function hidFrom(nav) {
|
|
6
|
+
const h = nav?.hid;
|
|
7
|
+
if (h === undefined) {
|
|
8
|
+
throw new TransportError('webhid', 'WebHID is not available in this environment');
|
|
9
|
+
}
|
|
10
|
+
return h;
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
export async function openWebHID(onCloseCb, hid = hidFrom(globalThis.navigator)) {
|
|
14
|
+
const filters = [{ vendorId: VENDOR_ID, productId: PRODUCT_ID }];
|
|
15
|
+
let device;
|
|
16
|
+
try {
|
|
17
|
+
let devices = await hid.getDevices({ filters });
|
|
18
|
+
if (devices.length === 0) {
|
|
19
|
+
devices = await hid.requestDevice({ filters });
|
|
20
|
+
}
|
|
21
|
+
device = devices[0];
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new TransportError('webhid-cancel', 'no BitBox02 selected');
|
|
25
|
+
}
|
|
26
|
+
if (device === undefined || !device.productName.includes(BITBOX02_PRODUCT_PREFIX)) {
|
|
27
|
+
throw new TransportError('webhid-cancel', 'no BitBox02 selected');
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
await device.open();
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const reason = err instanceof Error && err.message ? `: ${err.message}` : '';
|
|
34
|
+
throw new TransportError('webhid', `failed to open HID device${reason}`);
|
|
35
|
+
}
|
|
36
|
+
const queue = new MessageQueue();
|
|
37
|
+
const guard = makeCloseGuard(onCloseCb);
|
|
38
|
+
const onInputReport = (e) => {
|
|
39
|
+
queue.push(new Uint8Array(e.data.buffer, e.data.byteOffset, e.data.byteLength));
|
|
40
|
+
};
|
|
41
|
+
device.addEventListener('inputreport', onInputReport);
|
|
42
|
+
// The WebHID API delivers device-specific disconnect events at the HID
|
|
43
|
+
// level, not the device level, so this listener fires for every matching
|
|
44
|
+
// VID/PID device. Matches `webhid.js`.
|
|
45
|
+
const onDisconnect = (e) => {
|
|
46
|
+
if (e.device === device) {
|
|
47
|
+
guard();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
hid.addEventListener('disconnect', onDisconnect);
|
|
51
|
+
return {
|
|
52
|
+
write(bytes) {
|
|
53
|
+
if (!device.opened) {
|
|
54
|
+
throw new TransportError('write', 'HID device is closed');
|
|
55
|
+
}
|
|
56
|
+
void device.sendReport(0, bytes);
|
|
57
|
+
},
|
|
58
|
+
read() {
|
|
59
|
+
return queue.next();
|
|
60
|
+
},
|
|
61
|
+
close() {
|
|
62
|
+
device.removeEventListener('inputreport', onInputReport);
|
|
63
|
+
hid.removeEventListener('disconnect', onDisconnect);
|
|
64
|
+
void device.close();
|
|
65
|
+
guard();
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=transport-webhid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-webhid.js","sourceRoot":"","sources":["../../src/internal/transport-webhid.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAyCjE,SAAS,OAAO,CAAC,GAAY;IAC3B,MAAM,CAAC,GAAI,GAAwC,EAAE,GAAG,CAAC;IACzD,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACpB,MAAM,IAAI,cAAc,CAAC,QAAQ,EAAE,6CAA6C,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,SAAsB,EACtB,MAAW,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;IAExC,MAAM,OAAO,GAAgB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;IAE9E,IAAI,MAA6B,CAAC;IAClC,IAAI,CA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IACF,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAEtD,uEAAuE;IACvE,yEAAyE;IACzE,uCAAuC;IACvC,MAAM,YAAY,GAAG,CAAC,CAAqB,EAAQ,EAAE;QACnD,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACxB,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC,CAAC;IACF,GAAG,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IAEjD,OAAO;QACL,KAAK,CAAC,KAAiB;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,IAAI,cAAc,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;YAC5D,CAAC;YACD,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;QACD,IAAI;YACF,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,KAAK;YACH,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;YACzD,GAAG,CAAC,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YACpD,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,KAAK,EAAE,CAAC;QACV,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"u2f-framing.d.ts","sourceRoot":"","sources":["../../src/internal/u2f-framing.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { TransportError } from './read-write.js';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export const HEADER_INIT_LEN = 7;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export const HEADER_CONT_LEN = 5;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const PACKET_SIZE = 64;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const MAX_LEN = 129 * PACKET_SIZE;
|
|
11
|
+
const MAX_PAYLOAD = PACKET_SIZE - HEADER_INIT_LEN + 128 * (PACKET_SIZE - HEADER_CONT_LEN);
|
|
12
|
+
const MAX_WS_PAYLOAD = MAX_LEN - HEADER_INIT_LEN;
|
|
13
|
+
/**
|
|
14
|
+
* Total buffer length an encoded message occupies, counting the padding that
|
|
15
|
+
* fills each 64-byte HID packet. Mirrors
|
|
16
|
+
* `bitbox-api-rs/src/u2fframing.rs:163-170`.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export function getEncodedLen(len) {
|
|
20
|
+
if (len < PACKET_SIZE - HEADER_INIT_LEN) {
|
|
21
|
+
return PACKET_SIZE;
|
|
22
|
+
}
|
|
23
|
+
const remainder = len - (PACKET_SIZE - HEADER_INIT_LEN);
|
|
24
|
+
return PACKET_SIZE + PACKET_SIZE * Math.ceil(remainder / (PACKET_SIZE - HEADER_CONT_LEN));
|
|
25
|
+
}
|
|
26
|
+
function viewOf(buf) {
|
|
27
|
+
return new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
export function parseHeader(buf) {
|
|
31
|
+
if (buf.length < HEADER_INIT_LEN) {
|
|
32
|
+
throw new TransportError('u2f-decode', 'buffer too short for header');
|
|
33
|
+
}
|
|
34
|
+
const v = viewOf(buf);
|
|
35
|
+
return {
|
|
36
|
+
cid: v.getUint32(0, false),
|
|
37
|
+
cmd: v.getUint8(4),
|
|
38
|
+
len: v.getUint16(5, false),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns the CID used for every frame. Hardcoded to match
|
|
43
|
+
* `bitbox-api-rs/src/u2fframing.rs:68-70` so the existing test vectors apply
|
|
44
|
+
* byte-for-byte.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export function generateCid() {
|
|
48
|
+
return 0xff00ff00;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* U2F HID framing: splits a payload across 64-byte packets with one initial
|
|
52
|
+
* header and sequenced continuation headers. Mirrors Rust `U2fHid`.
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export class U2fHid {
|
|
56
|
+
cid;
|
|
57
|
+
cmd;
|
|
58
|
+
constructor(cmd, cid = generateCid()) {
|
|
59
|
+
this.cmd = cmd;
|
|
60
|
+
this.cid = cid;
|
|
61
|
+
}
|
|
62
|
+
encode(message) {
|
|
63
|
+
if (message.length > MAX_PAYLOAD) {
|
|
64
|
+
throw new TransportError('u2f-decode', 'message exceeds U2F HID max payload');
|
|
65
|
+
}
|
|
66
|
+
const encLen = getEncodedLen(message.length);
|
|
67
|
+
const buf = new Uint8Array(encLen);
|
|
68
|
+
const v = viewOf(buf);
|
|
69
|
+
v.setUint32(0, this.cid, false);
|
|
70
|
+
buf[4] = this.cmd;
|
|
71
|
+
v.setUint16(5, message.length, false);
|
|
72
|
+
const firstPayload = Math.min(PACKET_SIZE - HEADER_INIT_LEN, message.length);
|
|
73
|
+
buf.set(message.subarray(0, firstPayload), HEADER_INIT_LEN);
|
|
74
|
+
let msgOffset = firstPayload;
|
|
75
|
+
let pktOffset = PACKET_SIZE;
|
|
76
|
+
let seq = 0;
|
|
77
|
+
while (msgOffset < message.length) {
|
|
78
|
+
if (seq > 127) {
|
|
79
|
+
throw new TransportError('u2f-decode', 'too many U2F continuation frames');
|
|
80
|
+
}
|
|
81
|
+
v.setUint32(pktOffset, this.cid, false);
|
|
82
|
+
buf[pktOffset + 4] = seq;
|
|
83
|
+
const chunkLen = Math.min(PACKET_SIZE - HEADER_CONT_LEN, message.length - msgOffset);
|
|
84
|
+
buf.set(message.subarray(msgOffset, msgOffset + chunkLen), pktOffset + HEADER_CONT_LEN);
|
|
85
|
+
msgOffset += chunkLen;
|
|
86
|
+
pktOffset += PACKET_SIZE;
|
|
87
|
+
seq += 1;
|
|
88
|
+
}
|
|
89
|
+
return buf;
|
|
90
|
+
}
|
|
91
|
+
decode(buf) {
|
|
92
|
+
const { cid, cmd, len } = parseHeader(buf);
|
|
93
|
+
if (cid !== this.cid) {
|
|
94
|
+
throw new TransportError('u2f-decode', 'wrong CID');
|
|
95
|
+
}
|
|
96
|
+
if (cmd !== this.cmd) {
|
|
97
|
+
throw new TransportError('u2f-decode', 'wrong CMD');
|
|
98
|
+
}
|
|
99
|
+
if (buf.length < getEncodedLen(len)) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const res = new Uint8Array(len);
|
|
103
|
+
const firstLen = Math.min(PACKET_SIZE - HEADER_INIT_LEN, len);
|
|
104
|
+
res.set(buf.subarray(HEADER_INIT_LEN, HEADER_INIT_LEN + firstLen), 0);
|
|
105
|
+
let resOffset = firstLen;
|
|
106
|
+
let pktOffset = PACKET_SIZE;
|
|
107
|
+
while (resOffset < len) {
|
|
108
|
+
const chunkLen = Math.min(PACKET_SIZE - HEADER_CONT_LEN, len - resOffset);
|
|
109
|
+
res.set(buf.subarray(pktOffset + HEADER_CONT_LEN, pktOffset + HEADER_CONT_LEN + chunkLen), resOffset);
|
|
110
|
+
resOffset += chunkLen;
|
|
111
|
+
pktOffset += PACKET_SIZE;
|
|
112
|
+
}
|
|
113
|
+
return res;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* U2F WebSocket framing: single header + payload in one frame. The bridge
|
|
118
|
+
* uses this over the WebSocket instead of HID packet segmentation.
|
|
119
|
+
* Mirrors Rust `U2fWs`.
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
export class U2fWs {
|
|
123
|
+
cid;
|
|
124
|
+
cmd;
|
|
125
|
+
constructor(cmd, cid = generateCid()) {
|
|
126
|
+
this.cmd = cmd;
|
|
127
|
+
this.cid = cid;
|
|
128
|
+
}
|
|
129
|
+
encode(message) {
|
|
130
|
+
if (message.length > MAX_WS_PAYLOAD) {
|
|
131
|
+
throw new TransportError('u2f-decode', 'message exceeds U2F WS max payload');
|
|
132
|
+
}
|
|
133
|
+
const buf = new Uint8Array(HEADER_INIT_LEN + message.length);
|
|
134
|
+
const v = viewOf(buf);
|
|
135
|
+
v.setUint32(0, this.cid, false);
|
|
136
|
+
buf[4] = this.cmd;
|
|
137
|
+
v.setUint16(5, message.length, false);
|
|
138
|
+
buf.set(message, HEADER_INIT_LEN);
|
|
139
|
+
return buf;
|
|
140
|
+
}
|
|
141
|
+
decode(buf) {
|
|
142
|
+
const { cid, cmd, len } = parseHeader(buf);
|
|
143
|
+
if (cid !== this.cid) {
|
|
144
|
+
throw new TransportError('u2f-decode', 'wrong CID');
|
|
145
|
+
}
|
|
146
|
+
if (cmd !== this.cmd) {
|
|
147
|
+
throw new TransportError('u2f-decode', 'wrong CMD');
|
|
148
|
+
}
|
|
149
|
+
if (buf.length < HEADER_INIT_LEN + len) {
|
|
150
|
+
throw new TransportError('u2f-decode', 'invalid length');
|
|
151
|
+
}
|
|
152
|
+
return buf.slice(HEADER_INIT_LEN, HEADER_INIT_LEN + len);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=u2f-framing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"u2f-framing.js","sourceRoot":"","sources":["../../src/internal/u2f-framing.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,gBAAgB;AAChB,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,gBAAgB;AAChB,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,GAAG,WAAW,CAAC;AAEzC,MAAM,WAAW,GAAG,WAA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,CAAC;QAClC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,CAAC,GAAe;QACpB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YACrB,MAAM,IAAI,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YACrB,MAAM,IAAI,cAAc,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,GAAG,eAAe,GAAG,GAAG,EAAE,CAAC;YACvC,MAAM,IAAI,cAAc,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,eAAe,GAAG,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
export { concatBytes, hexToBytes, utf8ToBytes } from '@noble/hashes/utils';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export function sleep(ms) {
|
|
5
|
+
return new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
6
|
+
}
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function bytesToBigIntBE(bytes) {
|
|
9
|
+
let n = 0n;
|
|
10
|
+
for (const b of bytes) {
|
|
11
|
+
n = (n << 8n) | BigInt(b);
|
|
12
|
+
}
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Big-endian minimal-bytes encoding of a non-negative integer. `0n` returns
|
|
17
|
+
* an empty byte array.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export function bigUintToBytesBE(n) {
|
|
21
|
+
if (n < 0n) {
|
|
22
|
+
throw new RangeError('bigUintToBytesBE: expected non-negative bigint');
|
|
23
|
+
}
|
|
24
|
+
if (n === 0n) {
|
|
25
|
+
return new Uint8Array(0);
|
|
26
|
+
}
|
|
27
|
+
const bytes = [];
|
|
28
|
+
let v = n;
|
|
29
|
+
while (v > 0n) {
|
|
30
|
+
bytes.unshift(Number(v & 0xffn));
|
|
31
|
+
v >>= 8n;
|
|
32
|
+
}
|
|
33
|
+
return new Uint8Array(bytes);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Two's-complement signed minimal-bytes encoding. `0n` returns `[0x00]`.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function bigIntToSignedBytesBE(n) {
|
|
40
|
+
if (n === 0n) {
|
|
41
|
+
return new Uint8Array([0]);
|
|
42
|
+
}
|
|
43
|
+
if (n > 0n) {
|
|
44
|
+
const bytes = [];
|
|
45
|
+
let v = n;
|
|
46
|
+
while (v > 0n) {
|
|
47
|
+
bytes.unshift(Number(v & 0xffn));
|
|
48
|
+
v >>= 8n;
|
|
49
|
+
}
|
|
50
|
+
if ((bytes[0] & 0x80) !== 0) {
|
|
51
|
+
bytes.unshift(0);
|
|
52
|
+
}
|
|
53
|
+
return new Uint8Array(bytes);
|
|
54
|
+
}
|
|
55
|
+
let v = n;
|
|
56
|
+
const bytes = [];
|
|
57
|
+
while (v !== -1n || bytes.length === 0 || (bytes[0] & 0x80) === 0) {
|
|
58
|
+
bytes.unshift(Number(v & 0xffn));
|
|
59
|
+
v >>= 8n;
|
|
60
|
+
}
|
|
61
|
+
return new Uint8Array(bytes);
|
|
62
|
+
}
|
|
63
|
+
/** @internal */
|
|
64
|
+
export function stripLeadingZeroes(input) {
|
|
65
|
+
let i = 0;
|
|
66
|
+
while (i < input.length && input[i] === 0) {
|
|
67
|
+
i += 1;
|
|
68
|
+
}
|
|
69
|
+
return input.subarray(i);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE3E,gBAAgB;AAChB,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACX,MAAM,IAAI,UAAU,CAAC,gDAAgD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QACb,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACd,KAAK,CAAC,OAAO,CAAC,MAAM,CAA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iB;IAClD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1C,CAAC,IAAI,CAAC,CAAC;IACT,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file antiklepto.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_antiklepto: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message shiftcrypto.bitbox02.AntiKleptoHostNonceCommitment
|
|
9
|
+
*/
|
|
10
|
+
export type AntiKleptoHostNonceCommitment = Message<"shiftcrypto.bitbox02.AntiKleptoHostNonceCommitment"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: bytes commitment = 1;
|
|
13
|
+
*/
|
|
14
|
+
commitment: Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoHostNonceCommitment.
|
|
18
|
+
* Use `create(AntiKleptoHostNonceCommitmentSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export declare const AntiKleptoHostNonceCommitmentSchema: GenMessage<AntiKleptoHostNonceCommitment>;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from message shiftcrypto.bitbox02.AntiKleptoSignerCommitment
|
|
23
|
+
*/
|
|
24
|
+
export type AntiKleptoSignerCommitment = Message<"shiftcrypto.bitbox02.AntiKleptoSignerCommitment"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: bytes commitment = 1;
|
|
27
|
+
*/
|
|
28
|
+
commitment: Uint8Array;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoSignerCommitment.
|
|
32
|
+
* Use `create(AntiKleptoSignerCommitmentSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export declare const AntiKleptoSignerCommitmentSchema: GenMessage<AntiKleptoSignerCommitment>;
|
|
35
|
+
/**
|
|
36
|
+
* @generated from message shiftcrypto.bitbox02.AntiKleptoSignatureRequest
|
|
37
|
+
*/
|
|
38
|
+
export type AntiKleptoSignatureRequest = Message<"shiftcrypto.bitbox02.AntiKleptoSignatureRequest"> & {
|
|
39
|
+
/**
|
|
40
|
+
* @generated from field: bytes host_nonce = 1;
|
|
41
|
+
*/
|
|
42
|
+
hostNonce: Uint8Array;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoSignatureRequest.
|
|
46
|
+
* Use `create(AntiKleptoSignatureRequestSchema)` to create a new message.
|
|
47
|
+
*/
|
|
48
|
+
export declare const AntiKleptoSignatureRequestSchema: GenMessage<AntiKleptoSignatureRequest>;
|
|
49
|
+
//# sourceMappingURL=antiklepto_pb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antiklepto_pb.d.ts","sourceRoot":"","sources":["../../../src/proto/gen/antiklepto_pb.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAC4P,CAAC;AAE3R;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,OAAO,CAAC,oDAAoD,CAAC,GAAG;IAC1G;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mCAAmC,EAAE,UAAU,CAAC,6BAA6B,CACzD,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,iDAAiD,CAAC,GAAG;IACpG;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,UAAU,CAAC,0BAA0B,CACnD,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,iDAAiD,CAAC,GAAG;IACpG;;OAEG;IACH,SAAS,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,UAAU,CAAC,0BAA0B,CACnD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file antiklepto.proto.
|
|
5
|
+
*/
|
|
6
|
+
export const file_antiklepto = /*@__PURE__*/ fileDesc("ChBhbnRpa2xlcHRvLnByb3RvEhRzaGlmdGNyeXB0by5iaXRib3gwMiIzCh1BbnRpS2xlcHRvSG9zdE5vbmNlQ29tbWl0bWVudBISCgpjb21taXRtZW50GAEgASgMIjAKGkFudGlLbGVwdG9TaWduZXJDb21taXRtZW50EhIKCmNvbW1pdG1lbnQYASABKAwiMAoaQW50aUtsZXB0b1NpZ25hdHVyZVJlcXVlc3QSEgoKaG9zdF9ub25jZRgBIAEoDGIGcHJvdG8z");
|
|
7
|
+
/**
|
|
8
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoHostNonceCommitment.
|
|
9
|
+
* Use `create(AntiKleptoHostNonceCommitmentSchema)` to create a new message.
|
|
10
|
+
*/
|
|
11
|
+
export const AntiKleptoHostNonceCommitmentSchema = /*@__PURE__*/ messageDesc(file_antiklepto, 0);
|
|
12
|
+
/**
|
|
13
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoSignerCommitment.
|
|
14
|
+
* Use `create(AntiKleptoSignerCommitmentSchema)` to create a new message.
|
|
15
|
+
*/
|
|
16
|
+
export const AntiKleptoSignerCommitmentSchema = /*@__PURE__*/ messageDesc(file_antiklepto, 1);
|
|
17
|
+
/**
|
|
18
|
+
* Describes the message shiftcrypto.bitbox02.AntiKleptoSignatureRequest.
|
|
19
|
+
* Use `create(AntiKleptoSignatureRequestSchema)` to create a new message.
|
|
20
|
+
*/
|
|
21
|
+
export const AntiKleptoSignatureRequestSchema = /*@__PURE__*/ messageDesc(file_antiklepto, 2);
|
|
22
|
+
//# sourceMappingURL=antiklepto_pb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antiklepto_pb.js","sourceRoot":"","sources":["../../../src/proto/gen/antiklepto_pb.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAOtC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGrE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAY,aAAa,CACnD,QAAQ,CAAC,8QAA8Q,CAAC,CAAC;AAY3R;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAA8C,aAAa,CACzG,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AAYlC;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA2C,aAAa,CACnG,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AAYlC;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA2C,aAAa,CACnG,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file backup_commands.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_backup_commands: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message shiftcrypto.bitbox02.CheckBackupRequest
|
|
9
|
+
*/
|
|
10
|
+
export type CheckBackupRequest = Message<"shiftcrypto.bitbox02.CheckBackupRequest"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: bool silent = 1;
|
|
13
|
+
*/
|
|
14
|
+
silent: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message shiftcrypto.bitbox02.CheckBackupRequest.
|
|
18
|
+
* Use `create(CheckBackupRequestSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CheckBackupRequestSchema: GenMessage<CheckBackupRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from message shiftcrypto.bitbox02.CheckBackupResponse
|
|
23
|
+
*/
|
|
24
|
+
export type CheckBackupResponse = Message<"shiftcrypto.bitbox02.CheckBackupResponse"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: string id = 1;
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message shiftcrypto.bitbox02.CheckBackupResponse.
|
|
32
|
+
* Use `create(CheckBackupResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export declare const CheckBackupResponseSchema: GenMessage<CheckBackupResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Timestamp must be in UTC
|
|
37
|
+
*
|
|
38
|
+
* @generated from message shiftcrypto.bitbox02.CreateBackupRequest
|
|
39
|
+
*/
|
|
40
|
+
export type CreateBackupRequest = Message<"shiftcrypto.bitbox02.CreateBackupRequest"> & {
|
|
41
|
+
/**
|
|
42
|
+
* @generated from field: uint32 timestamp = 1;
|
|
43
|
+
*/
|
|
44
|
+
timestamp: number;
|
|
45
|
+
/**
|
|
46
|
+
* @generated from field: int32 timezone_offset = 2;
|
|
47
|
+
*/
|
|
48
|
+
timezoneOffset: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Describes the message shiftcrypto.bitbox02.CreateBackupRequest.
|
|
52
|
+
* Use `create(CreateBackupRequestSchema)` to create a new message.
|
|
53
|
+
*/
|
|
54
|
+
export declare const CreateBackupRequestSchema: GenMessage<CreateBackupRequest>;
|
|
55
|
+
/**
|
|
56
|
+
* @generated from message shiftcrypto.bitbox02.ListBackupsRequest
|
|
57
|
+
*/
|
|
58
|
+
export type ListBackupsRequest = Message<"shiftcrypto.bitbox02.ListBackupsRequest"> & {};
|
|
59
|
+
/**
|
|
60
|
+
* Describes the message shiftcrypto.bitbox02.ListBackupsRequest.
|
|
61
|
+
* Use `create(ListBackupsRequestSchema)` to create a new message.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ListBackupsRequestSchema: GenMessage<ListBackupsRequest>;
|
|
64
|
+
/**
|
|
65
|
+
* @generated from message shiftcrypto.bitbox02.BackupInfo
|
|
66
|
+
*/
|
|
67
|
+
export type BackupInfo = Message<"shiftcrypto.bitbox02.BackupInfo"> & {
|
|
68
|
+
/**
|
|
69
|
+
* @generated from field: string id = 1;
|
|
70
|
+
*/
|
|
71
|
+
id: string;
|
|
72
|
+
/**
|
|
73
|
+
* @generated from field: uint32 timestamp = 2;
|
|
74
|
+
*/
|
|
75
|
+
timestamp: number;
|
|
76
|
+
/**
|
|
77
|
+
* uint32 timezone_offset = 3;
|
|
78
|
+
*
|
|
79
|
+
* @generated from field: string name = 4;
|
|
80
|
+
*/
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Describes the message shiftcrypto.bitbox02.BackupInfo.
|
|
85
|
+
* Use `create(BackupInfoSchema)` to create a new message.
|
|
86
|
+
*/
|
|
87
|
+
export declare const BackupInfoSchema: GenMessage<BackupInfo>;
|
|
88
|
+
/**
|
|
89
|
+
* @generated from message shiftcrypto.bitbox02.ListBackupsResponse
|
|
90
|
+
*/
|
|
91
|
+
export type ListBackupsResponse = Message<"shiftcrypto.bitbox02.ListBackupsResponse"> & {
|
|
92
|
+
/**
|
|
93
|
+
* @generated from field: repeated shiftcrypto.bitbox02.BackupInfo info = 1;
|
|
94
|
+
*/
|
|
95
|
+
info: BackupInfo[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Describes the message shiftcrypto.bitbox02.ListBackupsResponse.
|
|
99
|
+
* Use `create(ListBackupsResponseSchema)` to create a new message.
|
|
100
|
+
*/
|
|
101
|
+
export declare const ListBackupsResponseSchema: GenMessage<ListBackupsResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* @generated from message shiftcrypto.bitbox02.RestoreBackupRequest
|
|
104
|
+
*/
|
|
105
|
+
export type RestoreBackupRequest = Message<"shiftcrypto.bitbox02.RestoreBackupRequest"> & {
|
|
106
|
+
/**
|
|
107
|
+
* @generated from field: string id = 1;
|
|
108
|
+
*/
|
|
109
|
+
id: string;
|
|
110
|
+
/**
|
|
111
|
+
* @generated from field: uint32 timestamp = 2;
|
|
112
|
+
*/
|
|
113
|
+
timestamp: number;
|
|
114
|
+
/**
|
|
115
|
+
* @generated from field: int32 timezone_offset = 3;
|
|
116
|
+
*/
|
|
117
|
+
timezoneOffset: number;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Describes the message shiftcrypto.bitbox02.RestoreBackupRequest.
|
|
121
|
+
* Use `create(RestoreBackupRequestSchema)` to create a new message.
|
|
122
|
+
*/
|
|
123
|
+
export declare const RestoreBackupRequestSchema: GenMessage<RestoreBackupRequest>;
|
|
124
|
+
//# sourceMappingURL=backup_commands_pb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup_commands_pb.d.ts","sourceRoot":"","sources":["../../../src/proto/gen/backup_commands_pb.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,e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