libtalek

package
v0.0.0-...-57ac6aa Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: BSD-2-Clause Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const PublishingOverhead = box.Overhead + ed25519.SignatureSize

PublishingOverhead represents the number of additional bytes used by encryption and signing.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b *Handle) bool

Equal tests equality of two handles

Types

type Client

type Client struct {

	// for debugging / testing
	Verbose bool
	Rand    io.Reader
	// contains filtered or unexported fields
}

Client represents a connection to the Talek system. Typically created with NewClient, the object manages requests, both reads an writes.

func NewClient

func NewClient(name string, config ClientConfig, leader common.FrontendInterface) *Client

NewClient creates a Talek client for reading and writing metadata-protected messages.

func (*Client) Done

func (c *Client) Done(handle *Handle) bool

Done unsubscribes a Handle from being Polled for new items.

func (*Client) Flush

func (c *Client) Flush()

Flush blocks until the the client has finished in-progress reads and writes.

func (*Client) Kill

func (c *Client) Kill()

Kill stops client processing. This allows for graceful shutdown or suspension of requests.

func (*Client) MaxLength

func (c *Client) MaxLength() uint64

MaxLength returns the maximum allowed message the client can Publish. TODO: support messages spanning multiple data items.

func (*Client) Poll

func (c *Client) Poll(handle *Handle) chan []byte

Poll handles to updates on a given log. When done reading messages, the channel can be closed via the Done method.

func (*Client) Publish

func (c *Client) Publish(handle *Topic, data []byte) error

Publish a new message to the end of a topic.

func (*Client) SetConfig

func (c *Client) SetConfig(config ClientConfig)

SetConfig allows updating the configuration of a Client, e.g. if server memebership or speed characteristics for the system are changed.

type ClientConfig

type ClientConfig struct {
	*common.Config

	// How often should Writes be made to the server
	WriteInterval time.Duration `json:",string"`

	// How often should reads be made to the server
	ReadInterval time.Duration `json:",string"`

	// Where are the different servers?
	TrustDomains []*common.TrustDomainConfig

	// Where should the client connect?
	FrontendAddr string
}

ClientConfig represents the configuration parameters to Talek needed by the client.

func ClientConfigFromFile

func ClientConfigFromFile(file string) *ClientConfig

ClientConfigFromFile restores a client configuration from on-disk form.

type Handle

type Handle struct {

	// For learning log positions
	Seed1 *drbg.Seed
	Seed2 *drbg.Seed

	// For decrypting messages
	SharedSecret     *[32]byte
	SigningPublicKey *[32]byte

	// Current log position
	Seqno uint64
	// contains filtered or unexported fields
}

Handle is the readable component of a Talek Log. Handles are created by making a NewTopic, but can be independently shared, and restored from a serialized state. A Handle is read by calling Client.Poll(handle) to receive a channel with new messages read from the Handle.

func NewHandle

func NewHandle() (h *Handle, err error)

NewHandle creates a new topic handle, without attachment to a specific topic.

func (*Handle) Decrypt

func (h *Handle) Decrypt(cyphertext []byte, nonce *[24]byte) ([]byte, error)

Decrypt attempts decryption of a message for a topic using a specific nonce.

func (*Handle) MarshalText

func (h *Handle) MarshalText() ([]byte, error)

MarshalText is a compact textual representation of a handle

func (*Handle) OnResponse

func (h *Handle) OnResponse(args *common.ReadArgs, reply *common.ReadReply, dataSize uint)

OnResponse processes a response for a request generated by generatePoll, sending it to the handle's updates channel if valid.

func (*Handle) UnmarshalText

func (h *Handle) UnmarshalText(text []byte) error

UnmarshalText restores a handle from its compact textual representation

type Topic

type Topic struct {

	// For updates?
	ID uint64

	// For authenticity
	// TODO: this should ratchet.
	SigningPrivateKey *[64]byte `json:",omitempty"`

	Handle
}

Topic is a writiable Talek log. A topic is created by calling NewTopic(). New items are published with a client via client.Publish(&topic, "Msg"). Messages can be read from the topic through its contained handle.

func NewTopic

func NewTopic() (t *Topic, err error)

NewTopic creates a new Topic, or fails if the system randomness isn't appropriately configured.

func (*Topic) GeneratePublish

func (t *Topic) GeneratePublish(commonConfig *common.Config, message []byte) (*common.WriteArgs, error)

GeneratePublish creates a set of write args for writing message as the next entry in this topic log.

func (*Topic) MarshalText

func (t *Topic) MarshalText() ([]byte, error)

MarshalText is a compact textual representation of a topic

func (*Topic) UnmarshalText

func (t *Topic) UnmarshalText(text []byte) error

UnmarshalText restores a topic from its compact textual representation

Jump to

Keyboard shortcuts

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