@scure/bip32
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -8,9 +8,5 @@ import { hmac } from '@noble/hashes/hmac'; | ||
import * as secp from '@noble/secp256k1'; | ||
import { base58check } from '@scure/base'; | ||
secp.utils.hmacSha256Sync = (key, ...messages) => { | ||
const h = hmac.create(sha256, key); | ||
messages.forEach((msg) => h.update(msg)); | ||
return h.digest(); | ||
}; | ||
const base58c = base58check(sha256); | ||
import { base58check as base58checker } from '@scure/base'; | ||
secp.utils.hmacSha256Sync = (key, ...msgs) => hmac(sha256, key, secp.utils.concatBytes(...msgs)); | ||
const base58check = base58checker(sha256); | ||
function bytesToNumber(bytes) { | ||
@@ -97,3 +93,3 @@ return BigInt(`0x${bytesToHex(bytes)}`); | ||
} | ||
return base58c.encode(this.serialize(this.versions.private, concatBytes(new Uint8Array([0]), priv))); | ||
return base58check.encode(this.serialize(this.versions.private, concatBytes(new Uint8Array([0]), priv))); | ||
} | ||
@@ -104,5 +100,6 @@ get publicExtendedKey() { | ||
} | ||
return base58c.encode(this.serialize(this.versions.public, this.pubKey)); | ||
return base58check.encode(this.serialize(this.versions.public, this.pubKey)); | ||
} | ||
static fromMasterSeed(seed, versions = BITCOIN_VERSIONS) { | ||
assertBytes(seed); | ||
if (8 * seed.length < 128 || 8 * seed.length > 512) { | ||
@@ -119,3 +116,3 @@ throw new Error(`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`); | ||
static fromExtendedKey(base58key, versions = BITCOIN_VERSIONS) { | ||
const keyBuffer = base58c.decode(base58key); | ||
const keyBuffer = base58check.decode(base58key); | ||
const keyView = createView(keyBuffer); | ||
@@ -122,0 +119,0 @@ const version = keyView.getUint32(0, false); |
@@ -12,8 +12,4 @@ "use strict"; | ||
const base_1 = require("@scure/base"); | ||
secp.utils.hmacSha256Sync = (key, ...messages) => { | ||
const h = hmac_1.hmac.create(sha256_1.sha256, key); | ||
messages.forEach((msg) => h.update(msg)); | ||
return h.digest(); | ||
}; | ||
const base58c = (0, base_1.base58check)(sha256_1.sha256); | ||
secp.utils.hmacSha256Sync = (key, ...msgs) => (0, hmac_1.hmac)(sha256_1.sha256, key, secp.utils.concatBytes(...msgs)); | ||
const base58check = (0, base_1.base58check)(sha256_1.sha256); | ||
function bytesToNumber(bytes) { | ||
@@ -100,3 +96,3 @@ return BigInt(`0x${(0, utils_1.bytesToHex)(bytes)}`); | ||
} | ||
return base58c.encode(this.serialize(this.versions.private, (0, utils_1.concatBytes)(new Uint8Array([0]), priv))); | ||
return base58check.encode(this.serialize(this.versions.private, (0, utils_1.concatBytes)(new Uint8Array([0]), priv))); | ||
} | ||
@@ -107,5 +103,6 @@ get publicExtendedKey() { | ||
} | ||
return base58c.encode(this.serialize(this.versions.public, this.pubKey)); | ||
return base58check.encode(this.serialize(this.versions.public, this.pubKey)); | ||
} | ||
static fromMasterSeed(seed, versions = BITCOIN_VERSIONS) { | ||
(0, _assert_1.bytes)(seed); | ||
if (8 * seed.length < 128 || 8 * seed.length > 512) { | ||
@@ -122,3 +119,3 @@ throw new Error(`HDKey: wrong seed length=${seed.length}. Should be between 128 and 512 bits; 256 bits is advised)`); | ||
static fromExtendedKey(base58key, versions = BITCOIN_VERSIONS) { | ||
const keyBuffer = base58c.decode(base58key); | ||
const keyBuffer = base58check.decode(base58key); | ||
const keyView = (0, utils_1.createView)(keyBuffer); | ||
@@ -125,0 +122,0 @@ const version = keyView.getUint32(0, false); |
{ | ||
"name": "@scure/bip32", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Secure, audited & minimal implementation of BIP32 hierarchical deterministic (HD) wallets", | ||
"files": [ | ||
@@ -17,10 +16,10 @@ "lib/index.js", | ||
".": { | ||
"types": "./lib/index.d.ts", | ||
"import": "./lib/esm/index.js", | ||
"default": "./lib/index.js" | ||
}, | ||
"./index.d.ts": "./lib/index.d.ts" | ||
} | ||
}, | ||
"dependencies": { | ||
"@noble/hashes": "~1.1.1", | ||
"@noble/secp256k1": "~1.6.0", | ||
"@noble/hashes": "~1.1.3", | ||
"@noble/secp256k1": "~1.7.0", | ||
"@scure/base": "~1.1.0" | ||
@@ -53,4 +52,4 @@ }, | ||
"build": "tsc -d && tsc -p tsconfig.esm.json", | ||
"lint": "prettier --check 'index.ts' 'test/**/*.{js,ts}'", | ||
"format": "prettier --write 'index.ts' 'test/**/*.{js,ts}'", | ||
"lint": "prettier --check 'index.ts' 'test/*.test.ts'", | ||
"format": "prettier --write 'index.ts' 'test/*.test.ts'", | ||
"test": "cd test && tsc && mocha hdkey.test.js" | ||
@@ -57,0 +56,0 @@ }, |
@@ -98,3 +98,3 @@ # scure-bip32 | ||
The library has been audited by Cure53 on Jan 5, 2022. Check out the audit [PDF](./audit/2022-01-05-cure53-audit-nbl2.pdf) & [URL](https://cure53.de/pentest-report_hashing-libs.pdf). | ||
The library has been audited by Cure53 on Jan 5, 2022. Check out the audit [PDF](./audit/2022-01-05-cure53-audit-nbl2.pdf) & [URL](https://cure53.de/pentest-report_hashing-libs.pdf). See [changes since audit](https://github.com/paulmillr/scure-bip32/compare/1.0.1..main). | ||
@@ -101,0 +101,0 @@ 1. The library was initially developed for [js-ethereum-cryptography](https://github.com/ethereum/js-ethereum-cryptography) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26605
0
565
0
+ Added@noble/secp256k1@1.7.1(transitive)
- Removed@noble/secp256k1@1.6.3(transitive)
Updated@noble/hashes@~1.1.3
Updated@noble/secp256k1@~1.7.0