Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 900 Bytes

README.md

File metadata and controls

33 lines (24 loc) · 900 Bytes

TS Bindings for no_std BLS Signatures

Creates bindings for https://github.com/gluwa/bls-signatures.

Installation

npm install bls-signatures-bindings

Usage

Import necessary structures from the package and use them as needed.

import { WasmPrivateKey } from 'bls-signatures-bindings';

async function main() {
    const seed = new Uint8Array(32);
    console.log("seed", seed);

    const privateKey = WasmPrivateKey.generate(seed);
    console.log("privateKey", privateKey.as_bytes());

    const publicKey = privateKey.public_key();
    console.log("publicKey", publicKey.as_bytes());

    const message = new TextEncoder().encode("Hello, World!");
    const signature = privateKey.sign(message);

    const isValid = publicKey.verify(signature, message);
    console.log("Signature valid:", isValid);
}

Compile it with tsc and run with dist/index.js.