libsignalgo.mau.fi/libsignal/groups Index | Files | Directories

package groups

import "go.mau.fi/libsignal/groups"

Package groups is responsible for setting up group SenderKey encrypted sessions. Once a session has been established, GroupCipher can be used to encrypt/decrypt messages in that session.

The built sessions are unidirectional: they can be used either for sending or for receiving, but not both. Sessions are constructed per (groupId + senderId + deviceId) tuple. Remote logical users are identified by their senderId, and each logical recipientId can have multiple physical devices.

Index

Types

type GroupCipher

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

GroupCipher is the main entry point for group encrypt/decrypt operations. Once a session has been established, this can be used for all encrypt/decrypt operations within that session.

func NewGroupCipher

func NewGroupCipher(builder *SessionBuilder, senderKeyID *protocol.SenderKeyName,
	senderKeyStore store.SenderKey) *GroupCipher

NewGroupCipher will return a new group message cipher that can be used for encrypt/decrypt operations.

func (*GroupCipher) Decrypt

func (c *GroupCipher) Decrypt(senderKeyMessage *protocol.SenderKeyMessage) ([]byte, error)

Decrypt decrypts the given message using an existing session that is stored in the senderKey store.

func (*GroupCipher) Encrypt

func (c *GroupCipher) Encrypt(plaintext []byte) (protocol.GroupCiphertextMessage, error)

Encrypt will take the given message in bytes and return encrypted bytes.

type SessionBuilder

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

SessionBuilder is a structure for building group sessions.

func NewGroupSessionBuilder

func NewGroupSessionBuilder(senderKeyStore store.SenderKey,
	serializer *serialize.Serializer) *SessionBuilder

NewGroupSessionBuilder will return a new group session builder.

func (*SessionBuilder) Create

Create will create a new group session for the given name.

func (*SessionBuilder) Process

Process will process an incoming group message and set up the corresponding session for it.

Source Files

GroupCipher.go GroupSessionBuilder.go

Directories

PathSynopsis
groups/ratchetPackage ratchet provides the methods necessary to establish a ratchet session for group messaging.
groups/state
groups/state/recordPackage record provides the state and record of a group session.
groups/state/storePackage store provides the storage interfaces for storing group sender key records.
Version
v0.1.2 (latest)
Published
Feb 12, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
1 week ago

Tools for package owners.