Configuration for cobox
Kieran Gibb 792f11a2dc
Merge branch 'development'
1 year ago
lib/handlers remove keyPair fn 1 year ago
test remove keyPair fn 1 year ago
.gitignore update with rad gitignore and nyc not istanbul 2 years ago
LICENSE add LICENSE 2 years ago
README.md update README 1 year ago
example.yaml remove identities from config 1 year ago
index.js update deps 1 year ago
package.json update deps 1 year ago
util.js make isPubKey function more resilent 2 years ago

README.md

cobox-config

Stores and retrieves a YAML configuration file for use with the cobox stack. Also loads up master key to generate a global identity.

Example

const Config = require('cobox-config')
const storage = './storage'

const 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(key)

Get a group from the config

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

Add a group to the config

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

Remove a group from the config

config.groups.list()

List saved groups