npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@scure/bip32

v2.2.0

Published

Secure, audited & minimal implementation of BIP32 hierarchical deterministic (HD) wallets over secp256k1

Readme

scure-bip32

Audited & minimal implementation of BIP32 hierarchical deterministic (HD) wallets over secp256k1.

  • 🔒 Audited by an independent security firm
  • 🔻 Tree-shakeable: unused code is excluded from your builds
  • 📦 ESM
  • ➰ Only 3 audited dependencies by the same author: noble-curves, noble-hashes, and scure-base
  • 🪶 18KB gzipped with all dependencies bundled

Check out scure-bip39 if you need mnemonic phrases. See key-producer if you need SLIP-0010/BIP32 ed25519 hdkey implementation. Notice Warnings about BIP32.

This library belongs to scure

scure — audited micro-libraries.

Usage

npm install @scure/bip32

deno add jsr:@scure/bip32

This module exports a single class HDKey, which should be used like this:

import { HDKey } from '@scure/bip32';
import { sha256 } from '@noble/hashes/sha2.js';
import { randomBytes } from '@noble/hashes/utils.js';

const seed = randomBytes(32);
const root = HDKey.fromMasterSeed(seed);
const base58key = root.privateExtendedKey;
const restored = HDKey.fromExtendedKey(base58key);
const fromJson = HDKey.fromJSON({ xpriv: base58key });
const child = fromJson.derive("m/0/2147483647'/1");
const msgHash = sha256(new TextEncoder().encode('hello scure-bip32'));

// props
[root.depth, root.index, root.chainCode];
[restored.privateKey, restored.publicKey];
const sig = child.sign(msgHash);
child.verify(msgHash, sig);

Note: chainCode property is essentially a private part of a secret "master" key, it should be guarded from unauthorized access.

The full API is:

class HDKey {
  public static HARDENED_OFFSET: number;
  public static fromMasterSeed(seed: Uint8Array, versions: Versions): HDKey;
  public static fromExtendedKey(base58key: string, versions: Versions): HDKey;
  public static fromJSON(json: { xpriv: string }): HDKey;

  readonly versions: Versions;
  readonly depth: number = 0;
  readonly index: number = 0;
  readonly chainCode: Uint8Array | null = null;
  readonly parentFingerprint: number = 0;

  get fingerprint(): number;
  get identifier(): Uint8Array | undefined;
  get pubKeyHash(): Uint8Array | undefined;
  get privateKey(): Uint8Array | null;
  get publicKey(): Uint8Array | null;
  get privateExtendedKey(): string;
  get publicExtendedKey(): string;

  derive(path: string): HDKey;
  deriveChild(index: number): HDKey;
  sign(hash: Uint8Array): Uint8Array;
  verify(hash: Uint8Array, signature: Uint8Array): boolean;
  wipePrivateData(): this;
}

interface Versions {
  private: number;
  public: number;
}

The module implements bip32 standard: check it out for additional documentation.

The implementation is loosely based on cryptocoinjs/hdkey, which has MIT License.

Warnings about BIP32

BIP32 is a bad standard. It would be great if we've had something better.

  • Network IDs (different currencies) are taken from a single GitHub document called SLIP-0044
  • There were new projects, which did not yet have SLIP. Exchanges added support of those projects to their cold wallets. Then after the projects were added to SLIP, the exchanges were required to re-generate their cold wallets - a complicated task
  • BIP32 is unusable for many different elliptic curves. For example, ETH2 uses bls12-381 curve, and with bip32 54% of generated keys would be invalid. So, they’re using much better BLS-only EIP-2333 as a replacement.
  • It’s easy to shoot yourself in foot with non-hardened keys, which could allow simple de-anonimization of all addresses

Security

The library has been audited:

The library was initially developed for js-ethereum-cryptography. At commit ae00e6d7, it was extracted to a separate package called micro-bip32. After the audit we've decided to use @scure NPM namespace for security.

Supply chain security

  • Commits are signed with PGP keys to prevent forgery. Be sure to verify the commit signatures
  • Releases are made transparently through token-less GitHub CI and Trusted Publishing. Be sure to verify the provenance logs for authenticity.
  • Rare releasing is practiced to minimize the need for re-audits by end-users.
  • Dependencies are minimized and strictly pinned to reduce supply-chain risk.
    • We use as few dependencies as possible.
    • Version ranges are locked, and changes are checked with npm-diff.
  • Dev dependencies are excluded from end-user installs; they’re only used for development and build steps.

For this package, there are 3 dependencies; and a few dev dependencies:

  • noble-hashes provides cryptographic hashing functionality
  • noble-curves provides ECDSA
  • scure-base provides base58
  • jsbt is used for benchmarking / testing / build tooling and developed by the same author
  • prettier, fast-check and typescript are used for code quality / test generation / ts compilation

Contributing & testing

  • npm install && npm run build && npm test will build the code and run tests.
  • npm run lint / npm run format will run linter / fix linter issues.
  • npm run build:release will build single file

License

MIT License

Copyright (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com)