@onekeyfe/hd-core 1.2.2-alpha.101 → 1.2.2-alpha.102

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.
@@ -25,15 +25,17 @@ const createMethod = (overrides: Record<string, unknown> = {}) =>
25
25
  messageVersion: SolanaOffChainMessageVersion.MESSAGE_VERSION_1,
26
26
  messageFormat: SolanaOffChainMessageFormat.V0_LIMITED_UTF8,
27
27
  applicationDomainHex: `0x${'aa'.repeat(32)}`,
28
- sourceFingerprint: 0x12345678,
29
28
  requiredSigners,
30
29
  ...overrides,
31
30
  },
32
31
  });
33
32
 
34
33
  describe('SolSignOffchainMessage', () => {
35
- test('maps V1 parameters without imposing a host-side signer count limit', async () => {
36
- const method = createMethod();
34
+ test.each([
35
+ { description: 'without a host-side signer count limit', requiredSigners },
36
+ { description: 'with omitted optional signers', requiredSigners: undefined },
37
+ ])('maps V1 parameters $description', async ({ requiredSigners }) => {
38
+ const method = createMethod({ requiredSigners });
37
39
  method.init();
38
40
 
39
41
  const typedCall = jest.fn().mockResolvedValue({
@@ -48,8 +50,7 @@ describe('SolSignOffchainMessage', () => {
48
50
  message_version: SolanaOffChainMessageVersion.MESSAGE_VERSION_1,
49
51
  message_format: SolanaOffChainMessageFormat.V0_LIMITED_UTF8,
50
52
  application_domain: 'aa'.repeat(32),
51
- source_fingerprint: 0x12345678,
52
- required_signers: requiredSigners,
53
+ required_signers: requiredSigners ?? [],
53
54
  });
54
55
  });
55
56
 
@@ -60,11 +61,4 @@ describe('SolSignOffchainMessage', () => {
60
61
  ])('rejects invalid required signers: $error', ({ requiredSigners, error }) => {
61
62
  expect(() => createMethod({ requiredSigners }).init()).toThrow(error);
62
63
  });
63
-
64
- test.each([-1, 0x100000000, 1.5])(
65
- 'rejects an invalid source fingerprint: %s',
66
- sourceFingerprint => {
67
- expect(() => createMethod({ sourceFingerprint }).init()).toThrow('uint32');
68
- }
69
- );
70
64
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SolSignOffchainMessage.d.ts","sourceRoot":"","sources":["../../../src/api/solana/SolSignOffchainMessage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,yBAAyB,IAAI,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AA6B1G,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IAC5F,qBAAqB;IAIrB,IAAI;IAqDJ,eAAe;;;;;;;;;;;IAcT,GAAG;;;;CAcV"}
1
+ {"version":3,"file":"SolSignOffchainMessage.d.ts","sourceRoot":"","sources":["../../../src/api/solana/SolSignOffchainMessage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,yBAAyB,IAAI,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AA2B1G,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IAC5F,qBAAqB;IAIrB,IAAI;IA0CJ,eAAe;;;;;;;;;;;IAcT,GAAG;;;;CAcV"}
package/dist/index.d.ts CHANGED
@@ -2477,7 +2477,6 @@ type SolSignOffchainMessageParams = {
2477
2477
  messageVersion?: SolanaOffChainMessageVersion;
2478
2478
  messageFormat?: SolanaOffChainMessageFormat;
2479
2479
  applicationDomainHex?: string;
2480
- sourceFingerprint?: number;
2481
2480
  /** 32-byte public keys encoded as hex, strictly sorted and unique. */
2482
2481
  requiredSigners?: string[];
2483
2482
  };
package/dist/index.js CHANGED
@@ -31502,10 +31502,6 @@ var nested = {
31502
31502
  request_id: {
31503
31503
  type: "bytes",
31504
31504
  id: 5
31505
- },
31506
- source_fingerprint: {
31507
- type: "uint32",
31508
- id: 6
31509
31505
  }
31510
31506
  }
31511
31507
  },
@@ -31761,10 +31757,6 @@ var nested = {
31761
31757
  expected_address: {
31762
31758
  type: "bytes",
31763
31759
  id: 12
31764
- },
31765
- source_fingerprint: {
31766
- type: "uint32",
31767
- id: 13
31768
31760
  }
31769
31761
  }
31770
31762
  },
@@ -31849,10 +31841,6 @@ var nested = {
31849
31841
  expected_address: {
31850
31842
  type: "bytes",
31851
31843
  id: 12
31852
- },
31853
- source_fingerprint: {
31854
- type: "uint32",
31855
- id: 13
31856
31844
  }
31857
31845
  }
31858
31846
  },
@@ -32000,7 +31988,29 @@ var nested = {
32000
31988
  type: "EthereumAuthorizationSignature",
32001
31989
  id: 10
32002
31990
  }
32003
- }
31991
+ },
31992
+ reserved: [
31993
+ [
31994
+ 5,
31995
+ 5
31996
+ ],
31997
+ [
31998
+ 6,
31999
+ 6
32000
+ ],
32001
+ [
32002
+ 7,
32003
+ 7
32004
+ ],
32005
+ [
32006
+ 8,
32007
+ 8
32008
+ ],
32009
+ [
32010
+ 9,
32011
+ 9
32012
+ ]
32013
+ ]
32004
32014
  },
32005
32015
  EthereumTxAckOneKey: {
32006
32016
  fields: {
@@ -32029,10 +32039,6 @@ var nested = {
32029
32039
  chain_id: {
32030
32040
  type: "uint64",
32031
32041
  id: 3
32032
- },
32033
- source_fingerprint: {
32034
- type: "uint32",
32035
- id: 4
32036
32042
  }
32037
32043
  }
32038
32044
  },
@@ -36079,10 +36085,6 @@ var nested = {
36079
36085
  rule: "required",
36080
36086
  type: "bytes",
36081
36087
  id: 2
36082
- },
36083
- source_fingerprint: {
36084
- type: "uint32",
36085
- id: 3
36086
36088
  }
36087
36089
  }
36088
36090
  },
