client

package
Version: v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Overview

Package client provides the Reunion protocol client.

Package client provides the Reunion protocol client.

Index

Constants

This section is empty.

Variables

View Source
var (

	// InvalidResponseErr is an error used to indicate
	// that an invalid response from the Reunion server was received.
	InvalidResponseErr = errors.New("invalid response received from Reunion DB")

	// ErrShutdown is an error invoked during shutdown.
	ErrShutdown = errors.New("reunion: shutdown requested")
)

Functions

This section is empty.

Types

type Exchange

type Exchange struct {
	ExchangeID uint64
	// contains filtered or unexported fields
}

Exchange encapsulates all the client key material and protocol state transitions.

The Reunion paper states:

For the linked protocol variant: For every other t1 message, they construct and transmit a respective t2 message. For every t2 message sent in reply to their own t1, they construct and transmit a t3 message.

func NewExchange

func NewExchange(
	payload []byte,
	log *logging.Logger,
	db server.ReunionDatabase,
	contactID uint64,
	passphrase []byte,
	sharedRandomValue []byte,
	epoch uint64,
	updateChan chan ReunionUpdate) (*Exchange, error)

NewExchange creates a new Exchange struct type.

func NewExchangeFromSnapshot

func NewExchangeFromSnapshot(
	serialized []byte,
	log *logging.Logger,
	db server.ReunionDatabase,
	updateChan chan ReunionUpdate) (*Exchange, error)

NewExchangeFromSnapshot creates a new Exchange given a snapshot blob.

func (*Exchange) Marshal

func (e *Exchange) Marshal() ([]byte, error)

Marshal returns a serialization of the Exchange or an error. XXX fix me; added many more fields since this was written...

func (*Exchange) Run

func (e *Exchange) Run()

Run performs the Reunion exchange and expresses a simple FSM which uses the updateChan to save it's state after each state transition. This method is meant to run in it's own goroutine.

func (*Exchange) Unmarshal

func (e *Exchange) Unmarshal(data []byte) error

Unmarshal returns an error if the given data fails to be deserialized.

type ExchangeHash

type ExchangeHash [32]byte

ExchangeHash is a 32 byte array which represents a hash of one of our cryptographic messages, t1 hash, t2 hash etc.

type ReunionUpdate

type ReunionUpdate struct {
	// ContactID is the unique contact identity.
	ContactID uint64
	// ExchangeID is the unique reunion exchange identity.
	ExchangeID uint64
	// Error contains an error or nil if no error.
	Error error
	// Serialized is the serialized Exchange state.
	Serialized []byte
	// Result is the received decrypted T1 message payload.
	Result []byte
}

ReunionUpdate represents an update to the reunion client state or to report a failure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto