Files
minibits_wallet/patches/@scure+bip32+1.7.0.patch
2025-12-04 01:55:33 +01:00

53 lines
1.9 KiB
Diff

diff --git a/node_modules/@scure/bip32/index.ts b/node_modules/@scure/bip32/index.ts
index 65e4bb2..7b7d7f7 100644
--- a/node_modules/@scure/bip32/index.ts
+++ b/node_modules/@scure/bip32/index.ts
@@ -30,6 +30,7 @@ import {
utf8ToBytes,
} from '@noble/hashes/utils';
import { createBase58check } from '@scure/base';
+import QuickCrypto from 'react-native-quick-crypto'
const Point = secp.ProjectivePoint;
const base58check = createBase58check(sha256);
@@ -119,7 +120,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),
@@ -242,7 +244,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 c40252d..7695067 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.9.0",
"@noble/hashes": "~1.8.0",