Documentation ¶
Index ¶
- func CreateNewBundleIfNecessary(api ClientAPI, store ClientStore, pub crypto.IdentityPub, ...) (bool, error)
- func RenewPrekey(api ClientAPI, pub crypto.IdentityPub, priv crypto.IdentityPriv) (crypto.ExchangePub, crypto.ExchangePriv, error)
- func StartChat(api ClientAPI, store ClientStore, me crypto.IdentityPub, ...) (<-chan string, error)
- type ClientAPI
- type ClientStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNewBundleIfNecessary ¶
func CreateNewBundleIfNecessary(api ClientAPI, store ClientStore, pub crypto.IdentityPub, priv crypto.IdentityPriv) (bool, error)
func RenewPrekey ¶
func RenewPrekey(api ClientAPI, pub crypto.IdentityPub, priv crypto.IdentityPriv) (crypto.ExchangePub, crypto.ExchangePriv, error)
func StartChat ¶
func StartChat(api ClientAPI, store ClientStore, me crypto.IdentityPub, myPriv crypto.IdentityPriv, them crypto.IdentityPub, in <-chan string) (<-chan string, error)
Types ¶
type ClientAPI ¶
type ClientAPI interface { // SendPrekey registers a new prekey for this identity, accompanied with a signature SendPrekey(crypto.IdentityPub, crypto.ExchangePub, crypto.Signature) error // CountOnetimes asks how many onetime keys this identity has registered with a server CountOnetimes(crypto.IdentityPub) (int, error) // SendBundle sends out a bundle, accompanied with a signature SendBundle(crypto.IdentityPub, crypto.BundlePub, crypto.Signature) error // CreateSession accesses a new set of exchange keys for a session CreateSession(crypto.IdentityPub) (crypto.ExchangePub, crypto.Signature, crypto.ExchangePub, error) // Listen starts listening to messages directed towards your public identity // // This will spawn necssary goroutines to maintain the connection. // // This takes in a channel which will forward messages you want to send, and returns // a channel for receiving incoming messages Listen(crypto.IdentityPub, <-chan server.Message) (<-chan server.Message, error) }
func NewClientAPI ¶
type ClientStore ¶
type ClientStore interface { // GetIdentity returns the user's current identity, if any, or an error GetIdentity() (crypto.IdentityPub, error) // GetIdentity returns the user's current identity, and private key, if any, or an error GetFullIdentity() (crypto.IdentityPub, crypto.IdentityPriv, error) // SaveIdentity saves an identity key-pair, replacing any existing identity SaveIdentity(crypto.IdentityPub, crypto.IdentityPriv) error // AddFriend registers a friend by identity, and name AddFriend(crypto.IdentityPub, string) error // GetFriend looks up a friend's identity key, using their name GetFriend(string) (crypto.IdentityPub, error) // SavePrekey saves a full prekey pair, possibly failing SavePrekey(crypto.ExchangePub, crypto.ExchangePriv) error // SaveBundle saves the public and private parts of a bundle, possibly failing SaveBundle(crypto.BundlePub, crypto.BundlePriv) error // GetPreKey retrieves the private part of a prekey GetPrekey(crypto.ExchangePub) (crypto.ExchangePriv, error) // HasPreKey checks if a prekey exists at all HasPrekey() (bool, error) // BurnOneTime retrieves a one time key, also deleting it BurnOnetime(crypto.ExchangePub) (crypto.ExchangePriv, error) }
ClientStore represents a store for information local to the client application.
This allows us to store things like a user's personal private keys, and other information that's useful for the application.
func NewStore ¶
func NewStore(database string) (ClientStore, error)
NewStore creates a new ClientStore given a path to a local database.
This will create the database file as necessary.
If this string is empty, a default database, placed in the user's Home directory, is used instead.
Click to show internal directories.
Click to hide internal directories.