From e6052a4217cfe43c03b77d6871b0a68835cbfee3 Mon Sep 17 00:00:00 2001 From: Kira Oakley Date: Fri, 22 May 2020 20:32:29 -0700 Subject: [PATCH] documentation --- README.md | 9 +++++++-- index.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8969a4a..9d87245 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ Core database, replication, swarming, and chat APIs for cabal. > var Cabal = require('cabal-node') -### var cabal = Cabal([storage][, uriString][, opts]) +### var cabal = Cabal([storage][, key][, opts]) Create a cabal p2p database using storage `storage`, which must be either a string (filepath to directory on disk) or an instance of [random-access-storage](https://github.com/random-access-storage/). -`uriString` is a cabal URI string, of the form `cabal://[?param1=value1¶m2=value2`. A hexidecimal key on its own will also be understood. +`key` is a cabal key, as a string or Buffer. If this is a new cabal, `key` can be omitted and will be generated. @@ -28,6 +28,11 @@ var level = require('level') var cabal = Cabal(storage, key, { db: level('/tmp/bot.db') }) ``` +Other `opts` include: + +- `opts.modKeys`: an array of keys to be considered moderators from this user's perspective. +- `opts.adminKeys`: an array of keys to be considered administrators from this user's perspective. + ### cabal.getLocalKey(cb) Returns the local user's key (as a hex string). diff --git a/index.js b/index.js index 393faf7..759fe1f 100644 --- a/index.js +++ b/index.js @@ -31,7 +31,7 @@ module.exports.databaseVersion = DATABASE_VERSION * local nickname -> mesh interactions for a single user. * @constructor * @param {string|function} storage - A hyperdb compatible storage function, or a string representing the local data path. - * @param {string} key - a protocol string, optionally with url parameters + * @param {string|Buffer} key - a hypercore public key */ function Cabal (storage, key, opts) { if (!(this instanceof Cabal)) return new Cabal(storage, key, opts)