Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scure/bip32

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scure/bip32

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

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by11.31%
Maintainers
0
Weekly downloads
 
Created

What is @scure/bip32?

@scure/bip32 is a JavaScript library for working with BIP-32 hierarchical deterministic (HD) wallets. It allows developers to generate and manage HD wallets, derive child keys, and perform various cryptographic operations related to BIP-32.

What are @scure/bip32's main functionalities?

Generate a Master Key

This feature allows you to generate a master key from a mnemonic seed phrase. The code sample demonstrates how to convert a mnemonic phrase to a seed and then generate a master key from that seed.

const { mnemonicToSeedSync } = require('@scure/bip39');
const { BIP32Factory } = require('@scure/bip32');
const ecc = require('tiny-secp256k1');

const bip32 = BIP32Factory(ecc);
const seed = mnemonicToSeedSync('praise you muffin lion enable neck grocery crumble super myself license ghost');
const root = bip32.fromSeed(seed);
console.log(root.toBase58());

Derive Child Keys

This feature allows you to derive child keys from the master key using a specific derivation path. The code sample shows how to derive a child key using the BIP-44 path.

const child = root.derivePath('m/44'/0'/0'/0/0');
console.log(child.toBase58());

Get Public Key

This feature allows you to extract the public key from a derived key. The code sample demonstrates how to get the public key in hexadecimal format.

const publicKey = child.publicKey.toString('hex');
console.log(publicKey);

Sign a Message

This feature allows you to sign a message using a derived key. The code sample shows how to sign a message and get the signature in hexadecimal format.

const message = Buffer.from('Hello, world!');
const signature = child.sign(message);
console.log(signature.toString('hex'));

Verify a Signature

This feature allows you to verify a signature using a derived key. The code sample demonstrates how to verify a signature and check its validity.

const isValid = child.verify(message, signature);
console.log(isValid);

Other packages similar to @scure/bip32

Keywords

FAQs

Package last updated on 23 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc