{"ava":{"files":["./node_test/*.js"],"require":[],"failFast":true},"bugs":{"url":"https://github.com/nats-io/nkeys.js/issues"},"dist":{"shasum":"de83a9a13f396c5b6d7c412788f4b9f7f35d4c18","tarball":"https://registry.npmjs.org/nkeys.js/-/nkeys.js-1.1.0.tgz","fileCount":29,"integrity":"sha512-tB/a0shZL5UZWSwsoeyqfTszONTt4k2YS0tuQioMOD180+MbombYVgzDUYHlx+gejYK6rgf08n/2Df99WY0Sxg==","signatures":[{"sig":"MEYCIQC5rTiYbkxi6YX1Hw6X3P3lQewiHRpb4eMUVKNVXQRtMAIhAL/AGyWiRr7mI7JbNt7ZvuaGUHoLymLlLA6/NLRKpvWg","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/nkeys.js@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":124722},"main":"lib/index.js","name":"nkeys.js","types":"lib/index.d.ts","author":{"name":"The NATS Authors"},"readme":"# nkeys.js\n\nA public-key signature system based on Ed25519 for the\n[NATS ecosystem system](https://nats.io) for JavaScript.\n\n[![license](https://img.shields.io/github/license/nats-io/ts-nats.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![nkeys.js](https://github.com/aricart/nkeys.js/workflows/nkeys.js/badge.svg)](https://github.com/aricart/nkeys.js/actions)\n[![npm](https://img.shields.io/npm/v/nkeys.js.svg)](https://www.npmjs.com/package/nkeys.js)\n[![npm](https://img.shields.io/npm/dt/nkeys.js.svg)](https://www.npmjs.com/package/nkeys.js)\n\nThe nkeys.js library works in Deno, Node.js, and the browser!\n\n## Installation\n\nFor your Deno projects:\n\n```javascript\nimport {\n  createUser,\n  fromPublic,\n  fromSeed,\n} from \"https://deno.land/x/nkeys.js/modules/esm/mod.ts\";\n```\n\nOn node, and browsers you can get a build from npm:\n\n```bash\nnpm install nkeys.js\n```\n\nIn your node projects:\n\n```javascript\nconst { createUser, fromSeed, fromPublic } = require(\"nkeys.js\");\n```\n\nOn your browser projects, make available the `node/nkeys.js/nkeys.mjs`, and then\n\n```javascript\nimport { createUser, fromPublic, fromSeed } from \"https://host/path/nkeys.mjs\";\n```\n\n## Basic Usage\n\nThe [documentation is here](https://nats-io.github.io/nkeys.js/)\n\n```typescript\n// create an user nkey KeyPair (can also create accounts, operators, etc).\nconst user = createUser();\n\n// A seed is the public and private keys together.\nconst seed: Uint8Array = user.getSeed();\n\n// Seeds are encoded into Uint8Array, and start with\n// the letter 'S'. Seeds need to be kept safe and never shared\nconsole.log(`seeds start with s: ${seed[0] === \"S\".charCodeAt(0)}`);\n\n// A seed's second letter encodes it's type:\n// `U` for user,\n// `A` for account,\n// `O` for operators\nconsole.log(`nkey is for a user? ${seed[1] === \"U\".charCodeAt(0)}`);\n\n// To view a seed, simply decode it:\nconsole.log(new TextDecoder().decode(seed));\n\n// you can recreate the keypair with its seed:\nconst priv = fromSeed(seed);\n\n// Using the KeyPair, you can cryptographically sign content:\nconst data = new TextEncoder().encode(\"Hello World!\");\nconst sig = priv.sign(data);\n\n// and verify a signature:\nconst valid = user.verify(data, sig);\nif (!valid) {\n  console.error(\"couldn't validate the data/signature against my key\");\n} else {\n  console.error(\"data was verified by my key\");\n}\n\n// others can validate using your public key:\nconst publicKey = user.getPublicKey();\nconst pub = fromPublic(publicKey);\nif (!pub.verify(data, sig)) {\n  console.error(`couldn't validate the data/signature with ${publicKey}`);\n} else {\n  console.info(`data was verified by ${publicKey}`);\n}\n\n// when extracting with seeds or private keys\n// you should clear them when done:\nseed.fill(0);\n\n// you should also clear the keypairs:\nuser.clear();\npriv.clear();\n```\n\n## Supported Node Versions\n\nOur support policy for Nodejs versions follows\n[Nodejs release support](https://github.com/nodejs/Release). We will support and\nbuild nkeys.js on even-numbered Nodejs versions that are current or in LTS.\n\n## License\n\nUnless otherwise noted, the NATS source files are distributed under the Apache\nVersion 2.0 license found in the LICENSE file.\n","engines":{"node":">=10.0.0"},"gitHead":"88d9d1c6479755ab4a215a7d5265b9d01990c57e","license":"Apache-2.0","scripts":{"cjs":"deno run --allow-all bin/cjs-fix-imports.ts -o build/ src/ modules/cjs/ node_test/","doc":"npm run clean && rm -Rf docs && npm run stage && node_modules/.bin/typedoc --out docs/ && touch ./docs/.nojekyll","fmt":"deno fmt src/ examples/ modules/ test/ node_test/","init":"mkdir -p build","test":"npm run prepare && ava --verbose && deno test -A test/","clean":"rm -Rf build/ lib/ nkeys.d.ts nkeys.mjs ./coverage","cover":"npm run clean && npm run prepare && deno test --coverage=coverage -A test/ && deno coverage ./coverage --lcov > ./coverage/out.lcov && genhtml -o ./coverage/html ./coverage/out.lcov && open ./coverage/html/index.html","stage":"npm run init && npm run cjs && npm run generate && tsc","prepare":"npm run stage && npm run generate && deno bundle modules/esm/mod.ts nkeys.mjs && tsc","generate":"deno run -A ./bin/tweetnacl-esm.ts","bump-release":"npm version patch --no-commit-hooks --no-git-tag-version","check-package":"deno run --allow-all bin/check-bundle-version.ts","bump-qualifier":"npm version prerelease --no-commit-hooks --no-git-tag-version"},"_npmUser":{"name":"aricart","email":"alberto@synadia.com"},"homepage":"https://github.com/nats-io/nkeys.js#readme","keywords":["nats","Ed25519","javascript"],"repository":{"url":"git+https://github.com/nats-io/nkeys.js.git","type":"git"},"_npmVersion":"10.4.0","description":"A public-key signature system based on Ed25519 for the NATS ecosystem in javascript","directories":{},"maintainers":[{"name":"aricart","email":"alberto@synadia.com"}],"_nodeVersion":"20.11.1","dependencies":{"tweetnacl":"1.0.3"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"ava":"^6.1.x","typedoc":"^0.25.8","typescript":"^5.3.3","@types/node":"^20.11.x"},"_npmOperationalInternal":{"tmp":"tmp/nkeys.js_1.1.0_1708548126361_0.10278259912597743","host":"s3://npm-registry-packages"},"_id":"nkeys.js@1.1.0","version":"1.1.0"}