Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var chloride = require('chloride')
var pull = require('pull-stream')
var tape = require('tape')
var MultiServer = require('../')
var Net = require('../protocols/net')
var Ws = require('../protocols/ws')
var Shs = require('../transforms/shs')
var alice = chloride.crypto_sign_keypair()
var bob = chloride.crypto_sign_keypair()
var app_key = chloride.crypto_hash_sha256(new Buffer('TEST'))
function party (id, cb) {
if(id.toString('hex') === bob.publicKey.toString('hex'))
cb(null, true)
else
cb(null, false)
}
var serverA = MultiServer([
Net(),
Ws(),
Shs(alice, app_key, 10000, party)
])
var serverB = MultiServer([
var chloride = require('chloride')
var pull = require('pull-stream')
var tape = require('tape')
var MultiServer = require('../')
var Net = require('../protocols/net')
var Ws = require('../protocols/ws')
var Shs = require('../transforms/shs')
var alice = chloride.crypto_sign_keypair()
var bob = chloride.crypto_sign_keypair()
var app_key = chloride.crypto_hash_sha256(new Buffer('TEST'))
function party (id, cb) {
if(id.toString('hex') === bob.publicKey.toString('hex'))
cb(null, true)
else
cb(null, false)
}
var serverA = MultiServer([
Net(),
Ws(),
Shs(alice, app_key, 10000, party)
])
static async generate(options) {
const bs58 = require('bs58');
const chloride = require('chloride');
const keyPair = chloride.crypto_sign_keypair();
const keys = new Ed25519KeyPair({
publicKey: bs58.encode(keyPair.publicKey),
privateKey: bs58.encode(keyPair.secretKey),
...options
});
return keys;
}