trackthis-ecdsa
ed25519 signature generation and verification
Install
npm install --save trackthis-ecdsa
Examples
Signing and verifying data
const lib = ;const seed = lib;const keypair = await lib;const msg = Buffer;const sig = await keypair; console; // true
Storing keypairs
const lib = ;const fs = ;const seed = lib;const keypair = await lib; fs
Loading keypairs
const lib = ;const fs = ; const base64keys = ;const keypair = lib;
API
lib.createSeed()
Generates 32-byte seed using Math.random
. Using a different random-generator
which is cryptographically secure is strongly advised.
lib.keyPairFrom( data )
Generates a keypair containing the .sign
and .verify
functions
lib.createKeyPair( seed )
Generates a keypair from the provided 32-byte seed with the following properties:
- arguments:
seed
- a 32-byte byffer
- returns:
keypair.publicKey
- A 32-byte public key as a bufferkeypair.secretKey
- A 64-byte secret key as a bufferkeypair.sign
- Function to sign a message using the keypairkeypair.verify
- Function to verify a signature using the keypair
lib.sign( msg, publicKey, secretKey )
Sign a message using the given keypair.
- arguments:
msg
- A buffer representing the messagepublicKey
- A 32-byte public key as a buffersecretKey
- A 64-byte secret key as a buffer
- returns:
signature
- A 64-byte buffer
lib.verify( sig, msg, publicKey )
TODO
keypair.sign( msg )
TODO
keypair.verify( sig, msg )
TODO