{"name":"@scure/bip32","version":"1.6.1","keywords":["bip32","hierarchical","deterministic","hd key","bip0032","bip-32","bip39","micro","scure","mnemonic","phrase","code"],"author":{"url":"https://paulmillr.com","name":"Paul Miller"},"license":"MIT","_id":"@scure/bip32@1.6.1","contributors":[{"name":"Patricio Palladino","email":"patricio@nomiclabs.io"},{"url":"https://paulmillr.com","name":"Paul Miller"}],"homepage":"https://paulmillr.com/noble/#scure","bugs":{"url":"https://github.com/paulmillr/scure-bip32/issues"},"dist":{"shasum":"848eca1bc96f6b5ce6aa750798853fb142dace05","tarball":"http://registry-npm.ywwl.com/@scure/bip32/download/@scure/bip32-1.6.1.tgz","fileCount":13,"integrity":"sha512-jSO+5Ud1E588Y+LFo8TaB8JVPNAZw/lGGao+1SepHDeTs2dFLurdNIAgUuDlwezqEjRjElkCJajVrtrZaBxvaQ==","signatures":[{"sig":"MEUCIQDayUORuaX2nwZP0A5rj72lWLxsgZLW4pwXRU/J7Oq28gIgaiwVcl7Ma66cxEuQYpXtAAiEHx3P9Jff89eRokA4jjs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":65458,"size":12903,"noattachment":false,"key":"/@scure/bip32/-/@scure/bip32-1.6.1.tgz"},"main":"./lib/index.js","types":"./lib/index.d.ts","module":"./lib/esm/index.js","exports":{".":{"import":"./lib/esm/index.js","require":"./lib/index.js"}},"funding":"https://paulmillr.com/funding/","gitHead":"bc83675aca84b49f9954225a69a5ebb2fade7976","scripts":{"lint":"prettier --check 'index.ts' 'test/*.test.ts'","test":"cd test && tsc && node hdkey.test.js","build":"tsc && tsc -p tsconfig.esm.json","format":"prettier --write 'index.ts' 'test/*.test.ts'","build:release":"cd build && npm ci && npm run build:release"},"_npmUser":{"name":"paulmillr","email":"paul@paulmillr.com"},"repository":{"url":"git+https://github.com/paulmillr/scure-bip32.git","type":"git"},"_npmVersion":"11.0.0","description":"Secure, audited & minimal implementation of BIP32 hierarchical deterministic (HD) wallets over secp256k1","directories":{},"sideEffects":false,"_nodeVersion":"20.18.1","dependencies":{"@scure/base":"~1.2.1","@noble/curves":"~1.8.0","@noble/hashes":"~1.7.0"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"3.3.2","typescript":"5.5.2","micro-should":"0.4.0","@paulmillr/jsbt":"0.2.1"},"_npmOperationalInternal":{"tmp":"tmp/bip32_1.6.1_1735872612468_0.7047428490696426","host":"s3://npm-registry-packages-npm-production"},"readme":"# scure-bip32\n\nAudited & minimal implementation of BIP32 hierarchical deterministic (HD) wallets over secp256k1.\n\n- 🔒 [Audited](#security) by an independent security firm\n- 🔻 Tree-shakeable: unused code is excluded from your builds\n- 📦 ESM and common.js\n- ➰ Only 3 audited dependencies by the same author:\n  [noble-curves](https://github.com/paulmillr/noble-curves),\n  [noble-hashes](https://github.com/paulmillr/noble-hashes),\n  and [scure-base](https://github.com/paulmillr/scure-base)\n- 🪶 49KB with all dependencies bundled (300 lines)\n\nCheck out [scure-bip39](https://github.com/paulmillr/scure-bip39) if you need mnemonic phrases.\nSee [key-producer](https://github.com/paulmillr/micro-key-producer) if you need SLIP-0010/BIP32 ed25519 hdkey implementation.\n\n### This library belongs to *scure*\n\n> **scure** — audited micro-libraries.\n\n- Zero or minimal dependencies\n- Highly readable TypeScript / JS code\n- PGP-signed releases and transparent NPM builds\n- Check out [homepage](https://paulmillr.com/noble/#scure) & all libraries:\n  [base](https://github.com/paulmillr/scure-base),\n  [bip32](https://github.com/paulmillr/scure-bip32),\n  [bip39](https://github.com/paulmillr/scure-bip39),\n  [btc-signer](https://github.com/paulmillr/scure-btc-signer),\n  [starknet](https://github.com/paulmillr/scure-starknet)\n\n## Usage\n\n> `npm install @scure/bip32`\n\n> `deno add jsr:@scure/bip32`\n\n> `deno doc jsr:@scure/bip32`  # command-line documentation\n\nThis module exports a single class `HDKey`, which should be used like this:\n\n```ts\nimport { HDKey } from \"@scure/bip32\";\nconst hdkey1 = HDKey.fromMasterSeed(seed);\nconst hdkey2 = HDKey.fromExtendedKey(base58key);\nconst hdkey3 = HDKey.fromJSON({ xpriv: string });\n\n// props\n[hdkey1.depth, hdkey1.index, hdkey1.chainCode];\nconsole.log(hdkey2.privateKey, hdkey2.publicKey);\nconsole.log(hdkey3.derive(\"m/0/2147483647'/1\"));\nconst sig = hdkey3.sign(hash);\nhdkey3.verify(hash, sig);\n```\n\nNote: `chainCode` property is essentially a private part\nof a secret \"master\" key, it should be guarded from unauthorized access.\n\nThe full API is:\n\n```ts\nclass HDKey {\n  public static HARDENED_OFFSET: number;\n  public static fromMasterSeed(seed: Uint8Array, versions: Versions): HDKey;\n  public static fromExtendedKey(base58key: string, versions: Versions): HDKey;\n  public static fromJSON(json: { xpriv: string }): HDKey;\n\n  readonly versions: Versions;\n  readonly depth: number = 0;\n  readonly index: number = 0;\n  readonly chainCode: Uint8Array | null = null;\n  readonly parentFingerprint: number = 0;\n\n  get fingerprint(): number;\n  get identifier(): Uint8Array | undefined;\n  get pubKeyHash(): Uint8Array | undefined;\n  get privateKey(): Uint8Array | null;\n  get publicKey(): Uint8Array | null;\n  get privateExtendedKey(): string;\n  get publicExtendedKey(): string;\n\n  derive(path: string): HDKey;\n  deriveChild(index: number): HDKey;\n  sign(hash: Uint8Array): Uint8Array;\n  verify(hash: Uint8Array, signature: Uint8Array): boolean;\n  wipePrivateData(): this;\n}\n\ninterface Versions {\n  private: number;\n  public: number;\n}\n```\n\nThe module implements [bip32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) standard:\ncheck it out for additional documentation.\n\nThe implementation is loosely based on cryptocoinjs/hdkey, [which has MIT License](#LICENSE).\n\n## Security\n\nThe library has been independently audited:\n\n- at version 1.0.1, in Jan 2022, by [cure53](https://cure53.de)\n  - PDFs: [online](https://cure53.de/pentest-report_hashing-libs.pdf), [offline](./audit/2022-01-05-cure53-audit-nbl2.pdf)\n  - [Changes since audit](https://github.com/paulmillr/scure-bip32/compare/1.0.0..main).\n  - The audit has been funded by [Ethereum Foundation](https://ethereum.org/en/) with help of [Nomic Labs](https://nomiclabs.io)\n\nThe library was initially developed for [js-ethereum-cryptography](https://github.com/ethereum/js-ethereum-cryptography).\nAt commit [ae00e6d7](https://github.com/ethereum/js-ethereum-cryptography/commit/ae00e6d7d24fb3c76a1c7fe10039f6ecd120b77e),\nit was extracted to a separate package called `micro-bip32`.\nAfter the audit we've decided to use `@scure` NPM namespace for security.\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)\n","publish_time":1735872612775,"maintainers":[{"name":"paulmillr","email":"paul@paulmillr.com"}],"_cnpm_publish_time":1735872612775,"dist-tags":{"beta":"2.0.0-beta.1","latest":"2.4.0"}}