stuff
This commit is contained in:
		
							
								
								
									
										4
									
								
								buildfiles/app/node_modules/tweetnacl/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								buildfiles/app/node_modules/tweetnacl/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| .eslintrc | ||||
| .travis.yml | ||||
| bower.json | ||||
| test | ||||
							
								
								
									
										28
									
								
								buildfiles/app/node_modules/tweetnacl/AUTHORS.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								buildfiles/app/node_modules/tweetnacl/AUTHORS.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| List of TweetNaCl.js authors | ||||
| ============================ | ||||
|  | ||||
|     Alphabetical order by first name. | ||||
|     Format: Name (GitHub username or URL) | ||||
|  | ||||
| * AndSDev (@AndSDev) | ||||
| * Devi Mandiri (@devi) | ||||
| * Dmitry Chestnykh (@dchest) | ||||
|  | ||||
| List of authors of third-party public domain code from which TweetNaCl.js code was derived | ||||
| ========================================================================================== | ||||
|  | ||||
| [TweetNaCl](http://tweetnacl.cr.yp.to/) | ||||
| -------------------------------------- | ||||
|  | ||||
| * Bernard van Gastel | ||||
| * Daniel J. Bernstein <http://cr.yp.to/djb.html> | ||||
| * Peter Schwabe <http://www.cryptojedi.org/users/peter/> | ||||
| * Sjaak Smetsers <http://www.cs.ru.nl/~sjakie/> | ||||
| * Tanja Lange <http://hyperelliptic.org/tanja> | ||||
| * Wesley Janssen | ||||
|  | ||||
|  | ||||
| [Poly1305-donna](https://github.com/floodyberry/poly1305-donna) | ||||
| -------------------------------------------------------------- | ||||
|  | ||||
| * Andrew Moon (@floodyberry) | ||||
							
								
								
									
										221
									
								
								buildfiles/app/node_modules/tweetnacl/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										221
									
								
								buildfiles/app/node_modules/tweetnacl/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,221 @@ | ||||
| TweetNaCl.js Changelog | ||||
| ====================== | ||||
|  | ||||
|  | ||||
| v0.14.5 | ||||
| ------- | ||||
|  | ||||
| * Fixed incomplete return types in TypeScript typings. | ||||
| * Replaced COPYING.txt with LICENSE file, which now has public domain dedication | ||||
|   text from The Unlicense. License fields in package.json and bower.json have | ||||
|   been set to "Unlicense". The project was and will be in the public domain -- | ||||
|   this change just makes it easier for automated tools to know about this fact by | ||||
|   using the widely recognized and SPDX-compatible template for public domain | ||||
|   dedication. | ||||
|  | ||||
|  | ||||
| v0.14.4 | ||||
| ------- | ||||
|  | ||||
| * Added TypeScript type definitions (contributed by @AndSDev). | ||||
| * Improved benchmarking code. | ||||
|  | ||||
|  | ||||
| v0.14.3 | ||||
| ------- | ||||
|  | ||||
| Fixed a bug in the fast version of Poly1305 and brought it back. | ||||
|  | ||||
| Thanks to @floodyberry for promptly responding and fixing the original C code: | ||||
|  | ||||
| > "The issue was not properly detecting if st->h was >= 2^130 - 5, coupled with | ||||
| > [testing mistake] not catching the failure. The chance of the bug affecting | ||||
| > anything in the real world is essentially zero luckily, but it's good to have | ||||
| > it fixed." | ||||
|  | ||||
| https://github.com/floodyberry/poly1305-donna/issues/2#issuecomment-202698577 | ||||
|  | ||||
|  | ||||
| v0.14.2 | ||||
| ------- | ||||
|  | ||||
| Switched Poly1305 fast version back to original (slow) version due to a bug. | ||||
|  | ||||
|  | ||||
| v0.14.1 | ||||
| ------- | ||||
|  | ||||
| No code changes, just tweaked packaging and added COPYING.txt. | ||||
|  | ||||
|  | ||||
| v0.14.0 | ||||
| ------- | ||||
|  | ||||
| * **Breaking change!** All functions from `nacl.util` have been removed. These | ||||
|   functions are no longer available: | ||||
|  | ||||
|       nacl.util.decodeUTF8 | ||||
|       nacl.util.encodeUTF8 | ||||
|       nacl.util.decodeBase64 | ||||
|       nacl.util.encodeBase64 | ||||
|  | ||||
|   If want to continue using them, you can include | ||||
|   <https://github.com/dchest/tweetnacl-util-js> package: | ||||
|  | ||||
|       <script src="nacl.min.js"></script> | ||||
|       <script src="nacl-util.min.js"></script> | ||||
|  | ||||
|   or | ||||
|  | ||||
|       var nacl = require('tweetnacl'); | ||||
|       nacl.util = require('tweetnacl-util'); | ||||
|  | ||||
|   However it is recommended to use better packages that have wider | ||||
|   compatibility and better performance. Functions from `nacl.util` were never | ||||
|   intended to be robust solution for string conversion and were included for | ||||
|   convenience: cryptography library is not the right place for them. | ||||
|  | ||||
|   Currently calling these functions will throw error pointing to | ||||
|   `tweetnacl-util-js` (in the next version this error message will be removed). | ||||
|  | ||||
| * Improved detection of available random number generators, making it possible | ||||
|   to use `nacl.randomBytes` and related functions in Web Workers without | ||||
|   changes. | ||||
|  | ||||
| * Changes to testing (see README). | ||||
|  | ||||
|  | ||||
| v0.13.3 | ||||
| ------- | ||||
|  | ||||
| No code changes. | ||||
|  | ||||
| * Reverted license field in package.json to "Public domain". | ||||
|  | ||||
| * Fixed typo in README. | ||||
|  | ||||
|  | ||||
| v0.13.2 | ||||
| ------- | ||||
|  | ||||
| * Fixed undefined variable bug in fast version of Poly1305. No worries, this | ||||
|   bug was *never* triggered. | ||||
|  | ||||
| * Specified CC0 public domain dedication. | ||||
|  | ||||
| * Updated development dependencies. | ||||
|  | ||||
|  | ||||
| v0.13.1 | ||||
| ------- | ||||
|  | ||||
| * Exclude `crypto` and `buffer` modules from browserify builds. | ||||
|  | ||||
|  | ||||
| v0.13.0 | ||||
| ------- | ||||
|  | ||||
| * Made `nacl-fast` the default version in NPM package. Now | ||||
|   `require("tweetnacl")` will use fast version; to get the original version, | ||||
|   use `require("tweetnacl/nacl.js")`. | ||||
|  | ||||
| * Cleanup temporary array after generating random bytes. | ||||
|  | ||||
|  | ||||
| v0.12.2 | ||||
| ------- | ||||
|  | ||||
| * Improved performance of curve operations, making `nacl.scalarMult`, `nacl.box`, | ||||
|   `nacl.sign` and related functions up to 3x faster in `nacl-fast` version. | ||||
|  | ||||
|  | ||||
| v0.12.1 | ||||
| ------- | ||||
|  | ||||
| * Significantly improved performance of Salsa20 (~1.5x faster) and | ||||
|   Poly1305 (~3.5x faster) in `nacl-fast` version. | ||||
|  | ||||
|  | ||||
| v0.12.0 | ||||
| ------- | ||||
|  | ||||
| * Instead of using the given secret key directly, TweetNaCl.js now copies it to | ||||
|   a new array in `nacl.box.keyPair.fromSecretKey` and | ||||
|   `nacl.sign.keyPair.fromSecretKey`. | ||||
|  | ||||
|  | ||||
| v0.11.2 | ||||
| ------- | ||||
|  | ||||
| * Added new constant: `nacl.sign.seedLength`. | ||||
|  | ||||
|  | ||||
| v0.11.1 | ||||
| ------- | ||||
|  | ||||
| * Even faster hash for both short and long inputs (in `nacl-fast`). | ||||
|  | ||||
|  | ||||
| v0.11.0 | ||||
| ------- | ||||
|  | ||||
| * Implement `nacl.sign.keyPair.fromSeed` to enable creation of sign key pairs | ||||
|   deterministically from a 32-byte seed. (It behaves like | ||||
|   [libsodium's](http://doc.libsodium.org/public-key_cryptography/public-key_signatures.html) | ||||
|   `crypto_sign_seed_keypair`: the seed becomes a secret part of the secret key.) | ||||
|  | ||||
| * Fast version now has an improved hash implementation that is 2x-5x faster. | ||||
|  | ||||
| * Fixed benchmarks, which may have produced incorrect measurements. | ||||
|  | ||||
|  | ||||
| v0.10.1 | ||||
| ------- | ||||
|  | ||||
| * Exported undocumented `nacl.lowlevel.crypto_core_hsalsa20`. | ||||
|  | ||||
|  | ||||
| v0.10.0 | ||||
| ------- | ||||
|  | ||||
| * **Signature API breaking change!** `nacl.sign` and `nacl.sign.open` now deal | ||||
|  with signed messages, and new `nacl.sign.detached` and | ||||
|  `nacl.sign.detached.verify` are available. | ||||
|   | ||||
|  Previously, `nacl.sign` returned a signature, and `nacl.sign.open` accepted a | ||||
|  message and "detached" signature. This was unlike NaCl's API, which dealt with | ||||
|  signed messages (concatenation of signature and message). | ||||
|   | ||||
|  The new API is: | ||||
|  | ||||
|       nacl.sign(message, secretKey) -> signedMessage | ||||
|       nacl.sign.open(signedMessage, publicKey) -> message | null | ||||
|  | ||||
|  Since detached signatures are common, two new API functions were introduced: | ||||
|   | ||||
|       nacl.sign.detached(message, secretKey) -> signature | ||||
|       nacl.sign.detached.verify(message, signature, publicKey) -> true | false | ||||
|  | ||||
|  (Note that it's `verify`, not `open`, and it returns a boolean value, unlike | ||||
|  `open`, which returns an "unsigned" message.) | ||||
|  | ||||
| * NPM package now comes without `test` directory to keep it small. | ||||
|  | ||||
|  | ||||
| v0.9.2 | ||||
| ------ | ||||
|  | ||||
| * Improved documentation. | ||||
| * Fast version: increased theoretical message size limit from 2^32-1 to 2^52 | ||||
|   bytes in Poly1305 (and thus, secretbox and box). However this has no impact | ||||
|   in practice since JavaScript arrays or ArrayBuffers are limited to 32-bit | ||||
|   indexes, and most implementations won't allocate more than a gigabyte or so. | ||||
|   (Obviously, there are no tests for the correctness of implementation.) Also, | ||||
|   it's not recommended to use messages that large without splitting them into | ||||
|   smaller packets anyway. | ||||
|  | ||||
|  | ||||
| v0.9.1 | ||||
| ------ | ||||
|  | ||||
| * Initial release | ||||
							
								
								
									
										24
									
								
								buildfiles/app/node_modules/tweetnacl/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								buildfiles/app/node_modules/tweetnacl/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| This is free and unencumbered software released into the public domain. | ||||
|  | ||||
| Anyone is free to copy, modify, publish, use, compile, sell, or | ||||
| distribute this software, either in source code form or as a compiled | ||||
| binary, for any purpose, commercial or non-commercial, and by any | ||||
| means. | ||||
|  | ||||
| In jurisdictions that recognize copyright laws, the author or authors | ||||
| of this software dedicate any and all copyright interest in the | ||||
| software to the public domain. We make this dedication for the benefit | ||||
| of the public at large and to the detriment of our heirs and | ||||
| successors. We intend this dedication to be an overt act of | ||||
| relinquishment in perpetuity of all present and future rights to this | ||||
| software under copyright law. | ||||
|  | ||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||||
| IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||||
| OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||||
| ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||||
| OTHER DEALINGS IN THE SOFTWARE. | ||||
|  | ||||
| For more information, please refer to <http://unlicense.org> | ||||
							
								
								
									
										20
									
								
								buildfiles/app/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								buildfiles/app/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| # Important! | ||||
|  | ||||
| If your contribution is not trivial (not a typo fix, etc.), we can only accept | ||||
| it if you dedicate your copyright for the contribution to the public domain. | ||||
| Make sure you understand what it means (see http://unlicense.org/)! If you | ||||
| agree, please add yourself to AUTHORS.md file, and include the following text | ||||
| to your pull request description or a comment in it: | ||||
|  | ||||
| ------------------------------------------------------------------------------ | ||||
|  | ||||
|     I dedicate any and all copyright interest in this software to the | ||||
|     public domain. I make this dedication for the benefit of the public at | ||||
|     large and to the detriment of my heirs and successors. I intend this | ||||
|     dedication to be an overt act of relinquishment in perpetuity of all | ||||
|     present and future rights to this software under copyright law. | ||||
|  | ||||
|     Anyone is free to copy, modify, publish, use, compile, sell, or | ||||
|     distribute this software, either in source code form or as a compiled | ||||
|     binary, for any purpose, commercial or non-commercial, and by any | ||||
|     means. | ||||
							
								
								
									
										459
									
								
								buildfiles/app/node_modules/tweetnacl/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										459
									
								
								buildfiles/app/node_modules/tweetnacl/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,459 @@ | ||||
| TweetNaCl.js | ||||
| ============ | ||||
|  | ||||
| Port of [TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/) | ||||
| to JavaScript for modern browsers and Node.js. Public domain. | ||||
|  | ||||
| [ | ||||
| ](https://travis-ci.org/dchest/tweetnacl-js) | ||||
|  | ||||
| Demo: <https://tweetnacl.js.org> | ||||
|  | ||||
| **:warning: The library is stable and API is frozen, however it has not been | ||||
| independently reviewed. If you can help reviewing it, please [contact | ||||
| me](mailto:dmitry@codingrobots.com).** | ||||
|  | ||||
| Documentation | ||||
| ============= | ||||
|  | ||||
| * [Overview](#overview) | ||||
| * [Installation](#installation) | ||||
| * [Usage](#usage) | ||||
|   * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box) | ||||
|   * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox) | ||||
|   * [Scalar multiplication](#scalar-multiplication) | ||||
|   * [Signatures](#signatures) | ||||
|   * [Hashing](#hashing) | ||||
|   * [Random bytes generation](#random-bytes-generation) | ||||
|   * [Constant-time comparison](#constant-time-comparison) | ||||
| * [System requirements](#system-requirements) | ||||
| * [Development and testing](#development-and-testing) | ||||
| * [Benchmarks](#benchmarks) | ||||
| * [Contributors](#contributors) | ||||
| * [Who uses it](#who-uses-it) | ||||
|  | ||||
|  | ||||
| Overview | ||||
| -------- | ||||
|  | ||||
| The primary goal of this project is to produce a translation of TweetNaCl to | ||||
| JavaScript which is as close as possible to the original C implementation, plus | ||||
| a thin layer of idiomatic high-level API on top of it. | ||||
|  | ||||
| There are two versions, you can use either of them: | ||||
|  | ||||
| * `nacl.js` is the port of TweetNaCl with minimum differences from the | ||||
|   original + high-level API. | ||||
|  | ||||
| * `nacl-fast.js` is like `nacl.js`, but with some functions replaced with | ||||
|   faster versions. | ||||
|  | ||||
|  | ||||
| Installation | ||||
| ------------ | ||||
|  | ||||
| You can install TweetNaCl.js via a package manager: | ||||
|  | ||||
| [Bower](http://bower.io): | ||||
|  | ||||
|     $ bower install tweetnacl | ||||
|  | ||||
| [NPM](https://www.npmjs.org/): | ||||
|  | ||||
|     $ npm install tweetnacl | ||||
|  | ||||
| or [download source code](https://github.com/dchest/tweetnacl-js/releases). | ||||
|  | ||||
|  | ||||
| Usage | ||||
| ----- | ||||
|  | ||||
| All API functions accept and return bytes as `Uint8Array`s.  If you need to | ||||
| encode or decode strings, use functions from | ||||
| <https://github.com/dchest/tweetnacl-util-js> or one of the more robust codec | ||||
| packages. | ||||
|  | ||||
| In Node.js v4 and later `Buffer` objects are backed by `Uint8Array`s, so you | ||||
| can freely pass them to TweetNaCl.js functions as arguments. The returned | ||||
| objects are still `Uint8Array`s, so if you need `Buffer`s, you'll have to | ||||
| convert them manually; make sure to convert using copying: `new Buffer(array)`, | ||||
| instead of sharing: `new Buffer(array.buffer)`, because some functions return | ||||
| subarrays of their buffers. | ||||
|  | ||||
|  | ||||
| ### Public-key authenticated encryption (box) | ||||
|  | ||||
| Implements *curve25519-xsalsa20-poly1305*. | ||||
|  | ||||
| #### nacl.box.keyPair() | ||||
|  | ||||
| Generates a new random key pair for box and returns it as an object with | ||||
| `publicKey` and `secretKey` members: | ||||
|  | ||||
|     { | ||||
|        publicKey: ...,  // Uint8Array with 32-byte public key | ||||
|        secretKey: ...   // Uint8Array with 32-byte secret key | ||||
|     } | ||||
|  | ||||
|  | ||||
| #### nacl.box.keyPair.fromSecretKey(secretKey) | ||||
|  | ||||
| Returns a key pair for box with public key corresponding to the given secret | ||||
| key. | ||||
|  | ||||
| #### nacl.box(message, nonce, theirPublicKey, mySecretKey) | ||||
|  | ||||
| Encrypt and authenticates message using peer's public key, our secret key, and | ||||
| the given nonce, which must be unique for each distinct message for a key pair. | ||||
|  | ||||
| Returns an encrypted and authenticated message, which is | ||||
| `nacl.box.overheadLength` longer than the original message. | ||||
|  | ||||
| #### nacl.box.open(box, nonce, theirPublicKey, mySecretKey) | ||||
|  | ||||
| Authenticates and decrypts the given box with peer's public key, our secret | ||||
| key, and the given nonce. | ||||
|  | ||||
| Returns the original message, or `false` if authentication fails. | ||||
|  | ||||
| #### nacl.box.before(theirPublicKey, mySecretKey) | ||||
|  | ||||
| Returns a precomputed shared key which can be used in `nacl.box.after` and | ||||
| `nacl.box.open.after`. | ||||
|  | ||||
| #### nacl.box.after(message, nonce, sharedKey) | ||||
|  | ||||
| Same as `nacl.box`, but uses a shared key precomputed with `nacl.box.before`. | ||||
|  | ||||
| #### nacl.box.open.after(box, nonce, sharedKey) | ||||
|  | ||||
| Same as `nacl.box.open`, but uses a shared key precomputed with `nacl.box.before`. | ||||
|  | ||||
| #### nacl.box.publicKeyLength = 32 | ||||
|  | ||||
| Length of public key in bytes. | ||||
|  | ||||
| #### nacl.box.secretKeyLength = 32 | ||||
|  | ||||
| Length of secret key in bytes. | ||||
|  | ||||
| #### nacl.box.sharedKeyLength = 32 | ||||
|  | ||||
| Length of precomputed shared key in bytes. | ||||
|  | ||||
| #### nacl.box.nonceLength = 24 | ||||
|  | ||||
| Length of nonce in bytes. | ||||
|  | ||||
| #### nacl.box.overheadLength = 16 | ||||
|  | ||||
| Length of overhead added to box compared to original message. | ||||
|  | ||||
|  | ||||
| ### Secret-key authenticated encryption (secretbox) | ||||
|  | ||||
| Implements *xsalsa20-poly1305*. | ||||
|  | ||||
| #### nacl.secretbox(message, nonce, key) | ||||
|  | ||||
| Encrypt and authenticates message using the key and the nonce. The nonce must | ||||
| be unique for each distinct message for this key. | ||||
|  | ||||
| Returns an encrypted and authenticated message, which is | ||||
| `nacl.secretbox.overheadLength` longer than the original message. | ||||
|  | ||||
| #### nacl.secretbox.open(box, nonce, key) | ||||
|  | ||||
| Authenticates and decrypts the given secret box using the key and the nonce. | ||||
|  | ||||
| Returns the original message, or `false` if authentication fails. | ||||
|  | ||||
| #### nacl.secretbox.keyLength = 32 | ||||
|  | ||||
| Length of key in bytes. | ||||
|  | ||||
| #### nacl.secretbox.nonceLength = 24 | ||||
|  | ||||
| Length of nonce in bytes. | ||||
|  | ||||
| #### nacl.secretbox.overheadLength = 16 | ||||
|  | ||||
| Length of overhead added to secret box compared to original message. | ||||
|  | ||||
|  | ||||
| ### Scalar multiplication | ||||
|  | ||||
| Implements *curve25519*. | ||||
|  | ||||
| #### nacl.scalarMult(n, p) | ||||
|  | ||||
| Multiplies an integer `n` by a group element `p` and returns the resulting | ||||
| group element. | ||||
|  | ||||
| #### nacl.scalarMult.base(n) | ||||
|  | ||||
| Multiplies an integer `n` by a standard group element and returns the resulting | ||||
| group element. | ||||
|  | ||||
| #### nacl.scalarMult.scalarLength = 32 | ||||
|  | ||||
| Length of scalar in bytes. | ||||
|  | ||||
| #### nacl.scalarMult.groupElementLength = 32 | ||||
|  | ||||
| Length of group element in bytes. | ||||
|  | ||||
|  | ||||
| ### Signatures | ||||
|  | ||||
| Implements [ed25519](http://ed25519.cr.yp.to). | ||||
|  | ||||
| #### nacl.sign.keyPair() | ||||
|  | ||||
| Generates new random key pair for signing and returns it as an object with | ||||
| `publicKey` and `secretKey` members: | ||||
|  | ||||
|     { | ||||
|        publicKey: ...,  // Uint8Array with 32-byte public key | ||||
|        secretKey: ...   // Uint8Array with 64-byte secret key | ||||
|     } | ||||
|  | ||||
| #### nacl.sign.keyPair.fromSecretKey(secretKey) | ||||
|  | ||||
| Returns a signing key pair with public key corresponding to the given | ||||
| 64-byte secret key. The secret key must have been generated by | ||||
| `nacl.sign.keyPair` or `nacl.sign.keyPair.fromSeed`. | ||||
|  | ||||
| #### nacl.sign.keyPair.fromSeed(seed) | ||||
|  | ||||
| Returns a new signing key pair generated deterministically from a 32-byte seed. | ||||
| The seed must contain enough entropy to be secure. This method is not | ||||
| recommended for general use: instead, use `nacl.sign.keyPair` to generate a new | ||||
| key pair from a random seed. | ||||
|  | ||||
| #### nacl.sign(message, secretKey) | ||||
|  | ||||
| Signs the message using the secret key and returns a signed message. | ||||
|  | ||||
| #### nacl.sign.open(signedMessage, publicKey) | ||||
|  | ||||
| Verifies the signed message and returns the message without signature. | ||||
|  | ||||
| Returns `null` if verification failed. | ||||
|  | ||||
| #### nacl.sign.detached(message, secretKey) | ||||
|  | ||||
| Signs the message using the secret key and returns a signature. | ||||
|  | ||||
| #### nacl.sign.detached.verify(message, signature, publicKey) | ||||
|  | ||||
| Verifies the signature for the message and returns `true` if verification | ||||
| succeeded or `false` if it failed. | ||||
|  | ||||
| #### nacl.sign.publicKeyLength = 32 | ||||
|  | ||||
| Length of signing public key in bytes. | ||||
|  | ||||
| #### nacl.sign.secretKeyLength = 64 | ||||
|  | ||||
| Length of signing secret key in bytes. | ||||
|  | ||||
| #### nacl.sign.seedLength = 32 | ||||
|  | ||||
| Length of seed for `nacl.sign.keyPair.fromSeed` in bytes. | ||||
|  | ||||
| #### nacl.sign.signatureLength = 64 | ||||
|  | ||||
| Length of signature in bytes. | ||||
|  | ||||
|  | ||||
| ### Hashing | ||||
|  | ||||
| Implements *SHA-512*. | ||||
|  | ||||
| #### nacl.hash(message) | ||||
|  | ||||
| Returns SHA-512 hash of the message. | ||||
|  | ||||
| #### nacl.hash.hashLength = 64 | ||||
|  | ||||
| Length of hash in bytes. | ||||
|  | ||||
|  | ||||
| ### Random bytes generation | ||||
|  | ||||
| #### nacl.randomBytes(length) | ||||
|  | ||||
| Returns a `Uint8Array` of the given length containing random bytes of | ||||
| cryptographic quality. | ||||
|  | ||||
| **Implementation note** | ||||
|  | ||||
| TweetNaCl.js uses the following methods to generate random bytes, | ||||
| depending on the platform it runs on: | ||||
|  | ||||
| * `window.crypto.getRandomValues` (WebCrypto standard) | ||||
| * `window.msCrypto.getRandomValues` (Internet Explorer 11) | ||||
| * `crypto.randomBytes` (Node.js) | ||||
|  | ||||
| If the platform doesn't provide a suitable PRNG, the following functions, | ||||
| which require random numbers, will throw exception: | ||||
|  | ||||
| * `nacl.randomBytes` | ||||
| * `nacl.box.keyPair` | ||||
| * `nacl.sign.keyPair` | ||||
|  | ||||
| Other functions are deterministic and will continue working. | ||||
|  | ||||
| If a platform you are targeting doesn't implement secure random number | ||||
| generator, but you somehow have a cryptographically-strong source of entropy | ||||
| (not `Math.random`!), and you know what you are doing, you can plug it into | ||||
| TweetNaCl.js like this: | ||||
|  | ||||
|     nacl.setPRNG(function(x, n) { | ||||
|       // ... copy n random bytes into x ... | ||||
|     }); | ||||
|  | ||||
| Note that `nacl.setPRNG` *completely replaces* internal random byte generator | ||||
| with the one provided. | ||||
|  | ||||
|  | ||||
| ### Constant-time comparison | ||||
|  | ||||
| #### nacl.verify(x, y) | ||||
|  | ||||
| Compares `x` and `y` in constant time and returns `true` if their lengths are | ||||
| non-zero and equal, and their contents are equal. | ||||
|  | ||||
| Returns `false` if either of the arguments has zero length, or arguments have | ||||
| different lengths, or their contents differ. | ||||
|  | ||||
|  | ||||
| System requirements | ||||
| ------------------- | ||||
|  | ||||
| TweetNaCl.js supports modern browsers that have a cryptographically secure | ||||
| pseudorandom number generator and typed arrays, including the latest versions | ||||
| of: | ||||
|  | ||||
| * Chrome | ||||
| * Firefox | ||||
| * Safari (Mac, iOS) | ||||
| * Internet Explorer 11 | ||||
|  | ||||
| Other systems: | ||||
|  | ||||
| * Node.js | ||||
|  | ||||
|  | ||||
| Development and testing | ||||
| ------------------------ | ||||
|  | ||||
| Install NPM modules needed for development: | ||||
|  | ||||
|     $ npm install | ||||
|  | ||||
| To build minified versions: | ||||
|  | ||||
|     $ npm run build | ||||
|  | ||||
| Tests use minified version, so make sure to rebuild it every time you change | ||||
| `nacl.js` or `nacl-fast.js`. | ||||
|  | ||||
| ### Testing | ||||
|  | ||||
| To run tests in Node.js: | ||||
|  | ||||
|     $ npm run test-node | ||||
|  | ||||
| By default all tests described here work on `nacl.min.js`. To test other | ||||
| versions, set environment variable `NACL_SRC` to the file name you want to test. | ||||
| For example, the following command will test fast minified version: | ||||
|  | ||||
|     $ NACL_SRC=nacl-fast.min.js npm run test-node | ||||
|  | ||||
| To run full suite of tests in Node.js, including comparing outputs of | ||||
| JavaScript port to outputs of the original C version: | ||||
|  | ||||
|     $ npm run test-node-all | ||||
|  | ||||
| To prepare tests for browsers: | ||||
|  | ||||
|     $ npm run build-test-browser | ||||
|  | ||||
| and then open `test/browser/test.html` (or `test/browser/test-fast.html`) to | ||||
| run them. | ||||
|  | ||||
| To run headless browser tests with `tape-run` (powered by Electron): | ||||
|  | ||||
|     $ npm run test-browser | ||||
|  | ||||
| (If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.) | ||||
|  | ||||
| To run tests in both Node and Electron: | ||||
|  | ||||
|     $ npm test | ||||
|  | ||||
| ### Benchmarking | ||||
|  | ||||
| To run benchmarks in Node.js: | ||||
|  | ||||
|     $ npm run bench | ||||
|     $ NACL_SRC=nacl-fast.min.js npm run bench | ||||
|  | ||||
| To run benchmarks in a browser, open `test/benchmark/bench.html` (or | ||||
| `test/benchmark/bench-fast.html`). | ||||
|  | ||||
|  | ||||
| Benchmarks | ||||
| ---------- | ||||
|  | ||||
| For reference, here are benchmarks from MacBook Pro (Retina, 13-inch, Mid 2014) | ||||
| laptop with 2.6 GHz Intel Core i5 CPU (Intel) in Chrome 53/OS X and Xiaomi Redmi | ||||
| Note 3 smartphone with 1.8 GHz Qualcomm Snapdragon 650 64-bit CPU (ARM) in | ||||
| Chrome 52/Android: | ||||
|  | ||||
| |               | nacl.js Intel | nacl-fast.js Intel  |   nacl.js ARM | nacl-fast.js ARM  | | ||||
| | ------------- |:-------------:|:-------------------:|:-------------:|:-----------------:| | ||||
| | salsa20       | 1.3 MB/s      | 128 MB/s            |  0.4 MB/s     |  43 MB/s          | | ||||
| | poly1305      | 13 MB/s       | 171 MB/s            |  4 MB/s       |  52 MB/s          | | ||||
| | hash          | 4 MB/s        | 34 MB/s             |  0.9 MB/s     |  12 MB/s          | | ||||
| | secretbox 1K  | 1113 op/s     | 57583 op/s          |  334 op/s     |  14227 op/s       | | ||||
| | box 1K        | 145 op/s      | 718 op/s            |  37 op/s      |  368 op/s         | | ||||
| | scalarMult    | 171 op/s      | 733 op/s            |  56 op/s      |  380 op/s         | | ||||
| | sign          | 77  op/s      | 200 op/s            |  20 op/s      |  61 op/s          | | ||||
| | sign.open     | 39  op/s      | 102  op/s           |  11 op/s      |  31 op/s          | | ||||
|  | ||||
| (You can run benchmarks on your devices by clicking on the links at the bottom | ||||
| of the [home page](https://tweetnacl.js.org)). | ||||
|  | ||||
| In short, with *nacl-fast.js* and 1024-byte messages you can expect to encrypt and | ||||
| authenticate more than 57000 messages per second on a typical laptop or more than | ||||
| 14000 messages per second on a $170 smartphone, sign about 200 and verify 100 | ||||
| messages per second on a laptop or 60 and 30 messages per second on a smartphone, | ||||
| per CPU core (with Web Workers you can do these operations in parallel), | ||||
| which is good enough for most applications. | ||||
|  | ||||
|  | ||||
| Contributors | ||||
| ------------ | ||||
|  | ||||
| See AUTHORS.md file. | ||||
|  | ||||
|  | ||||
| Third-party libraries based on TweetNaCl.js | ||||
| ------------------------------------------- | ||||
|  | ||||
| * [forward-secrecy](https://github.com/alax/forward-secrecy) — Axolotl ratchet implementation | ||||
| * [nacl-stream](https://github.com/dchest/nacl-stream-js) - streaming encryption | ||||
| * [tweetnacl-auth-js](https://github.com/dchest/tweetnacl-auth-js) — implementation of [`crypto_auth`](http://nacl.cr.yp.to/auth.html) | ||||
| * [chloride](https://github.com/dominictarr/chloride) - unified API for various NaCl modules | ||||
|  | ||||
|  | ||||
| Who uses it | ||||
| ----------- | ||||
|  | ||||
| Some notable users of TweetNaCl.js: | ||||
|  | ||||
| * [miniLock](http://minilock.io/) | ||||
| * [Stellar](https://www.stellar.org/) | ||||
							
								
								
									
										2388
									
								
								buildfiles/app/node_modules/tweetnacl/nacl-fast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2388
									
								
								buildfiles/app/node_modules/tweetnacl/nacl-fast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2
									
								
								buildfiles/app/node_modules/tweetnacl/nacl-fast.min.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								buildfiles/app/node_modules/tweetnacl/nacl-fast.min.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										98
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,98 @@ | ||||
| // Type definitions for TweetNaCl.js | ||||
|  | ||||
| export as namespace nacl; | ||||
|  | ||||
| declare var nacl: nacl; | ||||
| export = nacl; | ||||
|  | ||||
| declare namespace nacl { | ||||
|     export interface BoxKeyPair { | ||||
|         publicKey: Uint8Array; | ||||
|         secretKey: Uint8Array; | ||||
|     } | ||||
|  | ||||
|     export interface SignKeyPair { | ||||
|         publicKey: Uint8Array; | ||||
|         secretKey: Uint8Array; | ||||
|     } | ||||
|  | ||||
|     export interface secretbox { | ||||
|         (msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array; | ||||
|         open(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | false; | ||||
|         readonly keyLength: number; | ||||
|         readonly nonceLength: number; | ||||
|         readonly overheadLength: number; | ||||
|     } | ||||
|  | ||||
|     export interface scalarMult { | ||||
|         (n: Uint8Array, p: Uint8Array): Uint8Array; | ||||
|         base(n: Uint8Array): Uint8Array; | ||||
|         readonly scalarLength: number; | ||||
|         readonly groupElementLength: number; | ||||
|     } | ||||
|  | ||||
|     namespace box { | ||||
|         export interface open { | ||||
|             (msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array | false; | ||||
|             after(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array | false; | ||||
|         } | ||||
|  | ||||
|         export interface keyPair { | ||||
|             (): BoxKeyPair; | ||||
|             fromSecretKey(secretKey: Uint8Array): BoxKeyPair; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     export interface box { | ||||
|         (msg: Uint8Array, nonce: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array; | ||||
|         before(publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array; | ||||
|         after(msg: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array; | ||||
|         open: box.open; | ||||
|         keyPair: box.keyPair; | ||||
|         readonly publicKeyLength: number; | ||||
|         readonly secretKeyLength: number; | ||||
|         readonly sharedKeyLength: number; | ||||
|         readonly nonceLength: number; | ||||
|         readonly overheadLength: number; | ||||
|     } | ||||
|  | ||||
|     namespace sign { | ||||
|         export interface detached { | ||||
|             (msg: Uint8Array, secretKey: Uint8Array): Uint8Array; | ||||
|             verify(msg: Uint8Array, sig: Uint8Array, publicKey: Uint8Array): boolean; | ||||
|         } | ||||
|  | ||||
|         export interface keyPair { | ||||
|             (): SignKeyPair; | ||||
|             fromSecretKey(secretKey: Uint8Array): SignKeyPair; | ||||
|             fromSeed(secretKey: Uint8Array): SignKeyPair; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     export interface sign { | ||||
|         (msg: Uint8Array, secretKey: Uint8Array): Uint8Array; | ||||
|         open(signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array | null; | ||||
|         detached: sign.detached; | ||||
|         keyPair: sign.keyPair; | ||||
|         readonly publicKeyLength: number; | ||||
|         readonly secretKeyLength: number; | ||||
|         readonly seedLength: number; | ||||
|         readonly signatureLength: number; | ||||
|     } | ||||
|  | ||||
|     export interface hash { | ||||
|         (msg: Uint8Array): Uint8Array; | ||||
|         readonly hashLength: number; | ||||
|     } | ||||
| } | ||||
|  | ||||
| declare interface nacl { | ||||
|     randomBytes(n: number): Uint8Array; | ||||
|     secretbox: nacl.secretbox; | ||||
|     scalarMult: nacl.scalarMult; | ||||
|     box: nacl.box; | ||||
|     sign: nacl.sign; | ||||
|     hash: nacl.hash; | ||||
|     verify(x: Uint8Array, y: Uint8Array): boolean; | ||||
|     setPRNG(fn: (x: Uint8Array, n: number) => void): void; | ||||
| } | ||||
							
								
								
									
										1175
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1175
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.min.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								buildfiles/app/node_modules/tweetnacl/nacl.min.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										89
									
								
								buildfiles/app/node_modules/tweetnacl/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								buildfiles/app/node_modules/tweetnacl/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | ||||
| { | ||||
|   "_args": [ | ||||
|     [ | ||||
|       "tweetnacl@0.14.5", | ||||
|       "/home/shihaam/www/freezer.shihaam.me/app" | ||||
|     ] | ||||
|   ], | ||||
|   "_from": "tweetnacl@0.14.5", | ||||
|   "_id": "tweetnacl@0.14.5", | ||||
|   "_inBundle": false, | ||||
|   "_integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", | ||||
|   "_location": "/tweetnacl", | ||||
|   "_phantomChildren": {}, | ||||
|   "_requested": { | ||||
|     "type": "version", | ||||
|     "registry": true, | ||||
|     "raw": "tweetnacl@0.14.5", | ||||
|     "name": "tweetnacl", | ||||
|     "escapedName": "tweetnacl", | ||||
|     "rawSpec": "0.14.5", | ||||
|     "saveSpec": null, | ||||
|     "fetchSpec": "0.14.5" | ||||
|   }, | ||||
|   "_requiredBy": [ | ||||
|     "/bcrypt-pbkdf", | ||||
|     "/sshpk" | ||||
|   ], | ||||
|   "_resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", | ||||
|   "_spec": "0.14.5", | ||||
|   "_where": "/home/shihaam/www/freezer.shihaam.me/app", | ||||
|   "author": { | ||||
|     "name": "TweetNaCl-js contributors" | ||||
|   }, | ||||
|   "browser": { | ||||
|     "buffer": false, | ||||
|     "crypto": false | ||||
|   }, | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/dchest/tweetnacl-js/issues" | ||||
|   }, | ||||
|   "description": "Port of TweetNaCl cryptographic library to JavaScript", | ||||
|   "devDependencies": { | ||||
|     "browserify": "^13.0.0", | ||||
|     "eslint": "^2.2.0", | ||||
|     "faucet": "^0.0.1", | ||||
|     "tap-browser-color": "^0.1.2", | ||||
|     "tape": "^4.4.0", | ||||
|     "tape-run": "^2.1.3", | ||||
|     "tweetnacl-util": "^0.13.3", | ||||
|     "uglify-js": "^2.6.1" | ||||
|   }, | ||||
|   "directories": { | ||||
|     "test": "test" | ||||
|   }, | ||||
|   "homepage": "https://tweetnacl.js.org", | ||||
|   "keywords": [ | ||||
|     "crypto", | ||||
|     "cryptography", | ||||
|     "curve25519", | ||||
|     "ed25519", | ||||
|     "encrypt", | ||||
|     "hash", | ||||
|     "key", | ||||
|     "nacl", | ||||
|     "poly1305", | ||||
|     "public", | ||||
|     "salsa20", | ||||
|     "signatures" | ||||
|   ], | ||||
|   "license": "Unlicense", | ||||
|   "main": "nacl-fast.js", | ||||
|   "name": "tweetnacl", | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git+https://github.com/dchest/tweetnacl-js.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "bench": "node test/benchmark/bench.js", | ||||
|     "build": "uglifyjs nacl.js -c -m -o nacl.min.js && uglifyjs nacl-fast.js -c -m -o nacl-fast.min.js", | ||||
|     "build-test-browser": "browserify test/browser/init.js test/*.js | uglifyjs -c -m -o test/browser/_bundle.js 2>/dev/null && browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null", | ||||
|     "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js", | ||||
|     "test": "npm run test-node-all && npm run test-browser", | ||||
|     "test-browser": "NACL_SRC=${NACL_SRC:='nacl.min.js'} && npm run build-test-browser && cat $NACL_SRC test/browser/_bundle.js | tape-run | faucet", | ||||
|     "test-node": "tape test/*.js | faucet", | ||||
|     "test-node-all": "make -C test/c && tape test/*.js test/c/*.js | faucet" | ||||
|   }, | ||||
|   "types": "nacl.d.ts", | ||||
|   "version": "0.14.5" | ||||
| } | ||||
		Reference in New Issue
	
	Block a user