Documentation ¶
Index ¶
- Variables
- func NewUnboxerLog(root, seqlog margaret.Log, kp ssb.KeyPair) margaret.Log
- type GroupAddMember
- type Manager
- func (mgr *Manager) AddMember(groupID refs.MessageRef, r refs.FeedRef, welcome string) (refs.MessageRef, error)
- func (mgr *Manager) Create(name string) (refs.MessageRef, refs.MessageRef, error)
- func (mgr *Manager) DecryptBox1(ctxt []byte) ([]byte, error)
- func (mgr *Manager) DecryptBox1Message(m refs.Message) ([]byte, error)
- func (mgr *Manager) DecryptBox2(ctxt []byte, author refs.FeedRef, prev refs.MessageRef) ([]byte, error)
- func (mgr *Manager) DecryptBox2Message(m refs.Message) ([]byte, error)
- func (mgr *Manager) DecryptMessage(m refs.Message) ([]byte, error)
- func (mgr *Manager) EncryptBox1(content []byte, rcpts ...refs.FeedRef) ([]byte, error)
- func (mgr *Manager) EncryptBox2(content []byte, prev refs.MessageRef, recpts []refs.Ref) ([]byte, error)
- func (mgr *Manager) GetOrDeriveKeyFor(other refs.FeedRef) (keys.Recipients, error)
- func (mgr *Manager) Join(groupKey []byte, root refs.MessageRef) (refs.MessageRef, error)
- func (mgr *Manager) PublishPostTo(groupID refs.MessageRef, text string) (refs.MessageRef, error)
- func (mgr *Manager) PublishTo(groupID refs.MessageRef, content []byte) (refs.MessageRef, error)
- func (mgr *Manager) WrappedUnboxingSink(snk luigi.Sink) luigi.Sink
Constants ¶
This section is empty.
Variables ¶
var ErrNotBoxed = fmt.Errorf("private: not a boxed message")
Functions ¶
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 ¶
DecryptBox1 does exactly what the name suggests, it returns the cleartext if mgr.author can read it
func (*Manager) DecryptBox1Message ¶
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 (*Manager) EncryptBox1 ¶
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 ¶
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.