How to use the chloride.crypto_sign_keypair function in chloride

To help you get started, we’ve selected a few chloride examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ssbc / multiserver / test / shs.js View on Github external
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([
github ssbc / multiserver / test / shs.js View on Github external
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)
])
github digitalbazaar / did-io / lib / ld-key-pair.js View on Github external
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;
  }