Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var tape = require('tape')
var crypto = require('crypto')
var c = require('../')
var sodium = require('chloride')
var keypair = sodium.crypto_box_keypair
var alice = keypair()
var bob = keypair()
function arrayOfSize (n) {
return new Array(n+1).join('0').split('')
}
tape('simple', function (t) {
var msg = new Buffer('hello there!')
var ctxt = c.multibox(msg, [alice.publicKey, bob.publicKey])
console.log(ctxt)
;[alice.secretKey, bob.secretKey].forEach(function (sk) {
var sodium = require('chloride')
var scalarmult = sodium.crypto_scalarmult
var box = sodium.crypto_box_easy
var secretbox = sodium.crypto_secretbox_easy
var secretbox_open = sodium.crypto_secretbox_open_easy
var keypair = sodium.crypto_box_keypair
var concat = Buffer.concat
function randombytes(n) {
var b = new Buffer(n)
sodium.randombytes(b)
return b
}
function setMax (m) {
m = m || DEFAULT_MAX
if (m < 1 || m > 255)
throw new Error('max recipients must be between 0 and 255.')
return m
}