Files: dd9d879f2923aa9578ec24749c24fc658a74ff0b / README.md
2022 bytesRaw
Synopsis
This libary provides primitives for creating and verifying BLS threshold signatures in Webassembly with a JS API. All the hard work is done by herumi/bls. This wraps the bls C++ code which is compiled to Webassembly for easier use.
Installation
npm install bls-lib
Usage
const bls = require('bls-lib')
bls.onModuleInit(() => {
bls.init()
const sec = bls.secretKey()
const pub = bls.publicKey()
const sig = bls.signature()
bls.secretKeySetByCSPRNG(sec)
const msg = 'hello world'
bls.sign(sig, sec, msg)
bls.getPublicKey(pub, sec)
const v = bls.verify(sig, pub, msg)
// v === true
bls.free(sec)
bls.free(sig)
bls.free(pub)
})
Examples
API
Dependents
Building
First install the dependencies emscripten and ninja
git clone --recursive https://github.com/dfinity/js-bls-lib.git
cd js-bls-lib/build
ninja
License
Built with git-ssb-web