ts-slip32
ts-slip32 is a typescript implementation of the SLIP-0032 extended serialization format for BIP-32 wallets.
Installation
From npm:
npm install slip32
From git:
git clone https://github.com/witnet/ts-slip32.gitcd ts-slip32yarnyarn build
Usage
The main two functions are described in slip32.d.ts
:
/** * Import key from Slip32 format * @param * @returns {{keyPath: KeyPath; extendedKey: ExtendedKey<PrivateKey | PublicKey>}} */declare ; /** * Export key to Slip32 format * @param * @param {ExtendedKey<PrivateKey> | ExtendedKey<PublicKey>} extendedKey * @returns */declare ;
The aforementioned functions use the following interfaces and types, defined in keys.d.ts
:
/** * Key interface * The buffer should have a length of 32 bytes */ /** * Chain code (32 bytes) */declare ; /** * Private Key (33 bytes) */ /** * Public Key (33 bytes) */ /** * Extended keys, as introduced by BIP-0032, pair a key with a chain code */declare ;
Example
// Import key as {keyPath: KeyPath, extendedKey: ExtendedKey<PrivateKey | PublicKey>} // Export key as string
License
This library is free and open-source software released under the MIT license.