{"name":"tweetnacl","dist-tags":{"latest":"0.14.5"},"description":"Port of TweetNaCl cryptographic library to JavaScript","readme":"TweetNaCl.js\n============\n\nPortof[TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/)\nto JavaScript for modern browsers and Node.js. Public domain.\n\n[![Build Status](https://travis-ci.org/dchest/tweetnacl-js.svg?branch=master)\n](https://travis-ci.org/dchest/tweetnacl-js)\n\nDemo: <https://dchest.github.io/tweetnacl-js/>\n\nDocumentation\n=============\n\n* [Overview](#overview)\n* [Audits](#audits)\n* [Installation](#installation)\n* [Examples](#examples)\n* [Usage](#usage)\n * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box)\n * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox)\n * [Scalar multiplication](#scalar-multiplication)\n * [Signatures](#signatures)\n * [Hashing](#hashing)\n * [Random bytes generation](#random-bytes-generation)\n * [Constant-time comparison](#constant-time-comparison)\n* [System requirements](#system-requirements)\n* [Development and testing](#development-and-testing)\n* [Benchmarks](#benchmarks)\n* [Contributors](#contributors)\n* [Who uses it](#who-uses-it)\n\n\nOverview\n--------\n\nThe primary goal of this project is to produce a translation of TweetNaCl to\nJavaScript which is as close as possible to the original C implementation, plus\na thin layer of idiomatic high-level API on top of it.\n\nThere are two versions, you can use either of them:\n\n* `nacl.js` is the port of TweetNaCl with minimum differences from the\n original + high-level API.\n\n* `nacl-fast.js` is like `nacl.js`, but with some functions replaced with\n faster versions. (Used by default when importing NPM package.)\n\n\nAudits\n------\n\nTweetNaCl.js has been audited by [Cure53](https://cure53.de/) in January-February\n2017 (audit was sponsored by [Deletype](https://deletype.com)):\n\n> The overall outcome of this audit signals a particularly positive assessment\n> for TweetNaCl-js, as the testing team was unable to find any security\n> problems in the library. It has to be noted that this is an exceptionally\n> rare result of a source code audit for any project and must be seen as a true\n> testament to a development proceeding with security at its core.\n>\n> To reiterate, the TweetNaCl-js project, the source code was found to be\n> bug-free at this point.\n>\n> [...]\n>\n> In sum, the testing team is happy to recommend the TweetNaCl-js project as\n> likely one of the safer and more secure cryptographic tools among its\n> competition.\n\n[Read full audit report](https://cure53.de/tweetnacl.pdf)\n\n\nInstallation\n------------\n\nYou can install TweetNaCl.js via a package manager:\n\n[Yarn](https://yarnpkg.com/):\n\n $ yarn add tweetnacl\n\n[NPM](https://www.npmjs.org/):\n\n $ npm install tweetnacl\n\nor [download source code](https://github.com/dchest/tweetnacl-js/releases).\n\n\nExamples\n--------\nYou can find usage examples in our [wiki](https://github.com/dchest/tweetnacl-js/wiki/Examples).\n\n\nUsage\n-----\n\nAll API functions accept and return bytes as `Uint8Array`s. If you need to\nencode or decode strings, use functions from\n<https://github.com/dchest/tweetnacl-util-js> or one of the more robust codec\npackages.\n\nIn Node.js v4 and later `Buffer` objects are backed by `Uint8Array`s, so you\ncan freely pass them to TweetNaCl.js functions as arguments. The returned\nobjects are still `Uint8Array`s, so if you need `Buffer`s, you'll have to\nconvert them manually; make sure to convert using copying: `Buffer.from(array)`\n(or `new Buffer(array)` in Node.js v4 or earlier), instead of sharing:\n`Buffer.from(array.buffer)` (or `new Buffer(array.buffer)` Node 4 or earlier),\nbecause some functions return subarrays of their buffers.\n\n\n### Public-key authenticated encryption (box)\n\nImplements *x25519-xsalsa20-poly1305*.\n\n#### nacl.box.keyPair()\n\nGenerates a new random key pair for box and returns it as an object with\n`publicKey` and `secretKey` members