private

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotBoxed = fmt.Errorf("private: not a boxed message")

Functions

func NewUnboxerLog

func NewUnboxerLog(root, seqlog margaret.Log, kp ssb.KeyPair) margaret.Log

NewUnboxerLog expects the sequence numbers, that are returned from seqlog, to be decryptable by kp.

Types

type GroupAddMember

type GroupAddMember struct {
	Type string `json:"type"`
	Text string `json:"text"`

	Version string `json:"version"`

	GroupKey keys.Base64String `json:"groupKey"`
	Root     refs.MessageRef   `json:"root"` // initial message

	Recps []string `json:"recps"`

	Tangles refs.Tangles `json:"tangles"`
}

GroupAddMember is a JSON serialization helper. See https://github.com/ssbc/private-group-spec/tree/master/group/add-member for more.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is in charge of storing and retriving keys with the help of keymgr, can de- and encrypt messages and publish them.

func NewManager

func NewManager(author ssb.KeyPair, publishLog ssb.Publisher, km *keys.Store, rxlog margaret.Log, getter ssb.Getter, tangles multilog.MultiLog) *Manager

NewManager creates a new Manager

func (*Manager) AddMember

func (mgr *Manager) AddMember(groupID refs.MessageRef, r refs.FeedRef, welcome string) (refs.MessageRef, error)

AddMember creates, encrypts and publishes a GroupAddMember message.

func (*Manager) Create

func (mgr *Manager) Create(name string) (refs.MessageRef, refs.MessageRef, error)

Create returns cloaked id and public root of a new group

func (*Manager) DecryptBox1

func (mgr *Manager) DecryptBox1(ctxt []byte) ([]byte, error)

DecryptBox1 does exactly what the name suggests, it returns the cleartext if mgr.author can read it

func (*Manager) DecryptBox1Message

func (mgr *Manager) DecryptBox1Message(m refs.Message) ([]byte, error)

func (*Manager) DecryptBox2

func (mgr *Manager) DecryptBox2(ctxt []byte, author refs.FeedRef, prev refs.MessageRef) ([]byte, error)

DecryptBox2 decrypts box2 messages, using the keys that were previously stored/received.

func (*Manager) DecryptBox2Message

func (mgr *Manager) DecryptBox2Message(m refs.Message) ([]byte, error)

func (*Manager) DecryptMessage

func (mgr *Manager) DecryptMessage(m refs.Message) ([]byte, error)

func (*Manager) EncryptBox1

func (mgr *Manager) EncryptBox1(content []byte, rcpts ...refs.FeedRef) ([]byte, error)

EncryptBox1 creates box1 ciphertext that is readable by the recipients.

func (*Manager) EncryptBox2

func (mgr *Manager) EncryptBox2(content []byte, prev refs.MessageRef, recpts []refs.Ref) ([]byte, error)

EncryptBox2 creates box2 ciphertext

func (*Manager) GetOrDeriveKeyFor

func (mgr *Manager) GetOrDeriveKeyFor(other refs.FeedRef) (keys.Recipients, error)

GetOrDeriveKeyFor derives an encryption key for 1:1 private messages with an other feed.

func (*Manager) Join

func (mgr *Manager) Join(groupKey []byte, root refs.MessageRef) (refs.MessageRef, error)

Join is called with a groupKey and the tangle root for the group. It adds the key to the keystore so that messages to this group can be decrypted. It returns the cloaked message reference or an error.

func (*Manager) PublishPostTo

func (mgr *Manager) PublishPostTo(groupID refs.MessageRef, text string) (refs.MessageRef, error)

PublishPostTo publishes a new post to a group. TODO: reply root?

func (*Manager) PublishTo

func (mgr *Manager) PublishTo(groupID refs.MessageRef, content []byte) (refs.MessageRef, error)

PublishTo encrypts and publishes a json blob as content to a group.

func (*Manager) WrappedUnboxingSink

func (mgr *Manager) WrappedUnboxingSink(snk luigi.Sink) luigi.Sink

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL