Documentation ¶
Index ¶
- type Backend
- func (b *Backend) AddRequestHandler(handler RequestHandler)
- func (b *Backend) Close() error
- func (b *Backend) FetchPreKeyBundle(userIDPubKey ed25519.PublicKey) (x3dh.PreKeyBundle, error)
- func (b *Backend) FetchSignedPreKey(userIdPubKey ed25519.PublicKey) (preKey.PreKey, error)
- func (b *Backend) SubmitMessages(messages []*bpb.ChatMessage) error
- type PreKeyBundle
- type RequestHandler
- type ServerConfig
- type Transport
- type WSTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func NewBackend ¶
func NewBackend(trans Transport, km *km.KeyManager, signedPreKeyStorage db.SignedPreKeyStorage) (*Backend, error)
func (*Backend) AddRequestHandler ¶
func (b *Backend) AddRequestHandler(handler RequestHandler)
Add request handler that will be executed
func (*Backend) FetchPreKeyBundle ¶
fetch pre key bundle from backend
func (*Backend) FetchSignedPreKey ¶
fetch signed pre key of person
func (*Backend) SubmitMessages ¶
func (b *Backend) SubmitMessages(messages []*bpb.ChatMessage) error
submit messages
type PreKeyBundle ¶
type PreKeyBundle struct {
// contains filtered or unexported fields
}
func PreKeyBundleFromProto ¶
func PreKeyBundleFromProto(pubKey ed25519.PublicKey, protoPreKeyBundle *bpb.BackendMessage_PreKeyBundle) (*PreKeyBundle, error)
func (*PreKeyBundle) IdentityKey ¶
func (b *PreKeyBundle) IdentityKey() x3dh.PublicKey
func (*PreKeyBundle) OneTimePreKey ¶
func (b *PreKeyBundle) OneTimePreKey() *x3dh.PublicKey
func (*PreKeyBundle) SignedPreKey ¶
func (b *PreKeyBundle) SignedPreKey() x3dh.PublicKey
func (*PreKeyBundle) ValidSignature ¶
func (b *PreKeyBundle) ValidSignature() (bool, error)
type RequestHandler ¶
type RequestHandler func(req *bpb.BackendMessage_Request) (*bpb.BackendMessage_Response, error)
IMPORTANT - the returned error will be send to the backend. Make sure it only return an error message that doesn't have private information
type ServerConfig ¶
type Transport ¶
type Transport interface { // will be called by the backend to send a message Send(msg *bpb.BackendMessage) error // will return the next message from the transport NextMessage() (*bpb.BackendMessage, error) // close the transport Close() error }
type WSTransport ¶
type WSTransport struct {
// contains filtered or unexported fields
}
func NewWSTransport ¶
func NewWSTransport(endpoint, bearerToken string, km *keyManager.KeyManager) *WSTransport
func (*WSTransport) Close ¶
func (t *WSTransport) Close() error
func (*WSTransport) NextMessage ¶
func (t *WSTransport) NextMessage() (*bpb.BackendMessage, error)
func (*WSTransport) Send ¶
func (t *WSTransport) Send(msg *bpb.BackendMessage) error
Click to show internal directories.
Click to hide internal directories.