Home

Awesome

ssb-private-group-keys

Basic helper functions implementing the private-group spec.

Currently supports classic & bendy butt feed types.

API

directMessageKey(x_dh_secret, x_dh_public, x_feed_id, y_dh_public, y_feed_id) => { key, scheme }

Create a shared key for communication between your feed and another feed.

If you are encrypting a DM, x is your feed, and y is the person you are DM'ing. If you are decrypting a DM, x is your feed, and y is the message author's.

All inputs are BFE style buffers.

The output is a key (buffer) and associated scheme (string) which can be passed into an envelope key_slot

directMessageKey.easy(myKeys) => makeKey(feedId) => { key, scheme }

Convenience function which wraps directMessageKey


poBoxKey(x_dh_secret, x_dh_public, x_id, y_dh_public, y_id) => { key, scheme }

If you are encrypting to a P.O. Box, then x is your feed, and y is the P.O. Box. If you are decrypting a message sent to a P.O. Box, then x is the P.O. Box, and y is the message author's feed.

All inputs are BFE style buffers.

The output is a key (buffer) and associated scheme (string) which can be passed into an envelope key_slot

poBoxKey.easy(myKeys) => makeKey(poboxId) => { key, scheme }

Convenience function which wraps poBoxKey


new SecretKey(length?) => secretKey

Create a secret key that can be used for the group or message key.

methods:

new SecretKey(buffer) => secretKey

An alternative way to use the constructor, in case you already have the group key bytes as a buffer, is to pass the buffer as the argument. This simply "embodies" the group key as a SecretKey instance, it doesn't generate anything new.


new DiffieHellmanKeys(keys?, opts?) => dhKeys

alias: DHKeys

where:

DiffieHellmanKeys.scalarMult(A, B) => result

A class method for creating shared encryption keys.

NOTE:


History

This library was originally extracted from ssb-tribes.