New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@exodus/bip32

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/bip32

Exodus BIP32 modules.

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@exodus/bip32

This package helps you work with BIP32 keys.

Install

yarn add @exodus/bip32

Usage

Typical usage revolves around loading a serialized BIP32 xpub, xpriv or master key, deriving child keys from it, and using the child key's publicKey/privateKey.

Example:

const key = BIP32.fromXPub(
  'xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8'
)

const childKey = key.derive('m/0/0')

Static Methods

fromMasterSeed(seed: Buffer): BIP32

Import a BIP32 key from a seed.

import { fromMasterSeed } from '@exodus/bip32'

const key = fromMasterSeed(Buffer.from('000102030405060708090a0b0c0d0e0f'))
BIP32.fromXPub(base58xpub: string): BIP32

Import a BIP32 key from an extended public key.

import BIP32 from '@exodus/bip32'

const key = BIP32.fromXPub(
  'xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8'
)
BIP32.fromXPriv(base58xpriv: string): BIP32

Import a BIP32 key from an extended private key.

import BIP32 from '@exodus/bip32'

const key = BIP32.fromXPub(
  'xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi'
)

Constants

HARDENED_OFFSET: number

Constant offset value for hardened derivation indices.

import { HARDENED_OFFSET } from '@exodus/bip32'

console.log(HARDENED_OFFSET) // 0x80000000

Instance Methods

derive(numOrPath): BIP32

Derives a child key. Example:

const childKey = masterKey.derive(`m/0'/0'`)
wipePrivateData(): void

⚠️ Warning: destructive

Wipes all private key data from the instance.

toJSON(): { xpriv: string, xpub: string }

⚠️ Warning: returns sensitive xpriv data.

Converts the instance to a JSON object.

inspect(): { xpriv: string, xpub: string }

Alias to toJSON().

toString(): string

⚠️ Warning: returns sensitive xpriv data.

Returns a stringified version of the instance.

Instance Properties

privateKey: Buffer

Returns the private key.

publicKey: Buffer

Returns the public key.

chainCode: Buffer

Returns the chain code.

xPub: string

Returns the extended public key (xpub) in Base58 format.

identifier: Buffer

Returns the key identifier (hash160 of the public key).

fingerprint: number

Returns the fingerprint of the key (first 4 bytes of the identifier). See spec.

FAQs

Package last updated on 10 Feb 2025

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