New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ara-crypto

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ara-crypto - npm Package Compare versions

Comparing version 0.8.5 to 0.9.0

.github/workflows/tests.yml

4

bench/box.js
/* eslint-disable import/no-extraneous-dependencies */
const { createBoxStream } = require('../box')
const { randomBytes } = require('../random-bytes')
const speedometer = require('speedometer')

@@ -14,2 +12,4 @@ const { format } = require('util')

} = require('sodium-universal')
const { randomBytes } = require('../random-bytes')
const { createBoxStream } = require('../box')

@@ -16,0 +16,0 @@ const key = Buffer.alloc(32)

/* eslint-disable camelcase */
const { crypto_generichash_batch } = require('./sodium')
const isBuffer = require('is-buffer')
const alloc = require('buffer-alloc-unsafe')
const { crypto_generichash_batch } = require('./sodium')
const kDefaultBlake2bSize = 32

@@ -47,3 +48,8 @@

const digest = alloc(size)
crypto_generichash_batch(digest, buffer, key)
if (digest && buffer && key) {
crypto_generichash_batch(digest, buffer, key)
} else {
crypto_generichash_batch(digest, buffer)
}
return digest

@@ -50,0 +56,0 @@ }

@@ -120,3 +120,3 @@ const increment = require('increment-buffer')

/* eslint-disable-next-line no-param-reassign */
opts = Object.assign({}, opts)
opts = { ...opts }

