Configuration for cobox
Kieran Gibb 9300d2debc
correct callback
3 years ago
lib use cobox-crypto over hypercore-crypto for tests 3 years ago
test correct callback 3 years ago
.gitignore update with rad gitignore and nyc not istanbul 3 years ago
LICENSE add LICENSE 3 years ago
README.md CRUD API works! 3 years ago
example.yaml update example 3 years ago
index.js correct merge issue 3 years ago
logger.js fix bug with logging to stdout 3 years ago
package.json 1.0.0 3 years ago
util.js make isPubKey function more resilent 3 years ago
yarn.lock correct merge issue 3 years ago

README.md

cobox-config

Stores and retrieves a YAML configuration file for use with the cobox stack.

Example

const Config = require('cobox-config')
const crypto = require('cobox-crypto') // or some other crypto scheme

var storage = './storage' 
var config = Config(storage)

API

config.save()

Write to YAML storage, path set using the storage path when initialising. Make sure you call this otherwise the config will not write to disk.

config.load()

Load from YAML, path set using the storage path when initialising. This is called automatically when initialising a Config.

config.identities.add(identity)

Append an identity to the config

var key = identity.name || identity.publicKey || identity.publicKey.toString('hex')
config.identities.remove(key)

Remove an identity from the config

var key = group.name || group.publicKey || group.publicKey.toString('hex')
config.groups.remove(group)

Remove a group from the config

config.identities.list()

List saved identities

config.groups.list()

List saved groups

Todos

  • encode public keys as base64 urlsafe in YAML
  • store the path to secret key file (base64 urlsafe binary encoding) instead of raw secret key in the config file