@epicinium/clavem
v1.0.2
Published
An implementation of Ed25519 by SUPERCOP ref10.
Downloads
10
Readme
@epicinium/clavem
An implementation of Ed25519 by SUPERCOP ref10.
Table of Contents
Installation
$ npm install --save @epicinium/clavem
Usage
generateKeyPair([seed])
Generate a new asymmetric key pair of the Ed25519.
Definition
function generateKeyPair(seed?: Buffer = crypto.randomBytes(32)): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
Example
const { publicKey, privateKey } = await generateKeyPair();
sign(message, publicKey, privateKey)
Calculate the signature on the passed message and keys.
Definition
function sign(message: Message, publicKey: Buffer, privateKey: Buffer): Promise<Buffer>;
Example
const signature = await sign('Hello, world!', publicKey, privateKey);
verify(message, signature, publicKey)
Verify the provided data using the given message and signature.
Definition
function verify(message: Message, signature: Buffer, publicKey: Buffer): Promise<boolean>;
Example
const isVerified = await verify('Hello, world!', signature, publicKey);
if (isVerified) {
// ...
} else {
// ...
}
Contributing
Requisites
- Node.js LTS Dubnium v10.13.0+
- emscripten v1.38.15+
Trivia
clavem means key in the Latin Language.