Package Exports
- crypto-encoder
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (crypto-encoder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
crypto-encoder
A simple hypercore-compatible crypto encoder.
Example
const hypercore = require('hypercore')
const Encoder = require('.')
const encryptionKey = Encoder.encryptionKey()
const valueEncoding = Encoder(encrytionKey, { valueEncoding: 'utf-8' })
const feed = hypercore(storage, { valueEncoding })API
const Encoder = require('.')const encryptionKey = Encoder.encryptionKey()Generate a random 32 byte key to be used to encrypt.
const valueEncoding = Encoder(encryptionKey, opts)Returns a message encoder used for encrypting messages in hypercore.
encryptionKeymust be a buffer of lengthEncoder.KEYBYTES.optsis 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] }