@@ -123,0 +123,0 @@ if (false === isBuffer(opts.nonce)) {

@@ -0,1 +1,5 @@

# [0.9.0](https://github.com/AraBlocks/ara-crypto/compare/0.8.5...0.9.0) (2021-04-01)
## [0.8.5](https://github.com/AraBlocks/ara-crypto/compare/0.8.4...0.8.5) (2019-04-05)

@@ -10,3 +14,3 @@

* **package.json:** Lock in sodium-browserify@1.2.6 ([b389138](https://github.com/AraBlocks/ara-crypto/commit/b389138))
* **package.json:** Lock in sodium-browserify@1.2.6 ([b389138](https://github.com/AraBlocks/ara-crypto/commit/b389138b345e26679f11f6606b2db6ff0e51345c))

@@ -20,3 +24,3 @@

* **kdf:** Remove key length constraint. ([2f3103f](https://github.com/AraBlocks/ara-crypto/commit/2f3103f))
* **kdf:** Remove key length constraint. ([2f3103f](https://github.com/AraBlocks/ara-crypto/commit/2f3103f58cd9cf905e620511a865e3aab6fc263a))

@@ -34,8 +38,8 @@

* **kdf:** Alloc context buffer in init instead of allocUnsafe ([7c6d261](https://github.com/AraBlocks/ara-crypto/commit/7c6d261))
* **kdf:** Make buffer optional for 'init' and 'derive'. ([99d46f1](https://github.com/AraBlocks/ara-crypto/commit/99d46f1))
* **kdf:** Remove unused constants crypto_kdf_BYTES_M* ([b485c9c](https://github.com/AraBlocks/ara-crypto/commit/b485c9c))
* **kdf.js:** Destructure value in ctx object. ([8dffd65](https://github.com/AraBlocks/ara-crypto/commit/8dffd65))
* **kdf.js:** Fix eslint formatting ([a912996](https://github.com/AraBlocks/ara-crypto/commit/a912996))
* **kdf.js:** Update at i + 1 ([fe92c45](https://github.com/AraBlocks/ara-crypto/commit/fe92c45))
* **kdf:** Alloc context buffer in init instead of allocUnsafe ([7c6d261](https://github.com/AraBlocks/ara-crypto/commit/7c6d2612fbcec7a380e9366bd20d3a6ce6dd9d51))
* **kdf:** Make buffer optional for 'init' and 'derive'. ([99d46f1](https://github.com/AraBlocks/ara-crypto/commit/99d46f1f4ea7ba4e20204aa06887b96b740478ae))
* **kdf:** Remove unused constants crypto_kdf_BYTES_M* ([b485c9c](https://github.com/AraBlocks/ara-crypto/commit/b485c9c183e231d540a4fa708381686a3d9738df))
* **kdf.js:** Destructure value in ctx object. ([8dffd65](https://github.com/AraBlocks/ara-crypto/commit/8dffd65422da463cce38cdd5208891d8b61ed5d2))
* **kdf.js:** Fix eslint formatting ([a912996](https://github.com/AraBlocks/ara-crypto/commit/a9129967c569471febf0cb0c3ca9d2d883a1ebd1))
* **kdf.js:** Update at i + 1 ([fe92c45](https://github.com/AraBlocks/ara-crypto/commit/fe92c450ed3ae67bf7ec1ec9905349b9b9f2ef00))

@@ -45,3 +49,3 @@

* **kdf.js:** Introduce key derivation functions ([b7d8bf0](https://github.com/AraBlocks/ara-crypto/commit/b7d8bf0))
* **kdf.js:** Introduce key derivation functions ([b7d8bf0](https://github.com/AraBlocks/ara-crypto/commit/b7d8bf03dc5ec2c302930f017778ff397e0e8f92))

@@ -59,3 +63,3 @@

* **test/helpers:** Introduce test runner and browser index ([d1a95b6](https://github.com/AraBlocks/ara-crypto/commit/d1a95b6))
* **test/helpers:** Introduce test runner and browser index ([d1a95b6](https://github.com/AraBlocks/ara-crypto/commit/d1a95b6043c584631f911f7bebbf288708ad2690))

@@ -81,3 +85,3 @@

* **shash.js:** Introduce short hash ([b8bc6f1](https://github.com/AraBlocks/ara-crypto/commit/b8bc6f1))
* **shash.js:** Introduce short hash ([b8bc6f1](https://github.com/AraBlocks/ara-crypto/commit/b8bc6f10fab38ef2ae77e970d63b5f5ac0e03938))

@@ -91,3 +95,3 @@

* **curve25519.js:** Introduce shared keys (scalar multiplcation) ([8497317](https://github.com/AraBlocks/ara-crypto/commit/8497317))
* **curve25519.js:** Introduce shared keys (scalar multiplcation) ([8497317](https://github.com/AraBlocks/ara-crypto/commit/84973176e35d269c08ef360f2cf895717edf0d5d))

@@ -101,8 +105,8 @@

* **auth.js:** Introduce message authentication code API ([1c1d197](https://github.com/AraBlocks/ara-crypto/commit/1c1d197))
* **box.js:** Introduce box encryption ([f4dae43](https://github.com/AraBlocks/ara-crypto/commit/f4dae43))
* **ed25519.js:** Move ed25519 keyPair/sign/auth functions to scoped module ([8a86697](https://github.com/AraBlocks/ara-crypto/commit/8a86697))
* **kx.js:** Introduce key exchange API ([fffafe6](https://github.com/AraBlocks/ara-crypto/commit/fffafe6))
* **seal.js:** Introduce sealed box API ([13e2219](https://github.com/AraBlocks/ara-crypto/commit/13e2219))
* **unbox.js:** Introduce box decryption ([c31cd7b](https://github.com/AraBlocks/ara-crypto/commit/c31cd7b))
* **auth.js:** Introduce message authentication code API ([1c1d197](https://github.com/AraBlocks/ara-crypto/commit/1c1d1976d193929eac01cc148db6258a6b028708))
* **box.js:** Introduce box encryption ([f4dae43](https://github.com/AraBlocks/ara-crypto/commit/f4dae4339872ec512a9546d6c76f6accab3413fd))
* **ed25519.js:** Move ed25519 keyPair/sign/auth functions to scoped module ([8a86697](https://github.com/AraBlocks/ara-crypto/commit/8a8669718f7b34a48c674c6f9776262ebcdae468))
* **kx.js:** Introduce key exchange API ([fffafe6](https://github.com/AraBlocks/ara-crypto/commit/fffafe6bfd738271b9954c1f8e93fb3e9515ec43))
* **seal.js:** Introduce sealed box API ([13e2219](https://github.com/AraBlocks/ara-crypto/commit/13e2219cc0e264b75ecd857bda8fc2210ea5b02c))
* **unbox.js:** Introduce box decryption ([c31cd7b](https://github.com/AraBlocks/ara-crypto/commit/c31cd7b3d8e10cb85d7be07dba6206e3a59207aa))

@@ -116,3 +120,3 @@

* **curve25519.js:** Introduce Curve25519 key pairs ([5d0e731](https://github.com/AraBlocks/ara-crypto/commit/5d0e731))
* **curve25519.js:** Introduce Curve25519 key pairs ([5d0e731](https://github.com/AraBlocks/ara-crypto/commit/5d0e73175b53d86edaf53ea5ba36b8c8eef8cc54))

@@ -130,4 +134,4 @@

* **base58.js:** Introduce simple base58 wrapper ([a21649b](https://github.com/AraBlocks/ara-crypto/commit/a21649b))
* **base64.js:** Introduce simple base64 wrapper ([ab5d54d](https://github.com/AraBlocks/ara-crypto/commit/ab5d54d))
* **base58.js:** Introduce simple base58 wrapper ([a21649b](https://github.com/AraBlocks/ara-crypto/commit/a21649bcc85937230a688b3232d4d8cd48937058))
* **base64.js:** Introduce simple base64 wrapper ([ab5d54d](https://github.com/AraBlocks/ara-crypto/commit/ab5d54d47b84382253bc562665ad0cfee4a52115))

@@ -153,4 +157,4 @@

* **{encrypt,decrypt}.js:** Introduce encryption/decryption functions ([3fc4ffb](https://github.com/AraBlocks/ara-crypto/commit/3fc4ffb))
* **constants.js:** Add constants module ([2eeb243](https://github.com/AraBlocks/ara-crypto/commit/2eeb243))
* **{encrypt,decrypt}.js:** Introduce encryption/decryption functions ([3fc4ffb](https://github.com/AraBlocks/ara-crypto/commit/3fc4ffb00bcd8a7d17dee992d79d112c66345cab))
* **constants.js:** Add constants module ([2eeb243](https://github.com/AraBlocks/ara-crypto/commit/2eeb243472496984c55919c1b3f53a186321c3a9))

@@ -163,3 +167,3 @@

# [0.1.0](https://github.com/AraBlocks/ara-crypto/compare/1659ef7...0.1.0) (2018-05-18)
# [0.1.0](https://github.com/AraBlocks/ara-crypto/compare/1659ef791abf177070ba484941fb1d9627467f83...0.1.0) (2018-05-18)

@@ -169,5 +173,5 @@

* **.:** Initial implementation ([1659ef7](https://github.com/AraBlocks/ara-crypto/commit/1659ef7))
* **.:** Initial implementation ([1659ef7](https://github.com/AraBlocks/ara-crypto/commit/1659ef791abf177070ba484941fb1d9627467f83))

@@ -39,7 +39,11 @@ /* eslint-disable camelcase */

} else if (seed.length < crypto_sign_SEEDBYTES) {
throw new TypeError('curve25519.keyPair: Seed buffer length too small. ' +
`Expecting size ${crypto_sign_SEEDBYTES}.`)
throw new TypeError(
'curve25519.keyPair: Seed buffer length too small. '
+ `Expecting size ${crypto_sign_SEEDBYTES}.`
)
} else if (seed.length > crypto_sign_SEEDBYTES) {
throw new TypeError('curve25519.keyPair: Seed buffer length too large. ' +
`Expecting size ${crypto_sign_SEEDBYTES}.`)
throw new TypeError(
'curve25519.keyPair: Seed buffer length too large. '
+ `Expecting size ${crypto_sign_SEEDBYTES}.`
)
}

@@ -46,0 +50,0 @@ }

@@ -7,5 +7,5 @@ const { deprecate } = require('util')

storage.decrypt,
'ara-crypto: crypto.decrypt() is deprecated. ' +
'Please use \'ara-secret-storage\' instead.'
'ara-crypto: crypto.decrypt() is deprecated. '
+ 'Please use \'ara-secret-storage\' instead.'
)
}

@@ -32,7 +32,9 @@ const isBuffer = require('is-buffer')

throw new TypeError(
'crypto.discoveryKey: Expecting size to be a number.')
'crypto.discoveryKey: Expecting size to be a number.'
)
} else if (size <= 0) {
/* eslint-disable-next-line function-paren-newline */
throw new TypeError(
'crypto.discoveryKey: Expecting size to be greater than 0.')
'crypto.discoveryKey: Expecting size to be greater than 0.'
)
}

@@ -39,0 +41,0 @@

@@ -36,7 +36,11 @@ const isBuffer = require('is-buffer')

} else if (seed.length < crypto_sign_SEEDBYTES) {
throw new TypeError('ed25519.keyPair: Seed buffer length too small. ' +
`Expecting size ${crypto_sign_SEEDBYTES}.`)
throw new TypeError(
'ed25519.keyPair: Seed buffer length too small. '
+ `Expecting size ${crypto_sign_SEEDBYTES}.`
)
} else if (seed.length > crypto_sign_SEEDBYTES) {
throw new TypeError('ed25519.keyPair: Seed buffer length too large. ' +
`Expecting size ${crypto_sign_SEEDBYTES}.`)
throw new TypeError(
'ed25519.keyPair: Seed buffer length too large. '
+ `Expecting size ${crypto_sign_SEEDBYTES}.`
)
}

@@ -103,3 +107,4 @@ }

throw new TypeError(
'ed25519.verify: Cannot verify message with an signature buffer.')
'ed25519.verify: Cannot verify message with an signature buffer.'
)
} else if (signature.length < crypto_sign_BYTES) {

@@ -122,3 +127,4 @@ throw new TypeError('ed25519.verify: Signature buffer too small.')

throw new TypeError(
'ed25519.verify: Cannot verify message with an publicKey buffer.')
'ed25519.verify: Cannot verify message with an publicKey buffer.'
)
} else if (publicKey.length < crypto_sign_PUBLICKEYBYTES) {

@@ -125,0 +131,0 @@ throw new TypeError('ed25519.verify: Public key buffer too small.')

@@ -7,5 +7,5 @@ const { deprecate } = require('util')

storage.encrypt,
'ara-crypto: crypto.encrypt() is deprecated. ' +
'Please use \'ara-secret-storage\' instead.'
'ara-crypto: crypto.encrypt() is deprecated. '
+ 'Please use \'ara-secret-storage\' instead.'
)
}

@@ -0,3 +1,3 @@

const isBuffer = require('is-buffer')
const { randomBytes } = require('./random-bytes')
const isBuffer = require('is-buffer')

@@ -4,0 +4,0 @@ /* eslint-disable camelcase */

{
"name": "ara-crypto",
"version": "0.8.5",
"version": "0.9.0",
"description": "Cryptographic functions used in Ara modules",
"main": "index.js",
"scripts": {
"test": "ava test",
"test": "ava test/*",
"lint": "eslint .",

@@ -36,20 +36,20 @@ "lint-fix": "eslint . --fix",

"is-zero-buffer": "^1.0.1",
"sodium-browserify": "1.2.6",
"sodium-javascript": "^0.5.5",
"sodium-universal": "^2.0.0",
"sodium-browserify": "1.3.0",
"sodium-javascript": "^0.7.3",
"sodium-universal": "^3.0.4",
"split-buffer": "^1.0.0",
"through2": "^2.0.3",
"through2": "^4.0.2",
"tweetnacl-auth": "^1.0.1",
"uint64be": "^2.0.2",
"uuid": "^3.2.1"
"uint64be": "^3.0.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"ansi-diff": "^1.1.1",
"ava": "^0.25.0",
"ava": "^3.15.0",
"blue-tape": "^1.0.0",
"conventional-changelog-cli": "^2.0.5",
"eslint": "^4.19.1",
"eslint-config-ara": "github:arablocks/eslint-config-ara#semver:2.1.x",
"eslint-plugin-import": "^2.12.0",
"nyc": "^12.0.2",
"conventional-changelog-cli": "^2.1.1",
"eslint": "^7.23.0",
"eslint-config-ara": "github:arablocks/eslint-config-ara#semver:3.0.x",
"eslint-plugin-import": "^2.22.1",
"nyc": "^15.1.0",
"pretty-bytes": "^5.1.0",

@@ -56,0 +56,0 @@ "speedometer": "^1.1.0"

@@ -0,4 +1,4 @@

const alloc = require('buffer-alloc-unsafe')
/* eslint-disable camelcase */
const { randombytes_buf } = require('./sodium')
const alloc = require('buffer-alloc-unsafe')

@@ -5,0 +5,0 @@ /**

<img src="https://github.com/AraBlocks/docs/blob/master/ara.png" width="30" height="30" /> ara-crypto
==========
[![Build Status](https://travis-ci.com/AraBlocks/ara-crypto.svg?token=r6p7pesHZ9MRJsVsrYFe&branch=master)](https://travis-ci.com/AraBlocks/ara-crypto)
Cryptographic functions used in ARA modules for Node.js.

@@ -7,0 +5,0 @@

@@ -49,5 +49,8 @@ /* eslint-disable camelcase */

// const sodium = Object.assign({}, browser, javascript)
// const sodium = Object.assign({}, browser, javascript, polyfill)
const sodium = Object.assign({}, browser, javascript, polyfill, universal)
const sodium = {
...browser,
...javascript,
...polyfill,
...universal
}

@@ -54,0 +57,0 @@ module.exports = sodium

/* eslint-disable no-inline-comments */
const isBuffer = require('is-buffer')
const { randomBytes } = require('../random-bytes')
const { SharePoint } = require('./share')
const { blake2b } = require('../blake2b')
const isBuffer = require('is-buffer')

@@ -310,3 +310,3 @@ const kZeroes = new Array(1024).join('0')

return fromUTF8String()
} else if ('binary' === encoding) {
} if ('binary' === encoding) {
return fromBinaryString()

@@ -313,0 +313,0 @@ }

/* eslint-disable no-inline-comments */
const isBuffer = require('is-buffer')
const { ShareData } = require('./share')

@@ -6,3 +7,2 @@ const { Secret } = require('./secret')

const { Codec } = require('./codec')
const isBuffer = require('is-buffer')

@@ -9,0 +9,0 @@ /**

/* eslint-disable no-inline-comments */
const isZeroBuffer = require('is-zero-buffer')
const isBuffer = require('is-buffer')
const { randomBytes } = require('../random-bytes')
const isZeroBuffer = require('is-zero-buffer')
const { isSecret } = require('./secret')
const { Context } = require('./context')
const isBuffer = require('is-buffer')

@@ -36,3 +36,3 @@ const kContextDefaults = {

const ctx = new Context(Object.assign({}, kContextDefaults, opts))
const ctx = new Context({ ...kContextDefaults, ...opts })
return ctx

@@ -110,5 +110,5 @@ }

if (
false === isBuffer(secret) &&
false === isSecret(secret) &&
'string' !== typeof secret
false === isBuffer(secret)
&& false === isSecret(secret)
&& 'string' !== typeof secret
) {

@@ -115,0 +115,0 @@ throw new TypeError('shares: Invalid secret type.')

@@ -1,6 +0,2 @@

const { auth, verify } = require('../auth')
const { randomBytes } = require('../random-bytes')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -14,2 +10,6 @@ const {

const { auth, verify } = require('../auth')
const { randomBytes } = require('../random-bytes')
const test = require('./helpers/runner')
test.cb('auth(message, key) is a function', (t) => {

@@ -32,10 +32,10 @@ t.true('function' === typeof auth)

test.cb('auth(message, key) throws on bad input', (t) => {
t.throws(() => auth(), TypeError)
t.throws(() => auth(null, null), TypeError)
t.throws(() => auth(1, {}), TypeError)
t.throws(() => auth([], false), TypeError)
t.throws(() => auth('', Buffer.alloc(0)), TypeError)
t.throws(() => auth(Buffer.alloc(0), Buffer.alloc(0)), TypeError)
t.throws(() => auth(Buffer.from('hello'), Buffer.alloc(0)), TypeError)
t.throws(() => auth(Buffer.from('hello'), Buffer.from('key')), TypeError)
t.throws(() => auth(), { instanceOf: TypeError })
t.throws(() => auth(null, null), { instanceOf: TypeError })
t.throws(() => auth(1, {}), { instanceOf: TypeError })
t.throws(() => auth([], false), { instanceOf: TypeError })
t.throws(() => auth('', Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => auth(Buffer.alloc(0), Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => auth(Buffer.from('hello'), Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => auth(Buffer.from('hello'), Buffer.from('key')), { instanceOf: TypeError })
t.end()

@@ -47,15 +47,15 @@ })

const key = Buffer.from('key')
t.throws(() => verify(), TypeError)
t.throws(() => verify(null, null), TypeError)
t.throws(() => verify(1, {}), TypeError)
t.throws(() => verify([], false), TypeError)
t.throws(() => verify('', Buffer.alloc(0)), TypeError)
t.throws(() => verify(Buffer.alloc(0), Buffer.alloc(0)), TypeError)
t.throws(() => verify(hello, Buffer.alloc(0)), TypeError)
t.throws(() => verify(hello, key), TypeError)
t.throws(() => verify(null, Buffer.alloc(0), Buffer.alloc(0)), TypeError)
t.throws(() => verify(null, hello, Buffer.alloc(0)), TypeError)
t.throws(() => verify(null, hello, key), TypeError)
t.throws(() => verify('', hello, key), TypeError)
t.throws(() => verify(hello, hello, key), TypeError)
t.throws(() => verify(), { instanceOf: TypeError })
t.throws(() => verify(null, null), { instanceOf: TypeError })
t.throws(() => verify(1, {}), { instanceOf: TypeError })
t.throws(() => verify([], false), { instanceOf: TypeError })
t.throws(() => verify('', Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(Buffer.alloc(0), Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(hello, Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(hello, key), { instanceOf: TypeError })
t.throws(() => verify(null, Buffer.alloc(0), Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(null, hello, Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(null, hello, key), { instanceOf: TypeError })
t.throws(() => verify('', hello, key), { instanceOf: TypeError })
t.throws(() => verify(hello, hello, key), { instanceOf: TypeError })
t.end()

@@ -62,0 +62,0 @@ })

@@ -0,13 +1,14 @@

const isBuffer = require('is-buffer')
const { blake2b } = require('../blake2b')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
test('blake2b(buffer, size)', async (t) => {
t.throws(() => blake2b(0, 0), TypeError)
t.throws(() => blake2b(null), TypeError)
t.throws(() => blake2b([ null ]), TypeError)
t.throws(() => blake2b([ Buffer.alloc(0) ]), TypeError)
t.throws(() => blake2b(Buffer.alloc(0), 0), TypeError)
t.throws(() => blake2b(Buffer.from('message'), 0), TypeError)
t.throws(() => blake2b(Buffer.from('message'), -1), TypeError)
t.throws(() => blake2b(0, 0), { instanceOf: TypeError })
t.throws(() => blake2b(null), { instanceOf: TypeError })
t.throws(() => blake2b([ null ]), { instanceOf: TypeError })
t.throws(() => blake2b([ Buffer.alloc(0) ]), { instanceOf: TypeError })
t.throws(() => blake2b(Buffer.alloc(0), 0), { instanceOf: TypeError })
t.throws(() => blake2b(Buffer.from('message'), 0), { instanceOf: TypeError })
t.throws(() => blake2b(Buffer.from('message'), -1), { instanceOf: TypeError })
t.true(isBuffer(blake2b(Buffer.from('message'))))

@@ -14,0 +15,0 @@ t.true(isBuffer(blake2b(Buffer.from('message'), 16)))

@@ -1,8 +0,3 @@

const { box, createBoxStream } = require('../box')
const { randomBytes } = require('../random-bytes')
const increment = require('increment-buffer')
const { unbox } = require('../unbox')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -14,2 +9,7 @@ const {

const { box, createBoxStream } = require('../box')
const { randomBytes } = require('../random-bytes')
const { unbox } = require('../unbox')
const test = require('./helpers/runner')
test.cb('box(buffer, opts) is a function', (t) => {

@@ -21,10 +21,10 @@ t.true('function' === typeof box)

test.cb('box(buffer, opts) throws on bad input', (t) => {
t.throws(() => box(), TypeError)
t.throws(() => box(null), TypeError)
t.throws(() => box(true), TypeError)
t.throws(() => box(123), TypeError)
t.throws(() => box('string'), TypeError)
t.throws(() => box(Buffer.from('hello')), TypeError)
t.throws(() => box(Buffer.from('hello'), { secret: null }), TypeError)
t.throws(() => box(Buffer.from('hello'), { key: null }), TypeError)
t.throws(() => box(), { instanceOf: TypeError })
t.throws(() => box(null), { instanceOf: TypeError })
t.throws(() => box(true), { instanceOf: TypeError })
t.throws(() => box(123), { instanceOf: TypeError })
t.throws(() => box('string'), { instanceOf: TypeError })
t.throws(() => box(Buffer.from('hello')), { instanceOf: TypeError })
t.throws(() => box(Buffer.from('hello'), { secret: null }), { instanceOf: TypeError })
t.throws(() => box(Buffer.from('hello'), { key: null }), { instanceOf: TypeError })
t.end()

@@ -88,6 +88,6 @@ })

test.cb('createBoxStream(opts) throws on bad input', (t) => {
t.throws(() => createBoxStream(null), TypeError)
t.throws(() => createBoxStream(true), TypeError)
t.throws(() => createBoxStream(123), TypeError)
t.throws(() => createBoxStream(), TypeError)
t.throws(() => createBoxStream(null), { instanceOf: TypeError })
t.throws(() => createBoxStream(true), { instanceOf: TypeError })
t.throws(() => createBoxStream(123), { instanceOf: TypeError })
t.throws(() => createBoxStream(), { instanceOf: TypeError })
t.end()

@@ -94,0 +94,0 @@ })

@@ -0,14 +1,15 @@

const isBuffer = require('is-buffer')
const { keyPair, shared } = require('../curve25519')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
test.cb('curve25519.keyPair(seed)', (t) => {
t.throws(() => keyPair(null), TypeError)
t.throws(() => keyPair(0), TypeError)
t.throws(() => keyPair(''), TypeError)
t.throws(() => keyPair(true), TypeError)
t.throws(() => keyPair([]), TypeError)
t.throws(() => keyPair(Buffer.alloc(0)), TypeError)
t.throws(() => keyPair(Buffer.alloc(4)), TypeError)
t.throws(() => keyPair(Buffer.alloc(64)), TypeError)
t.throws(() => keyPair(null), { instanceOf: TypeError })
t.throws(() => keyPair(0), { instanceOf: TypeError })
t.throws(() => keyPair(''), { instanceOf: TypeError })
t.throws(() => keyPair(true), { instanceOf: TypeError })
t.throws(() => keyPair([]), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(4)), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(64)), { instanceOf: TypeError })

@@ -26,11 +27,11 @@ t.true('object' === typeof keyPair())

test.cb('curve25519.shared(secretKey, publicKey)', (t) => {
t.throws(() => shared(), TypeError)
t.throws(() => shared(0, 0), TypeError)
t.throws(() => shared('', ''), TypeError)
t.throws(() => shared(null, null), TypeError)
t.throws(() => shared(null, Buffer.alloc(32)), TypeError)
t.throws(() => shared(Buffer.alloc(32), null), TypeError)
t.throws(() => shared(Buffer.alloc(0), Buffer.alloc(0)), RangeError)
t.throws(() => shared(Buffer.alloc(32), Buffer.alloc(0)), RangeError)
t.throws(() => shared(Buffer.alloc(0), Buffer.alloc(32)), RangeError)
t.throws(() => shared(), { instanceOf: TypeError })
t.throws(() => shared(0, 0), { instanceOf: TypeError })
t.throws(() => shared('', ''), { instanceOf: TypeError })
t.throws(() => shared(null, null), { instanceOf: TypeError })
t.throws(() => shared(null, Buffer.alloc(32)), { instanceOf: TypeError })
t.throws(() => shared(Buffer.alloc(32), null), { instanceOf: TypeError })
t.throws(() => shared(Buffer.alloc(0), Buffer.alloc(0)), { instanceOf: RangeError })
t.throws(() => shared(Buffer.alloc(32), Buffer.alloc(0)), { instanceOf: RangeError })
t.throws(() => shared(Buffer.alloc(0), Buffer.alloc(32)), { instanceOf: RangeError })

@@ -37,0 +38,0 @@ const alice = keyPair()

@@ -0,10 +1,10 @@

const isBuffer = require('is-buffer')
const { discoveryKey } = require('../discovery-key')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
test.cb('discoveryKey(buffer, size, key)', (t) => {
t.throws(() => discoveryKey(0, 0), TypeError)
t.throws(() => discoveryKey(Buffer.alloc(0), 0), TypeError)
t.throws(() => discoveryKey(Buffer.from('message'), 0), TypeError)
t.throws(() => discoveryKey(Buffer.from('message'), -1), TypeError)
t.throws(() => discoveryKey(0, 0), { instanceOf: TypeError })
t.throws(() => discoveryKey(Buffer.alloc(0), 0), { instanceOf: TypeError })
t.throws(() => discoveryKey(Buffer.from('message'), 0), { instanceOf: TypeError })
t.throws(() => discoveryKey(Buffer.from('message'), -1), { instanceOf: TypeError })

@@ -11,0 +11,0 @@ t.true(isBuffer(discoveryKey(Buffer.from('message'))))

@@ -1,5 +0,2 @@

const { keyPair, verify, sign } = require('../ed25519')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -12,11 +9,14 @@ const {

const { keyPair, verify, sign } = require('../ed25519')
const test = require('./helpers/runner')
test.cb('ed25519.keyPair(seed)', (t) => {
t.throws(() => keyPair(null), TypeError)
t.throws(() => keyPair(0), TypeError)
t.throws(() => keyPair(''), TypeError)
t.throws(() => keyPair(true), TypeError)
t.throws(() => keyPair([]), TypeError)
t.throws(() => keyPair(Buffer.alloc(0)), TypeError)
t.throws(() => keyPair(Buffer.alloc(crypto_sign_SEEDBYTES + 1)), TypeError)
t.throws(() => keyPair(Buffer.alloc(crypto_sign_SEEDBYTES - 1)), TypeError)
t.throws(() => keyPair(null), { instanceOf: TypeError })
t.throws(() => keyPair(0), { instanceOf: TypeError })
t.throws(() => keyPair(''), { instanceOf: TypeError })
t.throws(() => keyPair(true), { instanceOf: TypeError })
t.throws(() => keyPair([]), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(crypto_sign_SEEDBYTES + 1)), { instanceOf: TypeError })
t.throws(() => keyPair(Buffer.alloc(crypto_sign_SEEDBYTES - 1)), { instanceOf: TypeError })

@@ -36,17 +36,17 @@ t.true('object' === typeof keyPair())

t.throws(() => verify(0, 0, 0), TypeError)
t.throws(() => verify(null, 0, 0), TypeError)
t.throws(() => verify([], 0, 0), TypeError)
t.throws(() => verify(true, 0, 0), TypeError)
t.throws(() => verify('', 0, 0), TypeError)
t.throws(() => verify(Buffer.alloc(0), 0, 0), TypeError)
t.throws(() => verify(0, 0, 0), { instanceOf: TypeError })
t.throws(() => verify(null, 0, 0), { instanceOf: TypeError })
t.throws(() => verify([], 0, 0), { instanceOf: TypeError })
t.throws(() => verify(true, 0, 0), { instanceOf: TypeError })
t.throws(() => verify('', 0, 0), { instanceOf: TypeError })
t.throws(() => verify(Buffer.alloc(0), 0, 0), { instanceOf: TypeError })
const message = Buffer.from('message')
t.throws(() => verify(0, message, 0, 0), TypeError)
t.throws(() => verify(0, message, null, 0), TypeError)
t.throws(() => verify(0, message, true, 0), TypeError)
t.throws(() => verify(0, message, '', 0), TypeError)
t.throws(() => verify(0, message, Buffer.alloc(0)), TypeError)
t.throws(() => verify(0, message, Buffer.alloc(8)), TypeError)
t.throws(() => verify(0, message, 0, 0), { instanceOf: TypeError })
t.throws(() => verify(0, message, null, 0), { instanceOf: TypeError })
t.throws(() => verify(0, message, true, 0), { instanceOf: TypeError })
t.throws(() => verify(0, message, '', 0), { instanceOf: TypeError })
t.throws(() => verify(0, message, Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => verify(0, message, Buffer.alloc(8)), { instanceOf: TypeError })

@@ -57,3 +57,3 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES + 1)
), TypeError)
), { instanceOf: TypeError })

@@ -64,3 +64,3 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES - 1)
), TypeError)
), { instanceOf: TypeError })

@@ -71,3 +71,3 @@ t.throws(() => verify(

null
), TypeError)
), { instanceOf: TypeError })

@@ -78,3 +78,3 @@ t.throws(() => verify(

Buffer.alloc(0)
), TypeError)
), { instanceOf: TypeError })

@@ -85,3 +85,3 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES)
), TypeError)
), { instanceOf: TypeError })

@@ -92,3 +92,3 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES)
), TypeError)
), { instanceOf: TypeError })

@@ -99,3 +99,3 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES)
), TypeError)
), { instanceOf: TypeError })

@@ -106,11 +106,11 @@ t.throws(() => verify(

Buffer.alloc(crypto_sign_PUBLICKEYBYTES)
), TypeError)
), { instanceOf: TypeError })
const signature = sign(message, secretKey)
t.throws(() => verify(signature, message, 0), TypeError)
t.throws(() => verify(signature, message, null), TypeError)
t.throws(() => verify(signature, message, []), TypeError)
t.throws(() => verify(signature, message, true), TypeError)
t.throws(() => verify(signature, message, ''), TypeError)
t.throws(() => verify(signature, message, 0), { instanceOf: TypeError })
t.throws(() => verify(signature, message, null), { instanceOf: TypeError })
t.throws(() => verify(signature, message, []), { instanceOf: TypeError })
t.throws(() => verify(signature, message, true), { instanceOf: TypeError })
t.throws(() => verify(signature, message, ''), { instanceOf: TypeError })

@@ -123,15 +123,15 @@ t.true(verify(signature, message, publicKey))

test.cb('ed25519.sign(message, secretKey)', (t) => {
t.throws(() => sign(0, 0), TypeError)
t.throws(() => sign(null, 0), TypeError)
t.throws(() => sign(true, 0), TypeError)
t.throws(() => sign([], 0), TypeError)
t.throws(() => sign('', 0), TypeError)
t.throws(() => sign(Buffer.alloc(0), 0), TypeError)
t.throws(() => sign(0, 0), { instanceOf: TypeError })
t.throws(() => sign(null, 0), { instanceOf: TypeError })
t.throws(() => sign(true, 0), { instanceOf: TypeError })
t.throws(() => sign([], 0), { instanceOf: TypeError })
t.throws(() => sign('', 0), { instanceOf: TypeError })
t.throws(() => sign(Buffer.alloc(0), 0), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), 0), TypeError)
t.throws(() => sign(Buffer.from('message'), null), TypeError)
t.throws(() => sign(Buffer.from('message'), true), TypeError)
t.throws(() => sign(Buffer.from('message'), []), TypeError)
t.throws(() => sign(Buffer.from('message'), ''), TypeError)
t.throws(() => sign(Buffer.from('message'), Buffer.alloc(0)), TypeError)
t.throws(() => sign(Buffer.from('message'), 0), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), null), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), true), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), []), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), ''), { instanceOf: TypeError })
t.throws(() => sign(Buffer.from('message'), Buffer.alloc(0)), { instanceOf: TypeError })

@@ -141,3 +141,3 @@ t.throws(() => sign(

null,
), TypeError)
), { instanceOf: TypeError })

@@ -144,0 +144,0 @@ const { secretKey } = keyPair()

@@ -1,2 +0,2 @@

const crypto = require('../')
const crypto = require('..')
const test = require('./helpers/runner')

@@ -3,0 +3,0 @@

@@ -1,6 +0,2 @@

const { randomBytes } = require('../random-bytes')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
const kdf = require('../kdf')
/* eslint-disable camelcase */

@@ -12,2 +8,6 @@ const {

const { randomBytes } = require('../random-bytes')
const test = require('./helpers/runner')
const kdf = require('../kdf')
test.cb('kdf.keygen(key) is a function', (t) => {

@@ -19,12 +19,12 @@ t.true('function' === typeof kdf.keygen)

test.cb('kdf.keygen(key) throws on bad input', (t) => {
t.throws(() => kdf.keygen(null), TypeError)
t.throws(() => kdf.keygen(1), TypeError)
t.throws(() => kdf.keygen({}), TypeError)
t.throws(() => kdf.keygen(''), TypeError)
t.throws(() => kdf.keygen(true), TypeError)
t.throws(() => kdf.keygen([]), TypeError)
t.throws(() => kdf.keygen(() => undefined), TypeError)
t.throws(() => kdf.keygen(randomBytes(0)), TypeError)
t.throws(() => kdf.keygen(randomBytes(crypto_kdf_KEYBYTES + 1)), TypeError)
t.throws(() => kdf.keygen(randomBytes(crypto_kdf_KEYBYTES - 1)), TypeError)
t.throws(() => kdf.keygen(null), { instanceOf: TypeError })
t.throws(() => kdf.keygen(1), { instanceOf: TypeError })
t.throws(() => kdf.keygen({}), { instanceOf: TypeError })
t.throws(() => kdf.keygen(''), { instanceOf: TypeError })
t.throws(() => kdf.keygen(true), { instanceOf: TypeError })
t.throws(() => kdf.keygen([]), { instanceOf: TypeError })
t.throws(() => kdf.keygen(() => undefined), { instanceOf: TypeError })
t.throws(() => kdf.keygen(randomBytes(0)), { instanceOf: TypeError })
t.throws(() => kdf.keygen(randomBytes(crypto_kdf_KEYBYTES + 1)), { instanceOf: TypeError })
t.throws(() => kdf.keygen(randomBytes(crypto_kdf_KEYBYTES - 1)), { instanceOf: TypeError })
t.end()

@@ -62,20 +62,20 @@ })

test.cb('kdf.init(key, buffer) throws on bad input', (t) => {
t.throws(() => kdf.init(), TypeError)
t.throws(() => kdf.init(123), TypeError)
t.throws(() => kdf.init(true), TypeError)
t.throws(() => kdf.init(() => undefined), TypeError)
t.throws(() => kdf.init('a'), TypeError)
t.throws(() => kdf.init({}), TypeError)
t.throws(() => kdf.init(), { instanceOf: TypeError })
t.throws(() => kdf.init(123), { instanceOf: TypeError })
t.throws(() => kdf.init(true), { instanceOf: TypeError })
t.throws(() => kdf.init(() => undefined), { instanceOf: TypeError })
t.throws(() => kdf.init('a'), { instanceOf: TypeError })
t.throws(() => kdf.init({}), { instanceOf: TypeError })
const key = randomBytes(crypto_kdf_KEYBYTES)
t.throws(() => kdf.init(key, 123), TypeError)
t.throws(() => kdf.init(key, true), TypeError)
t.throws(() => kdf.init(key, () => undefined), TypeError)
t.throws(() => kdf.init(key, 'a'), TypeError)
t.throws(() => kdf.init(key, {}), TypeError)
t.throws(() => kdf.init(key, 123), { instanceOf: TypeError })
t.throws(() => kdf.init(key, true), { instanceOf: TypeError })
t.throws(() => kdf.init(key, () => undefined), { instanceOf: TypeError })
t.throws(() => kdf.init(key, 'a'), { instanceOf: TypeError })
t.throws(() => kdf.init(key, {}), { instanceOf: TypeError })
const smallCtx = randomBytes(crypto_kdf_CONTEXTBYTES - 1)
const largeCtx = randomBytes(crypto_kdf_CONTEXTBYTES + 1)
t.throws(() => kdf.init(key, smallCtx), TypeError)
t.throws(() => kdf.init(key, largeCtx), TypeError)
t.throws(() => kdf.init(key, smallCtx), { instanceOf: TypeError })
t.throws(() => kdf.init(key, largeCtx), { instanceOf: TypeError })

@@ -125,38 +125,38 @@ t.end()

test.cb('kdf.update(ctx, id) throws on bad input', (t) => {
t.throws(() => kdf.update(123), TypeError)
t.throws(() => kdf.update(true), TypeError)
t.throws(() => kdf.update(() => undefined), TypeError)
t.throws(() => kdf.update(''), TypeError)
t.throws(() => kdf.update({}), TypeError)
t.throws(() => kdf.update({ subkey: 123 }), TypeError)
t.throws(() => kdf.update({ subkey: true }), TypeError)
t.throws(() => kdf.update({ subkey: () => undefined }), TypeError)
t.throws(() => kdf.update({ subkey: '' }), TypeError)
t.throws(() => kdf.update({ subkey: {} }), TypeError)
t.throws(() => kdf.update({ buffer: 123 }), TypeError)
t.throws(() => kdf.update({ buffer: true }), TypeError)
t.throws(() => kdf.update({ buffer: () => undefined }), TypeError)
t.throws(() => kdf.update({ buffer: '' }), TypeError)
t.throws(() => kdf.update({ buffer: {} }), TypeError)
t.throws(() => kdf.update(123), { instanceOf: TypeError })
t.throws(() => kdf.update(true), { instanceOf: TypeError })
t.throws(() => kdf.update(() => undefined), { instanceOf: TypeError })
t.throws(() => kdf.update(''), { instanceOf: TypeError })
t.throws(() => kdf.update({}), { instanceOf: TypeError })
t.throws(() => kdf.update({ subkey: 123 }), { instanceOf: TypeError })
t.throws(() => kdf.update({ subkey: true }), { instanceOf: TypeError })
t.throws(() => kdf.update({ subkey: () => undefined }), { instanceOf: TypeError })
t.throws(() => kdf.update({ subkey: '' }), { instanceOf: TypeError })
t.throws(() => kdf.update({ subkey: {} }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: 123 }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: true }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: () => undefined }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: '' }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: {} }), { instanceOf: TypeError })
const smallCtx = randomBytes(crypto_kdf_CONTEXTBYTES - 1)
const largeCtx = randomBytes(crypto_kdf_CONTEXTBYTES + 1)
t.throws(() => kdf.update({ buffer: smallCtx }), TypeError)
t.throws(() => kdf.update({ buffer: largeCtx }), TypeError)
t.throws(() => kdf.update({ buffer: smallCtx }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer: largeCtx }), { instanceOf: TypeError })
const buffer = randomBytes(crypto_kdf_CONTEXTBYTES)
t.throws(() => kdf.update({ buffer, key: 123 }), TypeError)
t.throws(() => kdf.update({ buffer, key: true }), TypeError)
t.throws(() => kdf.update({ buffer, key: () => undefined }), TypeError)
t.throws(() => kdf.update({ buffer, key: '' }), TypeError)
t.throws(() => kdf.update({ buffer, key: {} }), TypeError)
t.throws(() => kdf.update({ buffer, key: 123 }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer, key: true }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer, key: () => undefined }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer, key: '' }), { instanceOf: TypeError })
t.throws(() => kdf.update({ buffer, key: {} }), { instanceOf: TypeError })
const key = randomBytes(crypto_kdf_KEYBYTES)
const ctx = { buffer, key }
t.throws(() => kdf.update(ctx, true), TypeError)
t.throws(() => kdf.update(ctx, () => undefined), TypeError)
t.throws(() => kdf.update(ctx, ''), TypeError)
t.throws(() => kdf.update(ctx, {}), TypeError)
t.throws(() => kdf.update(ctx, -1), TypeError)
t.throws(() => kdf.update(ctx, 2 ** 65), TypeError)
t.throws(() => kdf.update(ctx, true), { instanceOf: TypeError })
t.throws(() => kdf.update(ctx, () => undefined), { instanceOf: TypeError })
t.throws(() => kdf.update(ctx, ''), { instanceOf: TypeError })
t.throws(() => kdf.update(ctx, {}), { instanceOf: TypeError })
t.throws(() => kdf.update(ctx, -1), { instanceOf: TypeError })
t.throws(() => kdf.update(ctx, 2 ** 65), { instanceOf: TypeError })

@@ -193,7 +193,7 @@ t.end()

test.cb('kdf.final(ctx) throws on bad input', (t) => {
t.throws(() => kdf.final(), TypeError)
t.throws(() => kdf.final(123), TypeError)
t.throws(() => kdf.final(true), TypeError)
t.throws(() => kdf.final(() => undefined), TypeError)
t.throws(() => kdf.final(''), TypeError)
t.throws(() => kdf.final(), { instanceOf: TypeError })
t.throws(() => kdf.final(123), { instanceOf: TypeError })
t.throws(() => kdf.final(true), { instanceOf: TypeError })
t.throws(() => kdf.final(() => undefined), { instanceOf: TypeError })
t.throws(() => kdf.final(''), { instanceOf: TypeError })

@@ -221,9 +221,9 @@ t.end()

t.throws(() => kdf.derive(key), TypeError)
t.throws(() => kdf.derive(key, true), TypeError)
t.throws(() => kdf.derive(key, () => undefined), TypeError)
t.throws(() => kdf.derive(key, ''), TypeError)
t.throws(() => kdf.derive(key, {}), TypeError)
t.throws(() => kdf.derive(key, 0), TypeError)
t.throws(() => kdf.derive(key, 2 ** 65), TypeError)
t.throws(() => kdf.derive(key), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, true), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, () => undefined), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, ''), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, {}), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, 0), { instanceOf: TypeError })
t.throws(() => kdf.derive(key, 2 ** 65), { instanceOf: TypeError })

@@ -230,0 +230,0 @@ t.end()

@@ -1,6 +0,2 @@

const { randomBytes } = require('../random-bytes')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
const kx = require('../kx')
/* eslint-disable camelcase */

@@ -14,2 +10,6 @@ const {

const { randomBytes } = require('../random-bytes')
const test = require('./helpers/runner')
const kx = require('../kx')
test.cb('kx.keyPair(seed) is a function', (t) => {

@@ -21,12 +21,12 @@ t.true('function' === typeof kx.keyPair)

test.cb('kx.keyPair(seed) throws on bad input', (t) => {
t.throws(() => kx.keyPair(null), TypeError)
t.throws(() => kx.keyPair(1), TypeError)
t.throws(() => kx.keyPair({}), TypeError)
t.throws(() => kx.keyPair(''), TypeError)
t.throws(() => kx.keyPair(true), TypeError)
t.throws(() => kx.keyPair([]), TypeError)
t.throws(() => kx.keyPair(() => undefined), TypeError)
t.throws(() => kx.keyPair(randomBytes(0)), TypeError)
t.throws(() => kx.keyPair(randomBytes(crypto_kx_SEEDBYTES + 1)), TypeError)
t.throws(() => kx.keyPair(randomBytes(crypto_kx_SEEDBYTES - 1)), TypeError)
t.throws(() => kx.keyPair(null), { instanceOf: TypeError })
t.throws(() => kx.keyPair(1), { instanceOf: TypeError })
t.throws(() => kx.keyPair({}), { instanceOf: TypeError })
t.throws(() => kx.keyPair(''), { instanceOf: TypeError })
t.throws(() => kx.keyPair(true), { instanceOf: TypeError })
t.throws(() => kx.keyPair([]), { instanceOf: TypeError })
t.throws(() => kx.keyPair(() => undefined), { instanceOf: TypeError })
t.throws(() => kx.keyPair(randomBytes(0)), { instanceOf: TypeError })
t.throws(() => kx.keyPair(randomBytes(crypto_kx_SEEDBYTES + 1)), { instanceOf: TypeError })
t.throws(() => kx.keyPair(randomBytes(crypto_kx_SEEDBYTES - 1)), { instanceOf: TypeError })
t.end()

@@ -69,11 +69,11 @@ })

test.cb('kx.client(opts) throws on bad input', (t) => {
t.throws(() => kx.client(), TypeError)
t.throws(() => kx.client(null), TypeError)
t.throws(() => kx.client(123), TypeError)
t.throws(() => kx.client(true), TypeError)
t.throws(() => kx.client(() => undefined), TypeError)
t.throws(() => kx.client(''), TypeError)
t.throws(() => kx.client({}), TypeError)
t.throws(() => kx.client({ publicKey: null }), TypeError)
t.throws(() => kx.client({ publicKey: randomBytes(16) }), TypeError)
t.throws(() => kx.client(), { instanceOf: TypeError })
t.throws(() => kx.client(null), { instanceOf: TypeError })
t.throws(() => kx.client(123), { instanceOf: TypeError })
t.throws(() => kx.client(true), { instanceOf: TypeError })
t.throws(() => kx.client(() => undefined), { instanceOf: TypeError })
t.throws(() => kx.client(''), { instanceOf: TypeError })
t.throws(() => kx.client({}), { instanceOf: TypeError })
t.throws(() => kx.client({ publicKey: null }), { instanceOf: TypeError })
t.throws(() => kx.client({ publicKey: randomBytes(16) }), { instanceOf: TypeError })

@@ -83,3 +83,3 @@ t.throws(() => kx.client({

secretKey: null,
}), TypeError)
}), { instanceOf: TypeError })

@@ -90,3 +90,3 @@ t.throws(() => kx.client({

server: null,
}), TypeError)
}), { instanceOf: TypeError })

@@ -97,3 +97,3 @@ t.throws(() => kx.client({

server: 123,
}), TypeError)
}), { instanceOf: TypeError })

@@ -104,3 +104,3 @@ t.throws(() => kx.client({

server: {},
}), TypeError)
}), { instanceOf: TypeError })

@@ -111,3 +111,3 @@ t.throws(() => kx.client({

server: { publicKey: null },
}), TypeError)
}), { instanceOf: TypeError })

@@ -118,3 +118,3 @@ t.throws(() => kx.client({

server: { publicKey: randomBytes(16) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -125,3 +125,3 @@ t.throws(() => kx.client({

server: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES - 1) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -132,3 +132,3 @@ t.throws(() => kx.client({

server: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -139,3 +139,3 @@ t.throws(() => kx.client({

server: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -167,11 +167,11 @@ t.end()

test.cb('kx.server(opts) throws on bad input', (t) => {
t.throws(() => kx.server(), TypeError)
t.throws(() => kx.server(null), TypeError)
t.throws(() => kx.server(123), TypeError)
t.throws(() => kx.server(true), TypeError)
t.throws(() => kx.server(() => undefined), TypeError)
t.throws(() => kx.server(''), TypeError)
t.throws(() => kx.server({}), TypeError)
t.throws(() => kx.server({ publicKey: null }), TypeError)
t.throws(() => kx.server({ publicKey: randomBytes(16) }), TypeError)
t.throws(() => kx.server(), { instanceOf: TypeError })
t.throws(() => kx.server(null), { instanceOf: TypeError })
t.throws(() => kx.server(123), { instanceOf: TypeError })
t.throws(() => kx.server(true), { instanceOf: TypeError })
t.throws(() => kx.server(() => undefined), { instanceOf: TypeError })
t.throws(() => kx.server(''), { instanceOf: TypeError })
t.throws(() => kx.server({}), { instanceOf: TypeError })
t.throws(() => kx.server({ publicKey: null }), { instanceOf: TypeError })
t.throws(() => kx.server({ publicKey: randomBytes(16) }), { instanceOf: TypeError })

@@ -181,3 +181,3 @@ t.throws(() => kx.server({

secretKey: null,
}), TypeError)
}), { instanceOf: TypeError })

@@ -188,3 +188,3 @@ t.throws(() => kx.server({

client: null,
}), TypeError)
}), { instanceOf: TypeError })

@@ -195,3 +195,3 @@ t.throws(() => kx.server({

client: 123,
}), TypeError)
}), { instanceOf: TypeError })

@@ -202,3 +202,3 @@ t.throws(() => kx.server({

client: {},
}), TypeError)
}), { instanceOf: TypeError })

@@ -209,3 +209,3 @@ t.throws(() => kx.server({

client: { publicKey: null },
}), TypeError)
}), { instanceOf: TypeError })

@@ -216,3 +216,3 @@ t.throws(() => kx.server({

client: { publicKey: randomBytes(16) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -223,3 +223,3 @@ t.throws(() => kx.server({

client: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES - 1) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -230,3 +230,3 @@ t.throws(() => kx.server({

client: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -237,3 +237,3 @@ t.throws(() => kx.server({

client: { publicKey: randomBytes(crypto_kx_PUBLICKEYBYTES) },
}), TypeError)
}), { instanceOf: TypeError })

@@ -240,0 +240,0 @@ t.end()

@@ -0,3 +1,4 @@

const isBuffer = require('is-buffer')
const { randomBytes } = require('../random-bytes')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')

@@ -8,12 +9,12 @@

t.throws(() => randomBytes(null), TypeError)
t.throws(() => randomBytes(), TypeError)
t.throws(() => randomBytes(0), TypeError)
t.throws(() => randomBytes(-1), TypeError)
t.throws(() => randomBytes(''), TypeError)
t.throws(() => randomBytes([]), TypeError)
t.throws(() => randomBytes({}), TypeError)
t.throws(() => randomBytes(() => {}), TypeError)
t.throws(() => randomBytes(true), TypeError)
t.throws(() => randomBytes(NaN), TypeError)
t.throws(() => randomBytes(null), { instanceOf: TypeError })
t.throws(() => randomBytes(), { instanceOf: TypeError })
t.throws(() => randomBytes(0), { instanceOf: TypeError })
t.throws(() => randomBytes(-1), { instanceOf: TypeError })
t.throws(() => randomBytes(''), { instanceOf: TypeError })
t.throws(() => randomBytes([]), { instanceOf: TypeError })
t.throws(() => randomBytes({}), { instanceOf: TypeError })
t.throws(() => randomBytes(() => {}), { instanceOf: TypeError })
t.throws(() => randomBytes(true), { instanceOf: TypeError })
t.throws(() => randomBytes(NaN), { instanceOf: TypeError })
t.true(16 === randomBytes(16).length)

@@ -20,0 +21,0 @@ t.true(8 === randomBytes(8).length)

@@ -1,6 +0,2 @@

const { seal, open } = require('../seal')
const { keyPair } = require('../curve25519')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -13,2 +9,6 @@ const {

const { seal, open } = require('../seal')
const { keyPair } = require('../curve25519')
const test = require('./helpers/runner')
test.cb('seal(message, opts) is a function', (t) => {

@@ -20,12 +20,12 @@ t.true('function' === typeof seal)

test.cb('seal(message, opts) throws on bad input', (t) => {
t.throws(() => seal(), TypeError)
t.throws(() => seal(null, null), TypeError)
t.throws(() => seal(Buffer.alloc(0), null), TypeError)
t.throws(() => seal(Buffer.from('hello'), null), TypeError)
t.throws(() => seal(Buffer.from('hello'), {}), TypeError)
t.throws(() => seal(Buffer.from('hello'), { publicKey: null }), TypeError)
t.throws(() => seal(), { instanceOf: TypeError })
t.throws(() => seal(null, null), { instanceOf: TypeError })
t.throws(() => seal(Buffer.alloc(0), null), { instanceOf: TypeError })
t.throws(() => seal(Buffer.from('hello'), null), { instanceOf: TypeError })
t.throws(() => seal(Buffer.from('hello'), {}), { instanceOf: TypeError })
t.throws(() => seal(Buffer.from('hello'), { publicKey: null }), { instanceOf: TypeError })
t.throws(() => seal(
Buffer.from('hello'),
{ publicKey: Buffer.alloc(crypto_box_PUBLICKEYBYTES - 1) }
), TypeError)
), { instanceOf: TypeError })

@@ -56,18 +56,18 @@ t.end()

t.throws(() => open(), TypeError)
t.throws(() => open(null, null), TypeError)
t.throws(() => open(sealed), TypeError)
t.throws(() => open(sealed, null), TypeError)
t.throws(() => open(sealed, {}), TypeError)
t.throws(() => open(sealed, { publicKey }), TypeError)
t.throws(() => open(Buffer.alloc(0), null), TypeError)
t.throws(() => open(sealed.slice(0, -1), {}), TypeError)
t.throws(() => open(), { instanceOf: TypeError })
t.throws(() => open(null, null), { instanceOf: TypeError })
t.throws(() => open(sealed), { instanceOf: TypeError })
t.throws(() => open(sealed, null), { instanceOf: TypeError })
t.throws(() => open(sealed, {}), { instanceOf: TypeError })
t.throws(() => open(sealed, { publicKey }), { instanceOf: TypeError })
t.throws(() => open(Buffer.alloc(0), null), { instanceOf: TypeError })
t.throws(() => open(sealed.slice(0, -1), {}), { instanceOf: TypeError })
t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {
publicKey: Buffer.alloc(0)
}), TypeError)
}), { instanceOf: TypeError })
t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {
publicKey: null,
}), TypeError)
}), { instanceOf: TypeError })

@@ -77,3 +77,3 @@ t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {

secretKey: Buffer.alloc(0)
}), TypeError)
}), { instanceOf: TypeError })

@@ -83,3 +83,3 @@ t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {

secretKey: Buffer.alloc(crypto_box_SECRETKEYBYTES)
}), TypeError)
}), { instanceOf: TypeError })

@@ -89,3 +89,3 @@ t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {

secretKey: Buffer.alloc(crypto_box_SECRETKEYBYTES)
}), TypeError)
}), { instanceOf: TypeError })

@@ -95,3 +95,3 @@ t.throws(() => open(Buffer.alloc(crypto_box_SEALBYTES), {

secretKey: Buffer.alloc(crypto_box_SECRETKEYBYTES - 1)
}), TypeError)
}), { instanceOf: TypeError })

@@ -101,3 +101,3 @@ t.throws(() => open(sealed, {

secretKey,
}), TypeError)
}), { instanceOf: TypeError })

@@ -107,3 +107,3 @@ t.throws(() => open(sealed, {

secretKey: secretKey.slice(0, -1)
}), TypeError)
}), { instanceOf: TypeError })

@@ -110,0 +110,0 @@ t.end()

const isBuffer = require('is-buffer')
const { shash } = require('../shash')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -11,2 +8,5 @@ const {

const { shash } = require('../shash')
const test = require('./helpers/runner')
test.cb('shash(message, secretKey) is a function', (t) => {

@@ -18,18 +18,18 @@ t.true('function' === typeof shash)

test.cb('shash(message, secretKey) throws on bad input', (t) => {
t.throws(() => shash(), TypeError)
t.throws(() => shash(null, null), TypeError)
t.throws(() => shash(123, null), TypeError)
t.throws(() => shash(true, null), TypeError)
t.throws(() => shash('hello', null), TypeError)
t.throws(() => shash(Buffer.alloc(0), null), TypeError)
t.throws(() => shash(Buffer.alloc(8), null), TypeError)
t.throws(() => shash(Buffer.alloc(8), true), TypeError)
t.throws(() => shash(Buffer.alloc(8), 123), TypeError)
t.throws(() => shash(Buffer.alloc(8), 'hello'), TypeError)
t.throws(() => shash(Buffer.alloc(8), 'hello'), TypeError)
t.throws(() => shash(Buffer.alloc(8), Buffer.alloc(0)), RangeError)
t.throws(() => shash(), { instanceOf: TypeError })
t.throws(() => shash(null, null), { instanceOf: TypeError })
t.throws(() => shash(123, null), { instanceOf: TypeError })
t.throws(() => shash(true, null), { instanceOf: TypeError })
t.throws(() => shash('hello', null), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(0), null), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), null), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), true), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), 123), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), 'hello'), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), 'hello'), { instanceOf: TypeError })
t.throws(() => shash(Buffer.alloc(8), Buffer.alloc(0)), { instanceOf: RangeError })
t.throws(() => shash(
Buffer.alloc(8),
Buffer.alloc(crypto_shorthash_KEYBYTES + 1)
), RangeError)
), { instanceOf: RangeError })

@@ -39,3 +39,3 @@ t.throws(() => shash(

Buffer.alloc(crypto_shorthash_KEYBYTES)
), RangeError)
), { instanceOf: RangeError })

@@ -42,0 +42,0 @@ t.end()

@@ -34,6 +34,6 @@ const isBuffer = require('is-buffer')

test.cb('sss.init(opts) throws on bad input', (t) => {
t.throws(() => sss.init(() => {}), TypeError)
t.throws(() => sss.init(true), TypeError)
t.throws(() => sss.init(123), TypeError)
t.throws(() => sss.init(''), TypeError)
t.throws(() => sss.init(() => {}), { instanceOf: TypeError })
t.throws(() => sss.init(true), { instanceOf: TypeError })
t.throws(() => sss.init(123), { instanceOf: TypeError })
t.throws(() => sss.init(''), { instanceOf: TypeError })

@@ -44,18 +44,18 @@ t.end()

test.cb('sss.secret(opts) throws on bad input', (t) => {
t.throws(() => sss.secret(undefined), TypeError)
t.throws(() => sss.secret(null), TypeError)
t.throws(() => sss.secret({}), TypeError)
t.throws(() => sss.secret([]), TypeError)
t.throws(() => sss.secret(() => {}), TypeError)
t.throws(() => sss.secret(true), TypeError)
t.throws(() => sss.secret(123), TypeError)
t.throws(() => sss.secret(''), TypeError)
t.throws(() => sss.secret(Buffer.alloc(0)), TypeError)
t.throws(() => sss.secret(ZERO), TypeError)
t.throws(() => sss.secret(undefined), { instanceOf: TypeError })
t.throws(() => sss.secret(null), { instanceOf: TypeError })
t.throws(() => sss.secret({}), { instanceOf: TypeError })
t.throws(() => sss.secret([]), { instanceOf: TypeError })
t.throws(() => sss.secret(() => {}), { instanceOf: TypeError })
t.throws(() => sss.secret(true), { instanceOf: TypeError })
t.throws(() => sss.secret(123), { instanceOf: TypeError })
t.throws(() => sss.secret(''), { instanceOf: TypeError })
t.throws(() => sss.secret(Buffer.alloc(0)), { instanceOf: TypeError })
t.throws(() => sss.secret(ZERO), { instanceOf: TypeError })
t.throws(() => sss.secret('secret', null), TypeError)
t.throws(() => sss.secret('secret', true), TypeError)
t.throws(() => sss.secret('secret', 123), TypeError)
t.throws(() => sss.secret('secret', ''), TypeError)
t.throws(() => sss.secret('secret', () => {}), TypeError)
t.throws(() => sss.secret('secret', null), { instanceOf: TypeError })
t.throws(() => sss.secret('secret', true), { instanceOf: TypeError })
t.throws(() => sss.secret('secret', 123), { instanceOf: TypeError })
t.throws(() => sss.secret('secret', ''), { instanceOf: TypeError })
t.throws(() => sss.secret('secret', () => {}), { instanceOf: TypeError })

@@ -66,6 +66,6 @@ t.end()

test.cb('sss.shares(opts) throws on bad input', (t) => {
t.throws(() => sss.shares(() => {}), TypeError)
t.throws(() => sss.shares(true), TypeError)
t.throws(() => sss.shares(123), TypeError)
t.throws(() => sss.shares(''), TypeError)
t.throws(() => sss.shares(() => {}), { instanceOf: TypeError })
t.throws(() => sss.shares(true), { instanceOf: TypeError })
t.throws(() => sss.shares(123), { instanceOf: TypeError })
t.throws(() => sss.shares(''), { instanceOf: TypeError })

@@ -76,6 +76,6 @@ t.end()

test.cb('sss.recover(opts) throws on bad input', (t) => {
t.throws(() => sss.recover(() => {}), TypeError)
t.throws(() => sss.recover(true), TypeError)
t.throws(() => sss.recover(123), TypeError)
t.throws(() => sss.recover(''), TypeError)
t.throws(() => sss.recover(() => {}), { instanceOf: TypeError })
t.throws(() => sss.recover(true), { instanceOf: TypeError })
t.throws(() => sss.recover(123), { instanceOf: TypeError })
t.throws(() => sss.recover(''), { instanceOf: TypeError })

@@ -118,3 +118,3 @@ t.end()

t.true(10 === shares.length)
t.true(shares.every(share => isBuffer(share)))
t.true(shares.every((share) => isBuffer(share)))

@@ -121,0 +121,0 @@ t.end()

@@ -6,9 +6,9 @@ const isBuffer = require('is-buffer')

test.cb('uint64.encode(value)', (t) => {
t.throws(() => uint64.encode(), TypeError)
t.throws(() => uint64.encode(null), TypeError)
t.throws(() => uint64.encode([]), TypeError)
t.throws(() => uint64.encode({}), TypeError)
t.throws(() => uint64.encode(true), TypeError)
t.throws(() => uint64.encode(NaN), TypeError)
t.throws(() => uint64.encode(() => {}), TypeError)
t.throws(() => uint64.encode(), { instanceOf: TypeError })
t.throws(() => uint64.encode(null), { instanceOf: TypeError })
t.throws(() => uint64.encode([]), { instanceOf: TypeError })
t.throws(() => uint64.encode({}), { instanceOf: TypeError })
t.throws(() => uint64.encode(true), { instanceOf: TypeError })
t.throws(() => uint64.encode(NaN), { instanceOf: TypeError })
t.throws(() => uint64.encode(() => {}), { instanceOf: TypeError })

@@ -25,9 +25,9 @@ t.true(isBuffer(uint64.encode(42)))

t.throws(() => uint64.decode(), TypeError)
t.throws(() => uint64.decode(null), TypeError)
t.throws(() => uint64.decode([]), TypeError)
t.throws(() => uint64.decode({}), TypeError)
t.throws(() => uint64.decode(true), TypeError)
t.throws(() => uint64.decode(NaN), TypeError)
t.throws(() => uint64.decode(() => {}), TypeError)
t.throws(() => uint64.decode(), { instanceOf: TypeError })
t.throws(() => uint64.decode(null), { instanceOf: TypeError })
t.throws(() => uint64.decode([]), { instanceOf: TypeError })
t.throws(() => uint64.decode({}), { instanceOf: TypeError })
t.throws(() => uint64.decode(true), { instanceOf: TypeError })
t.throws(() => uint64.decode(NaN), { instanceOf: TypeError })
t.throws(() => uint64.decode(() => {}), { instanceOf: TypeError })

@@ -34,0 +34,0 @@ t.true('number' === typeof uint64.decode(buffer))

@@ -1,7 +0,2 @@

const { unbox, createUnboxStream } = require('../unbox')
const { box, createBoxStream } = require('../box')
const { randomBytes } = require('../random-bytes')
const isBuffer = require('is-buffer')
const test = require('./helpers/runner')
/* eslint-disable camelcase */

@@ -13,2 +8,7 @@ const {

const { unbox, createUnboxStream } = require('../unbox')
const { box, createBoxStream } = require('../box')
const { randomBytes } = require('../random-bytes')
const test = require('./helpers/runner')
test.cb('unbox(opts) is a function', (t) => {

@@ -20,9 +20,9 @@ t.true('function' === typeof unbox)

test.cb('unbox(opts) throws on bad input', (t) => {
t.throws(() => unbox(), TypeError)
t.throws(() => unbox(null), TypeError)
t.throws(() => unbox(true), TypeError)
t.throws(() => unbox(123), TypeError)
t.throws(() => unbox('string'), TypeError)
t.throws(() => unbox({ secret: null }), TypeError)
t.throws(() => unbox({ key: null }), TypeError)
t.throws(() => unbox(), { instanceOf: TypeError })
t.throws(() => unbox(null), { instanceOf: TypeError })
t.throws(() => unbox(true), { instanceOf: TypeError })
t.throws(() => unbox(123), { instanceOf: TypeError })
t.throws(() => unbox('string'), { instanceOf: TypeError })
t.throws(() => unbox({ secret: null }), { instanceOf: TypeError })
t.throws(() => unbox({ key: null }), { instanceOf: TypeError })

@@ -71,6 +71,6 @@ t.end()

test.cb('createUnboxStream(opts) throws on bad input', (t) => {
t.throws(() => createUnboxStream(null), TypeError)
t.throws(() => createUnboxStream(true), TypeError)
t.throws(() => createUnboxStream(123), TypeError)
t.throws(() => createUnboxStream(), TypeError)
t.throws(() => createUnboxStream(null), { instanceOf: TypeError })
t.throws(() => createUnboxStream(true), { instanceOf: TypeError })
t.throws(() => createUnboxStream(123), { instanceOf: TypeError })
t.throws(() => createUnboxStream(), { instanceOf: TypeError })

@@ -77,0 +77,0 @@ t.end()

@@ -24,3 +24,4 @@ const isBuffer = require('is-buffer')

throw new TypeError(
'crypto.uint64.encode: Expecting size to greater than 8.')
'crypto.uint64.encode: Expecting size to greater than 8.'
)
} else if (Number.isNaN(value)) {

@@ -47,3 +48,4 @@ throw new TypeError('crypto.uint64.encode: Cannot encode NaN.')

throw new TypeError(
'crypto.uint64.decode: Cannot decode buffer of 0 length.')
'crypto.uint64.decode: Cannot decode buffer of 0 length.'
)
}

@@ -50,0 +52,0 @@ return uint64be.decode(buffer)

@@ -103,3 +103,3 @@ const increment = require('increment-buffer')

/* eslint-disable-next-line no-param-reassign */
opts = Object.assign({}, opts)
opts = { ...opts }

@@ -106,0 +106,0 @@ if (false === isBuffer(opts.nonce)) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc