Files
minibits_wallet/patches/@scure+bip32+1.6.2.patch
T

54 lines
2.0 KiB
Diff

diff --git a/node_modules/@scure/bip32/index.ts b/node_modules/@scure/bip32/index.ts
index 0c9c91c..14c9ae2 100644
--- a/node_modules/@scure/bip32/index.ts
+++ b/node_modules/@scure/bip32/index.ts
@@ -25,6 +25,7 @@ import { bytesToHex, concatBytes, createView, hexToBytes, utf8ToBytes } from '@n
import { secp256k1 as secp } from '@noble/curves/secp256k1';
import { mod } from '@noble/curves/abstract/modular';
import { createBase58check } from '@scure/base';
+import QuickCrypto from 'react-native-quick-crypto';
const Point = secp.ProjectivePoint;
const base58check = createBase58check(sha256);
@@ -114,7 +115,8 @@ export class HDKey {
seed.length
);
}
- const I = hmac(sha512, MASTER_SECRET, seed);
+ // const I = hmac(sha512, MASTER_SECRET, seed);
+ const I = new Uint8Array(QuickCrypto.createHmac('sha512', MASTER_SECRET).update(seed).digest());
return new HDKey({
versions,
chainCode: I.slice(32),
@@ -237,7 +239,8 @@ export class HDKey {
// Normal child: serP(point(kpar)) || ser32(index)
data = concatBytes(this.pubKey, data);
}
- const I = hmac(sha512, this.chainCode, data);
+ //const I = hmac(sha512, this.chainCode, data);
+ const I = new Uint8Array(QuickCrypto.createHmac('sha512', this.chainCode).update(data).digest())
const childTweak = bytesToNumber(I.slice(0, 32));
const chainCode = I.slice(32);
if (!secp.utils.isValidPrivateKey(childTweak)) {
diff --git a/node_modules/@scure/bip32/package.json b/node_modules/@scure/bip32/package.json
index e866fba..6389575 100644
--- a/node_modules/@scure/bip32/package.json
+++ b/node_modules/@scure/bip32/package.json
@@ -6,15 +6,8 @@
"index.ts",
"./lib"
],
- "main": "./lib/index.js",
- "module": "./lib/esm/index.js",
+ "main": "./index.ts",
"types": "./lib/index.d.ts",
- "exports": {
- ".": {
- "import": "./lib/esm/index.js",
- "require": "./lib/index.js"
- }
- },
"dependencies": {
"@noble/curves": "~1.8.1",
"@noble/hashes": "~1.7.1",