@onekeyfe/hd-core 1.2.8-alpha.9 → 1.2.9
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/README.md +27 -0
- package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +13 -4
- package/__tests__/DeviceCommands.test.ts +25 -0
- package/__tests__/allNetworkGetAddress-privacy-networks.test.ts +77 -0
- package/__tests__/allNetworkGetAddress-skippable.test.ts +49 -0
- package/__tests__/btc-derive-context-hash.test.ts +200 -0
- package/__tests__/core-dispose.test.ts +114 -1
- package/__tests__/core-error-output.test.ts +21 -0
- package/__tests__/device-connector-protocol.test.ts +5 -2
- package/__tests__/device-lifecycle-events.test.ts +127 -10
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +11 -0
- package/__tests__/logBlockEvent.test.ts +331 -9
- package/__tests__/logger.test.ts +18 -0
- package/__tests__/monero-get-address.test.ts +147 -0
- package/__tests__/monero-key-image-sync.test.ts +272 -0
- package/__tests__/monero-sign-transaction.test.ts +436 -0
- package/__tests__/protocol-v2-key-export-confirmation.test.ts +75 -0
- package/__tests__/protocol-v2-resources.test.ts +14 -0
- package/__tests__/protocol-v2.test.ts +845 -3
- package/__tests__/protocolV2FileWrite.test.ts +454 -7
- package/__tests__/search-devices.test.ts +36 -0
- package/__tests__/sol-sign-offchain-message.test.ts +8 -0
- package/__tests__/usb-identity-probe.test.ts +358 -0
- package/__tests__/zcash-protobuf.test.ts +152 -0
- package/__tests__/zcash-sign-pczt.test.ts +525 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +5 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +21 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +3 -0
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/btc/BTCDeriveContextHash.d.ts +16 -0
- package/dist/api/btc/BTCDeriveContextHash.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +1 -1
- package/dist/api/helpers/pathUtils.d.ts +1 -0
- package/dist/api/helpers/pathUtils.d.ts.map +1 -1
- package/dist/api/helpers/protocolV2FileWrite.d.ts +5 -1
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/monero/MoneroGetAddress.d.ts +11 -0
- package/dist/api/monero/MoneroGetAddress.d.ts.map +1 -0
- package/dist/api/monero/MoneroGetWatchKey.d.ts +11 -0
- package/dist/api/monero/MoneroGetWatchKey.d.ts.map +1 -0
- package/dist/api/monero/MoneroKeyImageSync.d.ts +20 -0
- package/dist/api/monero/MoneroKeyImageSync.d.ts.map +1 -0
- package/dist/api/monero/MoneroSignTransaction.d.ts +17 -0
- package/dist/api/monero/MoneroSignTransaction.d.ts.map +1 -0
- package/dist/api/monero/helpers.d.ts +5 -0
- package/dist/api/monero/helpers.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- package/dist/api/zcash/ZcashGetAddress.d.ts +12 -0
- package/dist/api/zcash/ZcashGetAddress.d.ts.map +1 -0
- package/dist/api/zcash/ZcashGetFullViewingKey.d.ts +12 -0
- package/dist/api/zcash/ZcashGetFullViewingKey.d.ts.map +1 -0
- package/dist/api/zcash/ZcashSignPczt.d.ts +16 -0
- package/dist/api/zcash/ZcashSignPczt.d.ts.map +1 -0
- package/dist/api/zcash/helpers.d.ts +2 -0
- package/dist/api/zcash/helpers.d.ts.map +1 -0
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +1 -0
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +10 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +2 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +202 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5849 -4205
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/resources.d.ts +1 -0
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/uiInteraction.d.ts +1 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
- package/dist/types/api/allNetworkGetAddress.d.ts +4 -1
- package/dist/types/api/allNetworkGetAddress.d.ts.map +1 -1
- package/dist/types/api/btcDeriveContextHash.d.ts +10 -0
- package/dist/types/api/btcDeriveContextHash.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +8 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +16 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/moneroGetAddress.d.ts +15 -0
- package/dist/types/api/moneroGetAddress.d.ts.map +1 -0
- package/dist/types/api/moneroGetWatchKey.d.ts +15 -0
- package/dist/types/api/moneroGetWatchKey.d.ts.map +1 -0
- package/dist/types/api/moneroKeyImageSync.d.ts +24 -0
- package/dist/types/api/moneroKeyImageSync.d.ts.map +1 -0
- package/dist/types/api/moneroSignTransaction.d.ts +32 -0
- package/dist/types/api/moneroSignTransaction.d.ts.map +1 -0
- package/dist/types/api/zcashGetAddress.d.ts +20 -0
- package/dist/types/api/zcashGetAddress.d.ts.map +1 -0
- package/dist/types/api/zcashGetFullViewingKey.d.ts +13 -0
- package/dist/types/api/zcashGetFullViewingKey.d.ts.map +1 -0
- package/dist/types/api/zcashSignPczt.d.ts +9 -0
- package/dist/types/api/zcashSignPczt.d.ts.map +1 -0
- package/dist/types/device.d.ts +10 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +2 -0
- package/src/api/FileWrite.ts +7 -1
- package/src/api/FirmwareUpdateV4.ts +358 -74
- package/src/api/SearchDevices.ts +172 -7
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +55 -15
- package/src/api/btc/BTCDeriveContextHash.ts +90 -0
- package/src/api/firmware/FirmwareArtifactSource.ts +12 -3
- package/src/api/helpers/pathUtils.ts +23 -0
- package/src/api/helpers/protocolV2FileWrite.ts +382 -111
- package/src/api/index.ts +9 -0
- package/src/api/monero/MoneroGetAddress.ts +71 -0
- package/src/api/monero/MoneroGetWatchKey.ts +75 -0
- package/src/api/monero/MoneroKeyImageSync.ts +170 -0
- package/src/api/monero/MoneroSignTransaction.ts +319 -0
- package/src/api/monero/helpers.ts +28 -0
- package/src/api/protocol-v2/DeviceUploadNft.ts +6 -1
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +15 -1
- package/src/api/zcash/ZcashGetAddress.ts +108 -0
- package/src/api/zcash/ZcashGetFullViewingKey.ts +78 -0
- package/src/api/zcash/ZcashSignPczt.ts +152 -0
- package/src/api/zcash/helpers.ts +16 -0
- package/src/core/index.ts +49 -17
- package/src/data/messages/messages-protocol-v2.json +152 -0
- package/src/data/messages/messages.json +51 -0
- package/src/device/Device.ts +21 -3
- package/src/device/DeviceCommands.ts +17 -0
- package/src/device/DeviceConnector.ts +4 -4
- package/src/events/logBlockEvent.ts +58 -3
- package/src/events/ui-request.ts +2 -0
- package/src/index.ts +1 -0
- package/src/inject.ts +17 -0
- package/src/protocols/protocol-v2/resources.ts +6 -1
- package/src/protocols/protocol-v2/uiInteraction.ts +1 -1
- package/src/types/api/allNetworkGetAddress.ts +8 -1
- package/src/types/api/btcDeriveContextHash.ts +15 -0
- package/src/types/api/export.ts +17 -0
- package/src/types/api/index.ts +24 -0
- package/src/types/api/moneroGetAddress.ts +27 -0
- package/src/types/api/moneroGetWatchKey.ts +28 -0
- package/src/types/api/moneroKeyImageSync.ts +45 -0
- package/src/types/api/moneroSignTransaction.ts +54 -0
- package/src/types/api/zcashGetAddress.ts +32 -0
- package/src/types/api/zcashGetFullViewingKey.ts +24 -0
- package/src/types/api/zcashSignPczt.ts +18 -0
- package/src/types/device.ts +18 -0
- package/src/utils/logger.ts +4 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
3
|
+
import ZcashSignPczt from '../src/api/zcash/ZcashSignPczt';
|
|
4
|
+
import ZcashGetAddress from '../src/api/zcash/ZcashGetAddress';
|
|
5
|
+
import ZcashGetFullViewingKey from '../src/api/zcash/ZcashGetFullViewingKey';
|
|
6
|
+
|
|
7
|
+
import type { Device } from '../src/device/Device';
|
|
8
|
+
|
|
9
|
+
jest.mock('../src/data/config', () => ({
|
|
10
|
+
getSDKVersion: jest.fn(() => '1.0.0'),
|
|
11
|
+
DEFAULT_DOMAIN: 'https://jssdk.onekey.so/1.0.0/',
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const hex = (byte: number, length: number) => byte.toString(16).padStart(2, '0').repeat(length);
|
|
15
|
+
|
|
16
|
+
const createSignMethod = (pczt: string) =>
|
|
17
|
+
new ZcashSignPczt({ id: 1, payload: { method: 'zcashSignPczt', pczt } });
|
|
18
|
+
|
|
19
|
+
const attachDevice = (
|
|
20
|
+
method: ZcashSignPczt | ZcashGetAddress | ZcashGetFullViewingKey,
|
|
21
|
+
typedCall: jest.Mock
|
|
22
|
+
) => {
|
|
23
|
+
const commands = { typedCall };
|
|
24
|
+
method.device = {
|
|
25
|
+
commands,
|
|
26
|
+
getCommands: () => commands,
|
|
27
|
+
toMessageObject: () => ({}),
|
|
28
|
+
} as unknown as Device;
|
|
29
|
+
method.postMessage = jest.fn();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
describe('ZcashSignPczt', () => {
|
|
33
|
+
test('uploads device-sized chunks and downloads host-sized chunks', async () => {
|
|
34
|
+
// 2500 bytes: initial 1024, then device asks 1000 + 476.
|
|
35
|
+
const pczt = hex(0xab, 2500);
|
|
36
|
+
const signed = Buffer.alloc(1500, 0xcd);
|
|
37
|
+
const method = createSignMethod(pczt);
|
|
38
|
+
method.init();
|
|
39
|
+
|
|
40
|
+
const typedCall = jest
|
|
41
|
+
.fn()
|
|
42
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1000 } })
|
|
43
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 476 } })
|
|
44
|
+
.mockResolvedValueOnce({
|
|
45
|
+
type: 'ZcashSignedPczt',
|
|
46
|
+
message: {
|
|
47
|
+
pczt_length: signed.length,
|
|
48
|
+
pczt_initial_chunk: signed.subarray(0, 1024).toString('hex'),
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
.mockResolvedValueOnce({
|
|
52
|
+
type: 'ZcashPcztChunkAck',
|
|
53
|
+
message: { data_chunk: signed.subarray(1024).toString('hex') },
|
|
54
|
+
});
|
|
55
|
+
attachDevice(method, typedCall);
|
|
56
|
+
|
|
57
|
+
await expect(method.run()).resolves.toEqual({ pczt: signed.toString('hex') });
|
|
58
|
+
|
|
59
|
+
expect(typedCall.mock.calls[0]).toEqual([
|
|
60
|
+
'ZcashSignPczt',
|
|
61
|
+
['ZcashSignedPczt', 'ZcashPcztChunkRequest'],
|
|
62
|
+
{ pczt_length: 2500, pczt_initial_chunk: hex(0xab, 1024) },
|
|
63
|
+
]);
|
|
64
|
+
expect(typedCall.mock.calls[1]).toEqual([
|
|
65
|
+
'ZcashPcztChunkAck',
|
|
66
|
+
['ZcashSignedPczt', 'ZcashPcztChunkRequest'],
|
|
67
|
+
{ data_chunk: hex(0xab, 1000) },
|
|
68
|
+
]);
|
|
69
|
+
expect(typedCall.mock.calls[2][2]).toEqual({ data_chunk: hex(0xab, 476) });
|
|
70
|
+
expect(typedCall.mock.calls[3]).toEqual([
|
|
71
|
+
'ZcashSignedPcztChunkRequest',
|
|
72
|
+
'ZcashPcztChunkAck',
|
|
73
|
+
{ chunk_length: 476 },
|
|
74
|
+
]);
|
|
75
|
+
expect(typedCall).toHaveBeenCalledTimes(4);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('single-message round trip when both sides fit in the initial chunk', async () => {
|
|
79
|
+
const method = createSignMethod(hex(0x01, 100));
|
|
80
|
+
method.init();
|
|
81
|
+
const typedCall = jest.fn().mockResolvedValueOnce({
|
|
82
|
+
type: 'ZcashSignedPczt',
|
|
83
|
+
message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 80) },
|
|
84
|
+
});
|
|
85
|
+
attachDevice(method, typedCall);
|
|
86
|
+
|
|
87
|
+
await expect(method.run()).resolves.toEqual({ pczt: hex(0x02, 80) });
|
|
88
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('rejects a device chunk request past the end of the pczt', async () => {
|
|
92
|
+
const method = createSignMethod(hex(0x01, 1100));
|
|
93
|
+
method.init();
|
|
94
|
+
const typedCall = jest
|
|
95
|
+
.fn()
|
|
96
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 200 } });
|
|
97
|
+
attachDevice(method, typedCall);
|
|
98
|
+
|
|
99
|
+
await expect(method.run()).rejects.toThrow('device requested 200 bytes at offset 1024');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('rejects completion before the entire input has been uploaded', async () => {
|
|
103
|
+
const method = createSignMethod(hex(0x01, 1100));
|
|
104
|
+
method.init();
|
|
105
|
+
const typedCall = jest.fn().mockResolvedValueOnce({
|
|
106
|
+
type: 'ZcashSignedPczt',
|
|
107
|
+
message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 80) },
|
|
108
|
+
});
|
|
109
|
+
attachDevice(method, typedCall);
|
|
110
|
+
await expect(method.run()).rejects.toThrow('before receiving the whole pczt');
|
|
111
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('rejects an initial signed chunk larger than its announced total', async () => {
|
|
115
|
+
const method = createSignMethod(hex(0x01, 100));
|
|
116
|
+
method.init();
|
|
117
|
+
const typedCall = jest.fn().mockResolvedValueOnce({
|
|
118
|
+
type: 'ZcashSignedPczt',
|
|
119
|
+
message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 81) },
|
|
120
|
+
});
|
|
121
|
+
attachDevice(method, typedCall);
|
|
122
|
+
await expect(method.run()).rejects.toThrow('more initial pczt bytes than announced');
|
|
123
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('rejects an announced signed length that is not a sane positive size', async () => {
|
|
127
|
+
for (const total of [0, 1.5, 16 * 1024 * 1024 + 1]) {
|
|
128
|
+
const method = createSignMethod(hex(0x01, 100));
|
|
129
|
+
method.init();
|
|
130
|
+
const typedCall = jest.fn().mockResolvedValueOnce({
|
|
131
|
+
type: 'ZcashSignedPczt',
|
|
132
|
+
message: { pczt_length: total, pczt_initial_chunk: '' },
|
|
133
|
+
});
|
|
134
|
+
attachDevice(method, typedCall);
|
|
135
|
+
await expect(method.run()).rejects.toThrow('invalid signed pczt length');
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('rejects empty input and leaves size limits to the device', () => {
|
|
140
|
+
expect(() => createSignMethod('').init()).toThrow('pczt is empty');
|
|
141
|
+
const method = createSignMethod(hex(0x00, 64 * 1024));
|
|
142
|
+
expect(() => method.init()).not.toThrow();
|
|
143
|
+
expect(method.params.pczt_length).toBe(64 * 1024);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('ZcashSignPczt protocol edge cases', () => {
|
|
148
|
+
const signedMessage = (signed: Buffer, initialLength = 1024) => ({
|
|
149
|
+
type: 'ZcashSignedPczt',
|
|
150
|
+
message: {
|
|
151
|
+
pczt_length: signed.length,
|
|
152
|
+
pczt_initial_chunk: signed.subarray(0, initialLength).toString('hex'),
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const runWith = (pczt: string, typedCall: jest.Mock) => {
|
|
157
|
+
const method = createSignMethod(pczt);
|
|
158
|
+
method.init();
|
|
159
|
+
attachDevice(method, typedCall);
|
|
160
|
+
return method.run();
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
test.each([
|
|
164
|
+
{ name: 'short', data: hex(0xcd, 100) },
|
|
165
|
+
{ name: 'empty', data: '' },
|
|
166
|
+
{ name: 'missing', data: undefined },
|
|
167
|
+
])('rejects a $name download chunk', async ({ data }) => {
|
|
168
|
+
const signed = Buffer.alloc(1500, 0xcd);
|
|
169
|
+
const typedCall = jest
|
|
170
|
+
.fn()
|
|
171
|
+
.mockResolvedValueOnce(signedMessage(signed))
|
|
172
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkAck', message: { data_chunk: data } });
|
|
173
|
+
|
|
174
|
+
await expect(runWith(hex(0x01, 100), typedCall)).rejects.toThrow(
|
|
175
|
+
'requested bytes at offset 1024 of 1500'
|
|
176
|
+
);
|
|
177
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('rejects a download chunk longer than requested', async () => {
|
|
181
|
+
const signed = Buffer.alloc(1500, 0xcd);
|
|
182
|
+
const typedCall = jest
|
|
183
|
+
.fn()
|
|
184
|
+
.mockResolvedValueOnce(signedMessage(signed))
|
|
185
|
+
.mockResolvedValueOnce({
|
|
186
|
+
type: 'ZcashPcztChunkAck',
|
|
187
|
+
message: { data_chunk: hex(0xcd, 477) },
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
await expect(runWith(hex(0x01, 100), typedCall)).rejects.toThrow(
|
|
191
|
+
'device returned 477 of 476 requested bytes'
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test.each([0, -1, 1.5, Number.NaN])(
|
|
196
|
+
'rejects a device upload request for chunk length %s',
|
|
197
|
+
async chunkLength => {
|
|
198
|
+
const typedCall = jest.fn().mockResolvedValueOnce({
|
|
199
|
+
type: 'ZcashPcztChunkRequest',
|
|
200
|
+
message: { chunk_length: chunkLength },
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
await expect(runWith(hex(0x01, 2000), typedCall)).rejects.toThrow(
|
|
204
|
+
`device requested ${chunkLength} bytes at offset 1024`
|
|
205
|
+
);
|
|
206
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
test('propagates a device Failure in the middle of upload', async () => {
|
|
211
|
+
const failure = ERRORS.TypedError(
|
|
212
|
+
HardwareErrorCode.ActionCancelled,
|
|
213
|
+
'Action cancelled by user'
|
|
214
|
+
);
|
|
215
|
+
const typedCall = jest
|
|
216
|
+
.fn()
|
|
217
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 500 } })
|
|
218
|
+
.mockRejectedValueOnce(failure);
|
|
219
|
+
|
|
220
|
+
await expect(runWith(hex(0x01, 2000), typedCall)).rejects.toBe(failure);
|
|
221
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test('propagates a device Failure in the middle of download', async () => {
|
|
225
|
+
const failure = ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Firmware error');
|
|
226
|
+
const signed = Buffer.alloc(3000, 0xcd);
|
|
227
|
+
const typedCall = jest
|
|
228
|
+
.fn()
|
|
229
|
+
.mockResolvedValueOnce(signedMessage(signed))
|
|
230
|
+
.mockResolvedValueOnce({
|
|
231
|
+
type: 'ZcashPcztChunkAck',
|
|
232
|
+
message: { data_chunk: signed.subarray(1024, 2048).toString('hex') },
|
|
233
|
+
})
|
|
234
|
+
.mockRejectedValueOnce(failure);
|
|
235
|
+
|
|
236
|
+
await expect(runWith(hex(0x01, 100), typedCall)).rejects.toBe(failure);
|
|
237
|
+
expect(typedCall).toHaveBeenCalledTimes(3);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test('exactly 1024 bytes in both directions needs no extra chunks', async () => {
|
|
241
|
+
const signed = Buffer.alloc(1024, 0xcd);
|
|
242
|
+
const typedCall = jest.fn().mockResolvedValueOnce(signedMessage(signed));
|
|
243
|
+
|
|
244
|
+
await expect(runWith(hex(0xab, 1024), typedCall)).resolves.toEqual({
|
|
245
|
+
pczt: signed.toString('hex'),
|
|
246
|
+
});
|
|
247
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
248
|
+
expect(typedCall.mock.calls[0][2]).toEqual({
|
|
249
|
+
pczt_length: 1024,
|
|
250
|
+
pczt_initial_chunk: hex(0xab, 1024),
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test('1025 bytes in both directions splits into 1024 + 1', async () => {
|
|
255
|
+
const pczt = `${hex(0xab, 1024)}ef`;
|
|
256
|
+
const signed = Buffer.concat([Buffer.alloc(1024, 0xcd), Buffer.from([0x99])]);
|
|
257
|
+
const typedCall = jest
|
|
258
|
+
.fn()
|
|
259
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1 } })
|
|
260
|
+
.mockResolvedValueOnce(signedMessage(signed))
|
|
261
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkAck', message: { data_chunk: '99' } });
|
|
262
|
+
|
|
263
|
+
await expect(runWith(pczt, typedCall)).resolves.toEqual({ pczt: signed.toString('hex') });
|
|
264
|
+
expect(typedCall.mock.calls[0][2]).toEqual({
|
|
265
|
+
pczt_length: 1025,
|
|
266
|
+
pczt_initial_chunk: hex(0xab, 1024),
|
|
267
|
+
});
|
|
268
|
+
expect(typedCall.mock.calls[1][2]).toEqual({ data_chunk: 'ef' });
|
|
269
|
+
expect(typedCall.mock.calls[2][2]).toEqual({ chunk_length: 1 });
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test('2048 bytes in both directions uses one full 1024-byte chunk each way', async () => {
|
|
273
|
+
const signed = Buffer.alloc(2048, 0xcd);
|
|
274
|
+
const typedCall = jest
|
|
275
|
+
.fn()
|
|
276
|
+
.mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1024 } })
|
|
277
|
+
.mockResolvedValueOnce(signedMessage(signed))
|
|
278
|
+
.mockResolvedValueOnce({
|
|
279
|
+
type: 'ZcashPcztChunkAck',
|
|
280
|
+
message: { data_chunk: signed.subarray(1024).toString('hex') },
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
await expect(runWith(hex(0xab, 2048), typedCall)).resolves.toEqual({
|
|
284
|
+
pczt: signed.toString('hex'),
|
|
285
|
+
});
|
|
286
|
+
expect(typedCall.mock.calls[1][2]).toEqual({ data_chunk: hex(0xab, 1024) });
|
|
287
|
+
expect(typedCall.mock.calls[2][2]).toEqual({ chunk_length: 1024 });
|
|
288
|
+
expect(typedCall).toHaveBeenCalledTimes(3);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('uploads with a flat loop when the device asks for one byte at a time', async () => {
|
|
292
|
+
const pczt = Buffer.from(Array.from({ length: 1024 + 20000 }, (_, i) => i % 251));
|
|
293
|
+
const signed = Buffer.alloc(80, 0xcd);
|
|
294
|
+
const uploaded: string[] = [];
|
|
295
|
+
let requested = 1024;
|
|
296
|
+
const typedCall = jest.fn(
|
|
297
|
+
(type: string, _response: unknown, message: { data_chunk?: string }) => {
|
|
298
|
+
if (type === 'ZcashPcztChunkAck') uploaded.push(message.data_chunk ?? '');
|
|
299
|
+
if (requested === pczt.length) return Promise.resolve(signedMessage(signed));
|
|
300
|
+
requested += 1;
|
|
301
|
+
return Promise.resolve({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1 } });
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
await expect(runWith(pczt.toString('hex'), typedCall)).resolves.toEqual({
|
|
306
|
+
pczt: signed.toString('hex'),
|
|
307
|
+
});
|
|
308
|
+
expect(uploaded).toHaveLength(20000);
|
|
309
|
+
expect(uploaded.join('')).toBe(pczt.subarray(1024).toString('hex'));
|
|
310
|
+
expect(typedCall).toHaveBeenCalledTimes(20001);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test.each(['abc', '0xabc', 'a'])('rejects odd-length hex %s', pczt => {
|
|
314
|
+
expect(() => createSignMethod(pczt).init()).toThrow('pczt hex must have an even length');
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test.each(['zz', '0xgg', 'ab cd'])('rejects non-hex input %s', pczt => {
|
|
318
|
+
expect(() => createSignMethod(pczt).init()).toThrow('should be [hexString]');
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
test('accepts a 0x-prefixed even-length hex string', () => {
|
|
322
|
+
const method = createSignMethod('0xABcd');
|
|
323
|
+
method.init();
|
|
324
|
+
expect(method.params).toEqual({ pczt_length: 2, pczt_initial_chunk: 'abcd' });
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
describe('ZcashGetAddress', () => {
|
|
329
|
+
test('maps params and response', async () => {
|
|
330
|
+
const method = new ZcashGetAddress({
|
|
331
|
+
id: 1,
|
|
332
|
+
payload: {
|
|
333
|
+
method: 'zcashGetAddress',
|
|
334
|
+
path: "m/32'/133'/0'",
|
|
335
|
+
showOnOneKey: false,
|
|
336
|
+
includeSeedFingerprint: true,
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
method.init();
|
|
340
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
341
|
+
message: { address: 'u1abc', seed_fingerprint: hex(0x0f, 32) },
|
|
342
|
+
});
|
|
343
|
+
attachDevice(method, typedCall);
|
|
344
|
+
|
|
345
|
+
await expect(method.run()).resolves.toEqual({
|
|
346
|
+
path: "m/32'/133'/0'",
|
|
347
|
+
address: 'u1abc',
|
|
348
|
+
seedFingerprint: hex(0x0f, 32),
|
|
349
|
+
});
|
|
350
|
+
expect(typedCall).toHaveBeenCalledWith('ZcashGetAddress', 'ZcashAddress', {
|
|
351
|
+
address_n: [2147483680, 2147483781, 2147483648],
|
|
352
|
+
address_type: 0,
|
|
353
|
+
scope: 0,
|
|
354
|
+
diversifier_index: 0,
|
|
355
|
+
show_display: false,
|
|
356
|
+
include_seed_fingerprint: true,
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test('omits the fingerprint the V2 decoder returns as null', async () => {
|
|
361
|
+
const method = new ZcashGetAddress({
|
|
362
|
+
id: 1,
|
|
363
|
+
payload: { method: 'zcashGetAddress', path: "m/32'/133'/0'" },
|
|
364
|
+
});
|
|
365
|
+
method.init();
|
|
366
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
367
|
+
type: 'ZcashAddress',
|
|
368
|
+
message: { address: 'u1abc', seed_fingerprint: null },
|
|
369
|
+
});
|
|
370
|
+
attachDevice(method, typedCall);
|
|
371
|
+
|
|
372
|
+
const result = await method.run();
|
|
373
|
+
expect(result).toEqual({ path: "m/32'/133'/0'", address: 'u1abc' });
|
|
374
|
+
expect(result).not.toHaveProperty('seedFingerprint');
|
|
375
|
+
expect(typedCall.mock.calls[0][2]).toMatchObject({ include_seed_fingerprint: false });
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// The UFVK has its own confirmed export; an address request never asks for it.
|
|
379
|
+
test('never requests the viewing key', async () => {
|
|
380
|
+
const method = new ZcashGetAddress({
|
|
381
|
+
id: 1,
|
|
382
|
+
payload: { method: 'zcashGetAddress', path: "m/32'/133'/0'", includeUfvk: true },
|
|
383
|
+
});
|
|
384
|
+
method.init();
|
|
385
|
+
const typedCall = jest.fn().mockResolvedValue({ message: { address: 'u1abc' } });
|
|
386
|
+
attachDevice(method, typedCall);
|
|
387
|
+
|
|
388
|
+
const result = await method.run();
|
|
389
|
+
expect(typedCall.mock.calls[0][2]).not.toHaveProperty('include_ufvk');
|
|
390
|
+
expect(result).not.toHaveProperty('ufvk');
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
describe('ZcashGetFullViewingKey', () => {
|
|
395
|
+
const createViewingKey = (payload: Record<string, unknown>) =>
|
|
396
|
+
new ZcashGetFullViewingKey({
|
|
397
|
+
id: 1,
|
|
398
|
+
payload: { method: 'zcashGetFullViewingKey', ...payload },
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
test('maps the account path and response', async () => {
|
|
402
|
+
const method = createViewingKey({ path: "m/32'/133'/1'" });
|
|
403
|
+
method.init();
|
|
404
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
405
|
+
type: 'ZcashFullViewingKey',
|
|
406
|
+
message: { ufvk: 'uview1abc' },
|
|
407
|
+
});
|
|
408
|
+
attachDevice(method, typedCall);
|
|
409
|
+
|
|
410
|
+
await expect(method.run()).resolves.toEqual({ path: "m/32'/133'/1'", ufvk: 'uview1abc' });
|
|
411
|
+
expect(typedCall).toHaveBeenCalledWith('ZcashGetFullViewingKey', 'ZcashFullViewingKey', {
|
|
412
|
+
address_n: [2147483680, 2147483781, 2147483649],
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test('exports a bundle one account at a time', async () => {
|
|
417
|
+
const method = createViewingKey({
|
|
418
|
+
bundle: [{ path: "m/32'/133'/0'" }, { path: "m/32'/133'/1'" }],
|
|
419
|
+
});
|
|
420
|
+
method.init();
|
|
421
|
+
const typedCall = jest
|
|
422
|
+
.fn()
|
|
423
|
+
.mockResolvedValueOnce({ message: { ufvk: 'uview1zero' } })
|
|
424
|
+
.mockResolvedValueOnce({ message: { ufvk: 'uview1one' } });
|
|
425
|
+
attachDevice(method, typedCall);
|
|
426
|
+
|
|
427
|
+
await expect(method.run()).resolves.toEqual([
|
|
428
|
+
{ path: "m/32'/133'/0'", ufvk: 'uview1zero' },
|
|
429
|
+
{ path: "m/32'/133'/1'", ufvk: 'uview1one' },
|
|
430
|
+
]);
|
|
431
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
test('rejects a response without a viewing key', async () => {
|
|
435
|
+
const method = createViewingKey({ path: "m/32'/133'/0'" });
|
|
436
|
+
method.init();
|
|
437
|
+
attachDevice(method, jest.fn().mockResolvedValue({ message: {} }));
|
|
438
|
+
|
|
439
|
+
await expect(method.run()).rejects.toThrow();
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test.each(["m/44'/133'/0'", "m/32'/133'/0'/0/0", "m/32'/133'/2147483648'"])(
|
|
443
|
+
'rejects the non-account path %s',
|
|
444
|
+
path => {
|
|
445
|
+
expect(() => createViewingKey({ path }).init()).toThrow();
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
test('requires a path', () => {
|
|
450
|
+
expect(() => createViewingKey({}).init()).toThrow();
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
describe('Zcash address protocol selection', () => {
|
|
455
|
+
const createAddress = (params: Record<string, unknown> = {}) =>
|
|
456
|
+
new ZcashGetAddress({
|
|
457
|
+
id: 1,
|
|
458
|
+
payload: { method: 'zcashGetAddress', path: "m/32'/133'/0'", ...params },
|
|
459
|
+
});
|
|
460
|
+
test('supports only Pro2 firmware 1.0.4 and later, on protocol V2', () => {
|
|
461
|
+
for (const method of [
|
|
462
|
+
createAddress(),
|
|
463
|
+
createSignMethod(hex(1, 1)),
|
|
464
|
+
new ZcashGetFullViewingKey({
|
|
465
|
+
id: 1,
|
|
466
|
+
payload: { method: 'zcashGetFullViewingKey', path: "m/32'/133'/0'" },
|
|
467
|
+
}),
|
|
468
|
+
]) {
|
|
469
|
+
method.init();
|
|
470
|
+
expect(method.supportsProtocol('V1')).toBe(false);
|
|
471
|
+
expect(method.supportsProtocol('V2')).toBe(true);
|
|
472
|
+
expect(method.strictCheckDeviceSupport).toBe(true);
|
|
473
|
+
expect(method.getVersionRange()).toEqual({ model_pro2: { min: '1.0.4' } });
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
test.each([0, 1, 2])('maps address type %s with internal scope and index', async addressType => {
|
|
477
|
+
const method = createAddress({ addressType, scope: 1, diversifierIndex: 37 });
|
|
478
|
+
method.init();
|
|
479
|
+
const typedCall = jest.fn().mockResolvedValue({ message: { address: 'device-address' } });
|
|
480
|
+
attachDevice(method, typedCall);
|
|
481
|
+
await method.run();
|
|
482
|
+
expect(typedCall).toHaveBeenCalledWith(
|
|
483
|
+
'ZcashGetAddress',
|
|
484
|
+
'ZcashAddress',
|
|
485
|
+
expect.objectContaining({
|
|
486
|
+
address_type: addressType,
|
|
487
|
+
scope: 1,
|
|
488
|
+
diversifier_index: 37,
|
|
489
|
+
show_display: true,
|
|
490
|
+
})
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
test.each([
|
|
494
|
+
{ addressType: 3 },
|
|
495
|
+
{ scope: 2 },
|
|
496
|
+
{ diversifierIndex: -1 },
|
|
497
|
+
{ diversifierIndex: 1.5 },
|
|
498
|
+
{ diversifierIndex: 0x80000000 },
|
|
499
|
+
{ addressType: 2, diversifierIndex: 0x100000000 },
|
|
500
|
+
{ path: "m/44'/133'/0'" },
|
|
501
|
+
{ path: "m/32'/133'/0'/0/0" },
|
|
502
|
+
])('rejects invalid address requests %j', params => {
|
|
503
|
+
expect(() => createAddress(params).init()).toThrow();
|
|
504
|
+
});
|
|
505
|
+
// Each of these would otherwise be sent as account 0'.
|
|
506
|
+
test.each([
|
|
507
|
+
"m/32'/133'/2147483648'",
|
|
508
|
+
"m/32'/133'/4294967296'",
|
|
509
|
+
"m/32'/133'/0.5'",
|
|
510
|
+
[0x80000020, 0x80000085, 0x100000000 + 0x80000000],
|
|
511
|
+
[0x80000020, 0x80000085, 0x80000000 + 0.5],
|
|
512
|
+
])('rejects the out-of-range account path %j before hardening', path => {
|
|
513
|
+
expect(() => createAddress({ path }).init()).toThrow('Not a valid path');
|
|
514
|
+
});
|
|
515
|
+
test('accepts the largest ZIP-32 account', () => {
|
|
516
|
+
const method = createAddress({ path: "m/32'/133'/2147483647'" });
|
|
517
|
+
method.init();
|
|
518
|
+
expect(method.params[0].address_n).toEqual([0x80000020, 0x80000085, 0xffffffff]);
|
|
519
|
+
});
|
|
520
|
+
test('accepts the uint32 limit only for an Orchard-only address', () => {
|
|
521
|
+
expect(() =>
|
|
522
|
+
createAddress({ addressType: 2, diversifierIndex: 0xffffffff }).init()
|
|
523
|
+
).not.toThrow();
|
|
524
|
+
});
|
|
525
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseMethod.d.ts","sourceRoot":"","sources":["../../src/api/BaseMethod.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAWhC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,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
|
|
1
|
-
{"version":3,"file":"FileWrite.d.ts","sourceRoot":"","sources":["../../src/api/FileWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FileWrite.d.ts","sourceRoot":"","sources":["../../src/api/FileWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAc1C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAU,CAAC,eAAe,CAAC;IAChE,qBAAqB;IAIrB,IAAI;IAsBE,GAAG;;;;;;;CAwBV"}
|
|
@@ -2,6 +2,7 @@ import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
|
2
2
|
import { FirmwareUpdateBaseMethod } from './firmware/FirmwareUpdateBaseMethod';
|
|
3
3
|
import type { FirmwareUpdateV4Params } from '../types/api/firmwareUpdate';
|
|
4
4
|
export declare function assertProtocolV2FirmwareTargetsSupported(deviceType: EDeviceType | string | undefined, params: FirmwareUpdateV4Params, hasExplicitTargetSelection?: boolean): void;
|
|
5
|
+
export declare function supportsProtocolV2BleFileWriteWindow(bootloaderVersion: string, minBootloaderVersion?: string | undefined): boolean;
|
|
5
6
|
export declare const isProtocolV2FirmwareFingerprintValid: (binary: ArrayBuffer | Uint8Array, fingerprint: string | undefined) => boolean;
|
|
6
7
|
export declare const assertProtocolV2ReconnectIdentity: (expectedSerialNumber?: string, actualSerialNumber?: string, expectedPath?: string, actualPath?: string) => void;
|
|
7
8
|
export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareUpdateV4Params> {
|
|
@@ -25,6 +26,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
25
26
|
private protocolV2LastTransferProgress?;
|
|
26
27
|
private protocolV2LastTransferProgressAt;
|
|
27
28
|
private protocolV2LastTransferredBytes;
|
|
29
|
+
private protocolV2FileWriteWindowDisabled;
|
|
28
30
|
init(): void;
|
|
29
31
|
private getProtocolV2FirmwareChunkSize;
|
|
30
32
|
run(): Promise<{
|
|
@@ -68,6 +70,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
68
70
|
private getProtocolV2ResourceComparePath;
|
|
69
71
|
private readProtocolV2DeviceFileHeader;
|
|
70
72
|
private isProtocolV2ResourceBundleUpToDate;
|
|
73
|
+
private isProtocolV2ResourceBundleUpToDateWithRecovery;
|
|
71
74
|
private isProtocolV2BootloaderMode;
|
|
72
75
|
private isProtocolV2RomloaderMode;
|
|
73
76
|
private rebootProtocolV2ToBootloader;
|
|
@@ -99,6 +102,8 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
99
102
|
private ensureProtocolV2DeviceAcquired;
|
|
100
103
|
private isProtocolV2ReconnectIdentityError;
|
|
101
104
|
private fileWriteChunk;
|
|
105
|
+
private shouldUseProtocolV2BleFileWriteWindow;
|
|
106
|
+
private writeProtocolV2SourceWindowed;
|
|
102
107
|
private recoverProtocolV2FileTransfer;
|
|
103
108
|
private acquireProtocolV2BleDevice;
|
|
104
109
|
private protocolV2StartFirmwareUpdate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA4BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAkC/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAiFrC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;AAGD,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE,MAAM,EACzB,oBAAoB,qBAA2D,WAOhF;AAiWD,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,iBACZ,MAAM,eACR,MAAM,SAsBpB,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,OAAO,CAAC,8BAA8B,CAAC,CAAS;IAEhD,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC,OAAO,CAAC,oCAAoC,CAAS;IAErD,qBAAqB;IAIrB,OAAO,CAAC,yBAAyB,CAA4B;IAE7D,OAAO,CAAC,2BAA2B,CAAS;IAE5C,OAAO,CAAC,iCAAiC,CAAS;IAElD,OAAO,CAAC,iCAAiC,CAA6B;IAEtE,OAAO,CAAC,4BAA4B,CAAqB;IAEzD,OAAO,CAAC,6BAA6B,CAAC,CAAW;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;YAwClC,8CAA8C;IA2B5D,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,yBAAyB;YAcnB,4BAA4B;IAqBpC,6BAA6B;YAkBrB,+BAA+B;IAyD7C,OAAO,CAAC,6BAA6B;YAkCvB,6BAA6B;YA0B7B,0CAA0C;YA6B1C,uBAAuB;YAiCvB,8BAA8B;YAgG9B,6BAA6B;IA8I3C,OAAO,CAAC,mCAAmC;YAI7B,0BAA0B;IAaxC,OAAO,CAAC,8BAA8B;IAiBtC,OAAO,CAAC,4BAA4B;IAoLpC,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,qCAAqC;IAoC7C,OAAO,CAAC,kCAAkC;IAyC1C,OAAO,CAAC,8CAA8C;YAIxC,uCAAuC;YA8UvC,gCAAgC;YAehC,yBAAyB;IAUvC,OAAO,CAAC,2BAA2B;YAMrB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAmDrC,yBAAyB;YAgGzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;IAyC5B,OAAO,CAAC,qCAAqC;YA8B/B,6BAA6B;YA8E7B,6BAA6B;YAiB7B,0BAA0B;YAoB1B,6BAA6B;YAwD7B,gBAAgB;IA0B9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { BaseMethod } from './BaseMethod';
|
|
2
|
-
import type { SearchDevice } from '../types/device';
|
|
2
|
+
import type { SearchDevice, UsbDeviceIdentity } from '../types/device';
|
|
3
3
|
import type DeviceConnector from '../device/DeviceConnector';
|
|
4
|
+
import type { AcquireInput, OneKeyDeviceInfo as DeviceDescriptor, Transport } from '@onekeyfe/hd-transport';
|
|
5
|
+
import type { Device } from '../device/Device';
|
|
6
|
+
type RequestQueueLookup = {
|
|
7
|
+
getRequestTasksIdByConnectId: (connectId: string) => number[];
|
|
8
|
+
getTask: (requestId: number) => {
|
|
9
|
+
method: {
|
|
10
|
+
device?: Device;
|
|
11
|
+
};
|
|
12
|
+
} | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type UsbIdentityProbeDescriptor = Pick<DeviceDescriptor, 'path' | 'commType'> & Partial<Pick<DeviceDescriptor, 'id' | 'session'>>;
|
|
15
|
+
export declare const getOwnedUsbDeviceIdentity: (descriptor: UsbIdentityProbeDescriptor, requestQueue: RequestQueueLookup) => UsbDeviceIdentity | undefined;
|
|
16
|
+
export type UsbIdentityProbeTransport = Pick<Transport, 'release' | 'call' | 'getProtocolType' | 'configureProtocolV2'> & {
|
|
17
|
+
init: (logger: object) => unknown;
|
|
18
|
+
enumerate: () => Promise<UsbIdentityProbeDescriptor[]>;
|
|
19
|
+
acquire: (input: AcquireInput) => Promise<string | undefined>;
|
|
20
|
+
configure: (signedData: string) => void | Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export declare const probeUsbDeviceIdentitiesWithTransport: (transport: UsbIdentityProbeTransport, commType: UsbDeviceIdentity['commType'], getOwnedIdentity?: ((descriptor: UsbIdentityProbeDescriptor) => UsbDeviceIdentity | undefined) | undefined) => Promise<UsbDeviceIdentity[]>;
|
|
4
23
|
export default class SearchDevices extends BaseMethod {
|
|
5
24
|
connector?: DeviceConnector;
|
|
6
25
|
init(): void;
|
|
7
26
|
run(): Promise<SearchDevice[]>;
|
|
8
27
|
}
|
|
28
|
+
export {};
|
|
9
29
|
//# sourceMappingURL=SearchDevices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchDevices.d.ts","sourceRoot":"","sources":["../../src/api/SearchDevices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,OAAO,KAAK,EAAE,YAA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AiB,CAAC,UAAU,CAAC,mCACP,0BAA0B,KAAK,iBAAiB,GAAG,SAAS,kBAC3F,QAAQ,iBAAiB,EAAE,CA4G7B,CAAC;AAsBF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD,SAAS,CAAC,EAAE,eAAe,CAAa;IAExC,IAAI;IAME,GAAG,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAuFrC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { HardwareError } from '@onekeyfe/hd-shared';
|
|
1
2
|
import { BaseMethod } from '../BaseMethod';
|
|
3
|
+
import type { Device } from '../../device/Device';
|
|
2
4
|
import type { CoreApi } from '../../types';
|
|
3
5
|
import type { AllNetworkAddress, AllNetworkAddressParams, CommonResponseParams, INetwork } from '../../types/api/allNetworkGetAddress';
|
|
4
6
|
export type NetworkConfig = {
|
|
@@ -50,5 +52,6 @@ export default abstract class AllNetworkGetAddressBase extends BaseMethod<{
|
|
|
50
52
|
protected stopAllNetworkLoading(canSend?: boolean): Promise<void>;
|
|
51
53
|
run(): Promise<AllNetworkAddress[]>;
|
|
52
54
|
}
|
|
55
|
+
export declare function handleSkippableHardwareError(e: any, device: Device, method: BaseMethod): HardwareError | undefined;
|
|
53
56
|
export {};
|
|
54
57
|
//# sourceMappingURL=AllNetworkGetAddressBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllNetworkGetAddressBase.d.ts","sourceRoot":"","sources":["../../../src/api/allnetwork/AllNetworkGetAddressBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AllNetworkGetAddressBase.d.ts","sourceRoot":"","sources":["../../../src/api/allnetwork/AllNetworkGetAddressBase.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAGd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe3C,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,q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