@onekeyfe/hd-core 1.2.8-alpha.134 → 1.2.8-alpha.135

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.
@@ -0,0 +1,75 @@
1
+ import MoneroGetWatchKey from '../src/api/monero/MoneroGetWatchKey';
2
+ import MoneroKeyImageSync from '../src/api/monero/MoneroKeyImageSync';
3
+ import ZcashGetFullViewingKey from '../src/api/zcash/ZcashGetFullViewingKey';
4
+ import { UI_REQUEST } from '../src/events';
5
+ import {
6
+ ProtocolV2UiInteractionCoordinator,
7
+ resolveProtocolV2UiInteraction,
8
+ } from '../src/protocols/protocol-v2/uiInteraction';
9
+
10
+ import type { BaseMethod } from '../src/api/BaseMethod';
11
+
12
+ jest.mock('../src/data/config', () => ({
13
+ getSDKVersion: jest.fn(() => '1.0.0'),
14
+ DEFAULT_DOMAIN: 'https://jssdk.onekey.so/1.0.0/',
15
+ }));
16
+
17
+ const key = (byte: number) => byte.toString(16).padStart(2, '0').repeat(32);
18
+
19
+ // Protocol V2 firmware sends no ButtonRequest, so these exports declare the prompt they cause.
20
+ test.each<[string, () => BaseMethod]>([
21
+ [
22
+ 'zcashGetFullViewingKey',
23
+ () =>
24
+ new ZcashGetFullViewingKey({
25
+ id: 1,
26
+ payload: { method: 'zcashGetFullViewingKey', path: "m/32'/133'/0'" },
27
+ }),
28
+ ],
29
+ [
30
+ 'moneroGetWatchKey',
31
+ () =>
32
+ new MoneroGetWatchKey({
33
+ id: 1,
34
+ payload: { method: 'moneroGetWatchKey', path: "m/44'/128'/0'", networkType: 0 },
35
+ }),
36
+ ],
37
+ [
38
+ 'moneroKeyImageSync',
39
+ () =>
40
+ new MoneroKeyImageSync({
41
+ id: 1,
42
+ payload: {
43
+ method: 'moneroKeyImageSync',
44
+ path: "m/44'/128'/0'",
45
+ networkType: 0,
46
+ transfers: [{ outKey: key(1), txPubKey: key(2), internalOutputIndex: 0 }],
47
+ },
48
+ }),
49
+ ],
50
+ ])('%s asks the client to show the device confirmation', (name, createMethod) => {
51
+ const method = createMethod();
52
+ method.init();
53
+ const postMessage = jest.fn();
54
+ const device = {
55
+ isProtocolV2: () => true,
56
+ toMessageObject: () => ({ connectId: 'pro2-test', deviceType: 'pro2' }),
57
+ };
58
+
59
+ // The same call the unlock-policy runner makes before run().
60
+ new ProtocolV2UiInteractionCoordinator(device as never, postMessage).enterMethodInteraction(
61
+ resolveProtocolV2UiInteraction(method)
62
+ );
63
+
64
+ expect(postMessage).toHaveBeenCalledTimes(1);
65
+ expect(postMessage).toHaveBeenCalledWith(
66
+ expect.objectContaining({
67
+ type: UI_REQUEST.REQUEST_BUTTON,
68
+ payload: expect.objectContaining({
69
+ reason: 'public-key-confirmation',
70
+ completion: 'operation-completed',
71
+ operation: name,
72
+ }),
73
+ })
74
+ );
75
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"MoneroGetWatchKey.d.ts","sourceRoot":"","sources":["../../../src/api/monero/MoneroGetWatchKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,KAAK,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAA2B,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEjG,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CAAC,yBAAyB,EAAE,CAAC;IACpF,SAAS,UAAS;IAElB,qBAAqB;IAIrB,IAAI;IAwBJ,eAAe;IAIT,GAAG;CAwBV"}
1
+ {"version":3,"file":"MoneroGetWatchKey.d.ts","sourceRoot":"","sources":["../../../src/api/monero/MoneroGetWatchKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,KAAK,EAAE,iBAAiB,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAA2B,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEjG,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CAAC,yBAAyB,EAAE,CAAC;IACpF,SAAS,UAAS;IAElB,qBAAqB;IAIrB,IAAI;IA6BJ,eAAe;IAIT,GAAG;CAwBV"}
@@ -1 +1 @@
1
- {"version":3,"file":"MoneroKeyImageSync.d.ts","sourceRoot":"","sources":["../../../src/api/monero/MoneroKeyImageSync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,oCAAoC,CAAC;AAM5C,KAAK,eAAe,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEvD,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB,CAAC;AAmEF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IAC5E,qBAAqB;IAIrB,IAAI;IAsBJ,eAAe;IAIT,GAAG;;;;CAsCV"}
1
+ {"version":3,"file":"MoneroKeyImageSync.d.ts","sourceRoot":"","sources":["../../../src/api/monero/MoneroKeyImageSync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,oCAAoC,CAAC;AAM5C,KAAK,eAAe,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAEvD,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB,CAAC;AAmEF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IAC5E,qBAAqB;IAIrB,IAAI;IA2BJ,eAAe;IAIT,GAAG;;;;CAsCV"}
@@ -1 +1 @@
1
- {"version":3,"file":"ZcashGetFullViewingKey.d.ts","sourceRoot":"","sources":["../../../src/api/zcash/ZcashGetFullViewingKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,KAAK,EAAE,sBAAsB,IAAI,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,8BAA8B,EAAE,CAAC;IAC9F,SAAS,UAAS;IAElB,qBAAqB;IAIrB,IAAI;IAiBJ,eAAe,IAAI,mBAAmB;IAQhC,GAAG;CAyBV"}
1
+ {"version":3,"file":"ZcashGetFullViewingKey.d.ts","sourceRoot":"","sources":["../../../src/api/zcash/ZcashGetFullViewingKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAO3C,OAAO,KAAK,EAAE,sBAAsB,IAAI,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,8BAA8B,EAAE,CAAC;IAC9F,SAAS,UAAS;IAElB,qBAAqB;IAIrB,IAAI;IAsBJ,eAAe,IAAI,mBAAmB;IAQhC,GAAG;CAyBV"}
package/dist/index.js CHANGED
@@ -66473,6 +66473,7 @@ class ZcashGetFullViewingKey extends BaseMethod {
66473
66473
  this.checkDeviceId = true;
66474
66474
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
66475
66475
  this.strictCheckDeviceSupport = true;
66476
+ this.protocolV2UiInteraction = createMethodInteraction('public-key-confirmation', 'zcashGetFullViewingKey');
66476
66477
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
66477
66478
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
66478
66479
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -66685,6 +66686,7 @@ class MoneroGetWatchKey extends BaseMethod {
66685
66686
  this.checkDeviceId = true;
66686
66687
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
66687
66688
  this.strictCheckDeviceSupport = true;
66689
+ this.protocolV2UiInteraction = createMethodInteraction('public-key-confirmation', 'moneroGetWatchKey');
66688
66690
  this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
66689
66691
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
66690
66692
  validateParams(payload, [{ name: 'bundle', type: 'array' }]);
@@ -66787,6 +66789,7 @@ class MoneroKeyImageSync extends BaseMethod {
66787
66789
  this.checkDeviceId = true;
66788
66790
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
66789
66791
  this.strictCheckDeviceSupport = true;
66792
+ this.protocolV2UiInteraction = createMethodInteraction('public-key-confirmation', 'moneroKeyImageSync');
66790
66793
  const payload = this.payload;
66791
66794
  validateParams(payload, [
66792
66795
  { name: 'path', required: true },
@@ -20,6 +20,7 @@ type PostMessage = (message: CoreMessage) => void;
20
20
  export declare const isProtocolV2UiEnabled: (method: {
21
21
  protocolV2UiMode?: 'auto' | 'none';
22
22
  }) => boolean;
23
+ export declare const createMethodInteraction: (reason: 'address-confirmation' | 'public-key-confirmation' | 'signing-confirmation', operation: string) => ProtocolV2InteractionDescriptor;
23
24
  export declare const resolveProtocolV2UiInteraction: (method: ProtocolV2InteractionMethod) => ProtocolV2InteractionDescriptor | undefined;
24
25
  export declare class ProtocolV2UiInteractionCoordinator {
25
26
  private readonly device;
@@ -1 +1 @@
1
- {"version":3,"file":"uiInteraction.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/uiInteraction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC1B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EACF,YAAY,GACZ,eAAe,GACf,eAAe,GACf,sBAAsB,GACtB,yBAAyB,GACzB,sBAAsB,GACtB,mBAAmB,CAAC;IACxB,UAAU,EAAE,sBAAsB,CAAC;IACnC,UAAU,EAAE,IAAI,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uBAAuB,CAAC,EAAE,+BAA+B,CAAC;CAC3D,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,GACvE,OAAO,CACL,IAAI,CACF,MAAM,EACJ,iCAAiC,GACjC,+BAA+B,GAC/B,gCAAgC,CACnC,CACF,CAAC;AACJ,KAAK,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;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BAAsB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS;IAiB9E,uBAAuB;IAIvB,KAAK,CACH,OAAO,GAAE;QACP,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC1B,GACL,OAAO;IAyBV,OAAO,CAAC,IAAI;CAcb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.8-alpha.134",
3
+ "version": "1.2.8-alpha.135",
4
4
  "description": "Core processes and APIs for communicating with OneKey hardware devices.",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "1.2.8-alpha.134",
29
- "@onekeyfe/hd-transport": "1.2.8-alpha.134",
28
+ "@onekeyfe/hd-shared": "1.2.8-alpha.135",
29
+ "@onekeyfe/hd-transport": "1.2.8-alpha.135",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "buffer": "^6.0.3",
@@ -46,5 +46,5 @@
46
46
  "@types/w3c-web-usb": "^1.0.10",
47
47
  "@types/web-bluetooth": "^0.0.21"
48
48
  },
49
- "gitHead": "15e55e8a6e60c881464845bdb2e3108a222a19a7"
49
+ "gitHead": "3f57cad8c1cfbe4a50909dc11e9db3edf92621bf"
50
50
  }
@@ -2,6 +2,7 @@ import { BaseMethod } from '../BaseMethod';
2
2
  import { serializedPath, validateStrictPath } from '../helpers/pathUtils';
3
3
  import { validateParams, validateResult } from '../helpers/paramsValidator';
4
4
  import { UI_REQUEST } from '../../constants/ui-request';
5
+ import { createMethodInteraction } from '../../protocols/protocol-v2/uiInteraction';
5
6
  import { decodeMoneroAddress, getMoneroVersionRange, validateMoneroNetworkType } from './helpers';
6
7
 
7
8
  import type { MoneroGetWatchKey as HardwareMoneroGetWatchKey } from '@onekeyfe/hd-transport';
@@ -18,6 +19,11 @@ export default class MoneroGetWatchKey extends BaseMethod<HardwareMoneroGetWatch
18
19
  this.checkDeviceId = true;
19
20
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
20
21
  this.strictCheckDeviceSupport = true;
22
+ // The name matches no Protocol V2 confirmation rule, so the export prompt is declared here.
23
+ this.protocolV2UiInteraction = createMethodInteraction(
24
+ 'public-key-confirmation',
25
+ 'moneroGetWatchKey'
26
+ );
21
27
 
22
28
  this.hasBundle = !!this.payload?.bundle;
23
29
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -6,6 +6,7 @@ import { hexToBytes, stripHexPrefix } from '../helpers/hexUtils';
6
6
  import { validateStrictPath } from '../helpers/pathUtils';
7
7
  import { invalidParameter, validateParams, validateResult } from '../helpers/paramsValidator';
8
8
  import { UI_REQUEST } from '../../constants/ui-request';
9
+ import { createMethodInteraction } from '../../protocols/protocol-v2/uiInteraction';
9
10
  import { getMoneroVersionRange, validateMoneroNetworkType } from './helpers';
10
11
 
11
12
  import type { MoneroTransferDetails } from '@onekeyfe/hd-transport';
@@ -101,6 +102,11 @@ export default class MoneroKeyImageSync extends BaseMethod<KeyImageSyncParams> {
101
102
  this.checkDeviceId = true;
102
103
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
103
104
  this.strictCheckDeviceSupport = true;
105
+ // The name matches no Protocol V2 confirmation rule, so the export prompt is declared here.
106
+ this.protocolV2UiInteraction = createMethodInteraction(
107
+ 'public-key-confirmation',
108
+ 'moneroKeyImageSync'
109
+ );
104
110
 
105
111
  const payload = this.payload as MoneroKeyImageSyncParams;
106
112
  validateParams(payload, [
@@ -2,6 +2,7 @@ import { BaseMethod } from '../BaseMethod';
2
2
  import { serializedPath } from '../helpers/pathUtils';
3
3
  import { validateParams, validateResult } from '../helpers/paramsValidator';
4
4
  import { UI_REQUEST } from '../../constants/ui-request';
5
+ import { createMethodInteraction } from '../../protocols/protocol-v2/uiInteraction';
5
6
  import { validateZcashAccountPath } from './helpers';
6
7
 
7
8
  import type { ZcashGetFullViewingKey as HardwareZcashGetFullViewingKey } from '@onekeyfe/hd-transport';
@@ -23,6 +24,11 @@ export default class ZcashGetFullViewingKey extends BaseMethod<HardwareZcashGetF
23
24
  this.checkDeviceId = true;
24
25
  this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
25
26
  this.strictCheckDeviceSupport = true;
27
+ // The name matches no Protocol V2 confirmation rule, so the export prompt is declared here.
28
+ this.protocolV2UiInteraction = createMethodInteraction(
29
+ 'public-key-confirmation',
30
+ 'zcashGetFullViewingKey'
31
+ );
26
32
 
27
33
  this.hasBundle = !!this.payload?.bundle;
28
34
  const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
@@ -71,7 +71,7 @@ const getDisplayState = (value: unknown) => {
71
71
  return { seen, enabled };
72
72
  };
73
73
 
74
- const createMethodInteraction = (
74
+ export const createMethodInteraction = (
75
75
  reason: 'address-confirmation' | 'public-key-confirmation' | 'signing-confirmation',
76
76
  operation: string
77
77
  ): ProtocolV2InteractionDescriptor => ({