Documentation ¶
Overview ¶
Package client implements all client used functions that relates to the interaction with external services typically APIs.
Index ¶
- Constants
- type Client
- func (c *Client) GetRecipientPublicKey(recipientIds []string) (*KeybaseUserLookupRes, error)
- func (c *Client) PostMessage(session *messages.SessionKeys, message []byte) (uint64, error)
- func (c *Client) PostNewSession(session *messages.SessionKeys, recipients openpgp.EntityList, ttl uint64) (*PostNewSessionResp, error)
- type HandshakeMsg
- type KeybaseBasicsRes
- type KeybasePictureRes
- type KeybasePicturesRes
- type KeybaseProfileRes
- type KeybasePublicKeyRes
- type KeybasePublicKeysRes
- type KeybaseStatusRes
- type KeybaseThemRes
- type KeybaseUserLookupRes
- type MessageRequest
- type MessageResponse
- type PostNewSessionResp
Constants ¶
const (
RootLookupUrl = "_/api/1.0/user/lookup.json" // base URL path.
)
Constant Keybase root paths.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Sessions []messages.SessionKeys `json:"-" xml:"-"` // client opened sessions; PrivateKey *openpgp.Entity `json:"-" xml:"-"` // user's in memory private key; PublicKey *openpgp.Entity `json:"-" xml:"-"` // user's in memory public key; RecipientsCache map[string]openpgp.EntityList `json:"-" xml:"-"` // cached recipients; ApiKey string `json:"-" xml:"-"` // api key used to identify client app; ServerUrl string `json:"-" xml:"-"` // backend server url; ServerKeys openpgp.EntityList `json:"-" xml:"-"` // backend server keys; KeyserverKeys openpgp.EntityList `json:"-" xml:"-"` // the public keys of the server specified in the url; KeyserverUrl string `json:"-" xml:"-"` // key servers. }
Client represent the base in memory structure used to represent the user acting and all service related infos.
func NewClient ¶
NewClient creates a new client struct starting minimum required data: keyserver url, 3nigm4 url and a keyring path address.
func (*Client) GetRecipientPublicKey ¶
func (c *Client) GetRecipientPublicKey(recipientIds []string) (*KeybaseUserLookupRes, error)
GetRecipientPublicKey uses Keybase APIs to retrieve recipient's PGP public key, if any.
func (*Client) PostMessage ¶
PostMessage send a new chat message to the server and manage the produced response.
func (*Client) PostNewSession ¶
func (c *Client) PostNewSession(session *messages.SessionKeys, recipients openpgp.EntityList, ttl uint64) (*PostNewSessionResp, error)
PostNewSession request the server to create a new session targeting some users.
type HandshakeMsg ¶
type HandshakeMsg struct { SessionKeys []byte `json:"sessionk"` ServerKeys []byte `json:"serverk"` }
HandshakeMsg is the message used in handshake operations for the chat functionality this structure is used to exchange all session related keys.
type KeybaseBasicsRes ¶
type KeybaseBasicsRes struct { Username string `json:"username"` Ctime uint `json:"ctime"` Mtime uint `json:"mtime"` IdVersion int `json:"id_version"` TrackVersion int `json:"track_version"` LastIdChange uint `json:"last_id_change"` UsernameCased string `json:"username_cased"` }
KeybaseBasicsRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybasePictureRes ¶
type KeybasePictureRes struct { Url string `json:"url"` Width uint `json:"width"` Height uint `json:"height"` }
KeybasePictureRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybasePicturesRes ¶
type KeybasePicturesRes struct {
Primary KeybasePictureRes `json:"primary"`
}
KeybasePicturesRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybaseProfileRes ¶
type KeybaseProfileRes struct { Mtime uint `json:"mtime"` FullName string `json:"full_name"` Location string `json:"location"` Bio string `json:"bio"` }
KeybaseProfileRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybasePublicKeyRes ¶
type KeybasePublicKeyRes struct { KeyFingerprint string `json:"key_fingerprint"` Kid string `json:"kid"` SigningKid string `json:"signing_kid"` KeyType int `json:"key_type"` Bundle string `json:"bundle"` Mtime uint `json:"mtime"` Ctime uint `json:"ctime"` Ukbid string `json:"ukbid"` KeyBits uint `json:"key_bits"` KeyAlgo uint `json:"key_algo"` KeyLevel uint `json:"key_level"` Status int `json:"status"` SelfSigned bool `json:"self_signed"` ExpirationTime uint `json:"etime"` }
KeybasePublicKeyRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybasePublicKeysRes ¶
type KeybasePublicKeysRes struct { Primary KeybasePublicKeyRes `json:"primary"` PgpPublicKeys []string `json:"pgp_public_keys"` }
KeybasePublicKeysRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybaseStatusRes ¶
KeybaseStatusRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybaseThemRes ¶
type KeybaseThemRes struct { Id string `json:"id"` Basics KeybaseBasicsRes `json:"basics"` Pictures KeybasePicturesRes `json:"pictures"` PublicKeys KeybasePublicKeysRes `json:"public_keys"` CsrfToken []byte `json:"csrf_token"` Profile KeybaseProfileRes `json:"profile"` }
KeybaseThemRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type KeybaseUserLookupRes ¶
type KeybaseUserLookupRes struct { Status KeybaseStatusRes `json:"status"` Them []KeybaseThemRes `json:"them"` }
KeybaseUserLookupRes keybase response structures see https://keybase.io/docs/api/1.0/call/user/lookup for details.
type MessageRequest ¶
type MessageRequest struct { SessionId []byte `json:"sessionid"` MessageBody []byte `json:"messagebody"` }
MessageRequest structu represent a chat message.
type MessageResponse ¶
type MessageResponse struct {
Counter uint64 `json:"counter"`
}
MessageResponse is returned by the server when a message request is sent.
type PostNewSessionResp ¶
type PostNewSessionResp struct {
SessionId []byte `json:"sessionid"`
}
PostNewSessionResp struct used to create a new session for chatting via REST APIs.