Configuration for cobox
Kieran Gibb aaaf7819fa
update with rad gitignore and nyc not istanbul
3 years ago
lib CRUD API works! 3 years ago
test CRUD API works! 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 with accurage example.yml 3 years ago
index.js CRUD API works! 3 years ago
package.json update with rad gitignore and nyc not istanbul 3 years ago
util.js CRUD API works! 3 years ago
yarn.lock update with rad gitignore and nyc not istanbul 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