@blocq-inc/lamport-key-manager-lib
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Lamport Key Manager

Lamport Key Manager is a library for managing and signing messages with Lamport keys.

Installation

npm install @blocq-inc/lamport-key-manager-lib
yarn add @blocq-inc/lamport-key-manager-lib

Usage

  • key generation and save to file
import { LamportKeyManager } from "@blocq-inc/lamport-key-manager";

// this will generate keys in `./keys/keys.json` and save to file in current directory
const manager = new LamportKeyManager();

// this will generate next keys and save to file
manager.generateNextKeys();

// these gets current private key, public key, lamport key pair, and public key hash
const currentPrivKey = manager.currentPrivKey;
const currentPubKey = manager.currentPubKey;
const currentLamportKeyPair = manager.currentLamportKeyPair;
const currentPubKeyHash = manager.currentPubKeyHash;
  • signing message
import { LamportSigner } from "@blocq-inc/lamport-key-manager";

// this loads keys from file in current directory
const manager = new LamportKeyManager("load");

const signer = new LamportSigner(manager.currentLamportKeyPair);

const message = "hello";
// this will sign message with current lamport key pair(private key)
const signature = signer.sign(message);

// this will verify signature with current public key
const result = signer.verify(message, signature);

// After signing, generate next keys because lamport key pair must not be reused.
manager.generateNextKeys();

Development tips

  • run test
yarn test
  • run type check
yarn type-check
  • build
yarn build
  • link local package
yarn link
  • unlink local package, re-build and link again after updating the code for the local development
yarn relink

TODO

  • [ ] add tests
  • [ ] add options for hash functions(e.g. sha256)

Dependencies (2)

Dev Dependencies (6)

Package Sidebar

Install

npm i @blocq-inc/lamport-key-manager-lib

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

47.4 kB

Total Files

33

Last publish

Collaborators

  • starcharles