@@ -36125,14 +36127,10 @@ var nested = {
36125
36127
  type: "bytes",
36126
36128
  id: 5
36127
36129
  },
36128
- source_fingerprint: {
36129
- type: "uint32",
36130
- id: 6
36131
- },
36132
36130
  required_signers: {
36133
36131
  rule: "repeated",
36134
36132
  type: "bytes",
36135
- id: 7
36133
+ id: 6
36136
36134
  }
36137
36135
  }
36138
36136
  },
@@ -36150,10 +36148,6 @@ var nested = {
36150
36148
  rule: "required",
36151
36149
  type: "bytes",
36152
36150
  id: 2
36153
- },
36154
- source_fingerprint: {
36155
- type: "uint32",
36156
- id: 3
36157
36151
  }
36158
36152
  }
36159
36153
  },
@@ -38969,6 +38963,10 @@ var nested = {
38969
38963
  manufacture_time: {
38970
38964
  type: "DeviceFactoryInfoManufactureTime",
38971
38965
  id: 5
38966
+ },
38967
+ data: {
38968
+ type: "bytes",
38969
+ id: 100
38972
38970
  }
38973
38971
  }
38974
38972
  },
@@ -38978,11 +38976,19 @@ var nested = {
38978
38976
  rule: "required",
38979
38977
  type: "DeviceFactoryInfo",
38980
38978
  id: 1
38979
+ },
38980
+ full_data: {
38981
+ type: "bool",
38982
+ id: 2
38981
38983
  }
38982
38984
  }
38983
38985
  },
38984
38986
  DeviceFactoryInfoGet: {
38985
38987
  fields: {
38988
+ full_data: {
38989
+ type: "bool",
38990
+ id: 1
38991
+ }
38986
38992
  }
38987
38993
  },
