crypto-encoder
A simple hypercore-compatible crypto encoder.
Example
const hypercore = const Encoder = const encryptionKey = Encoderconst valueEncoding = const feed =
API
const Encoder =
const encryptionKey = Encoder
Generate a random 32 byte key to be used to encrypt.
const valueEncoding =
Returns a message encoder used for encrypting messages in hypercore.
encryptionKey
must be a buffer of lengthEncoder.KEYBYTES
.opts
is an optional object which may contain:opts.valueEncoder
, an additional encoder to be used before encryption. May be one of:- The string 'utf-8' - utf-8 encoded strings will be assumed.
- The string 'JSON' - JSON encoding will be assumed.
- A custom encoder of the form
{ encode: [function] decode: [function] }