Sudoo-Token

Continuous Integration codecov npm version downloads

Token generator and signature validator

Install

yarn add @sudoo/token
# Or
npm install @sudoo/token --save

Create Token

import { generateKeyPair, KeyPair, SignatureCreator } from "@sudoo/token";

const keyPair: KeyPair = generateKeyPair();
const creator: SignatureCreator = SignatureCreator.instantiate(keyPair.private);

const token: string = creator.sign("Hello World");

Verify Token

import { KeyPair, SignatureVerifier } from "@sudoo/token";
// Also get your generated key pair

const verifier: SignatureVerifier = SignatureVerifier.instantiate(keyPair.public);

const result: string = verifier.verify("Hello World", "<Generated Token>");