Socket
Socket
Sign inDemoInstall

ssb-dht-invite

Package Overview
Dependencies
149
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ssb-dht-invite

An SSB plugin that shares connection invites via a Distributed Hash Table


Version published
Weekly downloads
4
decreased by-55.56%
Maintainers
1
Install size
17.3 MB
Created
Weekly downloads
 

Readme

Source

ssb-dht-invite

A scuttlebot plugin that shares connection invites via a Distributed Hash Table. Like the standard invite plugin, but over a DHT.

npm install --save ssb-dht-invite

Pre-requisites:

  • ssb-conn
  • secret-stack >=6.2.0
  • Node.js 6 or higher, because it utilizes some ES6 features

Usage

 const createSbot = require('scuttlebot/index')
   .use(require('scuttlebot/plugins/plugins'))
   .use(require('ssb-master'))
   .use(require('ssb-conn'))
   .use(require('ssb-lan'))
+  .use(require('ssb-dht-invite'))
   .use(require('ssb-replicate'))
   .use(require('ssb-friends'))
   .call(null, cfg)

Important: also setup the DHT transport in your ssb-config object:

 ...
 "connections": {
   "incoming": {
     "net": [{ "scope": "private, "transform": "shs", "port": 8008 }]
+    "dht": [{ "scope": "public", "transform": "shs", "port": 8423 }]
   },
   "outgoing": {
     "net": [{ "transform": "shs" }]
+    "dht": [{ "transform": "shs" }]
   }
 },
 ...

Plugin API

start() (async)

The start() API provides an explicit initialization procedure so that apps can decide what is the best time to initialize non-essential resources and plugins such as this one.

You must call this before using DHT invites in any way.

create() (async)

Creates a new invite code and notifies the multiserver DHT transport to host a peer on the DHT addressed with this invite. One invite can only be use once with another friend.

Returns the invite code (as a callback) to the caller of this function.

An invite code looks like dht:<seed>:<invite-creator-id>

accept(code) (async)

Pass an invite code to this API and wait for your sbot to connect with the remote friend.

hostingInvites() (source)

Pull stream that delivers arrays of {seed: string, claimer: string, online: boolean} DHT peers that are being hosted for remote friends.

Primarily purpose of this is for the frontend to know what's going on with the invite hosting.

claimingInvites() (source)

Pull stream that delivers arrays of invite codes (strings) that are being claimed and still pending to be accepted by the invitation creator.

(Internal API)

use({seed, feed}) (async)

Used internally by this plugin to exchange the invite code over RPC. Don't bother about this.

This API is called remotely by a trusted-or-untrusted peer who wants to "claim" an invite and make us follow them. The remote peer claims the invite by passing it ("seed") alongside the remote peer's id ("feed").

FAQs

Last updated on 25 Mar 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc