mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-12 11:39:59 +05:00
Clean build and minify
This commit is contained in:
parent
c22c454e24
commit
e570f66f79
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@ www/common/onlyoffice/v*
|
||||
/onlyoffice-conf/
|
||||
/onlyoffice-dist/
|
||||
|
||||
www/common/worker.bundle.js
|
||||
_build
|
||||
|
||||
# ---> Node
|
||||
|
||||
@ -44,6 +44,7 @@ module.exports = [{
|
||||
"www/code/mermaid*.js",
|
||||
"www/code/orgmode.js",
|
||||
"www/common/worker.bundle.js",
|
||||
"www/common/worker.bundle.min.js",
|
||||
"src/tweetnacl",
|
||||
"_build",
|
||||
"testapi.js",
|
||||
|
||||
@ -10,11 +10,30 @@ import json from '@rollup/plugin-json';
|
||||
export default {
|
||||
//input: "./_src/worker/index.ts",
|
||||
input: "./src/worker/store.ts",
|
||||
output: {
|
||||
output: [{
|
||||
name: 'cryptpad-worker',
|
||||
file: "./_build/worker.bundle.js",
|
||||
format: "umd"
|
||||
},
|
||||
file: "./www/common/worker.bundle.js",
|
||||
format: "umd",
|
||||
plugins: [
|
||||
terser({
|
||||
format: {
|
||||
comments: 'some',
|
||||
beautify: true,
|
||||
ecma: '2015',
|
||||
},
|
||||
compress: false,
|
||||
mangle: false,
|
||||
module: true,
|
||||
}),
|
||||
]
|
||||
}, {
|
||||
name: 'cryptpad-worker-min',
|
||||
file: "./www/common/worker.bundle.min.js",
|
||||
format: "umd",
|
||||
plugins: [terser({
|
||||
format: { comments: false, ecma: '2015' }
|
||||
})]
|
||||
}],
|
||||
preserveSymlinks: true,
|
||||
plugins: [
|
||||
json(),
|
||||
@ -25,16 +44,6 @@ export default {
|
||||
commonjs({
|
||||
ignore:['crypto', 'node:http', 'node:https'] // required by tweetnacl for node
|
||||
}),
|
||||
terser({
|
||||
format: {
|
||||
comments: 'some',
|
||||
beautify: true,
|
||||
ecma: '2015',
|
||||
},
|
||||
compress: false,
|
||||
mangle: false,
|
||||
module: true,
|
||||
}),
|
||||
//nodePolyfills( /* options */ )
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
const Messages = require('./src/messages');
|
||||
const AppConfig = require('./customize/application_config');
|
||||
const Messages = require('../../src/messages');
|
||||
const AppConfig = require('../../customize/application_config');
|
||||
//const App = require('./_build/worker.bundle');
|
||||
const Store = require('./www/common/store-interface');
|
||||
const Store = require('../../www/common/store-interface');
|
||||
const Http = require('node:http');
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
test
|
||||
.travis.yml
|
||||
bower.json
|
||||
@ -1,101 +0,0 @@
|
||||
TweetNaCl.js Changelog
|
||||
======================
|
||||
|
||||
|
||||
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
|
||||
@ -1,455 +0,0 @@
|
||||
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://dchest.github.io/tweetnacl-js/)
|
||||
|
||||
**:warning: Beta version. 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)
|
||||
* [Utilities](#utilities)
|
||||
* [Examples](#examples)
|
||||
* [System requirements](#system-requirements)
|
||||
* [Development and testing](#development-and-testing)
|
||||
* [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.is 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 `nacl.util` namespace.
|
||||
|
||||
### 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)
|
||||
|
||||
Note that browsers are required to throw `QuotaExceededError` exception if
|
||||
requested `length` is more than 65536, so do not ask for more than 65536 bytes
|
||||
in *one call* (multiple calls to get as many bytes as you like are okay:
|
||||
browsers can generate infinite amount of random bytes without any bad
|
||||
consequences).
|
||||
|
||||
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.
|
||||
|
||||
|
||||
### Utilities
|
||||
|
||||
Encoding/decoding functions are provided for convenience. They are correct,
|
||||
however their performance and wide compatibility with uncommon runtimes is not
|
||||
something that is considered important compared to the simplicity and size of
|
||||
implementation. You can use third-party libraries if you need to.
|
||||
|
||||
#### nacl.util.decodeUTF8(string)
|
||||
|
||||
Decodes string and returns `Uint8Array` of bytes.
|
||||
|
||||
#### nacl.util.encodeUTF8(array)
|
||||
|
||||
Encodes `Uint8Array` or `Array` of bytes into string.
|
||||
|
||||
#### nacl.util.decodeBase64(string)
|
||||
|
||||
Decodes Base-64 encoded string and returns `Uint8Array` of bytes.
|
||||
|
||||
#### nacl.util.encodeBase64(array)
|
||||
|
||||
Encodes `Uint8Array` or `Array` of bytes into string using Base-64 encoding.
|
||||
|
||||
|
||||
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 (we test on 0.10 and later)
|
||||
|
||||
|
||||
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 test
|
||||
|
||||
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 test
|
||||
|
||||
To run full suite of tests in Node.hs, including comparing outputs of
|
||||
JavaScript port to outputs of the original C version:
|
||||
|
||||
$ npm run testall
|
||||
|
||||
To prepare tests for browsers:
|
||||
|
||||
$ npm run browser
|
||||
|
||||
and then open `tests/browser/test.html` (or `tests/browser/test-fast.html`) to
|
||||
run them.
|
||||
|
||||
To run headless browser tests with `testling`:
|
||||
|
||||
$ npm run testling
|
||||
|
||||
(If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.)
|
||||
|
||||
### 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`).
|
||||
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
JavaScript port:
|
||||
|
||||
* [Dmitry Chestnykh](http://github.com/dchest) (ported xsalsa20, poly1305, curve25519)
|
||||
* [Devi Mandiri](https://github.com/devi) (ported curve25519, ed25519, sha512)
|
||||
|
||||
Original authors of [NaCl](http://nacl.cr.yp.to), [TweetNaCl](http://tweetnacl.cr.yp.to)
|
||||
and [Poly1305-donna](https://github.com/floodyberry/poly1305-donna)
|
||||
(who are *not* responsible for any errors in this implementation):
|
||||
|
||||
* [Daniel J. Bernstein](http://cr.yp.to/djb.html)
|
||||
* Wesley Janssen
|
||||
* [Tanja Lange](http://hyperelliptic.org/tanja)
|
||||
* [Peter Schwabe](http://www.cryptojedi.org/users/peter/)
|
||||
* [Matthew Dempsky](https://github.com/mdempsky)
|
||||
* [Andrew Moon](https://github.com/floodyberry)
|
||||
|
||||
Contributors have dedicated their work to the public domain.
|
||||
|
||||
This software is distributed without any warranty.
|
||||
|
||||
|
||||
Who uses it
|
||||
-----------
|
||||
|
||||
Some notable users of TweetNaCl.js:
|
||||
|
||||
* [miniLock](http://minilock.io/)
|
||||
* [Stellar](https://www.stellar.org/)
|
||||
File diff suppressed because it is too large
Load Diff
2
src/tweetnacl/nacl-fast.min.js
vendored
2
src/tweetnacl/nacl-fast.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
1
src/tweetnacl/nacl.min.js
vendored
1
src/tweetnacl/nacl.min.js
vendored
File diff suppressed because one or more lines are too long
4327
src/tweetnacl/package-lock.json
generated
4327
src/tweetnacl/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,59 +0,0 @@
|
||||
{
|
||||
"name": "tweetnacl",
|
||||
"version": "0.12.2",
|
||||
"description": "Port of TweetNaCl cryptographic library to JavaScript",
|
||||
"main": "nacl.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "uglifyjs nacl.js -c -m -o nacl.min.js && uglifyjs nacl-fast.js -c -m -o nacl-fast.min.js",
|
||||
"test": "tape test/*.js | faucet",
|
||||
"testall": "make -C test/c && tape test/*.js test/c/*.js | faucet",
|
||||
"browser": "browserify test/browser/init.js test/*.js | uglifyjs -c -m -o test/browser/_bundle.js 2>/dev/null",
|
||||
"browser-quick": "browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null",
|
||||
"testling": "browserify test/browser/testling_init.js test/*.js | testling | faucet",
|
||||
"firefox": "browserify test/browser/testling_init.js test/*.js | testling -x firefox | faucet",
|
||||
"chrome": "browserify test/browser/testling_init.js test/*.js | testling -x google-chrome | faucet",
|
||||
"bench": "node test/benchmark/bench.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/11..latest",
|
||||
"chrome/22..latest",
|
||||
"firefox/16..latest",
|
||||
"safari/latest",
|
||||
"opera/11.0..latest",
|
||||
"iphone/6..latest",
|
||||
"ipad/6..latest",
|
||||
"android-browser/latest"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dchest/tweetnacl-js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"crypto",
|
||||
"cryptography",
|
||||
"curve25519",
|
||||
"ed25519",
|
||||
"encrypt",
|
||||
"hash",
|
||||
"key",
|
||||
"nacl",
|
||||
"poly1305",
|
||||
"public",
|
||||
"salsa20",
|
||||
"signatures"
|
||||
],
|
||||
"author": "TweetNaCl-js contributors",
|
||||
"license": "Public domain",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dchest/tweetnacl-js/issues"
|
||||
},
|
||||
"homepage": "https://dchest.github.io/tweetnacl-js",
|
||||
"devDependencies": {
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import nacl from 'tweetnacl/nacl-fast';
|
||||
//import nacl from 'tweetnacl/nacl-fast';
|
||||
import { Module } from './types';
|
||||
import { TestModule, TestModuleObject } from './modules/test';
|
||||
//import { TestModule, TestModuleObject } from './modules/test';
|
||||
|
||||
import { Account } from './components/account';
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"target": "es6",
|
||||
"lib": ["ES2017", "DOM", "ES2020"],
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./_build"
|
||||
"outDir": "./www/common"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
(() => {
|
||||
const factory = function () {
|
||||
// XXX TODO
|
||||
// Support NodeJS
|
||||
// Support WebWorker
|
||||
// Return a usable API instead of postMsg/msgEv
|
||||
// XXX handle AppConfig, ApiConfig, MEssages and Broadcast in this file directly?
|
||||
// --> pull them using require if browser or... ?
|
||||
let USE_MIN = false;
|
||||
|
||||
let path = '/common/worker.bundle.js?';
|
||||
if (USE_MIN) { path = '/common/worker.bundle.min.js?'; }
|
||||
|
||||
let create = function (cfg = {}) {
|
||||
let { noWorker, noSharedWorker, AppConfig,
|
||||
@ -39,7 +37,7 @@ const factory = function () {
|
||||
|
||||
let worker, postMsg;
|
||||
if (!noWorker && !noSharedWorker && typeof(SharedWorker) !== "undefined") {
|
||||
worker = new SharedWorker('/common/worker.bundle.js?' + urlArgs);
|
||||
worker = new SharedWorker(path + urlArgs);
|
||||
worker.onerror = function (e) {
|
||||
console.error(e.message);
|
||||
};
|
||||
@ -68,7 +66,7 @@ const factory = function () {
|
||||
}
|
||||
|
||||
if (!noWorker && typeof(Worker) !== "undefined") {
|
||||
worker = new Worker('/common/worker.bundle.js?' + urlArgs);
|
||||
worker = new Worker(path + urlArgs);
|
||||
worker.onerror = function (e) {
|
||||
console.error(e.message);
|
||||
};
|
||||
@ -93,7 +91,7 @@ const factory = function () {
|
||||
// Use the async store in the main thread if workers
|
||||
// aren't available
|
||||
//if (typeof(require) === "undefined") { return; }
|
||||
require(['/common/worker.bundle.js'], function (Store) {
|
||||
require([path], function (Store) {
|
||||
let store = Store?.store;
|
||||
if (!store) { return void console.error("No store"); }
|
||||
store.onMessage(function (data) {
|
||||
|
||||
@ -1 +0,0 @@
|
||||
../../_build/worker.bundle.js
|
||||
36399
www/common/worker.bundle.js
Normal file
36399
www/common/worker.bundle.js
Normal file
File diff suppressed because it is too large
Load Diff
1
www/common/worker.bundle.min.js
vendored
Normal file
1
www/common/worker.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user