Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scuttle-testbot

Package Overview
Dependencies
Maintainers
20
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scuttle-testbot

Spins up an empty, temporary ssb-server server that stores data in your temp folder

  • 1.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
increased by158.33%
Maintainers
20
Weekly downloads
 
Created
Source

scuttle-testbot

Spins up an empty, temporary ssb-server that stores data in your temp folder

Usage

var CreateTestSbot = require('scuttle-testbot')
var ssbKeys = require('ssb-keys')

var pietKeys = ssbKeys.generate()
var katieKeys = ssbKeys.generate()

var myTempSbot = CreateTestSbot({name: 'testBotName', keys: pietKeys})

var katie = myTempSbot.createFeed(katieKeys)
var piet = myTempSbot.createFeed(pietKeys)

piet.add({type: 'test', content: "a test message"},function(err, data) {
  myTempSbot.close() //don't forget to close your sbot otherwise your script will never exit. ;)
  console.log(data)
})

Outputs:

{ 
  key: '%FQ2auS8kVY9qPgpTWNY3le/JG5+IlO6JHDjBIQcSPSc=.sha256',
  value: { 
    previous: null,
    sequence: 1,
    author: '@UreG2i/rf4mz7QAVOtg0OML5SRRB42Cwwl3D1ct0mbU=.ed25519',
    timestamp: 1517190039755,
    hash: 'sha256',
    content: { type: 'test', content: 'a test message' },
    signature: '0AxMJ7cKjHQ6vJDPkVNWcGND4gUwv2Z8barND5eha7ZXH/s5T0trFqcratIqzmhE3YJU2FY61Rf1S/Za2foLCA==.sig.ed25519' 
  },
  timestamp: 1517190039758 
}

API

var CreateTestSbot = require('scuttle-testbot')

CreateTestSbot(opts={})

Returns a ssb-server instance.

By default, CreateTestSbot deletes an existing database of the same name before starting.

Valid opts keys include:

name (default: ssb-test + Number(new Date)) - myTestName: Sets the database in /tmp/myTestName

startUnclean (default: false) - true: Don't delete an existing database before starting up.

keys (default: scuttle-testbot generates a new set of random keys) - keys: generated by ssb-keys.

CreateTestSbot.use(require('ssb-about'))

CreateTestSbot.use lets you add ssb-server plugins. use can be chained the same as the ssb-server api.

Install

With npm installed, run

$ npm install scuttle-testbot

Acknowledgments

See Also

License

MIT

Keywords

FAQs

Package last updated on 22 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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