@onekeyfe/hd-core 1.1.16-alpha.8 → 1.1.17-patch.1
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/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/xrp/XrpGetAddress.d.ts.map +1 -1
- package/dist/index.js +8 -18
- package/package.json +6 -8
- package/src/api/evm/EVMSignTypedData.ts +8 -2
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +1 -1
- package/src/api/xrp/XrpGetAddress.ts +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTypedData.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,UAAU,EACV,eAAe,EACf,SAAS,EAEV,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAC;AAQrB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IAC9E,IAAI;IAqCE,mBAAmB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,aAAa,GACd,EAAE;QACD,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;QACnE,QAAQ,EAAE,eAAe,CAAC,UAAU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AA4B,CAAC,0BAA0B,CAAC,CAAC;QACnE,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACtC,aAAa,EAAE,OAAO,CAAC;KACxB;;;;IA+JK,aAAa;;;;IAsCnB,aAAa,CAAC,EACZ,SAAS,EACT,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC;IA2BD,eAAe;;;;;IAQf,aAAa,CAAC,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC;IAuB5E,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO;IA8BnC,gBAAgB;IAcV,GAAG;CA2EV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,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;CAuCV"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var blake2s = require('@noble/hashes/blake2s');
|
|
|
14
14
|
var sha256 = require('@noble/hashes/sha256');
|
|
15
15
|
var JSZip = require('jszip');
|
|
16
16
|
var sha3 = require('@noble/hashes/sha3');
|
|
17
|
-
var rippleKeypairs = require('ripple-keypairs');
|
|
18
17
|
var blake2b = require('@noble/hashes/blake2b');
|
|
19
18
|
var buffer = require('buffer');
|
|
20
19
|
|
|
@@ -33030,8 +33029,12 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33030
33029
|
return false;
|
|
33031
33030
|
let biggerLimit = 1024;
|
|
33032
33031
|
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
33032
|
+
const currentDeviceType = getDeviceType(this.device.features);
|
|
33033
33033
|
const supportBiggerDataVersion = '4.4.0';
|
|
33034
|
-
|
|
33034
|
+
const supportBiggerData = DeviceModelToTypes.model_classic1s.includes(currentDeviceType) ||
|
|
33035
|
+
(DeviceModelToTypes.model_touch.includes(currentDeviceType) &&
|
|
33036
|
+
semver__default["default"].gte(currentVersion, supportBiggerDataVersion));
|
|
33037
|
+
if (supportBiggerData) {
|
|
33035
33038
|
biggerLimit = 1536;
|
|
33036
33039
|
}
|
|
33037
33040
|
const startIndex = data.startsWith('0x') ? 2 : 0;
|
|
@@ -34963,21 +34966,8 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
34963
34966
|
};
|
|
34964
34967
|
}
|
|
34965
34968
|
run() {
|
|
34966
|
-
var _a, _b, _c, _d
|
|
34969
|
+
var _a, _b, _c, _d;
|
|
34967
34970
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34968
|
-
if (this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features) && !this.shouldConfirm) {
|
|
34969
|
-
const res = yield batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
34970
|
-
const result = res.public_keys.map((publicKey, index) => ({
|
|
34971
|
-
path: serializedPath(this.params[index].address_n),
|
|
34972
|
-
address: rippleKeypairs.deriveAddress(publicKey),
|
|
34973
|
-
publicKey,
|
|
34974
|
-
pub: publicKey,
|
|
34975
|
-
}));
|
|
34976
|
-
validateResult(result, ['address', 'publicKey'], {
|
|
34977
|
-
expectedLength: this.params.length,
|
|
34978
|
-
});
|
|
34979
|
-
return Promise.resolve(result);
|
|
34980
|
-
}
|
|
34981
34971
|
const responses = [];
|
|
34982
34972
|
for (let i = 0; i < this.params.length; i++) {
|
|
34983
34973
|
const param = this.params[i];
|
|
@@ -34991,8 +34981,8 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
34991
34981
|
responses.push({
|
|
34992
34982
|
path,
|
|
34993
34983
|
address,
|
|
34994
|
-
publicKey: (
|
|
34995
|
-
pub: (
|
|
34984
|
+
publicKey: (_b = (_a = publicKey.message) === null || _a === void 0 ? void 0 : _a.public_keys) === null || _b === void 0 ? void 0 : _b[0],
|
|
34985
|
+
pub: (_d = (_c = publicKey.message) === null || _c === void 0 ? void 0 : _c.public_keys) === null || _d === void 0 ? void 0 : _d[0],
|
|
34996
34986
|
});
|
|
34997
34987
|
this.postPreviousAddressMessage({
|
|
34998
34988
|
path,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17-patch.1",
|
|
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.1.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.1.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.1.17-patch.1",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.1.17-patch.1",
|
|
30
30
|
"axios": "1.12.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -35,16 +35,14 @@
|
|
|
35
35
|
"semver": "^7.3.7"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@noble/hashes": "^1.1.3"
|
|
39
|
-
"ripple-keypairs": "^1.3.1"
|
|
38
|
+
"@noble/hashes": "^1.1.3"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@noble/hashes": "^1.1.3",
|
|
43
42
|
"@types/parse-uri": "^1.0.0",
|
|
44
43
|
"@types/semver": "^7.3.9",
|
|
45
44
|
"@types/w3c-web-usb": "^1.0.10",
|
|
46
|
-
"@types/web-bluetooth": "^0.0.21"
|
|
47
|
-
"ripple-keypairs": "^1.3.1"
|
|
45
|
+
"@types/web-bluetooth": "^0.0.21"
|
|
48
46
|
},
|
|
49
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "d8fb620849996e75b22360cf5de8537d4d8b6d2f"
|
|
50
48
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { get } from 'lodash';
|
|
3
3
|
import BigNumber from 'bignumber.js';
|
|
4
|
-
import { ERRORS, HardwareErrorCode
|
|
4
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
5
5
|
import {
|
|
6
6
|
EthereumTypedDataSignature,
|
|
7
7
|
EthereumTypedDataStructAck,
|
|
@@ -337,9 +337,15 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
337
337
|
let biggerLimit = 1024; // 1k
|
|
338
338
|
|
|
339
339
|
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
340
|
+
const currentDeviceType = getDeviceType(this.device.features);
|
|
340
341
|
const supportBiggerDataVersion = '4.4.0';
|
|
341
342
|
|
|
342
|
-
|
|
343
|
+
const supportBiggerData =
|
|
344
|
+
DeviceModelToTypes.model_classic1s.includes(currentDeviceType) ||
|
|
345
|
+
(DeviceModelToTypes.model_touch.includes(currentDeviceType) &&
|
|
346
|
+
semver.gte(currentVersion, supportBiggerDataVersion));
|
|
347
|
+
|
|
348
|
+
if (supportBiggerData) {
|
|
343
349
|
biggerLimit = 1536; // 1.5k
|
|
344
350
|
}
|
|
345
351
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { deriveAddress } from 'ripple-keypairs';
|
|
2
1
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
2
|
import { XrpAddress, XrpGetAddressParams } from '../../types/api/xrpGetAddress';
|
|
4
|
-
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
5
3
|
import { BaseMethod } from '../BaseMethod';
|
|
6
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
7
5
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
8
|
-
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
9
6
|
|
|
10
7
|
export default class XrpGetAddress extends BaseMethod<
|
|
11
8
|
{
|
|
@@ -57,22 +54,6 @@ export default class XrpGetAddress extends BaseMethod<
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
async run() {
|
|
60
|
-
if (this.hasBundle && supportBatchPublicKey(this.device?.features) && !this.shouldConfirm) {
|
|
61
|
-
const res = await batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
62
|
-
const result = res.public_keys.map((publicKey: string, index: number) => ({
|
|
63
|
-
path: serializedPath((this.params as unknown as any[])[index].address_n),
|
|
64
|
-
address: deriveAddress(publicKey),
|
|
65
|
-
publicKey,
|
|
66
|
-
pub: publicKey,
|
|
67
|
-
}));
|
|
68
|
-
|
|
69
|
-
validateResult(result, ['address', 'publicKey'], {
|
|
70
|
-
expectedLength: this.params.length,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return Promise.resolve(result);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
57
|
const responses: XrpAddress[] = [];
|
|
77
58
|
for (let i = 0; i < this.params.length; i++) {
|
|
78
59
|
const param = this.params[i];
|