@onekeyfe/hd-web-sdk 0.1.50 → 0.1.52

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.
@@ -4082,6 +4082,11 @@ const inject = ({
4082
4082
  connectId,
4083
4083
  method: 'getFeatures'
4084
4084
  }),
4085
+ batchGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
4086
+ connectId,
4087
+ deviceId,
4088
+ method: 'batchGetPublicKey'
4089
+ })),
4085
4090
  checkFirmwareRelease: connectId => call({
4086
4091
  connectId,
4087
4092
  method: 'checkFirmwareRelease'
@@ -8179,6 +8184,45 @@ var nested = {
8179
8184
  }
8180
8185
  }
8181
8186
  },
8187
+ BatchGetPublickeys: {
8188
+ fields: {
8189
+ ecdsa_curve_name: {
8190
+ type: "string",
8191
+ id: 1,
8192
+ options: {
8193
+ "default": "ed25519"
8194
+ }
8195
+ },
8196
+ paths: {
8197
+ rule: "repeated",
8198
+ type: "Path",
8199
+ id: 2
8200
+ }
8201
+ },
8202
+ nested: {
8203
+ Path: {
8204
+ fields: {
8205
+ address_n: {
8206
+ rule: "repeated",
8207
+ type: "uint32",
8208
+ id: 1,
8209
+ options: {
8210
+ packed: false
8211
+ }
8212
+ }
8213
+ }
8214
+ }
8215
+ }
8216
+ },
8217
+ EcdsaPublicKeys: {
8218
+ fields: {
8219
+ public_keys: {
8220
+ rule: "repeated",
8221
+ type: "bytes",
8222
+ id: 1
8223
+ }
8224
+ }
8225
+ },
8182
8226
  DebugLinkDecision: {
8183
8227
  fields: {
8184
8228
  yes_no: {
@@ -13340,6 +13384,8 @@ var nested = {
13340
13384
  MessageType_CosiCommitment: 72,
13341
13385
  MessageType_CosiSign: 73,
13342
13386
  MessageType_CosiSignature: 74,
13387
+ MessageType_BatchGetPublickeys: 10016,
13388
+ MessageType_EcdsaPublicKeys: 10017,
13343
13389
  MessageType_DebugLinkDecision: 100,
13344
13390
  MessageType_DebugLinkGetState: 101,
13345
13391
  MessageType_DebugLinkState: 102,
@@ -15310,11 +15356,11 @@ class DeviceCommands {
15310
15356
  _commonCall(type, msg) {
15311
15357
  return __awaiter(this, void 0, void 0, function* () {
15312
15358
  const resp = yield this.call(type, msg);
15313
- return this._filterCommonTypes(resp);
15359
+ return this._filterCommonTypes(resp, type);
15314
15360
  });
15315
15361
  }
15316
15362
 
15317
- _filterCommonTypes(res) {
15363
+ _filterCommonTypes(res, callType) {
15318
15364
  Log$5.debug('_filterCommonTypes: ', res);
15319
15365
 
15320
15366
  if (res.type === 'Failure') {
@@ -15344,6 +15390,10 @@ class DeviceCommands {
15344
15390
  error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlindSignDisabled);
15345
15391
  }
15346
15392
 
15393
+ if (code === 'Failure_UnexpectedMessage' && callType === 'PassphraseAck') {
15394
+ error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.UnexpectPassphrase);
15395
+ }
15396
+
15347
15397
  if (error) {
15348
15398
  return Promise.reject(error);
15349
15399
  }
@@ -17042,6 +17092,50 @@ class RequestWebUsbDevice extends BaseMethod {
17042
17092
 
17043
17093
  }
17044
17094
 
17095
+ class BatchGetPublicKey extends BaseMethod {
17096
+ init() {
17097
+ this.checkDeviceId = true;
17098
+ validateParams(this.payload, [{
17099
+ name: 'paths',
17100
+ type: 'array'
17101
+ }, {
17102
+ name: 'ecdsaCurveName',
17103
+ type: 'string'
17104
+ }]);
17105
+ this.params = this.payload.paths.map(path => {
17106
+ const addressN = validatePath(path, 1);
17107
+ return {
17108
+ address_n: addressN
17109
+ };
17110
+ });
17111
+ }
17112
+
17113
+ getVersionRange() {
17114
+ return {
17115
+ model_mini: {
17116
+ min: '2.6.0'
17117
+ }
17118
+ };
17119
+ }
17120
+
17121
+ run() {
17122
+ var _a;
17123
+
17124
+ return __awaiter(this, void 0, void 0, function* () {
17125
+ const res = yield this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
17126
+ paths: this.params,
17127
+ ecdsa_curve_name: (_a = this.payload.ecdsaCurveName) !== null && _a !== void 0 ? _a : 'secp256k1'
17128
+ });
17129
+ const result = res.message.public_keys.map((publicKey, index) => ({
17130
+ path: serializedPath(this.params[index].address_n),
17131
+ publicKey
17132
+ }));
17133
+ return Promise.resolve(result);
17134
+ });
17135
+ }
17136
+
17137
+ }
17138
+
17045
17139
  class CipherKeyValue extends BaseMethod {
17046
17140
  constructor() {
17047
17141
  super(...arguments);
@@ -20690,6 +20784,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
20690
20784
  deviceWipe: DeviceWipe,
20691
20785
  firmwareUpdate: FirmwareUpdate,
20692
20786
  requestWebUsbDevice: RequestWebUsbDevice,
20787
+ batchGetPublicKey: BatchGetPublicKey,
20693
20788
  cipherKeyValue: CipherKeyValue,
20694
20789
  btcGetAddress: BTCGetAddress,
20695
20790
  btcGetPublicKey: BTCGetPublicKey,
@@ -21380,7 +21475,8 @@ const onDevicePassphraseHandler = (...[device, callback]) => __awaiter(void 0, v
21380
21475
  Log.debug('onDevicePassphraseHandler');
21381
21476
  const uiPromise = createUiPromise(UI_RESPONSE.RECEIVE_PASSPHRASE, device);
21382
21477
  postMessage(createUiMessage(UI_REQUEST$1.REQUEST_PASSPHRASE, {
21383
- device: device.toMessageObject()
21478
+ device: device.toMessageObject(),
21479
+ passphraseState: device.passphraseState
21384
21480
  }));
21385
21481
  const uiResp = yield uiPromise.promise;
21386
21482
  const {
@@ -22871,7 +22967,8 @@ const HardwareErrorCode = {
22871
22967
  BridgeNotInstalled: 808,
22872
22968
  PollingTimeout: 809,
22873
22969
  PollingStop: 810,
22874
- BlindSignDisabled: 811
22970
+ BlindSignDisabled: 811,
22971
+ UnexpectPassphrase: 812
22875
22972
  };
22876
22973
  const HardwareErrorCodeMessage = {
22877
22974
  [HardwareErrorCode.UnknownError]: 'Unknown error occurred. Check message property.',
@@ -22930,7 +23027,8 @@ const HardwareErrorCodeMessage = {
22930
23027
  [HardwareErrorCode.BridgeNotInstalled]: 'Bridge not installed',
22931
23028
  [HardwareErrorCode.PollingTimeout]: 'Polling timeout',
22932
23029
  [HardwareErrorCode.PollingStop]: 'Polling stop',
22933
- [HardwareErrorCode.BlindSignDisabled]: 'Please confirm the BlindSign enabled'
23030
+ [HardwareErrorCode.BlindSignDisabled]: 'Please confirm the BlindSign enabled',
23031
+ [HardwareErrorCode.UnexpectPassphrase]: 'Unexpect passphrase'
22934
23032
  };
22935
23033
 
22936
23034
  const TypedError = (hardwareError, message, params) => {
@@ -45657,7 +45755,7 @@ try {
45657
45755
  /***/ ((module) => {
45658
45756
 
45659
45757
  "use strict";
45660
- module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.50","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.1.50","@onekeyfe/hd-transport":"^0.1.50","axios":"^0.27.2","bignumber.js":"^9.0.2","js-sha256":"^0.9.0","parse-uri":"^1.0.7","semver":"^7.3.7"},"devDependencies":{"@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
45758
+ module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.52","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.1.52","@onekeyfe/hd-transport":"^0.1.52","axios":"^0.27.2","bignumber.js":"^9.0.2","js-sha256":"^0.9.0","parse-uri":"^1.0.7","semver":"^7.3.7"},"devDependencies":{"@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}');
45661
45759
 
45662
45760
  /***/ })
45663
45761
 
@@ -48189,7 +48287,7 @@ const src_init = async settings => {
48189
48287
 
48190
48288
  try {
48191
48289
  await init({ ..._settings,
48192
- version: "0.1.50"
48290
+ version: "0.1.52"
48193
48291
  });
48194
48292
  return true;
48195
48293
  } catch (e) {