client

package
v0.0.0-...-9a70a3a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2016 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ENCRYPT_ADDED_LEN = 168
View Source
const ENCRYPT_FIRST_ADDED_LEN = 200
View Source
const PROFILE_FIELD_ID = 1984

Variables

This section is empty.

Functions

func CheckAuthWith

func CheckAuthWith(prt ProfileRatchet) func([]byte, []byte, []byte, *[32]byte) error

func CreateAccount

func CreateAccount(conn *transport.Conn, inBuf []byte) error

func CreateTestAccount

func CreateTestAccount(name string, denameClient *client.Client, secretConfig *proto.LocalAccountConfig, serverAddr string, serverPk *[32]byte, t testing.TB) *transport.Conn

func CreateTestDenameAccount

func CreateTestDenameAccount(name string, denameClient *client.Client, secretConfig *proto.LocalAccountConfig, serverAddr string, serverPk *[32]byte, t testing.TB)

func CreateTestHomeServerConn

func CreateTestHomeServerConn(dename string, denameClient *client.Client, secretConfig *proto.LocalAccountConfig, t testing.TB) *transport.Conn

func DecryptAuth

func DecryptAuth(in []byte, ratch *ratchet.Ratchet) (*ratchet.Ratchet, []byte, error)

func DecryptAuthFirst

func DecryptAuthFirst(in []byte, pkList []*[32]byte, skList []*[32]byte, skAuth *[32]byte, prt ProfileRatchet) (*ratchet.Ratchet, []byte, int, error)

func DeleteMessages

func DeleteMessages(connToServer *ConnectionToServer, messageList []*[32]byte) error

func EnablePush

func EnablePush(connToServer *ConnectionToServer) error

func EncryptAuth

func EncryptAuth(message []byte, ratch *ratchet.Ratchet) ([]byte, *ratchet.Ratchet, error)

func EncryptAuthFirst

func EncryptAuthFirst(message []byte, skAuth *[32]byte, userKey *[32]byte, prt ProfileRatchet) ([]byte, *ratchet.Ratchet, error)

func FillAuthWith

func FillAuthWith(ourAuthPrivate *[32]byte) func([]byte, []byte, *[32]byte)

func GenerateLongTermKeys

func GenerateLongTermKeys(secretConfig *proto.LocalAccountConfig, publicProfile *proto.Profile, rand io.Reader) error

func GetKey

func GetKey(conn *transport.Conn, inBuf []byte, pk *[32]byte, dename string, pkSig *[32]byte) (*[32]byte, error)

func GetNumKeys

func GetNumKeys(connToServer *ConnectionToServer) (int64, error)

func ListUserMessages

func ListUserMessages(connToServer *ConnectionToServer) ([]*[32]byte, error)

func NewAnonDialer

func NewAnonDialer(torAddr string) proxy.Dialer

func ReceiveProtobuf

func ReceiveProtobuf(conn *transport.Conn, inBuf []byte) (*proto.ServerToClient, error)

func ReceiveReply

func ReceiveReply(connToServer *ConnectionToServer) (*proto.ServerToClient, error)

func RequestMessage

func RequestMessage(connToServer *ConnectionToServer, messageHash *[32]byte) error

func SignKeys

func SignKeys(keys []*[32]byte, sk *[64]byte) [][]byte

func UploadKeys

func UploadKeys(connToServer *ConnectionToServer, keyList [][]byte) error

func UploadMessageToUser

func UploadMessageToUser(conn *transport.Conn, inBuf []byte, pk *[32]byte, envelope []byte) error

func WriteProtobuf

func WriteProtobuf(conn *transport.Conn, message *proto.ClientToServer) error

Types

type ConnectionCache

type ConnectionCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConnectionCache

func NewConnectionCache(dialer proxy.Dialer) *ConnectionCache

func (*ConnectionCache) DialServer

func (cc *ConnectionCache) DialServer(cacheKey, addr string, port int, serverPK, pk, sk *[32]byte) (conn *transport.Conn, err error)

Caller MUST call Put or PutClose after this

func (*ConnectionCache) Put

func (cc *ConnectionCache) Put(k string, conn *transport.Conn)

func (*ConnectionCache) PutClose

func (cc *ConnectionCache) PutClose(k string)

there must be a conn with the key k and no Puts to k may be issued in parallel with Close

type ConnectionToServer

type ConnectionToServer struct {
	InBuf        []byte
	Conn         *transport.Conn
	ReadReply    chan *proto.ServerToClient // TODO: do we want to return an error?
	ReadEnvelope chan *EnvelopeWithId

	Shutdown     chan struct{}
	WaitShutdown sync.WaitGroup
}

func (*ConnectionToServer) ReceiveMessages

func (c *ConnectionToServer) ReceiveMessages() error

func (*ConnectionToServer) WriteProtobuf

func (conn *ConnectionToServer) WriteProtobuf(msg *proto.ClientToServer) error

type EnvelopeWithId

type EnvelopeWithId struct {
	Envelope []byte
	Id       *[32]byte
}

type ProfileRatchet

type ProfileRatchet func(string, *dename.ClientReply) (*dename.Profile, error)

Directories

Path Synopsis
watches the file system for new messages --> sends them communicates with the server --> receive new messages
watches the file system for new messages --> sends them communicates with the server --> receive new messages

Jump to

Keyboard shortcuts

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