@onekeyfe/hd-core 1.2.8-alpha.110 → 1.2.8-alpha.111

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.
Files changed (38) hide show
  1. package/__tests__/logBlockEvent.test.ts +43 -0
  2. package/__tests__/search-devices.test.ts +0 -36
  3. package/__tests__/zcash-protobuf.test.ts +141 -0
  4. package/__tests__/zcash-sign-pczt.test.ts +387 -0
  5. package/dist/api/index.d.ts +2 -0
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/zcash/ZcashGetAddress.d.ts +12 -0
  8. package/dist/api/zcash/ZcashGetAddress.d.ts.map +1 -0
  9. package/dist/api/zcash/ZcashSignPczt.d.ts +16 -0
  10. package/dist/api/zcash/ZcashSignPczt.d.ts.map +1 -0
  11. package/dist/events/logBlockEvent.d.ts.map +1 -1
  12. package/dist/index.d.ts +36 -9
  13. package/dist/index.js +329 -2
  14. package/dist/inject.d.ts.map +1 -1
  15. package/dist/types/api/export.d.ts +2 -0
  16. package/dist/types/api/export.d.ts.map +1 -1
  17. package/dist/types/api/index.d.ts +4 -0
  18. package/dist/types/api/index.d.ts.map +1 -1
  19. package/dist/types/api/zcashGetAddress.d.ts +22 -0
  20. package/dist/types/api/zcashGetAddress.d.ts.map +1 -0
  21. package/dist/types/api/zcashSignPczt.d.ts +9 -0
  22. package/dist/types/api/zcashSignPczt.d.ts.map +1 -0
  23. package/dist/types/device.d.ts +0 -1
  24. package/dist/types/device.d.ts.map +1 -1
  25. package/dist/utils/patch.d.ts +1 -1
  26. package/dist/utils/patch.d.ts.map +1 -1
  27. package/package.json +4 -4
  28. package/src/api/index.ts +2 -0
  29. package/src/api/zcash/ZcashGetAddress.ts +121 -0
  30. package/src/api/zcash/ZcashSignPczt.ts +155 -0
  31. package/src/data/messages/messages-protocol-v2.json +138 -1
  32. package/src/events/logBlockEvent.ts +4 -2
  33. package/src/inject.ts +4 -0
  34. package/src/types/api/export.ts +2 -0
  35. package/src/types/api/index.ts +8 -0
  36. package/src/types/api/zcashGetAddress.ts +36 -0
  37. package/src/types/api/zcashSignPczt.ts +18 -0
  38. package/src/types/device.ts +0 -6
@@ -5,6 +5,7 @@ import {
5
5
  getLogBlockLabel,
6
6
  getSafeLogPayload,
7
7
  } from '../src/events';
8
+ import { getLog, initLog, setLoggerPostMessage } from '../src/utils/logger';
8
9
 
