Gathering detailed insights and metrics for ts-nkeys
Gathering detailed insights and metrics for ts-nkeys
Gathering detailed insights and metrics for ts-nkeys
Gathering detailed insights and metrics for ts-nkeys
npm install ts-nkeys
Typescript
Module System
Node Version
NPM Version
98.2
Supply Chain
92.2
Quality
75.7
Maintenance
100
Vulnerability
100
License
Total Downloads
18,759,996
Last Day
4,280
Last Week
26,196
Last Month
126,993
Last Year
1,984,469
Minified
Minified + Gzipped
Latest Version
1.0.16
Package Id
ts-nkeys@1.0.16
Size
15.77 kB
NPM Version
6.13.7
Node Version
12.15.0
Publised On
25 Feb 2020
Cumulative downloads
Total Downloads
Last day
-19.7%
4,280
Compared to previous day
Last week
-9.9%
26,196
Compared to previous week
Last month
-16.5%
126,993
Compared to previous month
Last year
-38.9%
1,984,469
Compared to previous year
1
7
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.
1npm install ts-nkeys
1 // create an user nkey - also possible to create accounts, clusters, servers. 2 let user = createUser(); 3 4 // once you have an nkey you can generate various keys. 5 // A seed is the public and private keys together. 6 // Seeds are strings, and start with the letter 'S'. 7 // Seeds need to be kept safe and never shared. 8 let seed = user.getSeed(); 9 t.true(Buffer.isBuffer(seed)); 10 t.is(seed[0], 'S'.charCodeAt(0)); 11 12 // the second letter in the seed represents its type: 13 // `U` for user, 14 // `A` for account, 15 // `C` for cluster 16 // `N` for severs 17 t.is(seed[1], 'U'.charCodeAt(0)); 18 19 // public keys can be shared and can be used to verify signed content 20 let publicKey = user.getPublicKey(); 21 t.true(Buffer.isBuffer(publicKey)); 22 // first letter represents the type of public key 23 // `U` for user, 24 // `A` for account, 25 // `C` for cluster 26 // `N` for severs 27 t.is(publicKey[0], 'U'.charCodeAt(0)); 28 29 30 // To sign data 31 let data = Buffer.from("HelloWorld"); 32 let sig = user.sign(data); 33 34 // to verify use the user, public or seed: 35 t.true(user.verify(data, sig)); 36 37 // public keys can be used to verify signatures you cannot sign with them though. 38 let pk = fromPublic(publicKey); 39 t.true(pk.verify(data, sig)); 40 41 // seeds can be used to reconstitute the keypair from a string 42 let sk = fromSeed(seed); 43 t.true(sk.verify(data, sig)); 44 // and can be used to sign 45 let sig2 = sk.sign(data); 46 t.true(sk.verify(data, sig));
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.
Unless otherwise noted, the NATS source files are distributed under the Apache Version 2.0 license found in the LICENSE file.
No vulnerabilities found.
No security vulnerabilities found.