@idena/vrf-js
v1.0.1
Published
Reference implementation of Google Key Transparency VRF
Downloads
144
Readme
vrf-js
A reference implementation of Google Key Transparency VRF
Installation
You can use this command to install:
npm install @idena/vrf-js
Usage
You could use like this:
If you use node.js, you should require the module first:
const { Evaluate, ProofHoHash } = require('vrf-js');
or ES6 import
import { Evaluate, ProofHoHash } from 'vrf-js'
Example
// evaluate VRF proof from private key
const privateKey = [123, 254, 12, ... 11] // 32 bytes
const data = [1, 2, 3, 4, 5] // data
const [hash, proof] = Evaluate(privateKey, data)
// check VRF proof with public key
const publicKey = [23, 45, 76, ..., 22] // 65 bytes
// throws exception if proof is invalid
const hash = ProofTohash(publicKey, data, proof)
License
The project is released under the MIT license.