9
10
  describe('getLogBlockLabel', () => {
10
11
  it('keeps existing sensitive UI response blocking', () => {
@@ -96,4 +97,46 @@ describe('getLogBlockLabel', () => {
96
97
  it('does not classify events without an API method as method calls', () => {
97
98
  expect(getLogBlockLabel({ event: 'DEVICE_EVENT', type: 'device-connect' })).toBeUndefined();
98
99
  });
100
+
101
+ it.each(['zcashGetAddress', 'zcashSignPczt'])(
102
+ 'keeps %s wallet data out of logger caches and events with debug disabled',
103
+ method => {
104
+ const postMessage = jest.fn();
105
+ const prefix = `sensitive-zcash-${method}`;
106
+ const logger = initLog(prefix, false);
107
+ setLoggerPostMessage(postMessage);
108
+ const request = {
109
+ event: 'iframe-call',
110
+ payload: { method, pczt: 'synthetic-pczt-marker', includeUfvk: true },
111
+ };
112
+ const response = {
113
+ success: true,
114
+ payload: [
115
+ {
116
+ ufvk: 'synthetic-viewing-key-marker',
117
+ seedFingerprint: 'synthetic-fingerprint-marker',
118
+ pczt: 'synthetic-signed-pczt-marker',
119
+ },
120
+ ],
121
+ };
122
+ const blockLabel = getLogBlockLabel(request);
123
+
124
+ expect(blockLabel).toBe(method);
125
+ expect(getLogBlockLabel(request.payload)).toBe(method);
126
+ logger.debug('request:', getSafeLogPayload(request, blockLabel));
127
+ logger.debug('response:', getSafeLogPayload(response, blockLabel));
128
+
129
+ const cached = getLog().filter(entry => entry.prefix === prefix);
130
+ expect(cached.map(entry => entry.message[1])).toEqual([
131
+ { method, payload: '[REDACTED]' },
132
+ { method, payload: '[REDACTED]' },
133
+ ]);
134
+ expect(postMessage).toHaveBeenCalledTimes(2);
135
+ for (const output of [JSON.stringify(cached), JSON.stringify(postMessage.mock.calls)]) {
136
+ expect(output).not.toContain('synthetic-');
137
+ expect(output).toContain('[REDACTED]');
138
+ }
139
+ expect(response.payload[0].ufvk).toBe('synthetic-viewing-key-marker');
140
+ }
141
+ );
99
142
  });
@@ -338,42 +338,6 @@ describe('SearchDevices', () => {
338
338
  }
339
339
  );
340
340
 
341
- test('BLE discovery returns the advertised color letter without a device identity', async () => {
342
- mockIsBleConnect.mockReturnValue(true);
343
-
344
- const descriptor = {
345
- id: 'ble-peripheral-id',
346
- path: 'ble-peripheral-id',
347
- name: 'Neo A1B2',
348
- commType: 'ble',
349
- bleColorCode: 'E',
350
- };
351
- const method = new SearchDevices({
352
- id: 1,
353
- payload: {
354
- method: 'searchDevices',
355
- },
356
- } as any);
357
- method.init();
358
- method.connector = {
359
- enumerate: jest.fn().mockResolvedValue({
360
- descriptors: [descriptor],
361
- }),
362
- } as any;
363
-
364
- await expect(method.run()).resolves.toEqual([
365
- {
366
- ...descriptor,
367
- connectId: 'ble-peripheral-id',
368
- serialNo: null,
369
- uuid: '',
370
- deviceId: null,
371
- deviceType: 'neo',
372
- bleColorCode: 'E',
373
- },
374
- ]);
375
- });
376
-
377
341
  test.each([
378
342
  ['Pro2 A1B2 - Find My', undefined, 'Pro 2 A1B2'],
379
343
  ['Pro2 5E9D - Finde My', undefined, 'Pro 2 5E9D'],
@@ -0,0 +1,141 @@
1
+ import * as protobuf from 'protobufjs/light';
2
+ import transport from '@onekeyfe/hd-transport';
3
+
4
+ import messagesJson from '../src/data/messages/messages-protocol-v2.json';
5
+
6
+ // Round-trips the Zcash messages through the SDK's real protobuf encoder and
7
+ // decoder against the shipped protocol V2 schema, pinning wire ids and defaults.
8
+ const {
9
+ createMessageFromName,
10
+ decodeProtobuf: decode,
11
+ encodeProtobuf: encode,
12
+ parseConfigure,
13
+ } = transport;
14
+ const messages = parseConfigure(messagesJson as protobuf.INamespace);
15
+
16
+ const wireFieldIds = (buf: Uint8Array) => {
17
+ const reader = protobuf.Reader.create(buf);
18
+ const ids: number[] = [];
19
+ while (reader.pos < reader.len) {
20
+ const tag = reader.uint32();
21
+ // eslint-disable-next-line no-bitwise
22
+ ids.push(tag >>> 3);
23
+ // eslint-disable-next-line no-bitwise
24
+ reader.skipType(tag & 7);
25
+ }
26
+ return ids;
27
+ };
28
+
29
+ const roundTrip = (name: string, data: Record<string, unknown>) => {
30
+ const { Message, messageTypeId } = createMessageFromName(messages, name);
31
+ const encoded = encode(Message, data);
32
+ const bytes = new Uint8Array(encoded.toBuffer());
33
+ return { messageTypeId, ids: wireFieldIds(bytes), decoded: decode(Message, encoded) };
34
+ };
35
+
36
+ describe('Zcash protobuf messages (protocol V2)', () => {
37
+ test.each([
38
+ ['ZcashGetAddress', 12400],
39
+ ['ZcashAddress', 12401],
40
+ ['ZcashSignPczt', 12402],
41
+ ['ZcashSignedPczt', 12403],
42
+ ['ZcashPcztChunkRequest', 12404],
43
+ ['ZcashPcztChunkAck', 12405],
44
+ ['ZcashSignedPcztChunkRequest', 12406],
45
+ ])('%s has wire type %d', (name, typeId) => {
46
+ expect(createMessageFromName(messages, name).messageTypeId).toBe(typeId);
47
+ });
48
+
49
+ test.each(['ZcashSignPczt', 'ZcashSignedPczt'])('%s round trips length and bytes', name => {
50
+ const chunk = 'ab'.repeat(1024);
51
+ const { ids, decoded } = roundTrip(name, { pczt_length: 4096, pczt_initial_chunk: chunk });
52
+ expect(ids).toEqual([1, 2]);
53
+ expect(decoded).toEqual({ pczt_length: 4096, pczt_initial_chunk: chunk });
54
+ });
55
+
56
+ test('ZcashPcztChunkAck round trips the data chunk', () => {
57
+ const { ids, decoded } = roundTrip('ZcashPcztChunkAck', { data_chunk: '00ff10' });
58
+ expect(ids).toEqual([1]);
59
+ expect(decoded).toEqual({ data_chunk: '00ff10' });
60
+ });
61
+
62
+ test.each(['ZcashPcztChunkRequest', 'ZcashSignedPcztChunkRequest'])(
63
+ '%s round trips the chunk length',
64
+ name => {
65
+ const { ids, decoded } = roundTrip(name, { chunk_length: 1024 });
66
+ expect(ids).toEqual([1]);
67
+ expect(decoded).toEqual({ chunk_length: 1024 });
68
+ }
69
+ );
70
+
71
+ test('ZcashGetAddress encodes every field with its schema id', () => {
72
+ const { ids, decoded } = roundTrip('ZcashGetAddress', {
73
+ address_n: [2147483680, 2147483781, 2147483648],
74
+ show_display: true,
75
+ include_seed_fingerprint: true,
76
+ include_ufvk: true,
77
+ diversifier_index: 0xffffffff,
78
+ address_type: 2,
79
+ scope: 1,
80
+ });
81
+ // address_n is unpacked: one tag per element.
82
+ expect(ids).toEqual([1, 1, 1, 2, 3, 4, 5, 6, 7]);
83
+ expect(decoded).toEqual({
84
+ address_n: [2147483680, 2147483781, 2147483648],
85
+ show_display: true,
86
+ include_seed_fingerprint: true,
87
+ include_ufvk: true,
88
+ diversifier_index: 0xffffffff,
89
+ address_type: 'UNIFIED_ORCHARD',
90
+ scope: 'INTERNAL',
91
+ });
92
+ });
93
+
94
+ test('ZcashGetAddress enum values match the schema', () => {
95
+ const addressType = messages.lookupEnum('ZcashAddressType').values;
96
+ const scope = messages.lookupEnum('ZcashAddressScope').values;
97
+ expect(addressType).toEqual({
98
+ UNIFIED_ORCHARD_P2PKH: 0,
99
+ TRANSPARENT_P2PKH: 1,
100
+ UNIFIED_ORCHARD: 2,
101
+ });
102
+ expect(scope).toEqual({ EXTERNAL: 0, INTERNAL: 1 });
103
+ });
104
+
105
+ test('ZcashGetAddress omits unset optional fields and keeps schema defaults', () => {
106
+ const { Message } = createMessageFromName(messages, 'ZcashGetAddress');
107
+ const { ids } = roundTrip('ZcashGetAddress', { address_n: [2147483680] });
108
+ expect(ids).toEqual([1]);
109
+ expect(Message.fields.diversifier_index.defaultValue).toBe(0);
110
+ expect(Message.fields.address_type.defaultValue).toBe(0);
111
+ expect(Message.fields.scope.defaultValue).toBe(0);
112
+ const empty = Message.decode(new Uint8Array(0)) as unknown as Record<string, unknown>;
113
+ expect(empty.diversifier_index).toBe(0);
114
+ expect(empty.address_type).toBe(0);
115
+ expect(empty.scope).toBe(0);
116
+ });
117
+
118
+ test('ZcashAddress decodes optional ufvk and seed fingerprint', () => {
119
+ const fingerprint = '0f'.repeat(32);
120
+ const full = roundTrip('ZcashAddress', {
121
+ address: 'u1abc',
122
+ ufvk: 'uview1abc',
123
+ seed_fingerprint: fingerprint,
124
+ });
125
+ expect(full.ids).toEqual([1, 2, 3]);
126
+ expect(full.decoded).toEqual({
127
+ address: 'u1abc',
128
+ ufvk: 'uview1abc',
129
+ seed_fingerprint: fingerprint,
130
+ });
131
+
132
+ const minimal = roundTrip('ZcashAddress', { address: 't1abc' });
133
+ expect(minimal.ids).toEqual([1]);
134
+ expect(minimal.decoded).toEqual({ address: 't1abc', ufvk: null, seed_fingerprint: null });
135
+ });
136
+
137
+ test('required fields are enforced on decode', () => {
138
+ const { Message } = createMessageFromName(messages, 'ZcashSignedPczt');
139
+ expect(() => Message.decode(new Uint8Array(0))).toThrow(/missing required/);
140
+ });
141
+ });
@@ -0,0 +1,387 @@
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
+
6
+ import type { Device } from '../src/device/Device';
7
+
8
+ jest.mock('../src/data/config', () => ({
9
+ getSDKVersion: jest.fn(() => '1.0.0'),
10
+ DEFAULT_DOMAIN: 'https://jssdk.onekey.so/1.0.0/',
11
+ }));
12
+
13
+ const hex = (byte: number, length: number) => byte.toString(16).padStart(2, '0').repeat(length);
14
+
15
+ const createSignMethod = (pczt: string) =>
16
+ new ZcashSignPczt({ id: 1, payload: { method: 'zcashSignPczt', pczt } });
17
+
18
+ const attachDevice = (method: ZcashSignPczt | ZcashGetAddress, typedCall: jest.Mock) => {
19
+ const commands = { typedCall };
20
+ method.device = {
21
+ commands,
22
+ getCommands: () => commands,
23
+ toMessageObject: () => ({}),
24
+ } as unknown as Device;
25
+ method.postMessage = jest.fn();
26
+ };
27
+
28
+ describe('ZcashSignPczt', () => {
29
+ test('uploads device-sized chunks and downloads host-sized chunks', async () => {
30
+ // 2500 bytes: initial 1024, then device asks 1000 + 476.
31
+ const pczt = hex(0xab, 2500);
32
+ const signed = Buffer.alloc(1500, 0xcd);
33
+ const method = createSignMethod(pczt);
34
+ method.init();
35
+
36
+ const typedCall = jest
37
+ .fn()
38
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1000 } })
39
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 476 } })
40
+ .mockResolvedValueOnce({
41
+ type: 'ZcashSignedPczt',
42
+ message: {
43
+ pczt_length: signed.length,
44
+ pczt_initial_chunk: signed.subarray(0, 1024).toString('hex'),
45
+ },
46
+ })
47
+ .mockResolvedValueOnce({
48
+ type: 'ZcashPcztChunkAck',
49
+ message: { data_chunk: signed.subarray(1024).toString('hex') },
50
+ });
51
+ attachDevice(method, typedCall);
52
+
53
+ await expect(method.run()).resolves.toEqual({ pczt: signed.toString('hex') });
54
+
55
+ expect(typedCall.mock.calls[0]).toEqual([
56
+ 'ZcashSignPczt',
57
+ ['ZcashSignedPczt', 'ZcashPcztChunkRequest'],
58
+ { pczt_length: 2500, pczt_initial_chunk: hex(0xab, 1024) },
59
+ ]);
60
+ expect(typedCall.mock.calls[1]).toEqual([
61
+ 'ZcashPcztChunkAck',
62
+ ['ZcashSignedPczt', 'ZcashPcztChunkRequest'],
63
+ { data_chunk: hex(0xab, 1000) },
64
+ ]);
65
+ expect(typedCall.mock.calls[2][2]).toEqual({ data_chunk: hex(0xab, 476) });
66
+ expect(typedCall.mock.calls[3]).toEqual([
67
+ 'ZcashSignedPcztChunkRequest',
68
+ 'ZcashPcztChunkAck',
69
+ { chunk_length: 476 },
70
+ ]);
71
+ expect(typedCall).toHaveBeenCalledTimes(4);
72
+ });
73
+
74
+ test('single-message round trip when both sides fit in the initial chunk', async () => {
75
+ const method = createSignMethod(hex(0x01, 100));
76
+ method.init();
77
+ const typedCall = jest.fn().mockResolvedValueOnce({
78
+ type: 'ZcashSignedPczt',
79
+ message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 80) },
80
+ });
81
+ attachDevice(method, typedCall);
82
+
83
+ await expect(method.run()).resolves.toEqual({ pczt: hex(0x02, 80) });
84
+ expect(typedCall).toHaveBeenCalledTimes(1);
85
+ });
86
+
87
+ test('rejects a device chunk request past the end of the pczt', async () => {
88
+ const method = createSignMethod(hex(0x01, 1100));
89
+ method.init();
90
+ const typedCall = jest
91
+ .fn()
92
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 200 } });
93
+ attachDevice(method, typedCall);
94
+
95
+ await expect(method.run()).rejects.toThrow('device requested 200 bytes at offset 1024');
96
+ });
97
+
98
+ test('rejects completion before the entire input has been uploaded', async () => {
99
+ const method = createSignMethod(hex(0x01, 1100));
100
+ method.init();
101
+ const typedCall = jest.fn().mockResolvedValueOnce({
102
+ type: 'ZcashSignedPczt',
103
+ message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 80) },
104
+ });
105
+ attachDevice(method, typedCall);
106
+ await expect(method.run()).rejects.toThrow('before receiving the whole pczt');
107
+ expect(typedCall).toHaveBeenCalledTimes(1);
108
+ });
109
+
110
+ test('rejects an initial signed chunk larger than its announced total', async () => {
111
+ const method = createSignMethod(hex(0x01, 100));
112
+ method.init();
113
+ const typedCall = jest.fn().mockResolvedValueOnce({
114
+ type: 'ZcashSignedPczt',
115
+ message: { pczt_length: 80, pczt_initial_chunk: hex(0x02, 81) },
116
+ });
117
+ attachDevice(method, typedCall);
118
+ await expect(method.run()).rejects.toThrow('more initial pczt bytes than announced');
119
+ expect(typedCall).toHaveBeenCalledTimes(1);
120
+ });
121
+
122
+ test('rejects an announced signed length that is not a sane positive size', async () => {
123
+ for (const total of [0, 1.5, 16 * 1024 * 1024 + 1]) {
124
+ const method = createSignMethod(hex(0x01, 100));
125
+ method.init();
126
+ const typedCall = jest.fn().mockResolvedValueOnce({
127
+ type: 'ZcashSignedPczt',
128
+ message: { pczt_length: total, pczt_initial_chunk: '' },
129
+ });
130
+ attachDevice(method, typedCall);
131
+ await expect(method.run()).rejects.toThrow('invalid signed pczt length');
132
+ }
133
+ });
134
+
135
+ test('rejects empty input and leaves size limits to the device', () => {
136
+ expect(() => createSignMethod('').init()).toThrow('pczt is empty');
137
+ const method = createSignMethod(hex(0x00, 64 * 1024));
138
+ expect(() => method.init()).not.toThrow();
139
+ expect(method.params.pczt_length).toBe(64 * 1024);
140
+ });
141
+ });
142
+
143
+ describe('ZcashSignPczt protocol edge cases', () => {
144
+ const signedMessage = (signed: Buffer, initialLength = 1024) => ({
145
+ type: 'ZcashSignedPczt',
146
+ message: {
147
+ pczt_length: signed.length,
148
+ pczt_initial_chunk: signed.subarray(0, initialLength).toString('hex'),
149
+ },
150
+ });
151
+
152
+ const runWith = (pczt: string, typedCall: jest.Mock) => {
153
+ const method = createSignMethod(pczt);
154
+ method.init();
155
+ attachDevice(method, typedCall);
156
+ return method.run();
157
+ };
158
+
159
+ test.each([
160
+ { name: 'short', data: hex(0xcd, 100) },
161
+ { name: 'empty', data: '' },
162
+ { name: 'missing', data: undefined },
163
+ ])('rejects a $name download chunk', async ({ data }) => {
164
+ const signed = Buffer.alloc(1500, 0xcd);
165
+ const typedCall = jest
166
+ .fn()
167
+ .mockResolvedValueOnce(signedMessage(signed))
168
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkAck', message: { data_chunk: data } });
169
+
170
+ await expect(runWith(hex(0x01, 100), typedCall)).rejects.toThrow(
171
+ 'requested bytes at offset 1024 of 1500'
172
+ );
173
+ expect(typedCall).toHaveBeenCalledTimes(2);
174
+ });
175
+
176
+ test('rejects a download chunk longer than requested', async () => {
177
+ const signed = Buffer.alloc(1500, 0xcd);
178
+ const typedCall = jest
179
+ .fn()
180
+ .mockResolvedValueOnce(signedMessage(signed))
181
+ .mockResolvedValueOnce({
182
+ type: 'ZcashPcztChunkAck',
183
+ message: { data_chunk: hex(0xcd, 477) },
184
+ });
185
+
186
+ await expect(runWith(hex(0x01, 100), typedCall)).rejects.toThrow(
187
+ 'device returned 477 of 476 requested bytes'
188
+ );
189
+ });
190
+
191
+ test.each([0, -1, 1.5, Number.NaN])(
192
+ 'rejects a device upload request for chunk length %s',
193
+ async chunkLength => {
194
+ const typedCall = jest.fn().mockResolvedValueOnce({
195
+ type: 'ZcashPcztChunkRequest',
196
+ message: { chunk_length: chunkLength },
197
+ });
198
+
199
+ await expect(runWith(hex(0x01, 2000), typedCall)).rejects.toThrow(
200
+ `device requested ${chunkLength} bytes at offset 1024`
201
+ );
202
+ expect(typedCall).toHaveBeenCalledTimes(1);
203
+ }
204
+ );
205
+
206
+ test('propagates a device Failure in the middle of upload', async () => {
207
+ const failure = ERRORS.TypedError(
208
+ HardwareErrorCode.ActionCancelled,
209
+ 'Action cancelled by user'
210
+ );
211
+ const typedCall = jest
212
+ .fn()
213
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 500 } })
214
+ .mockRejectedValueOnce(failure);
215
+
216
+ await expect(runWith(hex(0x01, 2000), typedCall)).rejects.toBe(failure);
217
+ expect(typedCall).toHaveBeenCalledTimes(2);
218
+ });
219
+
220
+ test('propagates a device Failure in the middle of download', async () => {
221
+ const failure = ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Firmware error');
222
+ const signed = Buffer.alloc(3000, 0xcd);
223
+ const typedCall = jest
224
+ .fn()
225
+ .mockResolvedValueOnce(signedMessage(signed))
226
+ .mockResolvedValueOnce({
227
+ type: 'ZcashPcztChunkAck',
228
+ message: { data_chunk: signed.subarray(1024, 2048).toString('hex') },
229
+ })
230
+ .mockRejectedValueOnce(failure);
231
+
232
+ await expect(runWith(hex(0x01, 100), typedCall)).rejects.toBe(failure);
233
+ expect(typedCall).toHaveBeenCalledTimes(3);
234
+ });
235
+
236
+ test('exactly 1024 bytes in both directions needs no extra chunks', async () => {
237
+ const signed = Buffer.alloc(1024, 0xcd);
238
+ const typedCall = jest.fn().mockResolvedValueOnce(signedMessage(signed));
239
+
240
+ await expect(runWith(hex(0xab, 1024), typedCall)).resolves.toEqual({
241
+ pczt: signed.toString('hex'),
242
+ });
243
+ expect(typedCall).toHaveBeenCalledTimes(1);
244
+ expect(typedCall.mock.calls[0][2]).toEqual({
245
+ pczt_length: 1024,
246
+ pczt_initial_chunk: hex(0xab, 1024),
247
+ });
248
+ });
249
+
250
+ test('1025 bytes in both directions splits into 1024 + 1', async () => {
251
+ const pczt = `${hex(0xab, 1024)}ef`;
252
+ const signed = Buffer.concat([Buffer.alloc(1024, 0xcd), Buffer.from([0x99])]);
253
+ const typedCall = jest
254
+ .fn()
255
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1 } })
256
+ .mockResolvedValueOnce(signedMessage(signed))
257
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkAck', message: { data_chunk: '99' } });
258
+
259
+ await expect(runWith(pczt, typedCall)).resolves.toEqual({ pczt: signed.toString('hex') });
260
+ expect(typedCall.mock.calls[0][2]).toEqual({
261
+ pczt_length: 1025,
262
+ pczt_initial_chunk: hex(0xab, 1024),
263
+ });
264
+ expect(typedCall.mock.calls[1][2]).toEqual({ data_chunk: 'ef' });
265
+ expect(typedCall.mock.calls[2][2]).toEqual({ chunk_length: 1 });
266
+ });
267
+
268
+ test('2048 bytes in both directions uses one full 1024-byte chunk each way', async () => {
269
+ const signed = Buffer.alloc(2048, 0xcd);
270
+ const typedCall = jest
271
+ .fn()
272
+ .mockResolvedValueOnce({ type: 'ZcashPcztChunkRequest', message: { chunk_length: 1024 } })
273
+ .mockResolvedValueOnce(signedMessage(signed))
274
+ .mockResolvedValueOnce({
275
+ type: 'ZcashPcztChunkAck',
276
+ message: { data_chunk: signed.subarray(1024).toString('hex') },
277
+ });
278
+
279
+ await expect(runWith(hex(0xab, 2048), typedCall)).resolves.toEqual({
280
+ pczt: signed.toString('hex'),
281
+ });
282
+ expect(typedCall.mock.calls[1][2]).toEqual({ data_chunk: hex(0xab, 1024) });
283
+ expect(typedCall.mock.calls[2][2]).toEqual({ chunk_length: 1024 });
284
+ expect(typedCall).toHaveBeenCalledTimes(3);
285
+ });
286
+
287
+ test.each(['abc', '0xabc', 'a'])('rejects odd-length hex %s', pczt => {
288
+ expect(() => createSignMethod(pczt).init()).toThrow('pczt hex must have an even length');
289
+ });
290
+
291
+ test.each(['zz', '0xgg', 'ab cd'])('rejects non-hex input %s', pczt => {
292
+ expect(() => createSignMethod(pczt).init()).toThrow('should be [hexString]');
293
+ });
294
+
295
+ test('accepts a 0x-prefixed even-length hex string', () => {
296
+ const method = createSignMethod('0xABcd');
297
+ method.init();
298
+ expect(method.params).toEqual({ pczt_length: 2, pczt_initial_chunk: 'abcd' });
299
+ });
300
+ });
301
+
302
+ describe('ZcashGetAddress', () => {
303
+ test('maps params and response', async () => {
304
+ const method = new ZcashGetAddress({
305
+ id: 1,
306
+ payload: {
307
+ method: 'zcashGetAddress',
308
+ path: "m/32'/133'/0'",
309
+ showOnOneKey: false,
310
+ includeUfvk: true,
311
+ includeSeedFingerprint: true,
312
+ },
313
+ });
314
+ method.init();
315
+ const typedCall = jest.fn().mockResolvedValue({
316
+ message: { address: 'u1abc', ufvk: 'uview1abc', seed_fingerprint: hex(0x0f, 32) },
317
+ });
318
+ attachDevice(method, typedCall);
319
+
320
+ await expect(method.run()).resolves.toEqual({
321
+ path: "m/32'/133'/0'",
322
+ address: 'u1abc',
323
+ ufvk: 'uview1abc',
324
+ seedFingerprint: hex(0x0f, 32),
325
+ });
326
+ expect(typedCall).toHaveBeenCalledWith('ZcashGetAddress', 'ZcashAddress', {
327
+ address_n: [2147483680, 2147483781, 2147483648],
328
+ address_type: 0,
329
+ scope: 0,
330
+ diversifier_index: 0,
331
+ show_display: false,
332
+ include_ufvk: true,
333
+ include_seed_fingerprint: true,
334
+ });
335
+ });
336
+ });
337
+
338
+ describe('Zcash address protocol selection', () => {
339
+ const createAddress = (params: Record<string, unknown> = {}) =>
340
+ new ZcashGetAddress({
341
+ id: 1,
342
+ payload: { method: 'zcashGetAddress', path: "m/32'/133'/0'", ...params },
343
+ });
344
+ test('supports only Pro2 and protocol V2', () => {
345
+ for (const method of [createAddress(), createSignMethod(hex(1, 1))]) {
346
+ method.init();
347
+ expect(method.supportsProtocol('V1')).toBe(false);
348
+ expect(method.supportsProtocol('V2')).toBe(true);
349
+ expect(method.strictCheckDeviceSupport).toBe(true);
350
+ expect(Object.keys(method.getVersionRange())).toEqual(['model_pro2']);
351
+ }
352
+ });
353
+ test.each([0, 1, 2])('maps address type %s with internal scope and index', async addressType => {
354
+ const method = createAddress({ addressType, scope: 1, diversifierIndex: 37 });
355
+ method.init();
356
+ const typedCall = jest.fn().mockResolvedValue({ message: { address: 'device-address' } });
357
+ attachDevice(method, typedCall);
358
+ await method.run();
359
+ expect(typedCall).toHaveBeenCalledWith(
360
+ 'ZcashGetAddress',
361
+ 'ZcashAddress',
362
+ expect.objectContaining({
363
+ address_type: addressType,
364
+ scope: 1,
365
+ diversifier_index: 37,
366
+ show_display: true,
367
+ })
368
+ );
369
+ });
370
+ test.each([
371
+ { addressType: 3 },
372
+ { scope: 2 },
373
+ { diversifierIndex: -1 },
374
+ { diversifierIndex: 1.5 },
375
+ { diversifierIndex: 0x80000000 },
376
+ { addressType: 2, diversifierIndex: 0x100000000 },
377
+ { path: "m/44'/133'/0'" },
378
+ { path: "m/32'/133'/0'/0/0" },
379
+ ])('rejects invalid address requests %j', params => {
380
+ expect(() => createAddress(params).init()).toThrow();
381
+ });
382
+ test('accepts the uint32 limit only for an Orchard-only address', () => {
383
+ expect(() =>
384
+ createAddress({ addressType: 2, diversifierIndex: 0xffffffff }).init()
385
+ ).not.toThrow();
386
+ });
387
+ });
@@ -140,4 +140,6 @@ export { default as benfenSignMessage } from './benfen/BenfenSignMessage';
140
140
  export { default as benfenSignTransaction } from './benfen/BenfenSignTransaction';
141
141
  export { default as neoGetAddress } from './neo/NeoGetAddress';
142
142
  export { default as neoSignTransaction } from './neo/NeoSignTransaction';
143
+ export { default as zcashGetAddress } from './zcash/ZcashGetAddress';
144
+ export { default as zcashSignPczt } from './zcash/ZcashSignPczt';
143
145
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,C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AE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAElF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { BaseMethod } from '../BaseMethod';
2
+ import type { ZcashGetAddress as HardwareZcashGetAddress } from '@onekeyfe/hd-transport';
3
+ import type { ZcashAddress } from '../../types/api/zcashGetAddress';
4
+ import type { DeviceFirmwareRange } from '../../types';
5
+ export default class ZcashGetAddress extends BaseMethod<HardwareZcashGetAddress[]> {
6
+ hasBundle: boolean;
7
+ getSupportedProtocols(): readonly ["V2"];
8
+ init(): void;
9
+ getVersionRange(): DeviceFirmwareRange;
10
+ run(): Promise<ZcashAddress | ZcashAddress[]>;
11
+ }
12
+ //# sourceMappingURL=ZcashGetAddress.d.ts.map