Configuration for cobox
ameba23 37e10024b3 test for key exchange keypair 2 years ago
lib update to use renamed crypto 2 years ago
test test for key exchange keypair 2 years ago
.gitignore update with rad gitignore and nyc not istanbul 2 years ago
LICENSE add LICENSE 3 years ago
README.md update to use renamed crypto 2 years ago
example.yaml update example 2 years ago
index.js add key exchange keypair on init. 2 years ago
logger.js fix bug with logging to stdout 2 years ago
package.json update crypto git branch 2 years ago
util.js make isPubKey function more resilent 2 years ago
yarn.lock update to use renamed crypto 2 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.

var key = group.name || group.address || group.address.toString('hex')
config.groups.get(group)

Get a group from the config

var key = group.name || group.address || group.address.toString('hex')
config.groups.set(group, { name, address, encryptionKey })

Add a group to the config

var key = group.name || group.address || group.address.toString('hex')
config.groups.delete(group)

Remove a group from the config

config.groups.list()

List saved groups