group

package
v0.1.0-preview.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGroupMembers    = 1000
	MaxGroupStateBytes = 8 * 1024 * 1024
)

Variables

View Source
var ErrMLSProviderRequired = errors.New("an audited RFC 9420 MLS/TreeKEM provider is required")

Functions

This section is empty.

Types

type Action

type Action struct {
	GroupID   string                      `json:"group_id"`
	Epoch     uint64                      `json:"epoch"`
	Previous  []byte                      `json:"previous"`
	Kind      ActionKind                  `json:"kind"`
	ActorID   string                      `json:"actor_id"`
	Subject   protocol.NodePublicIdentity `json:"subject"`
	CreatedAt time.Time                   `json:"created_at"`
	Signature protocol.HybridSignature    `json:"signature"`
}

func SignAction

func SignAction(signer *pqcrypto.HybridSigner, action Action) (Action, error)

type ActionKind

type ActionKind string
const (
	ActionAdd           ActionKind = "add"
	ActionRemove        ActionKind = "remove"
	ActionBan           ActionKind = "ban"
	ActionGrantAdmin    ActionKind = "grant_admin"
	ActionRevokeAdmin   ActionKind = "revoke_admin"
	ActionTransferOwner ActionKind = "transfer_owner"
)

type MLSProvider

type MLSProvider interface {
	Create(ctx context.Context, groupID string, creatorCredential []byte) ([]byte, error)
	Add(ctx context.Context, state []byte, keyPackage []byte) (newState, commit, welcome []byte, err error)
	Remove(ctx context.Context, state []byte, leafIndex uint32) (newState, commit []byte, err error)
	Encrypt(ctx context.Context, state, plaintext []byte) (newState, ciphertext []byte, err error)
	Decrypt(ctx context.Context, state, ciphertext []byte) (newState, plaintext []byte, err error)
}

MLSProvider keeps authorization separate from group encryption. A provider implementation should use RFC 9420 MLS and map every successful State action to the corresponding Add/Remove/Update proposal and Commit.

Hybrid post-quantum MLS ciphersuites are intentionally not implemented here: they are still IETF drafts. This boundary lets an audited provider replace the transport without changing frontends or node APIs.

type Member

type Member struct {
	Identity protocol.NodePublicIdentity `json:"identity"`
	Role     Role                        `json:"role"`
}

type Policy

type Policy struct {
	AdminsMayDelegate bool `json:"admins_may_delegate"`
}

type Role

type Role string
const (
	RoleOwner  Role = "owner"
	RoleAdmin  Role = "admin"
	RoleMember Role = "member"
	RoleBanned Role = "banned"
)

type State

type State struct {
	GroupID      string                      `json:"group_id"`
	Creator      protocol.NodePublicIdentity `json:"creator"`
	GenesisNonce []byte                      `json:"genesis_nonce"`
	Epoch        uint64                      `json:"epoch"`
	Policy       Policy                      `json:"policy"`
	Members      map[string]Member           `json:"members"`
	Hash         []byte                      `json:"hash"`
	// contains filtered or unexported fields
}

func New

func New(owner protocol.NodePublicIdentity, policy Policy) (*State, error)

func (*State) Apply

func (s *State) Apply(action Action) error

func (*State) UnmarshalJSON

func (s *State) UnmarshalJSON(data []byte) error

UnmarshalJSON restores the non-serialized concurrency guard and validates the complete self-certifying state before committing it to the receiver. Unknown fields and trailing JSON values are rejected.

Jump to

Keyboard shortcuts

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