Merge pull request #5543 from BlueWallet/renovate/bitcoinjs-lib-6.x

Update dependency bitcoinjs-lib to v6.1.1
This commit is contained in:
GLaDOS 2023-05-29 22:22:41 +01:00 committed by GitHub
commit 917f13bc83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 21 deletions

View File

@ -10,11 +10,16 @@ import { createHmac } from 'crypto';
import * as necc from '@noble/secp256k1';
import { TinySecp256k1Interface } from 'ecpair/src/ecpair';
import { TinySecp256k1Interface as TinySecp256k1InterfaceBIP32 } from 'bip32/types/bip32';
import { XOnlyPointAddTweakResult } from 'bitcoinjs-lib/src/types';
export interface TinySecp256k1InterfaceExtended {
pointMultiply(p: Uint8Array, tweak: Uint8Array, compressed?: boolean): Uint8Array | null;
pointAdd(pA: Uint8Array, pB: Uint8Array, compressed?: boolean): Uint8Array | null;
isXOnlyPoint(p: Uint8Array): boolean;
xOnlyPointAddTweak(p: Uint8Array, tweak: Uint8Array): XOnlyPointAddTweakResult | null;
}
necc.utils.sha256Sync = (...messages: Uint8Array[]): Uint8Array => {
@ -74,14 +79,14 @@ const ecc: TinySecp256k1InterfaceExtended & TinySecp256k1Interface & TinySecp256
} */
return necc.utils.isValidPrivateKey(d);
},
// isXOnlyPoint: (p: Uint8Array): boolean => isPoint(p, true),
isXOnlyPoint: (p: Uint8Array): boolean => isPoint(p, true),
/* xOnlyPointAddTweak: (p: Uint8Array, tweak: Uint8Array): { parity: 0 | 1; xOnlyPubkey: Uint8Array } | null =>
xOnlyPointAddTweak: (p: Uint8Array, tweak: Uint8Array): { parity: 0 | 1; xOnlyPubkey: Uint8Array } | null =>
throwToNull(() => {
const P = necc.utils.pointAddScalar(p, tweak, true);
const parity = P[0] % 2 === 1 ? 1 : 0;
return { parity, xOnlyPubkey: P.slice(1) };
}), */
}),
pointFromScalar: (sk: Uint8Array, compressed?: boolean): Uint8Array | null =>
throwToNull(() => necc.getPublicKey(sk, defaultTrue(compressed))),

View File

@ -12,6 +12,7 @@ import { ECPairAPI, ECPairFactory, Signer } from 'ecpair';
import ecc from '../../blue_modules/noble_ecc';
const ECPair: ECPairAPI = ECPairFactory(ecc);
bitcoin.initEccLib(ecc);
/**
* Has private key and single address like "1ABCD....."

78
package-lock.json generated
View File

@ -33,7 +33,7 @@
"bip32": "3.0.1",
"bip38": "github:BlueWallet/bip38",
"bip39": "3.1.0",
"bitcoinjs-lib": "6.0.2",
"bitcoinjs-lib": "6.1.1",
"bitcoinjs-message": "2.2.0",
"bolt11": "1.4.1",
"buffer": "6.0.3",
@ -7241,22 +7241,43 @@
"integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow=="
},
"node_modules/bitcoinjs-lib": {
"version": "6.0.2",
"integrity": "sha512-I994pGt9cL5s5OA6mkv1e8IuYcsKN2ORXnWbkqAXLNGvEnOHBhKBSvCjFl7YC2uVoJnfr/iwq7JMrq575SYO5w==",
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-6.1.1.tgz",
"integrity": "sha512-FYihfgTk29lt1eK2y48OtuarEDUnTprNBW3ctT8yHiOhvmeS3DzAVG6gI0VCvMkydz6UdlXlYNWIPqGD0SUYRQ==",
"dependencies": {
"@noble/hashes": "^1.2.0",
"bech32": "^2.0.0",
"bip174": "^2.0.1",
"bs58check": "^2.1.2",
"create-hash": "^1.1.0",
"ripemd160": "^2.0.2",
"bip174": "^2.1.0",
"bs58check": "^3.0.1",
"typeforce": "^1.11.3",
"varuint-bitcoin": "^1.1.2",
"wif": "^2.0.1"
"varuint-bitcoin": "^1.1.2"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/bitcoinjs-lib/node_modules/base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"node_modules/bitcoinjs-lib/node_modules/bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
"integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==",
"dependencies": {
"base-x": "^4.0.0"
}
},
"node_modules/bitcoinjs-lib/node_modules/bs58check": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz",
"integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==",
"dependencies": {
"@noble/hashes": "^1.2.0",
"bs58": "^5.0.0"
}
},
"node_modules/bitcoinjs-message": {
"version": "2.2.0",
"integrity": "sha512-103Wy3xg8Y9o+pdhGP4M3/mtQQuUWs6sPuOp1mYphSUoSMHjHTlkj32K4zxU8qMH0Ckv23emfkGlFWtoWZ7YFA==",
@ -28217,17 +28238,40 @@
"integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow=="
},
"bitcoinjs-lib": {
"version": "6.0.2",
"integrity": "sha512-I994pGt9cL5s5OA6mkv1e8IuYcsKN2ORXnWbkqAXLNGvEnOHBhKBSvCjFl7YC2uVoJnfr/iwq7JMrq575SYO5w==",
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-6.1.1.tgz",
"integrity": "sha512-FYihfgTk29lt1eK2y48OtuarEDUnTprNBW3ctT8yHiOhvmeS3DzAVG6gI0VCvMkydz6UdlXlYNWIPqGD0SUYRQ==",
"requires": {
"@noble/hashes": "^1.2.0",
"bech32": "^2.0.0",
"bip174": "^2.0.1",
"bs58check": "^2.1.2",
"create-hash": "^1.1.0",
"ripemd160": "^2.0.2",
"bip174": "^2.1.0",
"bs58check": "^3.0.1",
"typeforce": "^1.11.3",
"varuint-bitcoin": "^1.1.2",
"wif": "^2.0.1"
"varuint-bitcoin": "^1.1.2"
},
"dependencies": {
"base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
"integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==",
"requires": {
"base-x": "^4.0.0"
}
},
"bs58check": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz",
"integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==",
"requires": {
"@noble/hashes": "^1.2.0",
"bs58": "^5.0.0"
}
}
}
},
"bitcoinjs-message": {

View File

@ -122,7 +122,7 @@
"bip32": "3.0.1",
"bip38": "github:BlueWallet/bip38",
"bip39": "3.1.0",
"bitcoinjs-lib": "6.0.2",
"bitcoinjs-lib": "6.1.1",
"bitcoinjs-message": "2.2.0",
"bolt11": "1.4.1",
"buffer": "6.0.3",