38988
38994
  DeviceFactoryPermanentLock: {
@@ -59471,9 +59477,7 @@ class SolSignTransaction extends BaseMethod {
59471
59477
 
59472
59478
  const SOLANA_PUBLIC_KEY_LENGTH = 32;
59473
59479
  const SOLANA_APPLICATION_DOMAIN_LENGTH = 32;
59474
- const normalizeRequiredSigners = (requiredSigners) => {
59475
- if (!requiredSigners)
59476
- return undefined;
59480
+ const normalizeRequiredSigners = (requiredSigners = []) => {
59477
59481
  const normalized = requiredSigners.map((signer, index) => {
59478
59482
  if (typeof signer !== 'string' ||
59479
59483
  !isHexString(addHexPrefix(signer), SOLANA_PUBLIC_KEY_LENGTH)) {
@@ -59502,17 +59506,10 @@ class SolSignOffchainMessage extends BaseMethod {
59502
59506
  { name: 'messageVersion', type: 'number', required: false },
59503
59507
  { name: 'messageFormat', type: 'number', required: false },
59504
59508
  { name: 'applicationDomainHex', type: 'hexString', required: false },
59505
- { name: 'sourceFingerprint', type: 'number', required: false },
59506
59509
  { name: 'requiredSigners', type: 'array', required: false, allowEmpty: true },
59507
59510
  ]);
59508
- const { path, messageHex, messageVersion, messageFormat, applicationDomainHex, sourceFingerprint, requiredSigners, } = this.payload;
59511
+ const { path, messageHex, messageVersion, messageFormat, applicationDomainHex, requiredSigners, } = this.payload;
59509
59512
  const addressN = validatePath(path, 3);
59510
- if (sourceFingerprint !== undefined &&
59511
- (!Number.isInteger(sourceFingerprint) ||
59512
- sourceFingerprint < 0 ||
59513
- sourceFingerprint > 0xffffffff)) {
59514
- throw invalidParameter('Parameter [sourceFingerprint] must be a uint32 number.');
59515
- }
59516
59513
  if (applicationDomainHex !== undefined &&
59517
59514
  !isHexString(addHexPrefix(applicationDomainHex), SOLANA_APPLICATION_DOMAIN_LENGTH)) {
59518
59515
  throw invalidParameter('Parameter [applicationDomainHex] must be 32 bytes.');
@@ -59523,7 +59520,6 @@ class SolSignOffchainMessage extends BaseMethod {
59523
59520
  message_version: messageVersion !== null && messageVersion !== void 0 ? messageVersion : undefined,
59524
59521
  message_format: messageFormat !== null && messageFormat !== void 0 ? messageFormat : undefined,
59525
59522
  application_domain: applicationDomainHex ? stripHexPrefix(applicationDomainHex) : undefined,
59526
- source_fingerprint: sourceFingerprint !== null && sourceFingerprint !== void 0 ? sourceFingerprint : undefined,
59527
59523
  required_signers: normalizeRequiredSigners(requiredSigners),
59528
59524
  };
59529
59525
  }
@@ -10,7 +10,6 @@ export type SolSignOffchainMessageParams = {
10
10
  messageVersion?: SolanaOffChainMessageVersion;
11
11
  messageFormat?: SolanaOffChainMessageFormat;
12
12
  applicationDomainHex?: string;
13
- sourceFingerprint?: number;
14
13
  requiredSigners?: string[];
15
14
  };
16
15
  export declare function solSignOffchainMessage(connectId: string, deviceId: string, params: CommonParams & SolSignOffchainMessageParams): Response<SolSignOffchainMessageResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"solSignOffchainMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/solSignOffchainMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,wBAAwB,C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C,EAAE,MAAM,CAAC;IAE9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,4BAA4B,GAClD,QAAQ,CAAC,8BAA8B,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.2-alpha.101",
3
+ "version": "1.2.2-alpha.102",
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.2-alpha.101",
29
- "@onekeyfe/hd-transport": "1.2.2-alpha.101",
28
+ "@onekeyfe/hd-shared": "1.2.2-alpha.102",
29
+ "@onekeyfe/hd-transport": "1.2.2-alpha.102",
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": "b9a5ca0c73e5e2cc979c91c007ace476e442718c"
49
+ "gitHead": "abddc95e03d794d9c6fce7765d59de1f48a684d0"
50
50
  }
@@ -9,9 +9,7 @@ import type { SolanaSignOffChainMessage as HardwareSolSignOffChainMessage } from
9
9
  const SOLANA_PUBLIC_KEY_LENGTH = 32;
10
10
  const SOLANA_APPLICATION_DOMAIN_LENGTH = 32;
11
11
 
12
- const normalizeRequiredSigners = (requiredSigners?: unknown[]): string[] | undefined => {
13
- if (!requiredSigners) return undefined;
14
-
12
+ const normalizeRequiredSigners = (requiredSigners: unknown[] = []): string[] => {
15
13
  const normalized = requiredSigners.map((signer, index) => {
16
14
  if (
17
15
  typeof signer !== 'string' ||
@@ -50,7 +48,6 @@ export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
50
48
  { name: 'messageVersion', type: 'number', required: false },
51
49
  { name: 'messageFormat', type: 'number', required: false },
52
50
  { name: 'applicationDomainHex', type: 'hexString', required: false },
53
- { name: 'sourceFingerprint', type: 'number', required: false },
54
51
  { name: 'requiredSigners', type: 'array', required: false, allowEmpty: true },
55
52
  ]);
56
53
 
@@ -60,18 +57,9 @@ export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
60
57
  messageVersion,
61
58
  messageFormat,
62
59
  applicationDomainHex,
63
- sourceFingerprint,
64
60
  requiredSigners,
65
61
  } = this.payload;
66
62
  const addressN = validatePath(path, 3);
67
- if (
68
- sourceFingerprint !== undefined &&
69
- (!Number.isInteger(sourceFingerprint) ||
70
- sourceFingerprint < 0 ||
71
- sourceFingerprint > 0xffffffff)
72
- ) {
73
- throw invalidParameter('Parameter [sourceFingerprint] must be a uint32 number.');
74
- }
75
63
  if (
76
64
  applicationDomainHex !== undefined &&
77
65
  !isHexString(addHexPrefix(applicationDomainHex), SOLANA_APPLICATION_DOMAIN_LENGTH)
@@ -86,7 +74,6 @@ export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOf
86
74
  message_version: messageVersion ?? undefined,
87
75
  message_format: messageFormat ?? undefined,
88
76
  application_domain: applicationDomainHex ? stripHexPrefix(applicationDomainHex) : undefined,
89
- source_fingerprint: sourceFingerprint ?? undefined,
90
77
  required_signers: normalizeRequiredSigners(requiredSigners),
91
78
  };
92
79
  }
@@ -4463,10 +4463,6 @@
4463
4463
  "request_id": {
4464
4464
  "type": "bytes",
4465
4465
  "id": 5
4466
- },
4467
- "source_fingerprint": {
4468
- "type": "uint32",
4469
- "id": 6
4470
4466
  }
4471
4467
  }
4472
4468
  },
@@ -4722,10 +4718,6 @@
4722
4718
  "expected_address": {
4723
4719
  "type": "bytes",
4724
4720
  "id": 12
4725
- },
4726
- "source_fingerprint": {
4727
- "type": "uint32",
4728
- "id": 13
4729
4721
  }
4730
4722
  }
4731
4723
  },
@@ -4810,10 +4802,6 @@
4810
4802
  "expected_address": {
4811
4803
  "type": "bytes",
4812
4804
  "id": 12
4813
- },
4814
- "source_fingerprint": {
4815
- "type": "uint32",
4816
- "id": 13
4817
4805
  }
4818
4806
  }
4819
4807
  },
