mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-08-11 17:07:44 +00:00
Upgrade of cashu-ts library to v2.0, improved handling of ecash states.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/@scure/bip32/index.ts b/node_modules/@scure/bip32/index.ts
|
||||
index 51a702f..a13bf43 100644
|
||||
index 3368385..0659773 100644
|
||||
--- a/node_modules/@scure/bip32/index.ts
|
||||
+++ b/node_modules/@scure/bip32/index.ts
|
||||
@@ -8,6 +8,7 @@ import { bytesToHex, concatBytes, createView, hexToBytes, utf8ToBytes } from '@n
|
||||
@@ -10,32 +10,28 @@ index 51a702f..a13bf43 100644
|
||||
|
||||
const Point = secp.ProjectivePoint;
|
||||
const base58check = createBase58check(sha256);
|
||||
@@ -93,7 +94,9 @@ export class HDKey {
|
||||
`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`
|
||||
@@ -97,7 +98,8 @@ export class HDKey {
|
||||
seed.length
|
||||
);
|
||||
}
|
||||
- const I = hmac(sha512, MASTER_SECRET, seed);
|
||||
+ // const I = hmac(sha512, MASTER_SECRET, seed);
|
||||
+ // console.log('[fromMasterSeed] Using patched hmac');
|
||||
+ const I = new Uint8Array(QuickCrypto.createHmac('sha512', MASTER_SECRET).update(seed).digest());
|
||||
+ //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),
|
||||
@@ -217,7 +220,11 @@ export class HDKey {
|
||||
@@ -220,7 +222,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);
|
||||
+ // console.log('[deriveChild] Using patched hmac');
|
||||
+ const I = new Uint8Array(QuickCrypto.createHmac('sha512', this.chainCode).update(data).digest());
|
||||
+
|
||||
+ // 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 15a1215..1aea96c 100644
|
||||
index 5222d18..69ff82b 100644
|
||||
--- a/node_modules/@scure/bip32/package.json
|
||||
+++ b/node_modules/@scure/bip32/package.json
|
||||
@@ -6,15 +6,8 @@
|
||||
@@ -44,7 +40,7 @@ index 15a1215..1aea96c 100644
|
||||
],
|
||||
- "main": "./lib/index.js",
|
||||
- "module": "./lib/esm/index.js",
|
||||
+ "main": "./index.ts",
|
||||
+ "main": "./index.ts",
|
||||
"types": "./lib/index.d.ts",
|
||||
- "exports": {
|
||||
- ".": {
|
||||
@@ -53,5 +49,5 @@ index 15a1215..1aea96c 100644
|
||||
- }
|
||||
- },
|
||||
"dependencies": {
|
||||
"@noble/curves": "~1.6.0",
|
||||
"@noble/hashes": "~1.5.0",
|
||||
"@noble/curves": "~1.7.0",
|
||||
"@noble/hashes": "~1.6.0",
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/@scure/bip39/package.json b/node_modules/@scure/bip39/package.json
|
||||
index a903f6e..0bc8651 100644
|
||||
index c30d78b..95af581 100644
|
||||
--- a/node_modules/@scure/bip39/package.json
|
||||
+++ b/node_modules/@scure/bip39/package.json
|
||||
@@ -45,7 +45,7 @@
|
||||
@@ -12,7 +12,7 @@ index a903f6e..0bc8651 100644
|
||||
"exports": {
|
||||
".": {
|
||||
diff --git a/node_modules/@scure/bip39/src/index.ts b/node_modules/@scure/bip39/src/index.ts
|
||||
index e6afe12..c4546b4 100644
|
||||
index 5cd4255..6fba64b 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';
|
||||
@@ -30,6 +30,6 @@ index e6afe12..c4546b4 100644
|
||||
- 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')
|
||||
+ // console.log('[@scure.bip39.mnemonicToSeedSync] Patched to use QuickCrypto.pbkdf2Sync')
|
||||
+ return updated
|
||||
}
|
||||
Reference in New Issue
Block a user