replication

package
v0.1.0-preview.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxBatch = 100
View Source
const MaxCiphertext = 64 << 10
View Source
const Version = 1

Variables

View Source
var ErrConflict = errors.New("replication cursor or event conflict")
View Source
var ErrInvalid = errors.New("invalid replication message")

Functions

func Hash

func Hash(body []byte) string

func Proof

func Proof(domain string, value any) []byte

func Root

func Root(publicKey string) (string, error)

func Sign

func Sign(key ed25519.PrivateKey, proof []byte) string

func SnapshotKey

func SnapshotKey(e Envelope) string

func ValidID

func ValidID(id string) bool

func ValidRoot

func ValidRoot(id string) bool

func Verify

func Verify(publicKey string, proof []byte, signature string) bool

Types

type Ack

type Ack struct {
	Root      string `json:"source_root"`
	Stream    string `json:"stream_id"`
	Through   int64  `json:"through"`
	Epoch     string `json:"epoch"`
	Signature string `json:"signature"`
}

func (Ack) Proof

func (a Ack) Proof() []byte

type Binding

type Binding struct {
	Root          string `json:"root"`
	SigningKey    string `json:"signing_key"`
	EncryptionKey string `json:"encryption_key"`
}

type Delivery

type Delivery struct {
	Sequence int64    `json:"sequence"`
	Event    Envelope `json:"event"`
}

type Envelope

type Envelope struct {
	Version          int             `json:"version"`
	EventID          string          `json:"event_id"`
	SourceRoot       string          `json:"source_root"`
	StreamID         string          `json:"stream_id"`
	Sequence         int64           `json:"source_sequence"`
	AggregateID      string          `json:"aggregate_id"`
	AggregateVersion int64           `json:"aggregate_version"`
	Authority        string          `json:"authority"`
	AuthorityRoot    string          `json:"authority_root"`
	Kind             string          `json:"kind"`
	PeerRoot         string          `json:"peer_root,omitempty"`
	Recipients       []string        `json:"recipients"`
	SigningKey       string          `json:"signing_key"`
	Ciphertext       []byte          `json:"ciphertext,omitempty"`
	ServerPayload    json.RawMessage `json:"server_payload,omitempty"`
	Signature        string          `json:"signature"`
}

Routing is public; file names and recipient receipts remain in Ciphertext. Client packets describe history and never grant cloud-object access.

func (Envelope) Proof

func (e Envelope) Proof() []byte

func (Envelope) Validate

func (e Envelope) Validate() error

type Info

type Info struct {
	Version   int    `json:"version"`
	Epoch     string `json:"epoch"`
	PublicKey string `json:"public_key"`
	UnixTime  int64  `json:"unix_time"`
	Nonce     string `json:"nonce"`
	Signature string `json:"signature"`
}

func (Info) Proof

func (i Info) Proof() []byte

func (Info) Validate

func (i Info) Validate(pin, nonce string) error

type Page

type Page struct {
	Root      string     `json:"consumer_root"`
	Epoch     string     `json:"epoch"`
	After     int64      `json:"after"`
	Through   int64      `json:"through"`
	Upper     int64      `json:"upper"`
	Items     []Delivery `json:"items"`
	More      bool       `json:"more"`
	Snapshot  bool       `json:"snapshot,omitempty"`
	NextKey   string     `json:"next_key,omitempty"`
	Signature string     `json:"signature"`
}

func (Page) Proof

func (p Page) Proof() []byte

func (Page) Validate

func (p Page) Validate(key, root string) error

type Peer

type Peer struct {
	Root          string `json:"root"`
	SigningKey    string `json:"signing_key"`
	EncryptionKey string `json:"encryption_key"`
}

func (Peer) Validate

func (p Peer) Validate() error

type Profile

type Profile struct {
	Root          string `json:"root"`
	Epoch         string `json:"epoch"`
	RosterVersion int64  `json:"roster_version"`
	Uploaded      int64  `json:"uploaded"`
	Signature     string `json:"signature"`
}

func (Profile) Proof

func (p Profile) Proof() []byte

type Roster

type Roster struct {
	OperationID     string `json:"operation_id"`
	ExpectedVersion int64  `json:"expected_version"`
	Peers           []Peer `json:"peers"`
}

type Upload

type Upload struct {
	SourceRoot string     `json:"source_root"`
	StreamID   string     `json:"stream_id"`
	After      int64      `json:"after"`
	Through    int64      `json:"through"`
	Events     []Envelope `json:"events"`
}

func (Upload) Validate

func (b Upload) Validate() error

Jump to

Keyboard shortcuts

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