diff --git a/README.md b/README.md index 57d78aa..573a710 100644 --- a/README.md +++ b/README.md @@ -28,32 +28,26 @@ npm install ts-nkeys // Seeds are strings, and start with the letter 'S'. // Seeds need to be kept safe and never shared. let seed = user.getSeed(); - t.is(typeof seed, 'string'); - t.is(seed[0], 'S'); + t.true(Buffer.isBuffer(seed)); + t.is(seed[0], 'S'.charCodeAt(0)); // the second letter in the seed represents its type: // `U` for user, // `A` for account, // `C` for cluster // `N` for severs - t.is(seed[1], 'U'); + t.is(seed[1], 'U'.charCodeAt(0)); // public keys can be shared and can be used to verify signed content let publicKey = user.getPublicKey(); - t.is(typeof publicKey, 'string'); + t.true(Buffer.isBuffer(publicKey)); // first letter represents the type of public key // `U` for user, // `A` for account, // `C` for cluster // `N` for severs - t.is(publicKey[0], 'U'); + t.is(publicKey[0], 'U'.charCodeAt(0)); - // private keys like seeds shouldn't be shared. In most cases you should - // just save the seed. - let privateKey = user.getPrivateKey(); - t.is(typeof privateKey, 'string'); - // private keys start with the letter 'P'. - t.is(privateKey[0], 'P'); // To sign data let data = Buffer.from("HelloWorld"); @@ -71,5 +65,5 @@ npm install ts-nkeys t.true(sk.verify(data, sig)); // and can be used to sign let sig2 = sk.sign(data); - t.true(sk.verify(data, sig)) + t.true(sk.verify(data, sig)); ``` \ No newline at end of file diff --git a/package.json b/package.json index b4d7f98..86aad8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-nkeys", - "version": "1.0.8", + "version": "1.0.10", "description": "A public-key signature system based on Ed25519 for the NATS ecosystem in typescript for ts-nats and node-nats", "main": "lib/nkeys.js", "types": "lib/nkeys.d.ts", @@ -42,7 +42,6 @@ "typescript": "^3.0.3" }, "dependencies": { - "npm": "^6.4.1", "tweetnacl": "^1.0.0" }, "ava": { diff --git a/src/nkeys.ts b/src/nkeys.ts index 12f34b2..0846170 100644 --- a/src/nkeys.ts +++ b/src/nkeys.ts @@ -18,7 +18,7 @@ import {KP} from "./kp"; import {PublicKey} from "./public"; import {Codec} from "./codec"; -export const VERSION = "1.0.4"; +export const VERSION = "1.0.10"; export function createPair(prefix: Prefix): KeyPair { let rawSeed = ed25519.randomBytes(32).buffer;