You are reading content from Scuttlebutt
@mix.exe %4tVnMOLDbBKq0AiQxGWxWdSbRjQ8DHwZKcEAbVSSSYQ=.sha256

ssb-tribes@1.0.0

This module has been in production in Ahau for some time and is basically stable. There are some optimisations which are still going to happen in the future but most of the features needed exist.

With this major release I've put some energy into making the README more accessible for beginners - thanks a lot to @arj for the pairing session where I was able to see first hand how rough my previous layout of the docs was.

auto-replicate peers (new feature!)

I've taught ssb-tribes to make sure that you're always replicating people who you are sharing a private group with. This is based on the assumption that if you know a person well enough to be in a group with them, that you also want to ensure you hear their contributions (and they hear yours).

This only activates if ssb-replicate is present (or a plugin is installed at ssb.replicate)

@mix.exe %CYCXlGf/lXA19pDzYbxOG+9/6subQXnit6+8yhFKTx0=.sha256

here's the more accessible intro to ssb-tribes use + behaviour for those interested


Example Usage

const SecretStack = require('secret-stack')
const config = require('ssb-config')
const caps = require('ssb-caps')

const stack = SecretStack({ caps })
  .use(require('ssb-db'))        // << required
  .use(require('ssb-backlinks')) // << required index
  .use(require('ssb-query'))     // << required index
  .use(require('ssb-tribes'))
  .use(require('ssb-private1'))  // if you want to support old encryption
                                 // *order matters*, load tribes first
  .use(...)

const ssb = stack(config)
ssb.tribes.create({}, (err, info) => {
  const { groupId } = info

  const content = {
    type: 'post',
    test: 'kia ora, e te whānau',
    recps: [groupId] // <<< you can now put a groupId in the recps
  }
  ssb.publish(content, (err, msg) => {
    // tada msg is encrypted to group!

    const keks = '@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519'
    const staltz = '@QlCTpvY7p9ty2yOFrv1WU1AE88aoQc4Y7wYal7PFc+w=.ed25519'

    ssb.tribes.invite(groupId, [keks, statlz], {}, (err, invite) => {
      // two friends have been sent an invite which includes the decryption key for the group
      // they can now read the message I just published, and publish their own messages to the group

    })
  })
})

Behaviour

This plugin provides functions for creating groups and administering things about them, but it also provides a bunch of "automatic" behviour.

  1. When you publish a message with recps it will auto-encrypt the content when:
    • there are 1-16 FeedIds (direct mesaaging)
    • there is 1 GroupId (private group messaging)
    • there is 1 GroupId followed by 1-15 FeedId
      • NOTE this is currently only recommended for group invite messages as it's easy to leak group info
  2. When you receive an encrypted message with suffix .box2 it will attempt to auto-decrypt the content:
    • on success this value will then be accessible in all database queries/ indexes
    • if it fails because it didn't have the key, the message gets passed to the next auto-decrypter to attempt
    • if it fails because something is clearly horribly wrong in the encyprtion and it should have worked, it throws an error (check this)
  3. When you receive an invite to a new group, you will auto-decrypt all messages
    • we re-index your whole database, which will reveal new messages you can decrypt
      • in the future we will only re-index messages you previously could not decrypt
    • keys for groups are stored in a off-chain key-store
  4. If you've been given the readKey for a particular message, you can use that
    • e.g. ssb.get({ id, private: true, key: readKey }, cb)
@Anders %eroQ6oT+6a2aJSMCyq1KUIoWlybmORaC/Xj6EfEj25Q=.sha256

This is really exciting, great milestone (all the mixes) @mix.desktop @mixmix @Mix Android !

Join Scuttlebutt now