Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97200f90da | ||
|
|
656d6d251e | ||
|
|
61b6e6916a | ||
|
|
ab004d8022 | ||
|
|
ce5ac41ecd | ||
|
|
a82160d51b | ||
|
|
a546f3e51d | ||
|
|
a338ae9f9d | ||
|
|
e4693065fd | ||
|
|
44e5985630 |
+15
@@ -1,3 +1,18 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- lts/*
|
||||
env:
|
||||
global:
|
||||
- MOZ_HEADLESS=1
|
||||
services:
|
||||
- xvfb
|
||||
addons:
|
||||
firefox: latest
|
||||
chrome: stable
|
||||
cache:
|
||||
npm: false
|
||||
|
||||
script:
|
||||
- npm test
|
||||
- xvfb-run --auto-servernum npm run test-browser -- --browser chrome
|
||||
- xvfb-run --auto-servernum npm run test-browser -- --browser firefox
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ function crypto_aead_chacha20poly1305_ietf_decrypt_detached (m, nsec, c, mac, ad
|
||||
computed_mac.fill(0)
|
||||
slen.fill(0)
|
||||
|
||||
if (ret !== 0) {
|
||||
if (!ret) {
|
||||
m.fill(0)
|
||||
throw new Error('could not verify data')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* eslint-disable camelcase */
|
||||
const { crypto_verify_32 } = require('./crypto_verify')
|
||||
const Sha512 = require('sha512-universal')
|
||||
const assert = require('nanoassert')
|
||||
|
||||
const crypto_auth_BYTES = 32
|
||||
const crypto_auth_KEYBYTES = 32
|
||||
|
||||
function crypto_auth (out, input, k) {
|
||||
assert(out.byteLength === crypto_auth_BYTES, "out should be 'crypto_auth_BYTES' in length")
|
||||
assert(k.byteLength === crypto_auth_KEYBYTES, "key should be 'crypto_auth_KEYBYTES' in length")
|
||||
|
||||
const out0 = new Uint8Array(64)
|
||||
const hmac = Sha512.HMAC(k)
|
||||
hmac.update(input)
|
||||
hmac.digest(out0)
|
||||
|
||||
out.set(out0.subarray(0, 32))
|
||||
}
|
||||
|
||||
function crypto_auth_verify (h, input, k) {
|
||||
assert(h.byteLength === crypto_auth_BYTES, "h should be 'crypto_auth_BYTES' in length")
|
||||
assert(k.byteLength === crypto_auth_KEYBYTES, "key should be 'crypto_auth_KEYBYTES' in length")
|
||||
|
||||
const correct = Sha512.HMAC(k).update(input).digest()
|
||||
|
||||
return crypto_verify_32(h, 0, correct, 0)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
crypto_auth_BYTES,
|
||||
crypto_auth_KEYBYTES,
|
||||
crypto_auth,
|
||||
crypto_auth_verify
|
||||
}
|
||||
+99
-3
@@ -3,7 +3,13 @@ const { crypto_hash_sha512 } = require('./crypto_hash')
|
||||
const { crypto_scalarmult, crypto_scalarmult_base } = require('./crypto_scalarmult')
|
||||
const { randombytes } = require('./randombytes')
|
||||
const { crypto_generichash_batch } = require('./crypto_generichash')
|
||||
const { crypto_secretbox_open_easy, crypto_secretbox_easy } = require('./crypto_secretbox')
|
||||
const { crypto_stream_xsalsa20_MESSAGEBYTES_MAX } = require('./crypto_stream')
|
||||
const {
|
||||
crypto_secretbox_open_easy,
|
||||
crypto_secretbox_easy,
|
||||
crypto_secretbox_detached,
|
||||
crypto_secretbox_open_detached
|
||||
} = require('./crypto_secretbox')
|
||||
const xsalsa20 = require('xsalsa20')
|
||||
const assert = require('nanoassert')
|
||||
|
||||
@@ -15,8 +21,17 @@ const crypto_box_BOXZEROBYTES = 16
|
||||
const crypto_box_SEALBYTES = 48
|
||||
const crypto_box_SEEDBYTES = 32
|
||||
const crypto_box_BEFORENMBYTES = 32
|
||||
const crypto_box_MACBYTES = 16
|
||||
|
||||
const crypto_box_curve25519xsalsa20poly1305_MACBYTES = 16
|
||||
|
||||
const crypto_box_MESSAGEBYTES_MAX =
|
||||
crypto_stream_xsalsa20_MESSAGEBYTES_MAX -
|
||||
crypto_box_curve25519xsalsa20poly1305_MACBYTES
|
||||
|
||||
module.exports = {
|
||||
crypto_box_easy,
|
||||
crypto_box_open_easy,
|
||||
crypto_box_keypair,
|
||||
crypto_box_seed_keypair,
|
||||
crypto_box_seal,
|
||||
@@ -28,7 +43,8 @@ module.exports = {
|
||||
crypto_box_BOXZEROBYTES,
|
||||
crypto_box_SEALBYTES,
|
||||
crypto_box_SEEDBYTES,
|
||||
crypto_box_BEFORENMBYTES
|
||||
crypto_box_BEFORENMBYTES,
|
||||
crypto_box_MACBYTES
|
||||
}
|
||||
|
||||
function crypto_box_keypair (pk, sk) {
|
||||
@@ -37,7 +53,6 @@ function crypto_box_keypair (pk, sk) {
|
||||
randombytes(sk, 32)
|
||||
return crypto_scalarmult_base(pk, sk)
|
||||
}
|
||||
|
||||
function crypto_box_seed_keypair (pk, sk, seed) {
|
||||
assert(pk.byteLength === crypto_box_PUBLICKEYBYTES, "pk should be 'crypto_box_PUBLICKEYBYTES' bytes")
|
||||
assert(sk.byteLength === crypto_box_SECRETKEYBYTES, "sk should be 'crypto_box_SECRETKEYBYTES' bytes")
|
||||
@@ -95,6 +110,87 @@ function crypto_box_seal_open (m, c, pk, sk) {
|
||||
return crypto_secretbox_open_easy(m, c.subarray(epk.length), n, k)
|
||||
}
|
||||
|
||||
function crypto_box_beforenm (k, pk, sk) {
|
||||
const zero = new Uint8Array(16)
|
||||
const s = new Uint8Array(32)
|
||||
|
||||
assert(crypto_scalarmult(s, sk, pk) === 0)
|
||||
|
||||
xsalsa20.core_hsalsa20(k, zero, s, xsalsa20.SIGMA)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function crypto_box_detached_afternm (c, mac, m, n, k) {
|
||||
return crypto_secretbox_detached(c, mac, m, n, k)
|
||||
}
|
||||
|
||||
function crypto_box_detached (c, mac, m, n, pk, sk) {
|
||||
check(mac, crypto_box_MACBYTES)
|
||||
check(n, crypto_box_NONCEBYTES)
|
||||
check(pk, crypto_box_PUBLICKEYBYTES)
|
||||
check(sk, crypto_box_SECRETKEYBYTES)
|
||||
|
||||
const k = new Uint8Array(crypto_box_BEFORENMBYTES)
|
||||
|
||||
assert(crypto_box_beforenm(k, pk, sk))
|
||||
|
||||
const ret = crypto_box_detached_afternm(c, mac, m, n, k)
|
||||
cleanup(k)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
function crypto_box_easy (c, m, n, pk, sk) {
|
||||
assert(
|
||||
c.length >= m.length + crypto_box_MACBYTES,
|
||||
"c should be at least 'm.length + crypto_box_MACBYTES' bytes"
|
||||
)
|
||||
assert(
|
||||
m.length <= crypto_box_MESSAGEBYTES_MAX,
|
||||
"m should be at most 'crypto_box_MESSAGEBYTES_MAX' bytes"
|
||||
)
|
||||
|
||||
return crypto_box_detached(
|
||||
c.subarray(crypto_box_MACBYTES, m.length + crypto_box_MACBYTES),
|
||||
c.subarray(0, crypto_box_MACBYTES),
|
||||
m,
|
||||
n,
|
||||
pk,
|
||||
sk
|
||||
)
|
||||
}
|
||||
|
||||
function crypto_box_open_detached_afternm (m, c, mac, n, k) {
|
||||
return crypto_secretbox_open_detached(m, c, mac, n, k)
|
||||
}
|
||||
|
||||
function crypto_box_open_detached (m, c, mac, n, pk, sk) {
|
||||
const k = new Uint8Array(crypto_box_BEFORENMBYTES)
|
||||
assert(crypto_box_beforenm(k, pk, sk))
|
||||
|
||||
const ret = crypto_box_open_detached_afternm(m, c, mac, n, k)
|
||||
cleanup(k)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
function crypto_box_open_easy (m, c, n, pk, sk) {
|
||||
assert(
|
||||
c.length >= m.length + crypto_box_MACBYTES,
|
||||
"c should be at least 'm.length + crypto_box_MACBYTES' bytes"
|
||||
)
|
||||
|
||||
return crypto_box_open_detached(
|
||||
m,
|
||||
c.subarray(crypto_box_MACBYTES, m.length + crypto_box_MACBYTES),
|
||||
c.subarray(0, crypto_box_MACBYTES),
|
||||
n,
|
||||
pk,
|
||||
sk
|
||||
)
|
||||
}
|
||||
|
||||
function check (buf, len) {
|
||||
if (!buf || (len && buf.length < len)) throw new Error('Argument must be a buffer' + (len ? ' of length ' + len : ''))
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
const sha512 = require('sha512-wasm')
|
||||
const sha512 = require('sha512-universal')
|
||||
const assert = require('nanoassert')
|
||||
|
||||
if (new Uint16Array([1])[0] !== 1) throw new Error('Big endian architecture is not supported.')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
const sha256 = require('sha256-wasm')
|
||||
const sha256 = require('sha256-universal')
|
||||
const assert = require('nanoassert')
|
||||
|
||||
if (new Uint16Array([1])[0] !== 1) throw new Error('Big endian architecture is not supported.')
|
||||
|
||||
@@ -23,7 +23,6 @@ function crypto_onetimeauth (mac, msg, key) {
|
||||
var s = new Poly1305(key)
|
||||
s.update(msg, 0, msg.byteLength)
|
||||
s.finish(mac, 0)
|
||||
return true
|
||||
}
|
||||
|
||||
function crypto_onetimeauth_verify (mac, msg, key) {
|
||||
@@ -33,5 +32,5 @@ function crypto_onetimeauth_verify (mac, msg, key) {
|
||||
|
||||
var tmp = new Uint8Array(16)
|
||||
crypto_onetimeauth(tmp, msg, key)
|
||||
return crypto_verify_16(mac, 0, tmp, 0) === 0
|
||||
return crypto_verify_16(mac, 0, tmp, 0)
|
||||
}
|
||||
|
||||
+5
-7
@@ -37,7 +37,6 @@ function crypto_secretbox (c, m, n, k) {
|
||||
c.subarray(0, crypto_onetimeauth_KEYBYTES)
|
||||
)
|
||||
c.fill(0, 0, crypto_secretbox_BOXZEROBYTES)
|
||||
return 0
|
||||
}
|
||||
|
||||
function crypto_secretbox_open (m, c, n, k) {
|
||||
@@ -69,8 +68,8 @@ function crypto_secretbox_detached (o, mac, msg, n, k) {
|
||||
|
||||
const tmp = new Uint8Array(msg.byteLength + mac.byteLength)
|
||||
crypto_secretbox_easy(tmp, msg, n, k)
|
||||
o.set(tmp.subarray(0, msg.byteLength))
|
||||
mac.set(tmp.subarray(msg.byteLength))
|
||||
mac.set(tmp.subarray(0, mac.byteLength))
|
||||
o.set(tmp.subarray(mac.byteLength))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -81,8 +80,8 @@ function crypto_secretbox_open_detached (msg, o, mac, n, k) {
|
||||
assert(k.byteLength === crypto_secretbox_KEYBYTES, "k must be 'crypto_secretbox_KEYBYTES' bytes")
|
||||
|
||||
const tmp = new Uint8Array(o.byteLength + mac.byteLength)
|
||||
tmp.set(o)
|
||||
tmp.set(mac, msg.byteLength)
|
||||
tmp.set(mac)
|
||||
tmp.set(o, mac.byteLength)
|
||||
return crypto_secretbox_open_easy(msg, tmp, n, k)
|
||||
}
|
||||
|
||||
@@ -94,9 +93,8 @@ function crypto_secretbox_easy (o, msg, n, k) {
|
||||
const m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.byteLength)
|
||||
const c = new Uint8Array(m.byteLength)
|
||||
m.set(msg, crypto_secretbox_ZEROBYTES)
|
||||
if (crypto_secretbox(c, m, n, k) === false) return false
|
||||
crypto_secretbox(c, m, n, k)
|
||||
o.set(c.subarray(crypto_secretbox_BOXZEROBYTES))
|
||||
return true
|
||||
}
|
||||
|
||||
function crypto_secretbox_open_easy (msg, box, n, k) {
|
||||
|
||||
+182
-17
@@ -8,11 +8,19 @@ const {
|
||||
inv25519, unpack25519
|
||||
} = require('./internal/ed25519')
|
||||
const { randombytes } = require('./randombytes')
|
||||
const { crypto_scalarmult_BYTES } = require('./crypto_scalarmult.js')
|
||||
const { crypto_hash_sha512_BYTES } = require('./crypto_hash.js')
|
||||
const assert = require('nanoassert')
|
||||
|
||||
const crypto_sign_BYTES = 64
|
||||
const crypto_sign_PUBLICKEYBYTES = 32
|
||||
const crypto_sign_SECRETKEYBYTES = 64
|
||||
const crypto_sign_SEEDBYTES = 32
|
||||
const crypto_sign_ed25519_PUBLICKEYBYTES = 32
|
||||
const crypto_sign_ed25519_SECRETKEYBYTES = 64
|
||||
const crypto_sign_ed25519_SEEDBYTES = 32
|
||||
const crypto_sign_ed25519_BYTES = 64
|
||||
|
||||
const crypto_sign_BYTES = crypto_sign_ed25519_BYTES
|
||||
const crypto_sign_PUBLICKEYBYTES = crypto_sign_ed25519_PUBLICKEYBYTES
|
||||
const crypto_sign_SECRETKEYBYTES = crypto_sign_ed25519_SECRETKEYBYTES
|
||||
const crypto_sign_SEEDBYTES = crypto_sign_ed25519_SEEDBYTES
|
||||
|
||||
module.exports = {
|
||||
crypto_sign_keypair,
|
||||
@@ -24,7 +32,15 @@ module.exports = {
|
||||
crypto_sign_BYTES,
|
||||
crypto_sign_PUBLICKEYBYTES,
|
||||
crypto_sign_SECRETKEYBYTES,
|
||||
crypto_sign_SEEDBYTES
|
||||
crypto_sign_SEEDBYTES,
|
||||
crypto_sign_ed25519_PUBLICKEYBYTES,
|
||||
crypto_sign_ed25519_SECRETKEYBYTES,
|
||||
crypto_sign_ed25519_SEEDBYTES,
|
||||
crypto_sign_ed25519_BYTES,
|
||||
crypto_sign_ed25519_pk_to_curve25519,
|
||||
crypto_sign_ed25519_sk_to_curve25519,
|
||||
unpackneg,
|
||||
pack
|
||||
}
|
||||
|
||||
function set25519 (r, a) {
|
||||
@@ -85,6 +101,8 @@ function pack (r, p) {
|
||||
}
|
||||
|
||||
function scalarmult (p, q, s) {
|
||||
// don't mutate q
|
||||
var h = [gf(q[0]), gf(q[1]), gf(q[2]), gf(q[3])]
|
||||
var b, i
|
||||
set25519(p[0], gf0)
|
||||
set25519(p[1], gf1)
|
||||
@@ -92,10 +110,10 @@ function scalarmult (p, q, s) {
|
||||
set25519(p[3], gf0)
|
||||
for (i = 255; i >= 0; --i) {
|
||||
b = (s[(i / 8) | 0] >> (i & 7)) & 1
|
||||
cswap(p, q, b)
|
||||
add(q, p)
|
||||
cswap(p, h, b)
|
||||
add(h, p)
|
||||
add(p, p)
|
||||
cswap(p, q, b)
|
||||
cswap(p, h, b)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +144,6 @@ function crypto_sign_keypair (pk, sk, seeded) {
|
||||
pack(pk, p)
|
||||
|
||||
for (i = 0; i < 32; i++) sk[i + 32] = pk[i]
|
||||
return 0
|
||||
}
|
||||
|
||||
function crypto_sign_seed_keypair (pk, sk, seed) {
|
||||
@@ -216,6 +233,24 @@ function crypto_sign_detached (sig, m, sk) {
|
||||
for (let i = 0; i < crypto_sign_BYTES; i++) sig[i] = sm[i]
|
||||
}
|
||||
|
||||
function is_zero25519 (f) {
|
||||
var s = new Uint8Array(32)
|
||||
pack25519(s, f)
|
||||
|
||||
return sodium_is_zero(s, 32)
|
||||
|
||||
function sodium_is_zero (n) {
|
||||
let i
|
||||
let d = 0
|
||||
|
||||
for (let i = 0; i < n.length; i++) {
|
||||
d |= n[i]
|
||||
}
|
||||
|
||||
return 1 & ((d - 1) >> 8)
|
||||
}
|
||||
}
|
||||
|
||||
function unpackneg (r, p) {
|
||||
var t = gf(), chk = gf(), num = gf(),
|
||||
den = gf(), den2 = gf(), den4 = gf(),
|
||||
@@ -242,16 +277,18 @@ function unpackneg (r, p) {
|
||||
|
||||
S(chk, r[0])
|
||||
M(chk, chk, den)
|
||||
if (neq25519(chk, num)) M(r[0], r[0], I)
|
||||
if (!neq25519(chk, num)) M(r[0], r[0], I)
|
||||
|
||||
S(chk, r[0])
|
||||
M(chk, chk, den)
|
||||
if (neq25519(chk, num)) return -1
|
||||
if (!neq25519(chk, num)) return false
|
||||
|
||||
if (par25519(r[0]) === (p[31] >> 7)) Z(r[0], gf0, r[0])
|
||||
if (par25519(r[0]) === (p[31] >> 7)) {
|
||||
Z(r[0], gf(), r[0])
|
||||
}
|
||||
|
||||
M(r[3], r[0], r[1])
|
||||
return 0
|
||||
return true
|
||||
}
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
@@ -270,7 +307,7 @@ function crypto_sign_open (msg, sm, pk) {
|
||||
mlen = -1
|
||||
if (n < 64) return false
|
||||
|
||||
if (unpackneg(q, pk)) return false
|
||||
if (!unpackneg(q, pk)) return false
|
||||
|
||||
for (i = 0; i < n; i++) m[i] = sm[i]
|
||||
for (i = 0; i < 32; i++) m[i + 32] = pk[i]
|
||||
@@ -283,7 +320,7 @@ function crypto_sign_open (msg, sm, pk) {
|
||||
pack(t, p)
|
||||
|
||||
n -= 64
|
||||
if (crypto_verify_32(sm, 0, t, 0)) {
|
||||
if (!crypto_verify_32(sm, 0, t, 0)) {
|
||||
for (i = 0; i < n; i++) m[i] = 0
|
||||
return false
|
||||
// throw new Error('crypto_sign_open failed')
|
||||
@@ -317,6 +354,134 @@ function neq25519 (a, b) {
|
||||
return crypto_verify_32(c, 0, d, 0)
|
||||
}
|
||||
|
||||
function check (buf, len) {
|
||||
if (!buf || (len && buf.length < len)) throw new Error('Argument must be a buffer' + (len ? ' of length ' + len : ''))
|
||||
function ed25519_mul_l (p, q) {
|
||||
scalarmult(p, q, L)
|
||||
}
|
||||
|
||||
function ed25519_is_on_main_subgroup (p) {
|
||||
var pl = [gf(), gf(), gf(), gf()]
|
||||
|
||||
ed25519_mul_l(pl, p)
|
||||
|
||||
var zero = 0
|
||||
for (let i = 0; i < 16; i++) {
|
||||
zero |= (pl[0][i] & 0xffff)
|
||||
}
|
||||
|
||||
return zero === 0
|
||||
}
|
||||
|
||||
function crypto_sign_ed25519_pk_to_curve25519 (x25519_pk, ed25519_pk) {
|
||||
check(x25519_pk, crypto_sign_PUBLICKEYBYTES)
|
||||
check(ed25519_pk, crypto_sign_ed25519_PUBLICKEYBYTES)
|
||||
|
||||
var a = [gf(), gf(), gf(), gf()]
|
||||
var x = gf([1])
|
||||
var one_minus_y = gf([1])
|
||||
|
||||
assert(
|
||||
isSmallOrder(ed25519_pk) &&
|
||||
unpackneg(a, ed25519_pk) &&
|
||||
ed25519_is_on_main_subgroup(a), 'Cannot convert key: bad point')
|
||||
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
pack25519(x25519_pk, a[i]);
|
||||
}
|
||||
|
||||
Z(one_minus_y, one_minus_y, a[1])
|
||||
A(x, x, a[1])
|
||||
inv25519(one_minus_y, one_minus_y)
|
||||
M(x, x, one_minus_y)
|
||||
pack25519(x25519_pk, x)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function isSmallOrder (s) {
|
||||
Uint8Array.from([])
|
||||
|
||||
var bad_points = [
|
||||
// 0 (order 4)
|
||||
Uint8Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
|
||||
|
||||
// 1 (order 1)
|
||||
Uint8Array.from([0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),
|
||||
|
||||
// 2707385501144840649318225287225658788936804267575313519463743609750303402022(order 8)
|
||||
Uint8Array.from([0x26, 0xe8, 0x95, 0x8f, 0xc2, 0xb2, 0x27, 0xb0, 0x45, 0xc3,
|
||||
0xf4, 0x89, 0xf2, 0xef, 0x98, 0xf0, 0xd5, 0xdf, 0xac, 0x05, 0xd3,
|
||||
0xc6, 0x33, 0x39, 0xb1, 0x38, 0x02, 0x88, 0x6d, 0x53, 0xfc, 0x05]),
|
||||
|
||||
// 55188659117513257062467267217118295137698188065244968500265048394206261417927 (order 8)
|
||||
Uint8Array.from([0xc7, 0x17, 0x6a, 0x70, 0x3d, 0x4d, 0xd8, 0x4f, 0xba, 0x3c,
|
||||
0x0b, 0x76, 0x0d, 0x10, 0x67, 0x0f, 0x2a, 0x20, 0x53, 0xfa, 0x2c,
|
||||
0x39, 0xcc, 0xc6, 0x4e, 0xc7, 0xfd, 0x77, 0x92, 0xac, 0x03, 0x7a]),
|
||||
|
||||
// p-1 (order 2)
|
||||
Uint8Array.from([0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f]),
|
||||
|
||||
// p (=0 order 4)
|
||||
Uint8Array.from([0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f]),
|
||||
|
||||
// p + 1 (=1 order 1)
|
||||
Uint8Array.from([0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f])
|
||||
]
|
||||
|
||||
var c = new Uint8Array(7)
|
||||
var j
|
||||
|
||||
check (bad_points, 7)
|
||||
for (let i = 0; i < bad_points.length; i++) {
|
||||
for (j = 0; j < 31; j++) {
|
||||
c[i] |= s[j] ^ bad_points[i][j]
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < bad_points.length; i++) {
|
||||
c[i] |= (s[j] & 0x7f) ^ bad_points[i][j]
|
||||
}
|
||||
|
||||
var k = 0
|
||||
for (let i = 0; i < bad_points.length; i++) {
|
||||
k |= (c[i] - 1)
|
||||
}
|
||||
|
||||
return ((k >> 8) & 1) === 0
|
||||
}
|
||||
|
||||
function crypto_sign_ed25519_sk_to_pk (pk, sk) {
|
||||
check(pk, crypto_sign_ed25519_PUBLICKEYBYTES)
|
||||
pk.set(sk.subarray(crypto_sign_ed25519_SEEDBYTES))
|
||||
return pk
|
||||
}
|
||||
|
||||
function crypto_sign_ed25519_sk_to_curve25519 (curveSk, edSk) {
|
||||
assert(curveSk && curveSk.byteLength === crypto_scalarmult_BYTES, "curveSk must be 'crypto_sign_SECRETKEYBYTES' long")
|
||||
assert(edSk && edSk.byteLength === crypto_sign_ed25519_SECRETKEYBYTES, "edSk must be 'crypto_sign_ed25519_SECRETKEYBYTES' long")
|
||||
|
||||
var h = Buffer.alloc(crypto_hash_sha512_BYTES);
|
||||
crypto_hash(h, edSk, 32)
|
||||
|
||||
h[0] &= 248;
|
||||
h[31] &= 127;
|
||||
h[31] |= 64;
|
||||
|
||||
curveSk.set(h.subarray(0, crypto_scalarmult_BYTES))
|
||||
h.fill(0)
|
||||
return curveSk
|
||||
}
|
||||
|
||||
|
||||
function check (buf, len, arg = 'Argument') {
|
||||
if (!buf || (len && buf.length < len)) throw new Error(arg + ' must be a buffer' + (len ? ' of length ' + len : ''))
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ if (new Uint16Array([1])[0] !== 1) throw new Error('Big endian architecture is n
|
||||
exports.crypto_stream_KEYBYTES = 32
|
||||
exports.crypto_stream_NONCEBYTES = 24
|
||||
exports.crypto_stream_PRIMITIVE = 'xsalsa20'
|
||||
exports.crypto_stream_xsalsa20_MESSAGEBYTES_MAX = Number.MAX_SAFE_INTEGER
|
||||
|
||||
exports.crypto_stream = function (c, nonce, key) {
|
||||
c.fill(0)
|
||||
|
||||
+10
-16
@@ -1,11 +1,8 @@
|
||||
/* eslint-disable camelcase */
|
||||
const assert = require('nanoassert')
|
||||
|
||||
module.exports = {
|
||||
crypto_verify_16,
|
||||
crypto_verify_32,
|
||||
sodium_memcmp,
|
||||
sodium_is_zero
|
||||
crypto_verify_64
|
||||
}
|
||||
|
||||
function vn (x, xi, y, yi, n) {
|
||||
@@ -14,22 +11,19 @@ function vn (x, xi, y, yi, n) {
|
||||
return (1 & ((d - 1) >>> 8)) - 1
|
||||
}
|
||||
|
||||
// Make non enumerable as this is an internal function
|
||||
Object.defineProperty(module.exports, 'vn', {
|
||||
value: vn
|
||||
})
|
||||
|
||||
function crypto_verify_16 (x, xi, y, yi) {
|
||||
return vn(x, xi, y, yi, 16)
|
||||
return vn(x, xi, y, yi, 16) === 0
|
||||
}
|
||||
|
||||
function crypto_verify_32 (x, xi, y, yi) {
|
||||
return vn(x, xi, y, yi, 32)
|
||||
return vn(x, xi, y, yi, 32) === 0
|
||||
}
|
||||
|
||||
function sodium_memcmp (a, b) {
|
||||
assert(a.byteLength === b.byteLength, 'buffers must be the same size')
|
||||
|
||||
return vn(a, 0, b, 0, a.byteLength) === 0
|
||||
}
|
||||
|
||||
function sodium_is_zero (arr) {
|
||||
var d = 0
|
||||
for (let i = 0; i < arr.length; i++) d |= arr[i]
|
||||
return d === 0
|
||||
function crypto_verify_64 (x, xi, y, yi) {
|
||||
return vn(x, xi, y, yi, 64) === 0
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/* eslint-disable camelcase */
|
||||
const assert = require('nanoassert')
|
||||
const { vn } = require('./crypto_verify')
|
||||
|
||||
function sodium_increment (n) {
|
||||
const nlen = n.byteLength
|
||||
var c = 1
|
||||
for (var i = 0; i < nlen; i++) {
|
||||
c += n[i]
|
||||
n[i] = c
|
||||
c >>= 8
|
||||
}
|
||||
}
|
||||
|
||||
function sodium_memcmp (a, b) {
|
||||
assert(a.byteLength === b.byteLength, 'buffers must be the same size')
|
||||
|
||||
return vn(a, 0, b, 0, a.byteLength) === 0
|
||||
}
|
||||
|
||||
function sodium_is_zero (arr) {
|
||||
var d = 0
|
||||
for (let i = 0; i < arr.length; i++) d |= arr[i]
|
||||
return d === 0
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sodium_increment,
|
||||
sodium_memcmp,
|
||||
sodium_is_zero
|
||||
}
|
||||
@@ -8,7 +8,11 @@
|
||||
// Implementation derived from TweetNaCl version 20140427.
|
||||
// See for details: http://tweetnacl.cr.yp.to/
|
||||
|
||||
forward(require('./randombytes'))
|
||||
forward(require('./memory'))
|
||||
forward(require('./helpers'))
|
||||
forward(require('./crypto_verify'))
|
||||
forward(require('./crypto_auth'))
|
||||
forward(require('./crypto_box'))
|
||||
forward(require('./crypto_generichash'))
|
||||
forward(require('./crypto_hash'))
|
||||
@@ -23,8 +27,6 @@ forward(require('./crypto_shorthash'))
|
||||
forward(require('./crypto_sign'))
|
||||
forward(require('./crypto_stream'))
|
||||
forward(require('./crypto_stream_chacha20'))
|
||||
forward(require('./crypto_verify'))
|
||||
forward(require('./randombytes'))
|
||||
|
||||
function forward (submodule) {
|
||||
Object.keys(submodule).forEach(function (prop) {
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
/* eslint-disable camelcase */
|
||||
var MessageChannel = global.MessageChannel
|
||||
if (MessageChannel == null) ({ MessageChannel } = require('worker' + '_threads'))
|
||||
|
||||
function sodium_malloc (n) {
|
||||
return new Uint8Array(n)
|
||||
}
|
||||
|
||||
const sink = new MessageChannel()
|
||||
function sodium_free (n) {
|
||||
sodium_memzero(n)
|
||||
sink.port1.postMessage(n.buffer, [n.buffer])
|
||||
}
|
||||
|
||||
function sodium_memzero (arr) {
|
||||
arr.fill(0)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sodium_malloc,
|
||||
sodium_free,
|
||||
sodium_memzero
|
||||
}
|
||||
|
||||
Generated
+566
@@ -0,0 +1,566 @@
|
||||
{
|
||||
"name": "sodium-javascript",
|
||||
"version": "0.7.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"blake2b": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz",
|
||||
"integrity": "sha512-pkDss4xFVbMb4270aCyGD3qLv92314Et+FsKzilCLxDz5DuZ2/1g3w4nmBbu6nKApPspnjG7JcwTjGZnduB1yg==",
|
||||
"requires": {
|
||||
"blake2b-wasm": "^1.1.0",
|
||||
"nanoassert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"blake2b-wasm": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/blake2b-wasm/-/blake2b-wasm-1.1.7.tgz",
|
||||
"integrity": "sha512-oFIHvXhlz/DUgF0kq5B1CqxIDjIJwh9iDeUUGQUcvgiGz7Wdw03McEO7CfLBy7QKGdsydcMCgO9jFNBAFCtFcA==",
|
||||
"requires": {
|
||||
"nanoassert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-byte-frequency": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-byte-frequency/-/buffer-byte-frequency-1.0.1.tgz",
|
||||
"integrity": "sha1-xf8lpKwSZy8wPk25H/VD+gl1wTM=",
|
||||
"dev": true
|
||||
},
|
||||
"chacha20-universal": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/chacha20-universal/-/chacha20-universal-1.0.4.tgz",
|
||||
"integrity": "sha512-/IOxdWWNa7nRabfe7+oF+jVkGjlr2xUL4J8l/OvzZhj+c9RpMqoo3Dq+5nU1j/BflRV4BKnaQ4+4oH1yBpQG1Q==",
|
||||
"requires": {
|
||||
"nanoassert": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nanoassert": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz",
|
||||
"integrity": "sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"deep-equal": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz",
|
||||
"integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-arguments": "^1.0.4",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-regex": "^1.0.4",
|
||||
"object-is": "^1.0.1",
|
||||
"object-keys": "^1.1.1",
|
||||
"regexp.prototype.flags": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"object-keys": "^1.0.12"
|
||||
}
|
||||
},
|
||||
"defined": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
|
||||
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
|
||||
"dev": true
|
||||
},
|
||||
"dotignore": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz",
|
||||
"integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.17.6",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
|
||||
"integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.0",
|
||||
"is-regex": "^1.1.0",
|
||||
"object-inspect": "^1.7.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.0",
|
||||
"string.prototype.trimend": "^1.0.1",
|
||||
"string.prototype.trimstart": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-regex": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
|
||||
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"es-to-primitive": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
|
||||
"integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-callable": "^1.1.4",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-symbol": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"for-each": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
|
||||
"integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-callable": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz",
|
||||
"integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==",
|
||||
"dev": true
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-arguments": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz",
|
||||
"integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==",
|
||||
"dev": true
|
||||
},
|
||||
"is-callable": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz",
|
||||
"integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==",
|
||||
"dev": true
|
||||
},
|
||||
"is-date-object": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
|
||||
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
|
||||
"dev": true
|
||||
},
|
||||
"is-negative-zero": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",
|
||||
"integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=",
|
||||
"dev": true
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
|
||||
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"is-symbol": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz",
|
||||
"integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
},
|
||||
"nanoassert": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz",
|
||||
"integrity": "sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40="
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
|
||||
"integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==",
|
||||
"dev": true
|
||||
},
|
||||
"object-is": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.2.tgz",
|
||||
"integrity": "sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
}
|
||||
},
|
||||
"object-keys": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
|
||||
"dev": true
|
||||
},
|
||||
"object.assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz",
|
||||
"integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.18.0-next.0",
|
||||
"has-symbols": "^1.0.1",
|
||||
"object-keys": "^1.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"es-abstract": {
|
||||
"version": "1.18.0-next.0",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz",
|
||||
"integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.0",
|
||||
"is-negative-zero": "^2.0.0",
|
||||
"is-regex": "^1.1.1",
|
||||
"object-inspect": "^1.8.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.0",
|
||||
"string.prototype.trimend": "^1.0.1",
|
||||
"string.prototype.trimstart": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
|
||||
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
|
||||
"integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||
"dev": true
|
||||
},
|
||||
"regexp.prototype.flags": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz",
|
||||
"integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.0-next.1"
|
||||
}
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
|
||||
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"resumer": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz",
|
||||
"integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"through": "~2.3.4"
|
||||
}
|
||||
},
|
||||
"sha256-universal": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sha256-universal/-/sha256-universal-1.1.0.tgz",
|
||||
"integrity": "sha512-CDpS+UrEMA7UOPdogFJ1HOPNrhj0vH+mzWHT5FaU0qlsEXQ4BBey2Mc5+TfJ5nxyRf77fpABbKmXbL/QIzgz2A==",
|
||||
"requires": {
|
||||
"sha256-wasm": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"sha256-wasm": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sha256-wasm/-/sha256-wasm-2.1.0.tgz",
|
||||
"integrity": "sha512-xhb4uSXGIotJj2Q8pWpchDjkszHeTWVoP7p9NM6TGssL/mGUOLFR7vfIrrmcG99aRRox8YiN0JukZf4ZlLWu1w==",
|
||||
"requires": {
|
||||
"nanoassert": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nanoassert": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz",
|
||||
"integrity": "sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"sha512-universal": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sha512-universal/-/sha512-universal-1.1.0.tgz",
|
||||
"integrity": "sha512-2ag5no5DwP9lv6Nk8VkJNujqv5LiJODxReqNp2qiY+O1c1bgiN/PlCRdmjQdBp0k/2XAkdIirEPDpZJoGf9gLw==",
|
||||
"requires": {
|
||||
"sha512-wasm": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"sha512-wasm": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sha512-wasm/-/sha512-wasm-2.1.0.tgz",
|
||||
"integrity": "sha512-ztqU8O5mRrHFt1pXuXEnyxmj629IWxxErvAABOr0Itov2B0ejWy5zNhpVubSibrdpNlJtaZEJL2/0Jf1BnkG9g==",
|
||||
"requires": {
|
||||
"nanoassert": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nanoassert": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-2.0.0.tgz",
|
||||
"integrity": "sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"siphash24": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/siphash24/-/siphash24-1.1.1.tgz",
|
||||
"integrity": "sha512-dKKwjIoTOa587TARYLlBRXq2lkbu5Iz35XrEVWpelhBP1m8r2BGOy1QlaZe84GTFHG/BTucEUd2btnNc8QzIVA==",
|
||||
"requires": {
|
||||
"nanoassert": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"sodium-test": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/sodium-test/-/sodium-test-0.10.0.tgz",
|
||||
"integrity": "sha512-OggB5WtfI6BbssXyA4FIbAVmYPoLuMO21qy9ndQq9+fxvuoolEeGXSPyk+R0E/E7Ot5pnBkE1WMWkefoxBBhSw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-byte-frequency": "^1.0.1",
|
||||
"tape": "^4.6.3"
|
||||
}
|
||||
},
|
||||
"string.prototype.trim": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.2.tgz",
|
||||
"integrity": "sha512-b5yrbl3BXIjHau9Prk7U0RRYcUYdN4wGSVaqoBQS50CCE3KBuYU0TYRNPFCP7aVoNMX87HKThdMRVIP3giclKg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.18.0-next.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"es-abstract": {
|
||||
"version": "1.18.0-next.0",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.0.tgz",
|
||||
"integrity": "sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.0",
|
||||
"is-negative-zero": "^2.0.0",
|
||||
"is-regex": "^1.1.1",
|
||||
"object-inspect": "^1.8.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.0",
|
||||
"string.prototype.trimend": "^1.0.1",
|
||||
"string.prototype.trimstart": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz",
|
||||
"integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-symbols": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz",
|
||||
"integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"string.prototype.trimend": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz",
|
||||
"integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
}
|
||||
},
|
||||
"string.prototype.trimstart": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz",
|
||||
"integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.17.5"
|
||||
}
|
||||
},
|
||||
"tape": {
|
||||
"version": "4.13.3",
|
||||
"resolved": "https://registry.npmjs.org/tape/-/tape-4.13.3.tgz",
|
||||
"integrity": "sha512-0/Y20PwRIUkQcTCSi4AASs+OANZZwqPKaipGCEwp10dQMipVvSZwUUCi01Y/OklIGyHKFhIcjock+DKnBfLAFw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"deep-equal": "~1.1.1",
|
||||
"defined": "~1.0.0",
|
||||
"dotignore": "~0.1.2",
|
||||
"for-each": "~0.3.3",
|
||||
"function-bind": "~1.1.1",
|
||||
"glob": "~7.1.6",
|
||||
"has": "~1.0.3",
|
||||
"inherits": "~2.0.4",
|
||||
"is-regex": "~1.0.5",
|
||||
"minimist": "~1.2.5",
|
||||
"object-inspect": "~1.7.0",
|
||||
"resolve": "~1.17.0",
|
||||
"resumer": "~0.0.0",
|
||||
"string.prototype.trim": "~1.2.1",
|
||||
"through": "~2.3.8"
|
||||
}
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
},
|
||||
"xsalsa20": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xsalsa20/-/xsalsa20-1.1.0.tgz",
|
||||
"integrity": "sha512-zd3ytX2cm+tcSndRU+krm0eL4TMMpZE7evs5hLRAoOy6gviqLfe3qOlkjF3i5SeAkQUCeJk0lJZrEU56kHRfWw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -1,21 +1,20 @@
|
||||
{
|
||||
"name": "sodium-javascript",
|
||||
"version": "0.6.1",
|
||||
"version": "0.7.0",
|
||||
"description": "WIP - a pure javascript version of sodium-native",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"blake2b": "^2.1.1",
|
||||
"chacha20-universal": "^1.0.4",
|
||||
"nanoassert": "^2.0.0",
|
||||
"sha256-wasm": "^1.3.0",
|
||||
"sha512-wasm": "^1.2.0",
|
||||
"sha256-universal": "^1.1.0",
|
||||
"sha512-universal": "^1.1.0",
|
||||
"siphash24": "^1.0.1",
|
||||
"xsalsa20": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-run": "^7.0.2",
|
||||
"browserify": "^16.5.1",
|
||||
"sodium-test": "^0.9.0",
|
||||
"sodium-test": "^0.10.0",
|
||||
"standard": "^14.3.4",
|
||||
"tape-run": "^7.0.0"
|
||||
},
|
||||
@@ -31,10 +30,9 @@
|
||||
"crypto": "crypto"
|
||||
},
|
||||
"scripts": {
|
||||
"browser": "browserify test.js | browser-run",
|
||||
"browser-manual": "browserify test.js | tape-run",
|
||||
"pretest": "standard",
|
||||
"test": "node test.js"
|
||||
"test": "node test.js",
|
||||
"test-browser": "browserify test.js | tape-run"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in New Issue
Block a user