hyper-secret-sharing
Secret sharing over Hypercore that leverages xsalsa20-encoding to secure shares at rest.
Installation
$ npm install hyper-secret-sharing
Usage
const secrets = // split 'secret' into shares appended to 'originFeed'secrets // recover secret from 'recoveryFeed'secrets
Example
const recover share = const keyPair = const replicate = const hypercore = const crypto = const ram = const publicKey secretKey = const threshold = 32const shares = 64const secret = Bufferconst nonce = crypto const recoverer = const origin = const holders = Arrayshares { console} { console;} { feed}
API
secrets.share(feed, opts, callback)
Split opts.secret
into opts.shares
shares with a recovery threshold
specified by opts.threshold
appending each share into the feed
calling callback(err, shares, start, end, threshold)
upon success or
error where opts
can be:
threshold: Number // The number of shares need to recover the secret shares: Number // The number of shares to create from the secret, secret: Buffer // The secret to split into shares nonce: Buffer // _Required_ nonce for 'xsalsa20-encoding' encryption secretKey: feedsecretKey // An optional secret key override
const crypto = const secret = Bufferconst nonce = cryptoconst feed = feed
secrets.recover(feed, opts, callback)
Recover secret in feed
with at least opts.threshold
shares calling
callback(err, secret)
where opts
can be:
threshold: Number // The number of shares need to recover the secret secretKey: Buffer // _Required_ key for 'xsalsa20-encryption' decryption nonce: Buffer // _Required_ nonce for 'xsalsa20-encoding' decryption
const replicate = const crypto = const secret = Bufferconst nonce = cryptoconst feed = const copy = feed
License
MIT