ssb-zero-conf-client

1.0.1 • Public • Published

ssb-zero-conf-client

Bring a netKey (caps.shs) and an ssb keypair and you get a working ssb client!

This works by scanning the lan for broadcasts of ssb-servers with ssb-lan installed. I then connects to any server that broadcasts the correct netKey and tries to request its manifest. This will only work when the provided public key (keys.public) is allowed to do this, for example because it is listed in the server's config.master.

const client = require('ssb-zero-conf-client')
const ssbKeys = require('ssb-keys')
 
const netKey = 'FZ0EmZO8NAhI8BLk5F1gxdBOTOO42BV9V6R4+KZS77c='
const keys = ssbKeys.loadOrCreateSync(__dirname + '/keyfile')
 
client(netKey, keys, (err, ssb, opts) =>{
  if (err) return console.error(err.message)
  console.log('Connected to', opts.remote)
  ssb.whoami( (err, feed) =>{
    if (err) return console.error(err.message)
    console.log(feed.id)
    ssb.close()
  })
})

I built this for connecting to ssb-servers started by Bay Of Plenty. Run bay-of-plenty -- --authorize keyfile to authorize your public key with all ssb-servers spawned by Bay Of Plenty.

License: MIT

Readme

Keywords

Package Sidebar

Install

npm i ssb-zero-conf-client

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.13 kB

Total Files

4

Last publish

Collaborators

  • regular