BLS HD Key Utilities
![Node Version](https://img.shields.io/badge/node-10.x-green)
Utility functions for managing BLS heirarchical deterministic accounts.
- Create a master private key from entropy
- Create a child private key from a private key and index
- Convert a standard path into an array of indices
- Create a decendent private key from a private key and array of indices
Implementation is following EIPS: EIP-2334, EIP-2333
For a higher-level interface, see @chainsafe/bls-keygen.
Example
import {deriveMasterSK, deriveChildSK, deriveChildSKMultiple, pathToIndices} from "@chainsafe/bls-hd-key";
const entropy: Buffer = Buffer.from(...);
const masterKey: Buffer = deriveMasterSK(entropy);
const childIndex: number = ...;
const childKey: Buffer = deriveChildSK(masterKey, childIndex);
cont path = "m/12381/3600/0/0";
const childIndices: number[] = pathToIndices(path);
const eth1KeyType = 60;
cont path = "m/12381/60/0/0";
const childIndices: number[] = pathToIndices(path, eth1KeyType);
const childIndices: number[] = [...];
const childKey = deriveChildSKMultiple(masterKey, childIndices);
const entropy: Buffer = Buffer.from(...);
cont path = "m/12381/3600/0/0";
const childKey = deriveChildSKMultiple(deriveMasterSK(entropy), pathToIndices(path));
Contrubuting
Requirements:
yarn install
yarn run test
Audit
This repo was audited by Least Authority as part of this security audit, released 2020-03-23. Commit 767c998
verified in the report.
License
Apache-2.0