How to use the ssb-config.caps function in ssb-config

To help you get started, we’ve selected a few ssb-config 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 / ssb-tunnel / examples / browser / index.js View on Github external
function reconnect () {
    if(timer) return
    console.error('waiting to reconnect')
    timer = setTimeout(function () {
      timer = null
      connect()
    }, 500 + Math.random() * 1000)

  }

  PortalClient(
    keys,
    {
    remote: portal,
    caps: config.caps,
    manifest: {
      tunnel: {connect: 'duplex'}
    }
  }, function (err, rpc) {
    if(err) {
      console.error(err)
      return reconnect()
    }
    console.error('connecting to tunnel:', target)
    var stream = rpc.tunnel.connect({
      target: '@'+target.split(':').pop()+'.ed25519',
      port: 0
    })
    pull(
      stream.source,
      Client(toBuffer(target.split(':').pop()), function (err, stream) {
github ssbc / ssb-tunnel / examples / browser / index.js View on Github external
}

//var portal = process.argv[2]
//var target = process.argv[3]

function toSodiumKeys(keys) {
  if(!keys || !keys.public) return null
  console.log(keys)
  return {
    publicKey: toBuffer(keys.public),
    secretKey: toBuffer(keys.private)
  }
}
console.log('target:', target)
console.log('keys:', keys)
var Client = TunnelClient(toSodiumKeys(keys), toBuffer(config.caps.shs), timeout)

var timer
;(function connect () {
  console.error('connecting to portal:', portal)

  function reconnect () {
    if(timer) return
    console.error('waiting to reconnect')
    timer = setTimeout(function () {
      timer = null
      connect()
    }, 500 + Math.random() * 1000)

  }

  PortalClient(
github soapdog / patchfox / src / inject.js View on Github external
return new Promise((resolve, reject) => {
        client(data.keys, {
            remote: data.remote,
            caps: config.caps,
            manifest: data.manifest
        }, (err, s) => {

            if (err) {
                reject("Connecting to sbot, <a href="\&quot;#/setup\&quot;">go back to setup</a> and check your settings. Also, make sure <i>sbot</i> is running (is scuttle-shell icon appearing on your machine?).");
            } else {
                resolve({sbot: s, remote: data.remote, keys: data.keys, manifest: data.manifest});
            }
        });
    });
};

ssb-config

load ssb config

MIT
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis