There's a live demo on Codepen to show the package in use.
Browser bundle at dist/hashchains-browser.js
Modules in dist
but installing the npm release and import/requiring @theqrl/hashchains should work with modern toolsets, i.e:
npm install @theqrl/hashchains
import { HashChain, HashChains } from '@theqrl/hashchains'
Exposes two classes:
const hc = new HashChain(hashRoot, hashFunction, length)
The hash of (secret data + index)
which forms the first hash in the chain and is iteratively hashed.
Currently only keccak256
is implemented.
Number of hashes to generate in the chain.
const hc = new HashChains(mnemonic, numberToCreate, index, hashFunction, length)
Secret data (eg. BIP39 mnemonic or hexstring) which is hashed along with sequential index to be the start of the hashchains.
Number of hashchains to return
Starting index for hashchains. Starting at index 0 and generating 10 chains then starting at index 8 and generating 5 chains will create two overlapping (i.e. identical) hashchains.
Currently only keccak256
is implemented.
Number of hashes to generate per chain created.
After an npm install
:
npm run serve
Starts a local vue development environment serving the browser-based demo from the CodePen above. This may be useful in adding more functionality/hash functions.
npm run test
npm run dev
Runs a watched for continuous development: lint code as per repository standards and ensure test cases pass.
npm run build
Outputs cjs/umd/esm and browserified JS modules to dist/
directory.