ssb-about-self

An SSB secret-stack plugin for profile data using ssb-db2

Install

npm install ssb-about-self

Usage

 SecretStack({appKey: require('ssb-caps').shs})
   .use(require('ssb-master'))
+  .use(require('ssb-db2'))
+  .use(require('ssb-about-self'))
   .use(require('ssb-conn'))
   .use(require('ssb-blobs'))
   .call(null, config)

This plugin indexes only self-assigned about messages in contrast to ssb-social-index that indexes all about messages.

Example usage:

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

const ssb = SecretStack({ caps })
  .use(require('ssb-db2'))
  .use(require('ssb-db2/about-self')) // include index
  .call(null, { path: './' })

ssb.aboutSelf.get(ssb.id, (err, profile) => {
  console.log('My profile name is: ' + profile.name)
})

The profile object has the following fields:

  • name: string
  • description: string
  • image: blob ID as a string

API

ssb.aboutSelf.get(feedId, cb) (muxrpc “async”)

  • feedId: the feedId to get the profile for
  • cb: callback(err, profile)

Async API to get the latest self-assigned profile data for the given feedId.

ssb.aboutSelf.stream(feedId) (muxrpc “source”)

  • feedId: the feedId to get the profile for

pull-stream “source” API to get the latest self-assigned profile data for the given feedId followed by any live updates to that profile.

License

LGPL-3.0

GitHub

View Github