Files
minibits_wallet/patches/@scure+bip39+1.4.0.patch
T

36 lines
1.6 KiB
Diff

diff --git a/node_modules/@scure/bip39/package.json b/node_modules/@scure/bip39/package.json
index a903f6e..0bc8651 100644
--- a/node_modules/@scure/bip39/package.json
+++ b/node_modules/@scure/bip39/package.json
@@ -45,7 +45,7 @@
"fetch-wordlist": "./scripts/fetch-wordlist.js"
},
"sideEffects": false,
- "main": "index.js",
+ "main": "src/index.ts",
"types": "./index.d.ts",
"exports": {
".": {
diff --git a/node_modules/@scure/bip39/src/index.ts b/node_modules/@scure/bip39/src/index.ts
index e6afe12..c4546b4 100644
--- a/node_modules/@scure/bip39/src/index.ts
+++ b/node_modules/@scure/bip39/src/index.ts
@@ -5,6 +5,7 @@ import { sha256 } from '@noble/hashes/sha256';
import { sha512 } from '@noble/hashes/sha512';
import { randomBytes } from '@noble/hashes/utils';
import { utils as baseUtils } from '@scure/base';
+import QuickCrypto from 'react-native-quick-crypto'
// Japanese wordlist
const isJapanese = (wordlist: string[]) => wordlist[0] === '\u3042\u3044\u3053\u304f\u3057\u3093';
@@ -142,5 +143,8 @@ export function mnemonicToSeed(mnemonic: string, passphrase = '') {
* // new Uint8Array([...64 bytes])
*/
export function mnemonicToSeedSync(mnemonic: string, passphrase = '') {
- return pbkdf2(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
+ // const original = pbkdf2(sha512, normalize(mnemonic).nfkd, salt(passphrase), { c: 2048, dkLen: 64 });
+ const updated = new Uint8Array(QuickCrypto.pbkdf2Sync(normalize(mnemonic).nfkd, salt(passphrase), 2048, 64, 'sha512'));
+ console.log('[@scure.bip39.mnemonicToSeedSync] Patched to use QuickCrypto.pbkdf2Sync')
+ return updated
}