Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var test = require('tape')
var Client = require('ssb-client')
var home = require('os-homedir')()
var Server = require('ssb-server')
.use(require('ssb-server/plugins/master'))
var Defaults = require('../defaults')
var Config = require('../inject')
if (process.env.SKIP_SERVER) {
console.log('\n!! skipping server startup tests\n')
return
}
test('Server startup - default config', t => {
// NOTE: ideally would use index.js, but maybe on a system with ~/.ssb/config,
// this simulates a clean setup by side-stepping RC
const defaultConfig = Defaults('ssb')
t.equal(defaultConfig.path, `${home}/.ssb`, 'has default ~/.ssb folder')
let ssbAppName = appname || process.env.ssb_appname
const config = require('ssb-config/inject')(ssbAppName, minimist(conf))
const keys = ssbKeys.loadOrCreateSync(path.join(config.path, 'secret'))
if (keys.curve === 'k256') {
// i think this is _really_ old and could be removed
throw new Error('k256 curves are no longer supported,' +
'please delete' + path.join(config.path, 'secret'))
}
config.keys = keys
ssbConfig = config
const manifestFile = path.join(config.path, 'manifest.json')
const createSbot = require('ssb-server')
.use(require('ssb-local'))
.use(require('ssb-logging'))
.use(require('ssb-master'))
.use(require('ssb-no-auth'))
.use(require('ssb-unix-socket'))
// who and how to peer
.use(require('ssb-gossip'))
.use(require('ssb-replicate'))
.use(require('ssb-friends'))
// old invites
.use(require('ssb-invite'))
// needed by device device-addrs
.use(require('ssb-query'))
const fs = require('fs')
const Path = require('path')
const Server = require('ssb-server')
.use(require('ssb-master'))
module.exports = function TestServer (config) {
const server = Server(config)
writeManifest(server)
process.on('message', msg => {
if (msg.action === 'CLOSE') {
server.close(() => {
console.log('CLOSING')
process.send({ action: 'KILLME' })
})
}
})
server.whoami((err, data) => {
const Server = require('ssb-server')
.use(require('ssb-server/plugins/master'))
const config = require('./server-default-config')
const server = Server(config)
writeManifest(server)
process.on('message', msg => {
if (msg.action === 'CLOSE') {
server.close(() => {
process.send({ action: 'KILLME' })
})
}
})
server.whoami((err, data) => {
var crypto = require('crypto')
var Scuttlebot = require('ssb-server')
.use(require('ssb-gossip'))
.use(require('../'))
.use(require('ssb-query'))
.use(require('ssb-device-address'))
var tape = require('tape')
var ssbKeys = require('ssb-keys')
function hash (s) {
return crypto.createHash('sha256').update(s).digest()
}
var a_keys = ssbKeys.generate(null, hash('alice'))
var b_keys = ssbKeys.generate(null, hash('bob'))
var c_keys = ssbKeys.generate(null, hash('carol'))
var crypto = require('crypto')
var Scuttlebot = require('ssb-server')
.use(require('ssb-gossip'))
.use(require('../'))
.use(require('ssb-query'))
.use(require('ssb-device-address'))
var tape = require('tape')
Scuttlebot
var ssbKeys = require('ssb-keys')
function hash (s) {
return crypto.createHash('sha256').update(s).digest()
}
var a_keys = ssbKeys.generate(null, hash('alice'))
var b_keys = ssbKeys.generate(null, hash('bob'))
var cont = require('cont')
var pull = require('pull-stream')
var createSbot = require('ssb-server')
.use({
//fake replicate plugin
name: 'replicate',
init: function () {
return {request: function () {}}
}
})
.use(require('../')) //EBT
var ssbKeys = require('ssb-keys')
var alice = ssbKeys.generate()
var bob = ssbKeys.generate()
var a_bot = createSbot({
temp: 'random-animals',
var crypto = require('crypto')
var Scuttlebot = require('ssb-server')
.use(require('ssb-gossip'))
.use(require('../'))
var tape = require('tape')
Scuttlebot
var ssbKeys = require('ssb-keys')
function hash (s) {
return crypto.createHash('sha256').update(s).digest()
}
var a_keys = ssbKeys.generate(null, hash('alice'))
var b_keys = ssbKeys.generate(null, hash('bob'))
var c_keys = ssbKeys.generate(null, hash('carol'))
var tape = require('tape')
var ssbKeys = require('ssb-keys')
var path = require('path')
var createSbot = require('ssb-server')
.use(require('..'))
var alice = createSbot({
temp: 'ooo_a',
timeout: 1000,
port: 34597,
keys: ssbKeys.generate()
})
var bob = createSbot({
temp: 'ooo_b',
timeout: 1000,
port: 34598,
host: 'localhost',
replicate: {hops: 3, legacy: false},
keys: ssbKeys.generate()
})
var tape = require('tape')
var ssbKeys = require('ssb-keys')
var path = require('path')
var rmrf = require('rimraf')
var createSbot = require('ssb-server')
.use(require('..'))
var alice = createSbot({
temp: 'ooo_a',
timeout: 1000,
port: 34597,
keys: ssbKeys.generate()
})
var bob = createSbot({
temp: 'ooo_b',
timeout: 1000,
port: 34598,
keys: ssbKeys.generate()
})
tape('connect', function (t) {