catshadow: github.com/katzenpost/catshadow Index | Files | Directories

package catshadow

import "github.com/katzenpost/catshadow"

Index

Package Files

client.go contact.go disk.go events.go message.go operations.go worker.go

func LoadStateWriter Uses

func LoadStateWriter(log *logging.Logger, stateFile string, passphrase []byte) (*StateWriter, *State, error)

LoadStateWriter decrypts the given stateFile and returns the State as well as a new StateWriter.

func NewContactExchangeBytes Uses

func NewContactExchangeBytes(spoolWriteDescriptor *memspoolClient.SpoolWriteDescriptor, signedKeyExchange *ratchet.SignedKeyExchange) ([]byte, error)

NewContactExchangeBytes returns serialized contact exchange information.

type Client Uses

type Client struct {
    worker.Worker

    EventSink chan interface{}
    // contains filtered or unexported fields
}

Client is the mixnet client which interacts with other clients and services on the network.

func New Uses

func New(logBackend *log.Backend, mixnetClient *client.Client, stateWorker *StateWriter, state *State) (*Client, error)

New creates a new Client instance given a mixnetClient, stateWorker and state. This constructor is used to load the previously saved state of a Client.

func NewClientAndRemoteSpool Uses

func NewClientAndRemoteSpool(logBackend *log.Backend, mixnetClient *client.Client, stateWorker *StateWriter, user string, linkKey *ecdh.PrivateKey) (*Client, error)

NewClientAndRemoteSpool creates a new Client and creates a new remote spool for collecting messages destined to this Client. The Client is associated with this remote spool and this state is preserved in the encrypted statefile, of course. This constructor of Client is used when creating a new Client as opposed to loading the previously saved state for an existing Client.

func (*Client) CreateRemoteSpool Uses

func (c *Client) CreateRemoteSpool() error

CreateRemoteSpool creates a remote spool for collecting messages destined to this Client. This method blocks until the reply from the remote spool service is received or the round trip timeout is reached.

func (*Client) GetAllConversations Uses

func (c *Client) GetAllConversations() map[string]map[[constants.MessageIDLen]byte]*Message

func (*Client) GetConversation Uses

func (c *Client) GetConversation(nickname string) map[[constants.MessageIDLen]byte]*Message

func (*Client) GetNicknames Uses

func (c *Client) GetNicknames() []string

XXX do we even need this method?

func (*Client) NewContact Uses

func (c *Client) NewContact(nickname string, sharedSecret []byte)

NewContact adds a new contact to the Client's state. This starts the PANDA protocol instance for this contact where intermediate states will be preserved in the encrypted statefile such that progress on the PANDA key exchange can be continued at a later time after program shutdown or restart.

func (*Client) RemoveContact Uses

func (c *Client) RemoveContact(nickname string)

RemoveContact removes a contact from the Client's state.

func (*Client) SendMessage Uses

func (c *Client) SendMessage(nickname string, message []byte)

SendMessage sends a message to the Client contact with the given nickname.

func (*Client) Shutdown Uses

func (c *Client) Shutdown()

Shutdown shuts down the client.

func (*Client) Start Uses

func (c *Client) Start()

Start starts the client worker goroutine and the read-inbox worker goroutine.

type Contact Uses

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

Contact is a communications contact that we have bidirectional communication with.

func NewContact Uses

func NewContact(nickname string, id uint64, spoolReadDescriptor *memspoolClient.SpoolReadDescriptor, session *client.Session) (*Contact, error)

NewContact creates a new Contact or returns an error.

func (*Contact) ID Uses

func (c *Contact) ID() uint64

ID returns the Contact ID.

func (*Contact) MarshalBinary Uses

func (c *Contact) MarshalBinary() ([]byte, error)

MarshalBinary does what you expect and returns a serialized Contact.

func (*Contact) UnmarshalBinary Uses

func (c *Contact) UnmarshalBinary(data []byte) error

UnmarshalBinary does what you expect and initializes the given Contact with deserialized Contact fields from the given binary blob.

type KeyExchangeCompletedEvent Uses

type KeyExchangeCompletedEvent struct {
    // Nickname is the nickname of the contact with whom our key
    // exchange has been completed.
    Nickname string
    // Err is a key exchange error or is set to nil on success.
    Err error
}

KeyExchangeCompletedEvent is an event signaling the completion of a key exchange or failure if Err is non-nil.

type Message Uses

type Message struct {
    Plaintext []byte
    Timestamp time.Time
    Outbound  bool
}

Message encapsulates message that is sent or received.

type MessageDeliveredEvent Uses

type MessageDeliveredEvent struct {
    // Nickname is the nickname of the recipient of our delivered message.
    Nickname string

    // MessageID is the key in the conversation map referencing a specific message.
    MessageID [constants.MessageIDLen]byte
}

MessageDeliveredEvent is an event signaling that the message has been delivered.

type MessageReceivedEvent Uses

type MessageReceivedEvent struct {
    // Nickname is the nickname from whom we received a message.
    Nickname string
    // Message is the message content which was received.
    Message []byte
    // Timestamp is the time the message was received.
    Timestamp time.Time
}

MessageReceivedEvent is the event signaling that a message was received.

type MessageSentEvent Uses

type MessageSentEvent struct {
    // Nickname is the nickname of the recipient of our delivered message.
    Nickname string

    // MessageID is the key in the conversation map referencing a specific message.
    MessageID [constants.MessageIDLen]byte
}

MessageSentEvent is an event signaling that the message was sent.

type SentMessageDescriptor Uses

type SentMessageDescriptor struct {
    // Nickname is the contact nickname to whom a message was sent.
    Nickname string

    // MessageID is the key in the conversation map referencing a specific message.
    MessageID [constants.MessageIDLen]byte
}

type State Uses

type State struct {
    SpoolReadDescriptor *client.SpoolReadDescriptor
    Contacts            []*Contact
    User                string
    Provider            string
    LinkKey             *ecdh.PrivateKey
    Conversations       map[string]map[[constants.MessageIDLen]byte]*Message
}

State is the struct type representing the Client's state which is encrypted and persisted to disk.

func GetStateFromFile Uses

func GetStateFromFile(stateFile string, passphrase []byte) (*State, *[keySize]byte, error)

type StateWriter Uses

type StateWriter struct {
    worker.Worker
    // contains filtered or unexported fields
}

StateWriter takes ownership of the Client's encrypted statefile and has a worker goroutine which writes updates to disk.

func NewStateWriter Uses

func NewStateWriter(log *logging.Logger, stateFile string, passphrase []byte) (*StateWriter, error)

NewStateWriter is a constructor for StateWriter which is to be used when creating the statefile for the first time.

func (*StateWriter) Start Uses

func (w *StateWriter) Start()

Start starts the StateWriter's worker goroutine.

Directories

PathSynopsis
configPackage config implements the configuration for catshadow.
constants

Package catshadow imports 27 packages (graph). Updated 2019-11-08. Refresh now. Tools for package owners.