Home

Awesome

envelope-js

A javascript tool for cryptographically "boxing" and "unboxing" messages following the envelope spec.

envelope supports encryption to individuals and groups

Example Usage

var { box, unbox, CloakedMsgId } = require('envelope-js')

...

API

box(plain_text, feed_id, prev_msg_id, msg_key, recp_keys) => ciphertext

where:

unbox(ciphertext, feed_id, prev_msg_id, trial_keys, max_attempts) => plain_text | null

where:

NOTE: we also expose unboxKey and unboxBody for convenience.

DeriveSecret(feed_id, prev_msg_id) => derive

Used for taking a msg_key (the one-time key for a particular envelope) and deriving other keys used in the envelope (e.g. read_key)

where:

new CloakedMsgId(public_msg_id, read_key) => cloakedMsgId

Determine a cloaked message id for a published message following the envelope-spec/cloaked_msg_id/README.md

where:

slp.encode(info) => Buffer

where info is an Array of Buffers.

This is "short length-prefixed encoding", see https://github.com/ssbc/envelope-spec/blob/master/encoding/slp.md

...

License

MIT