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
// create an user nkey - also possible to create accounts, clusters, servers. ; // once you have an nkey you can generate various keys. // A seed is the public and private keys together. // Seeds are strings, and start with the letter 'S'. // Seeds need to be kept safe and never shared. ; t.trueBuffer.isBufferseed; t.isseed, 'S'.charCodeAt0; // the second letter in the seed represents its type: // `U` for user, // `A` for account, // `C` for cluster // `N` for severs t.isseed, 'U'.charCodeAt0; // public keys can be shared and can be used to verify signed content ; t.trueBuffer.isBufferpublicKey; // first letter represents the type of public key // `U` for user, // `A` for account, // `C` for cluster // `N` for severs t.ispublicKey, 'U'.charCodeAt0; // To sign data ; ; // to verify use the user, public or seed: t.trueuser.verifydata, sig; // public keys can be used to verify signatures you cannot sign with them though. ; t.truepk.verifydata, sig; // seeds can be used to reconstitute the keypair from a string ; t.truesk.verifydata, sig; // and can be used to sign ; t.truesk.verifydata, 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.