@@ -4961,7 +4949,14 @@
4961
4949
  "type": "EthereumAuthorizationSignature",
4962
4950
  "id": 10
4963
4951
  }
4964
- }
4952
+ },
4953
+ "reserved": [
4954
+ [5, 5],
4955
+ [6, 6],
4956
+ [7, 7],
4957
+ [8, 8],
4958
+ [9, 9]
4959
+ ]
4965
4960
  },
4966
4961
  "EthereumTxAckOneKey": {
4967
4962
  "fields": {
@@ -4990,10 +4985,6 @@
4990
4985
  "chain_id": {
4991
4986
  "type": "uint64",
4992
4987
  "id": 3
4993
- },
4994
- "source_fingerprint": {
4995
- "type": "uint32",
4996
- "id": 4
4997
4988
  }
4998
4989
  }
4999
4990
  },
@@ -9017,10 +9008,6 @@
9017
9008
  "rule": "required",
9018
9009
  "type": "bytes",
9019
9010
  "id": 2
9020
- },
9021
- "source_fingerprint": {
9022
- "type": "uint32",
9023
- "id": 3
9024
9011
  }
9025
9012
  }
9026
9013
  },
@@ -9063,14 +9050,10 @@
9063
9050
  "type": "bytes",
9064
9051
  "id": 5
9065
9052
  },
9066
- "source_fingerprint": {
9067
- "type": "uint32",
9068
- "id": 6
9069
- },
9070
9053
  "required_signers": {
9071
9054
  "rule": "repeated",
9072
9055
  "type": "bytes",
9073
- "id": 7
9056
+ "id": 6
9074
9057
  }
9075
9058
  }
9076
9059
  },
@@ -9088,10 +9071,6 @@
9088
9071
  "rule": "required",
9089
9072
  "type": "bytes",
9090
9073
  "id": 2
9091
- },
9092
- "source_fingerprint": {
9093
- "type": "uint32",
9094
- "id": 3
9095
9074
  }
9096
9075
  }
9097
9076
  },
@@ -11888,6 +11867,10 @@
11888
11867
  "manufacture_time": {
11889
11868
  "type": "DeviceFactoryInfoManufactureTime",
11890
11869
  "id": 5
11870
+ },
11871
+ "data": {
11872
+ "type": "bytes",
11873
+ "id": 100
11891
11874
  }
11892
11875
  }
11893
11876
  },
@@ -11897,11 +11880,20 @@
11897
11880
  "rule": "required",
11898
11881
  "type": "DeviceFactoryInfo",
11899
11882
  "id": 1
11883
+ },
11884
+ "full_data": {
11885
+ "type": "bool",
11886
+ "id": 2
11900
11887
  }
11901
11888
  }
11902
11889
  },
11903
11890
  "DeviceFactoryInfoGet": {
11904
- "fields": {}
11891
+ "fields": {
11892
+ "full_data": {
11893
+ "type": "bool",
11894
+ "id": 1
11895
+ }
11896
+ }
11905
11897
  },
11906
11898
  "DeviceFactoryPermanentLock": {
11907
11899
  "fields": {
@@ -15,7 +15,6 @@ export type SolSignOffchainMessageParams = {
15
15
  messageVersion?: SolanaOffChainMessageVersion;
16
16
  messageFormat?: SolanaOffChainMessageFormat;
17
17
  applicationDomainHex?: string;
18
- sourceFingerprint?: number;
19
18
  /** 32-byte public keys encoded as hex, strictly sorted and unique. */
20
19
  requiredSigners?: string[];
21
20
  };