ts-nkeys
A public-key signature system based on Ed25519 for the NATS ecosystem system in JavaScript and Typescript.
ts-nkeys is a typescript nats library for node that for generating nkeys.
Installation
npm install ts-nkeys
Basic Usage
let user = createUser();
let seed = user.getSeed();
t.true(Buffer.isBuffer(seed));
t.is(seed[0], 'S'.charCodeAt(0));
t.is(seed[1], 'U'.charCodeAt(0));
let publicKey = user.getPublicKey();
t.true(Buffer.isBuffer(publicKey));
t.is(publicKey[0], 'U'.charCodeAt(0));
let data = Buffer.from("HelloWorld");
let sig = user.sign(data);
t.true(user.verify(data, sig));
let pk = fromPublic(publicKey);
t.true(pk.verify(data, sig));
let sk = fromSeed(seed);
t.true(sk.verify(data, sig));
let sig2 = sk.sign(data);
t.true(sk.verify(data, sig));
Supported Node Versions
Our support policy for Nodejs versions follows Nodejs release support.
We will support and build node-nats on even-numbered Nodejs versions that are current or in LTS.
License
Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.