@onekeyfe/hd-web-sdk 0.1.51 → 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.
- package/build/data/messages/messages.json +41 -0
- package/build/iframe.html +1 -1
- package/build/js/iframe.85b50859cfdb077280b0.js +3 -0
- package/build/js/{iframe.fe55716ec5664e14b47b.js.LICENSE.txt → iframe.85b50859cfdb077280b0.js.LICENSE.txt} +0 -0
- package/build/js/iframe.85b50859cfdb077280b0.js.map +1 -0
- package/build/onekey-js-sdk.js +100 -20
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +6 -6
- package/webpack/webpack.config.ts +1 -0
- package/build/js/iframe.fe55716ec5664e14b47b.js +0 -3
- package/build/js/iframe.fe55716ec5664e14b47b.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -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,
|
|
@@ -15583,7 +15629,6 @@ class Device extends events.exports {
|
|
|
15583
15629
|
this.needReloadDevice = false;
|
|
15584
15630
|
this.keepSession = false;
|
|
15585
15631
|
this.passphraseState = undefined;
|
|
15586
|
-
this.skipPassphraseCheck = false;
|
|
15587
15632
|
this.originalDescriptor = descriptor;
|
|
15588
15633
|
}
|
|
15589
15634
|
|
|
@@ -15723,11 +15768,10 @@ class Device extends events.exports {
|
|
|
15723
15768
|
getInternalState(_deviceId) {
|
|
15724
15769
|
var _a, _b;
|
|
15725
15770
|
|
|
15726
|
-
Log$4.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}
|
|
15771
|
+
Log$4.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `features.device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
15727
15772
|
Log$4.debug('getInternalState session cache: ', deviceSessionCache);
|
|
15728
15773
|
const deviceId = _deviceId || ((_b = this.features) === null || _b === void 0 ? void 0 : _b.device_id);
|
|
15729
15774
|
if (!deviceId) return undefined;
|
|
15730
|
-
if (this.skipPassphraseCheck) return deviceSessionCache[deviceId];
|
|
15731
15775
|
if (!this.passphraseState) return undefined;
|
|
15732
15776
|
const usePassKey = `${deviceId}@${this.passphraseState}`;
|
|
15733
15777
|
|
|
@@ -15747,11 +15791,7 @@ class Device extends events.exports {
|
|
|
15747
15791
|
|
|
15748
15792
|
Log$4.debug('setInternalState session param: ', `state: ${state}`, `initSession: ${initSession}`, `device_id: ${(_a = this.features) === null || _a === void 0 ? void 0 : _a.device_id}`, `passphraseState: ${this.passphraseState}`);
|
|
15749
15793
|
if (!this.features) return;
|
|
15750
|
-
|
|
15751
|
-
if (!this.skipPassphraseCheck) {
|
|
15752
|
-
if (!this.passphraseState && !initSession) return;
|
|
15753
|
-
}
|
|
15754
|
-
|
|
15794
|
+
if (!this.passphraseState && !initSession) return;
|
|
15755
15795
|
let key = `${this.features.device_id}`;
|
|
15756
15796
|
|
|
15757
15797
|
if (this.passphraseState) {
|
|
@@ -15784,7 +15824,6 @@ class Device extends events.exports {
|
|
|
15784
15824
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15785
15825
|
Log$4.debug('initialize param:', options);
|
|
15786
15826
|
this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
15787
|
-
this.skipPassphraseCheck = options === null || options === void 0 ? void 0 : options.skipPassphraseCheck;
|
|
15788
15827
|
|
|
15789
15828
|
if (options === null || options === void 0 ? void 0 : options.initSession) {
|
|
15790
15829
|
this.clearInternalState(options === null || options === void 0 ? void 0 : options.deviceId);
|
|
@@ -17053,6 +17092,50 @@ class RequestWebUsbDevice extends BaseMethod {
|
|
|
17053
17092
|
|
|
17054
17093
|
}
|
|
17055
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
|
+
|
|
17056
17139
|
class CipherKeyValue extends BaseMethod {
|
|
17057
17140
|
constructor() {
|
|
17058
17141
|
super(...arguments);
|
|
@@ -20701,6 +20784,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
20701
20784
|
deviceWipe: DeviceWipe,
|
|
20702
20785
|
firmwareUpdate: FirmwareUpdate,
|
|
20703
20786
|
requestWebUsbDevice: RequestWebUsbDevice,
|
|
20787
|
+
batchGetPublicKey: BatchGetPublicKey,
|
|
20704
20788
|
cipherKeyValue: CipherKeyValue,
|
|
20705
20789
|
btcGetAddress: BTCGetAddress,
|
|
20706
20790
|
btcGetPublicKey: BTCGetPublicKey,
|
|
@@ -20887,7 +20971,6 @@ const Log = getLogger(exports.d0.Core);
|
|
|
20887
20971
|
const parseInitOptions = method => ({
|
|
20888
20972
|
initSession: method === null || method === void 0 ? void 0 : method.payload.initSession,
|
|
20889
20973
|
passphraseState: method === null || method === void 0 ? void 0 : method.payload.passphraseState,
|
|
20890
|
-
skipPassphraseCheck: method === null || method === void 0 ? void 0 : method.payload.skipPassphraseCheck,
|
|
20891
20974
|
deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId
|
|
20892
20975
|
});
|
|
20893
20976
|
|
|
@@ -21042,14 +21125,12 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
21042
21125
|
}));
|
|
21043
21126
|
}
|
|
21044
21127
|
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
checkPassphraseSafety(method, device.features);
|
|
21128
|
+
const passphraseState = yield device.checkPassphraseState();
|
|
21129
|
+
checkPassphraseSafety(method, device.features);
|
|
21048
21130
|
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
}
|
|
21131
|
+
if (passphraseState) {
|
|
21132
|
+
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
21133
|
+
return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError));
|
|
21053
21134
|
}
|
|
21054
21135
|
}
|
|
21055
21136
|
|
|
@@ -21312,7 +21393,6 @@ const cancel = connectId => {
|
|
|
21312
21393
|
|
|
21313
21394
|
const checkPassphraseSafety = (method, features) => {
|
|
21314
21395
|
if (!method.useDevicePassphraseState) return;
|
|
21315
|
-
if (method.payload.skipPassphraseCheck) return;
|
|
21316
21396
|
|
|
21317
21397
|
if ((features === null || features === void 0 ? void 0 : features.passphrase_protection) === true && !method.payload.passphraseState) {
|
|
21318
21398
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
@@ -45675,7 +45755,7 @@ try {
|
|
|
45675
45755
|
/***/ ((module) => {
|
|
45676
45756
|
|
|
45677
45757
|
"use strict";
|
|
45678
|
-
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.1.
|
|
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"}}');
|
|
45679
45759
|
|
|
45680
45760
|
/***/ })
|
|
45681
45761
|
|
|
@@ -48207,7 +48287,7 @@ const src_init = async settings => {
|
|
|
48207
48287
|
|
|
48208
48288
|
try {
|
|
48209
48289
|
await init({ ..._settings,
|
|
48210
|
-
version: "0.1.
|
|
48290
|
+
version: "0.1.52"
|
|
48211
48291
|
});
|
|
48212
48292
|
return true;
|
|
48213
48293
|
} catch (e) {
|