@onekeyfe/hd-core 1.0.18 → 1.0.19
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/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts +4 -0
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -0
- package/dist/api/helpers/pathUtils.d.ts +2 -0
- package/dist/api/helpers/pathUtils.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/xrp/XrpGetAddress.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/index.js +30 -32
- package/package.json +4 -4
- package/src/api/aptos/AptosGetAddress.ts +2 -8
- package/src/api/aptos/AptosGetPublicKey.ts +2 -4
- package/src/api/benfen/BenfenGetAddress.ts +2 -9
- package/src/api/benfen/BenfenGetPublicKey.ts +2 -4
- package/src/api/cosmos/CosmosGetPublicKey.ts +2 -5
- package/src/api/helpers/batchGetPublickeys.ts +33 -0
- package/src/api/helpers/pathUtils.ts +6 -0
- package/src/api/sui/SuiGetAddress.ts +3 -9
- package/src/api/sui/SuiGetPublicKey.ts +2 -5
- package/src/api/xrp/XrpGetAddress.ts +2 -4
- package/src/device/DeviceCommands.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AptosGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/aptos/AptosGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAMpF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AptosGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/aptos/AptosGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAMpF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;AAKlE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,uBAAuB,EAAE,CAAC;IAChF,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,IAAI;IAiCJ,kBAAkB,CAAC,SAAS,EAAE,MAAM;IAOpC,eAAe;;;;;IAQT,GAAG;CA6DV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AptosGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/aptos/AptosGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAyB,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"AptosGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/aptos/AptosGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAyB,cAAc,EAAE,MAAM,aAAa,CAAC;AAGpE,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC5D,SAAS,UAAS;IAElB,IAAI;IA6BJ,eAAe;;;;;IAQT,GAAG;CAiBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BenfenGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/benfen/BenfenGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BenfenGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/benfen/BenfenGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,aAAa,EAA0B,MAAM,aAAa,CAAC;AAIpE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,wBAAwB,EAAE,CAAC;IAClF,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,wBAAwB,UAAQ;IAEhC,IAAI;IA+BJ,eAAe;;;;;;;;IAWT,GAAG;CAyDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BenfenGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/benfen/BenfenGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BenfenGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/benfen/BenfenGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;AAGxE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC7D,SAAS,UAAS;IAElB,wBAAwB,UAAQ;IAEhC,IAAI;IA2BJ,eAAe;;;;;;;;IAWT,GAAG;CAgBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/cosmos/CosmosGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAA4B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CosmosGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/cosmos/CosmosGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAA4B,MAAM,aAAa,CAAC;AAGtE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC7D,SAAS,UAAS;IAElB,IAAI;IAwCJ,eAAe;;;;;;;;IAWT,GAAG;CAgBV"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Path } from '@onekeyfe/hd-transport';
|
|
2
|
+
import { Device } from '../../device/Device';
|
|
3
|
+
export declare function batchGetPublickeys(device: Device, paths: Path[], ecdsaCurveName: string, coinType: number): Promise<import("../../device/DeviceCommands").TypedResponseMessage<"EcdsaPublicKeys">>;
|
|
4
|
+
//# sourceMappingURL=batchGetPublickeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batchGetPublickeys.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/batchGetPublickeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,0FAqBjB"}
|
|
@@ -3,6 +3,8 @@ export declare const toHardened: (n: number) => number;
|
|
|
3
3
|
export declare const fromHardened: (n: number) => number;
|
|
4
4
|
export declare const getSlip44ByPath: (path: number[]) => number;
|
|
5
5
|
export declare const getHDPath: (path: string) => Array<number>;
|
|
6
|
+
export declare const isEqualBip44CoinType: (path: Array<number>, coinType: number) => boolean;
|
|
7
|
+
export declare const isBip44Path: (path: Array<number>) => boolean;
|
|
6
8
|
export declare const isMultisigPath: (path: Array<number>) => boolean;
|
|
7
9
|
export declare const isSegwitPath: (path: Array<number>) => boolean;
|
|
8
10
|
export declare const isBech32Path: (path: Array<number>) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathUtils.d.ts","sourceRoot":"","sources":["../../../src/api/helpers/pathUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIjF,eAAO,MAAM,UAAU,MAAO,MAAM,KAAG,MAAiC,CAAC;AACzE,eAAO,MAAM,YAAY,MAAO,MAAM,KAAG,MAAkC,CAAC;AAC5E,eAAO,MAAM,eAAe,SAAU,MAAM,EAAE,WAA0B,CAAC;AAWzE,eAAO,MAAM,SAAS,SAAU,MAAM,KAAG,MAAM,MAAM,CAuBpD,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,MAAM,MAAM,CAAC,KAAG,OACF,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,MAAM,MAAM,CAAC,KAAG,OACA,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,MAAM,MAAM,CAAC,KAAG,OACA,CAAC;AAEpD,eAAO,MAAM,aAAa,SAAU,MAAM,EAAE,GAAG,SAAS,YAC8B,CAAC;AAEvF,eAAO,MAAM,aAAa,SAAU,MAAM,MAAM,CAAC,KAAG,eAiBnD,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,MAAM,EAAE,KAAG,sBAuBrD,CAAC;AAEF,eAAO,MAAM,cAAc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CAoBd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuiGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/sui/SuiGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SuiGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/sui/SuiGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAK9D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,qBAAqB,EAAE,CAAC;IAC5E,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,IAAI;IAiCJ,eAAe;;;;;;;;IAWT,GAAG;CAwDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuiGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/sui/SuiGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAuB,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SuiGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/sui/SuiGetPublicKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAuB,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC1D,SAAS,UAAS;IAElB,IAAI;IA6BJ,eAAe;;;;;;;;IAWT,GAAG;CAgBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CACnD;IACE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACvB,EAAE,CACJ;IACC,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,IAAI;IA+BJ,eAAe;;;;;IAQT,GAAG;;;;;CAsDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCommands.d.ts","sourceRoot":"","sources":["../../src/device/DeviceCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAe,MAAM,wBAAwB,CAAC;AAK/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,KAAK,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;AACxC,KAAK,UAAU,GAAG,MAAM,WAAW,CAAC;AACpC,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,UAAU,IAAI;IACvD,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACzB,CAAC;AACF,KAAK,oBAAoB,GAAG;KAC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AAC;IAoDlC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAAE,EACpD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,CAAC,EACV,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3C,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAClD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,CAAC,EACV,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAkD7B,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC;IAK3E,kBAAkB,CAChB,GAAG,EAAE,sBAAsB,EAC3B,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,sBAAsB,CAAC;IA6HlC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,oBAAoB;IAwB/C,iBAAiB;CA2BlB;AAED,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1038,6 +1038,8 @@ const getHDPath = (path) => {
|
|
|
1038
1038
|
return n;
|
|
1039
1039
|
});
|
|
1040
1040
|
};
|
|
1041
|
+
const isEqualBip44CoinType = (path, coinType) => isBip44Path(path) && path[1] === toHardened(coinType);
|
|
1042
|
+
const isBip44Path = (path) => Array.isArray(path) && path[0] === toHardened(44);
|
|
1041
1043
|
const isMultisigPath = (path) => Array.isArray(path) && path[0] === toHardened(48);
|
|
1042
1044
|
const isSegwitPath = (path) => Array.isArray(path) && path[0] === toHardened(49);
|
|
1043
1045
|
const isTaprootPath = (path) => Array.isArray(path) && (path[0] === toHardened(86) || path[0] === toHardened(10025));
|
|
@@ -25663,6 +25665,7 @@ class DeviceCommands {
|
|
|
25663
25665
|
if (error.message.indexOf('BridgeDeviceDisconnected') > -1) {
|
|
25664
25666
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BridgeDeviceDisconnected);
|
|
25665
25667
|
}
|
|
25668
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.ResponseUnexpectTypeError);
|
|
25666
25669
|
}
|
|
25667
25670
|
}
|
|
25668
25671
|
else {
|
|
@@ -31725,6 +31728,25 @@ class NearSignTransaction extends BaseMethod {
|
|
|
31725
31728
|
}
|
|
31726
31729
|
}
|
|
31727
31730
|
|
|
31731
|
+
function batchGetPublickeys(device, paths, ecdsaCurveName, coinType) {
|
|
31732
|
+
const existsPathNotValid = paths.find(p => p.address_n.length < 3);
|
|
31733
|
+
if (existsPathNotValid) {
|
|
31734
|
+
throw hdShared.TypedError(hdShared.HardwareErrorCode.ForbiddenKeyPath, 'Path length must be greater than 3');
|
|
31735
|
+
}
|
|
31736
|
+
const supportsBatchPublicKey = supportBatchPublicKey(device.features);
|
|
31737
|
+
if (!supportsBatchPublicKey) {
|
|
31738
|
+
throw hdShared.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportMethod);
|
|
31739
|
+
}
|
|
31740
|
+
const existsPathNotEqualCoinType = paths.find(p => !isEqualBip44CoinType(p.address_n, coinType));
|
|
31741
|
+
if (existsPathNotEqualCoinType) {
|
|
31742
|
+
throw hdShared.TypedError(hdShared.HardwareErrorCode.ForbiddenKeyPath);
|
|
31743
|
+
}
|
|
31744
|
+
return device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
|
|
31745
|
+
paths,
|
|
31746
|
+
ecdsa_curve_name: ecdsaCurveName,
|
|
31747
|
+
});
|
|
31748
|
+
}
|
|
31749
|
+
|
|
31728
31750
|
class AptosGetAddress extends BaseMethod {
|
|
31729
31751
|
constructor() {
|
|
31730
31752
|
super(...arguments);
|
|
@@ -31775,10 +31797,7 @@ class AptosGetAddress extends BaseMethod {
|
|
|
31775
31797
|
const supportsBatchPublicKey = supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features);
|
|
31776
31798
|
let responses = [];
|
|
31777
31799
|
if (supportsBatchPublicKey) {
|
|
31778
|
-
const publicKeyRes = yield this.device.
|
|
31779
|
-
paths: this.params,
|
|
31780
|
-
ecdsa_curve_name: 'ed25519',
|
|
31781
|
-
});
|
|
31800
|
+
const publicKeyRes = yield batchGetPublickeys(this.device, this.params, 'ed25519', 637);
|
|
31782
31801
|
for (let i = 0; i < this.params.length; i++) {
|
|
31783
31802
|
const param = this.params[i];
|
|
31784
31803
|
const publicKey = publicKeyRes.message.public_keys[i];
|
|
@@ -31860,10 +31879,7 @@ class AptosGetPublicKey extends BaseMethod {
|
|
|
31860
31879
|
}
|
|
31861
31880
|
run() {
|
|
31862
31881
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31863
|
-
const res = yield this.device.
|
|
31864
|
-
paths: this.params,
|
|
31865
|
-
ecdsa_curve_name: 'ed25519',
|
|
31866
|
-
});
|
|
31882
|
+
const res = yield batchGetPublickeys(this.device, this.params, 'ed25519', 637);
|
|
31867
31883
|
const responses = res.message.public_keys.map((publicKey, index) => ({
|
|
31868
31884
|
path: serializedPath(this.params[index].address_n),
|
|
31869
31885
|
pub: publicKey,
|
|
@@ -32172,10 +32188,7 @@ class CosmosGetPublicKey extends BaseMethod {
|
|
|
32172
32188
|
}
|
|
32173
32189
|
run() {
|
|
32174
32190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32175
|
-
const res = yield this.device.
|
|
32176
|
-
paths: this.params,
|
|
32177
|
-
ecdsa_curve_name: this.params[0].curve,
|
|
32178
|
-
});
|
|
32191
|
+
const res = yield batchGetPublickeys(this.device, this.params, this.params[0].curve, 118);
|
|
32179
32192
|
const responses = res.message.public_keys.map((publicKey, index) => ({
|
|
32180
32193
|
path: serializedPath(this.params[index].address_n),
|
|
32181
32194
|
pub: publicKey,
|
|
@@ -32272,10 +32285,7 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
32272
32285
|
var _a, _b, _c, _d, _e;
|
|
32273
32286
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32274
32287
|
if (this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features) && !this.shouldConfirm) {
|
|
32275
|
-
const res = yield this.device.
|
|
32276
|
-
paths: this.params,
|
|
32277
|
-
ecdsa_curve_name: 'secp256k1',
|
|
32278
|
-
});
|
|
32288
|
+
const res = yield batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
32279
32289
|
const result = res.message.public_keys.map((publicKey, index) => ({
|
|
32280
32290
|
path: serializedPath(this.params[index].address_n),
|
|
32281
32291
|
publicKey,
|
|
@@ -32440,10 +32450,7 @@ class SuiGetAddress extends BaseMethod {
|
|
|
32440
32450
|
const supportsBatchPublicKey = supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features);
|
|
32441
32451
|
let responses = [];
|
|
32442
32452
|
if (supportsBatchPublicKey) {
|
|
32443
|
-
const publicKeyRes = yield this.device.
|
|
32444
|
-
paths: this.params,
|
|
32445
|
-
ecdsa_curve_name: 'ed25519',
|
|
32446
|
-
});
|
|
32453
|
+
const publicKeyRes = yield batchGetPublickeys(this.device, this.params, 'ed25519', 784);
|
|
32447
32454
|
for (let i = 0; i < this.params.length; i++) {
|
|
32448
32455
|
const param = this.params[i];
|
|
32449
32456
|
const publicKey = publicKeyRes.message.public_keys[i];
|
|
@@ -32528,10 +32535,7 @@ class SuiGetPublicKey extends BaseMethod {
|
|
|
32528
32535
|
}
|
|
32529
32536
|
run() {
|
|
32530
32537
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32531
|
-
const res = yield this.device.
|
|
32532
|
-
paths: this.params,
|
|
32533
|
-
ecdsa_curve_name: 'ed25519',
|
|
32534
|
-
});
|
|
32538
|
+
const res = yield batchGetPublickeys(this.device, this.params, 'ed25519', 784);
|
|
32535
32539
|
const responses = res.message.public_keys.map((publicKey, index) => ({
|
|
32536
32540
|
path: serializedPath(this.params[index].address_n),
|
|
32537
32541
|
publicKey,
|
|
@@ -35623,10 +35627,7 @@ class BenfenGetAddress extends BaseMethod {
|
|
|
35623
35627
|
const supportsBatchPublicKey = supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features);
|
|
35624
35628
|
let responses = [];
|
|
35625
35629
|
if (supportsBatchPublicKey) {
|
|
35626
|
-
const publicKeyRes = yield this.device.
|
|
35627
|
-
paths: this.params,
|
|
35628
|
-
ecdsa_curve_name: 'ed25519',
|
|
35629
|
-
});
|
|
35630
|
+
const publicKeyRes = yield batchGetPublickeys(this.device, this.params, 'ed25519', 728);
|
|
35630
35631
|
for (let i = 0; i < this.params.length; i++) {
|
|
35631
35632
|
const param = this.params[i];
|
|
35632
35633
|
const publicKey = publicKeyRes.message.public_keys[i];
|
|
@@ -35710,10 +35711,7 @@ class BenfenGetPublicKey extends BaseMethod {
|
|
|
35710
35711
|
}
|
|
35711
35712
|
run() {
|
|
35712
35713
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35713
|
-
const res = yield this.device.
|
|
35714
|
-
paths: this.params,
|
|
35715
|
-
ecdsa_curve_name: 'ed25519',
|
|
35716
|
-
});
|
|
35714
|
+
const res = yield batchGetPublickeys(this.device, this.params, 'ed25519', 728);
|
|
35717
35715
|
const responses = res.message.public_keys.map((publicKey, index) => ({
|
|
35718
35716
|
path: serializedPath(this.params[index].address_n),
|
|
35719
35717
|
pub: publicKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "> TODO: description",
|
|
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.0.
|
|
29
|
-
"@onekeyfe/hd-transport": "^1.0.
|
|
28
|
+
"@onekeyfe/hd-shared": "^1.0.19",
|
|
29
|
+
"@onekeyfe/hd-transport": "^1.0.19",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/semver": "^7.3.9",
|
|
45
45
|
"ripple-keypairs": "^1.1.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4f189046a5bebc30851bf605067bdd4cbcda83b7"
|
|
48
48
|
}
|
|
@@ -9,6 +9,7 @@ import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
|
9
9
|
import { AptosAddress, AptosGetAddressParams } from '../../types';
|
|
10
10
|
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
11
11
|
import { hexToBytes } from '../helpers/hexUtils';
|
|
12
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
12
13
|
|
|
13
14
|
export default class AptosGetAddress extends BaseMethod<HardwareAptosGetAddress[]> {
|
|
14
15
|
hasBundle = false;
|
|
@@ -67,14 +68,7 @@ export default class AptosGetAddress extends BaseMethod<HardwareAptosGetAddress[
|
|
|
67
68
|
const supportsBatchPublicKey = supportBatchPublicKey(this.device?.features);
|
|
68
69
|
let responses: AptosAddress[] = [];
|
|
69
70
|
if (supportsBatchPublicKey) {
|
|
70
|
-
const publicKeyRes = await this.device.
|
|
71
|
-
'BatchGetPublickeys',
|
|
72
|
-
'EcdsaPublicKeys',
|
|
73
|
-
{
|
|
74
|
-
paths: this.params,
|
|
75
|
-
ecdsa_curve_name: 'ed25519',
|
|
76
|
-
}
|
|
77
|
-
);
|
|
71
|
+
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 637);
|
|
78
72
|
|
|
79
73
|
for (let i = 0; i < this.params.length; i++) {
|
|
80
74
|
const param = this.params[i];
|
|
@@ -3,6 +3,7 @@ import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
|
3
3
|
import { BaseMethod } from '../BaseMethod';
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
import { AptosGetAddressParams, AptosPublicKey } from '../../types';
|
|
6
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
7
|
|
|
7
8
|
export default class AptosGetPublicKey extends BaseMethod<any> {
|
|
8
9
|
hasBundle = false;
|
|
@@ -45,10 +46,7 @@ export default class AptosGetPublicKey extends BaseMethod<any> {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
async run() {
|
|
48
|
-
const res = await this.device.
|
|
49
|
-
paths: this.params,
|
|
50
|
-
ecdsa_curve_name: 'ed25519',
|
|
51
|
-
});
|
|
49
|
+
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 637);
|
|
52
50
|
|
|
53
51
|
const responses: AptosPublicKey[] = res.message.public_keys.map(
|
|
54
52
|
(publicKey: string, index: number) => ({
|
|
@@ -7,6 +7,7 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
7
7
|
import { hex2BfcAddress, publicKeyToAddress } from './normalize';
|
|
8
8
|
import { BenfenAddress, BenfenGetAddressParams } from '../../types';
|
|
9
9
|
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
10
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
10
11
|
|
|
11
12
|
export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddress[]> {
|
|
12
13
|
hasBundle = false;
|
|
@@ -62,15 +63,7 @@ export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddres
|
|
|
62
63
|
let responses: BenfenAddress[] = [];
|
|
63
64
|
|
|
64
65
|
if (supportsBatchPublicKey) {
|
|
65
|
-
const publicKeyRes = await this.device.
|
|
66
|
-
'BatchGetPublickeys',
|
|
67
|
-
'EcdsaPublicKeys',
|
|
68
|
-
{
|
|
69
|
-
paths: this.params,
|
|
70
|
-
ecdsa_curve_name: 'ed25519',
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
|
|
66
|
+
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 728);
|
|
74
67
|
for (let i = 0; i < this.params.length; i++) {
|
|
75
68
|
const param = this.params[i];
|
|
76
69
|
const publicKey = publicKeyRes.message.public_keys[i];
|
|
@@ -3,6 +3,7 @@ import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
|
3
3
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
5
5
|
import { BenfenPublicKey, BenfenGetPublicKeyParams } from '../../types';
|
|
6
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
7
|
|
|
7
8
|
export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
8
9
|
hasBundle = false;
|
|
@@ -48,10 +49,7 @@ export default class BenfenGetPublicKey extends BaseMethod<any> {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
async run() {
|
|
51
|
-
const res = await this.device.
|
|
52
|
-
paths: this.params,
|
|
53
|
-
ecdsa_curve_name: 'ed25519',
|
|
54
|
-
});
|
|
52
|
+
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 728);
|
|
55
53
|
|
|
56
54
|
const responses: BenfenPublicKey[] = res.message.public_keys.map(
|
|
57
55
|
(publicKey: string, index: number) => ({
|
|
@@ -3,6 +3,7 @@ import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
|
3
3
|
import { BaseMethod } from '../BaseMethod';
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
import { CosmosAddress, CosmosGetPublicKeyParams } from '../../types';
|
|
6
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
7
|
|
|
7
8
|
export default class CosmosGetPublicKey extends BaseMethod<any> {
|
|
8
9
|
hasBundle = false;
|
|
@@ -59,11 +60,7 @@ export default class CosmosGetPublicKey extends BaseMethod<any> {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
async run() {
|
|
62
|
-
const res = await this.device.
|
|
63
|
-
paths: this.params,
|
|
64
|
-
ecdsa_curve_name: this.params[0].curve,
|
|
65
|
-
});
|
|
66
|
-
|
|
63
|
+
const res = await batchGetPublickeys(this.device, this.params, this.params[0].curve, 118);
|
|
67
64
|
const responses: CosmosAddress[] = res.message.public_keys.map(
|
|
68
65
|
(publicKey: string, index: number) => ({
|
|
69
66
|
path: serializedPath((this.params as unknown as any[])[index].address_n),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Path } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
3
|
+
import { TypedError, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
|
+
import { Device } from '../../device/Device';
|
|
5
|
+
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
6
|
+
import { isEqualBip44CoinType } from './pathUtils';
|
|
7
|
+
|
|
8
|
+
export function batchGetPublickeys(
|
|
9
|
+
device: Device,
|
|
10
|
+
paths: Path[],
|
|
11
|
+
ecdsaCurveName: string,
|
|
12
|
+
coinType: number
|
|
13
|
+
) {
|
|
14
|
+
const existsPathNotValid = paths.find(p => p.address_n.length < 3);
|
|
15
|
+
if (existsPathNotValid) {
|
|
16
|
+
throw TypedError(HardwareErrorCode.ForbiddenKeyPath, 'Path length must be greater than 3');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const supportsBatchPublicKey = supportBatchPublicKey(device.features);
|
|
20
|
+
if (!supportsBatchPublicKey) {
|
|
21
|
+
throw TypedError(HardwareErrorCode.DeviceNotSupportMethod);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const existsPathNotEqualCoinType = paths.find(p => !isEqualBip44CoinType(p.address_n, coinType));
|
|
25
|
+
if (existsPathNotEqualCoinType) {
|
|
26
|
+
throw TypedError(HardwareErrorCode.ForbiddenKeyPath);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
|
|
30
|
+
paths,
|
|
31
|
+
ecdsa_curve_name: ecdsaCurveName,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -42,6 +42,12 @@ export const getHDPath = (path: string): Array<number> => {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
export const isEqualBip44CoinType = (path: Array<number>, coinType: number): boolean =>
|
|
46
|
+
isBip44Path(path) && path[1] === toHardened(coinType);
|
|
47
|
+
|
|
48
|
+
export const isBip44Path = (path: Array<number>): boolean =>
|
|
49
|
+
Array.isArray(path) && path[0] === toHardened(44);
|
|
50
|
+
|
|
45
51
|
export const isMultisigPath = (path: Array<number>): boolean =>
|
|
46
52
|
Array.isArray(path) && path[0] === toHardened(48);
|
|
47
53
|
|
|
@@ -7,6 +7,7 @@ import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
|
7
7
|
import { SuiAddress, SuiGetAddressParams } from '../../types';
|
|
8
8
|
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
9
9
|
import { publicKeyToAddress } from './normalize';
|
|
10
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
10
11
|
|
|
11
12
|
export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
12
13
|
hasBundle = false;
|
|
@@ -61,18 +62,11 @@ export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
|
61
62
|
const supportsBatchPublicKey = supportBatchPublicKey(this.device?.features);
|
|
62
63
|
let responses: SuiAddress[] = [];
|
|
63
64
|
if (supportsBatchPublicKey) {
|
|
64
|
-
const publicKeyRes = await this.device.
|
|
65
|
-
'BatchGetPublickeys',
|
|
66
|
-
'EcdsaPublicKeys',
|
|
67
|
-
{
|
|
68
|
-
paths: this.params,
|
|
69
|
-
ecdsa_curve_name: 'ed25519',
|
|
70
|
-
}
|
|
71
|
-
);
|
|
65
|
+
const publicKeyRes = await batchGetPublickeys(this.device, this.params, 'ed25519', 784);
|
|
72
66
|
for (let i = 0; i < this.params.length; i++) {
|
|
73
67
|
const param = this.params[i];
|
|
74
68
|
const publicKey = publicKeyRes.message.public_keys[i];
|
|
75
|
-
let address: string;
|
|
69
|
+
let address: string | undefined;
|
|
76
70
|
|
|
77
71
|
if (this.shouldConfirm) {
|
|
78
72
|
const addressRes = await this.device.commands.typedCall(
|
|
@@ -3,6 +3,7 @@ import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
|
3
3
|
import { BaseMethod } from '../BaseMethod';
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
import { SuiGetAddressParams, SuiPublicKey } from '../../types';
|
|
6
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
6
7
|
|
|
7
8
|
export default class SuiGetPublicKey extends BaseMethod<any> {
|
|
8
9
|
hasBundle = false;
|
|
@@ -48,11 +49,7 @@ export default class SuiGetPublicKey extends BaseMethod<any> {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
async run() {
|
|
51
|
-
const res = await this.device.
|
|
52
|
-
paths: this.params,
|
|
53
|
-
ecdsa_curve_name: 'ed25519',
|
|
54
|
-
});
|
|
55
|
-
|
|
52
|
+
const res = await batchGetPublickeys(this.device, this.params, 'ed25519', 784);
|
|
56
53
|
const responses: SuiPublicKey[] = res.message.public_keys.map(
|
|
57
54
|
(publicKey: string, index: number) => ({
|
|
58
55
|
path: serializedPath((this.params as unknown as any[])[index].address_n),
|
|
@@ -5,6 +5,7 @@ import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
|
5
5
|
import { BaseMethod } from '../BaseMethod';
|
|
6
6
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
7
7
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
8
|
+
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
8
9
|
|
|
9
10
|
export default class XrpGetAddress extends BaseMethod<
|
|
10
11
|
{
|
|
@@ -57,10 +58,7 @@ export default class XrpGetAddress extends BaseMethod<
|
|
|
57
58
|
|
|
58
59
|
async run() {
|
|
59
60
|
if (this.hasBundle && supportBatchPublicKey(this.device?.features) && !this.shouldConfirm) {
|
|
60
|
-
const res = await this.device.
|
|
61
|
-
paths: this.params,
|
|
62
|
-
ecdsa_curve_name: 'secp256k1',
|
|
63
|
-
});
|
|
61
|
+
const res = await batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
64
62
|
const result = res.message.public_keys.map((publicKey: string, index: number) => ({
|
|
65
63
|
path: serializedPath((this.params as unknown as any[])[index].address_n),
|
|
66
64
|
publicKey,
|
|
@@ -170,6 +170,7 @@ export class DeviceCommands {
|
|
|
170
170
|
if (error.message.indexOf('BridgeDeviceDisconnected') > -1) {
|
|
171
171
|
throw ERRORS.TypedError(HardwareErrorCode.BridgeDeviceDisconnected);
|
|
172
172
|
}
|
|
173
|
+
throw ERRORS.TypedError(HardwareErrorCode.ResponseUnexpectTypeError);
|
|
173
174
|
}
|
|
174
175
|
} else {
|
|
175
176
|
// throw error anyway, next call should be resolved properly// throw error anyway, next call should be resolved properly
|