Files
minibits_wallet/patches/@scure+bip32+2.4.0.patch

33 lines
1.7 KiB
Diff

diff --git a/node_modules/@scure/bip32/index.js b/node_modules/@scure/bip32/index.js
index 49b54b8..a66540e 100644
--- a/node_modules/@scure/bip32/index.js
+++ b/node_modules/@scure/bip32/index.js
@@ -28,6 +28,7 @@ import { ripemd160 } from '@noble/hashes/legacy.js';
import { sha256, sha512 } from '@noble/hashes/sha2.js';
import { abytes, concatBytes, createView } from '@noble/hashes/utils.js';
import { createBase58check } from '@scure/base';
+import quickCrypto from 'react-native-quick-crypto';
const Point = /* @__PURE__ */ (() => secp.Point)();
const Fn = /* @__PURE__ */ (() => Point.Fn)();
const base58check = /* @__PURE__ */ createBase58check(sha256);
@@ -112,7 +113,8 @@ export class HDKey {
throw new RangeError('HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got ' +
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());
const privateKey = I.slice(0, 32);
const chainCode = I.slice(32);
return new HDKey({ versions, chainCode, privateKey });
@@ -248,7 +250,8 @@ export class HDKey {
// Normal child: serP(point(kpar)) || ser32(index)
data = concatBytes(this._publicKey, data);
}
- const out = _I || hmac(sha512, this._chainCode, data);
+ //const out = _I || hmac(sha512, this._chainCode, data);
+ const out = _I || new Uint8Array(quickCrypto.createHmac('sha512', this._chainCode).update(data).digest());
abytes(out, 64);
const childTweak = out.slice(0, 32);
const chainCode = out.slice(32);