UNPKG

cobox-group

Version:

a p2p private group for files and application-layer data

72 lines (38 loc) 2.02 kB
# cobox-group Group class for cobox. Wraps `KappaDrive` in a custom encryption scheme for content encryption, enabling blind replication. ## API `const Group = require('cobox-group')` `var group = Group(storage, key, opts)` Returns a group object - `storage` - path for storing feed data. Defaults to `random-access-file` - `key` - the group key (which may be a compound key containing a symmetric encryption key) - `opts` an options object, which may contain: - `opts.config` a config object from `cobox-config` Blind Replicator logic is exported as a separate function, to prevent empty indexes being created and run. `const { Blind } = require('cobox-group')` `var group = Blind(storage, key, opts)` ### `group.ready(callback)` callback is called when the group is ready to use. ### `group.masterKey` A master key for key derivation, to generate context specific keypairs for signing hypercores. ### `group.keys` An object with properties `address` and `encryptionKey` as detailed below. ### `group.address` The address or public key for the group ### `group.encryptionKey` Random 32 byte key used to derive encryption key. ### `group.drive` Your `KappaDrive` instance ### `group.state` An interface to query your group drive changes, built with `kappa-view-query`. ### `group.log` An additional hypercore for storing group-specific messages. ### `group.logs` An interface to query your group log, built with `kappa-view-query`. ### `group.swarm(opts)` Swarm across either Hyperswarm, or Discovery Swarm, based on opts. ### `group.bytesUsed()` Returns the cumulative size of all of the groups feeds. Cannot be run before group is ready. Note that this is only the size of the data in the feeds, in reality a little more disk space is used to store keys, etc. ## CLI We've retired the command-line interface to a separate package, as `cobox-server` now exports a CLI and handles managing multiple groups. It is still available [here](https://ledger-git.dyne.org/CoBox/cobox-group-cli).