Documentation
¶
Index ¶
- Variables
- func DirectMessageToWhisper(rpcMsg SendDirectMessageRPC, payload []byte) whisper.NewMessage
- func ExtractIdentity(bundle *Bundle) (string, error)
- func PerformActiveDH(publicKey *ecdsa.PublicKey) ([]byte, *ecdsa.PublicKey, error)
- func PerformActiveX3DH(identity []byte, signedPreKey []byte, prv *ecdsa.PrivateKey) ([]byte, *ecdsa.PublicKey, error)
- func PerformDH(privateKey *ecies.PrivateKey, publicKey *ecies.PublicKey) ([]byte, error)
- func PerformPassiveX3DH(theirIdentityKey *ecdsa.PublicKey, mySignedPreKey *ecdsa.PrivateKey, ...) ([]byte, error)
- func PublicMessageToWhisper(rpcMsg SendPublicMessageRPC, payload []byte) whisper.NewMessage
- func SignBundle(identity *ecdsa.PrivateKey, bundleContainer *BundleContainer) error
- func VerifyBundle(bundle *Bundle) error
- type Bundle
- func (*Bundle) Descriptor() ([]byte, []int)
- func (m *Bundle) GetIdentity() []byte
- func (m *Bundle) GetSignature() []byte
- func (m *Bundle) GetSignedPreKeys() map[string]*SignedPreKey
- func (m *Bundle) GetTimestamp() int64
- func (*Bundle) ProtoMessage()
- func (m *Bundle) Reset()
- func (m *Bundle) String() string
- func (bundle *Bundle) ToBase64() (string, error)
- func (m *Bundle) XXX_DiscardUnknown()
- func (m *Bundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Bundle) XXX_Merge(src proto.Message)
- func (m *Bundle) XXX_Size() int
- func (m *Bundle) XXX_Unmarshal(b []byte) error
- type BundleContainer
- func (*BundleContainer) Descriptor() ([]byte, []int)
- func (m *BundleContainer) GetBundle() *Bundle
- func (m *BundleContainer) GetPrivateSignedPreKey() []byte
- func (*BundleContainer) ProtoMessage()
- func (m *BundleContainer) Reset()
- func (m *BundleContainer) String() string
- func (m *BundleContainer) XXX_DiscardUnknown()
- func (m *BundleContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BundleContainer) XXX_Merge(src proto.Message)
- func (m *BundleContainer) XXX_Size() int
- func (m *BundleContainer) XXX_Unmarshal(b []byte) error
- type ChatMessagePayload
- func (*ChatMessagePayload) Descriptor() ([]byte, []int)
- func (m *ChatMessagePayload) GetClockValue() float64
- func (m *ChatMessagePayload) GetContent() string
- func (m *ChatMessagePayload) GetContentType() string
- func (m *ChatMessagePayload) GetMessageType() string
- func (*ChatMessagePayload) ProtoMessage()
- func (m *ChatMessagePayload) Reset()
- func (m *ChatMessagePayload) String() string
- func (m *ChatMessagePayload) XXX_DiscardUnknown()
- func (m *ChatMessagePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ChatMessagePayload) XXX_Merge(src proto.Message)
- func (m *ChatMessagePayload) XXX_Size() int
- func (m *ChatMessagePayload) XXX_Unmarshal(b []byte) error
- type ChatProtocolMessage
- func (*ChatProtocolMessage) Descriptor() ([]byte, []int)
- func (m *ChatProtocolMessage) GetPayload() []byte
- func (*ChatProtocolMessage) ProtoMessage()
- func (m *ChatProtocolMessage) Reset()
- func (m *ChatProtocolMessage) String() string
- func (m *ChatProtocolMessage) XXX_DiscardUnknown()
- func (m *ChatProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ChatProtocolMessage) XXX_Merge(src proto.Message)
- func (m *ChatProtocolMessage) XXX_Size() int
- func (m *ChatProtocolMessage) XXX_Unmarshal(b []byte) error
- type ContactUpdatePayload
- func (*ContactUpdatePayload) Descriptor() ([]byte, []int)
- func (m *ContactUpdatePayload) GetAddress() string
- func (m *ContactUpdatePayload) GetFcmToken() string
- func (m *ContactUpdatePayload) GetName() string
- func (m *ContactUpdatePayload) GetProfileImage() string
- func (*ContactUpdatePayload) ProtoMessage()
- func (m *ContactUpdatePayload) Reset()
- func (m *ContactUpdatePayload) String() string
- func (m *ContactUpdatePayload) XXX_DiscardUnknown()
- func (m *ContactUpdatePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ContactUpdatePayload) XXX_Merge(src proto.Message)
- func (m *ContactUpdatePayload) XXX_Size() int
- func (m *ContactUpdatePayload) XXX_Unmarshal(b []byte) error
- type ContactUpdateRPC
- func (*ContactUpdateRPC) Descriptor() ([]byte, []int)
- func (m *ContactUpdateRPC) GetDst() string
- func (m *ContactUpdateRPC) GetPayload() *ContactUpdatePayload
- func (m *ContactUpdateRPC) GetSrc() string
- func (*ContactUpdateRPC) ProtoMessage()
- func (m *ContactUpdateRPC) Reset()
- func (m *ContactUpdateRPC) String() string
- func (m *ContactUpdateRPC) XXX_DiscardUnknown()
- func (m *ContactUpdateRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ContactUpdateRPC) XXX_Merge(src proto.Message)
- func (m *ContactUpdateRPC) XXX_Size() int
- func (m *ContactUpdateRPC) XXX_Unmarshal(b []byte) error
- type DHHeader
- func (*DHHeader) Descriptor() ([]byte, []int)
- func (m *DHHeader) GetKey() []byte
- func (*DHHeader) ProtoMessage()
- func (m *DHHeader) Reset()
- func (m *DHHeader) String() string
- func (m *DHHeader) XXX_DiscardUnknown()
- func (m *DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DHHeader) XXX_Merge(src proto.Message)
- func (m *DHHeader) XXX_Size() int
- func (m *DHHeader) XXX_Unmarshal(b []byte) error
- type DRHeader
- func (*DRHeader) Descriptor() ([]byte, []int)
- func (m *DRHeader) GetId() []byte
- func (m *DRHeader) GetKey() []byte
- func (m *DRHeader) GetN() uint32
- func (m *DRHeader) GetPn() uint32
- func (*DRHeader) ProtoMessage()
- func (m *DRHeader) Reset()
- func (m *DRHeader) String() string
- func (m *DRHeader) XXX_DiscardUnknown()
- func (m *DRHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DRHeader) XXX_Merge(src proto.Message)
- func (m *DRHeader) XXX_Size() int
- func (m *DRHeader) XXX_Unmarshal(b []byte) error
- type DirectMessageProtocol
- func (*DirectMessageProtocol) Descriptor() ([]byte, []int)
- func (m *DirectMessageProtocol) GetDHHeader() *DHHeader
- func (m *DirectMessageProtocol) GetDRHeader() *DRHeader
- func (m *DirectMessageProtocol) GetPayload() []byte
- func (m *DirectMessageProtocol) GetX3DHHeader() *X3DHHeader
- func (*DirectMessageProtocol) ProtoMessage()
- func (m *DirectMessageProtocol) Reset()
- func (m *DirectMessageProtocol) String() string
- func (m *DirectMessageProtocol) XXX_DiscardUnknown()
- func (m *DirectMessageProtocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *DirectMessageProtocol) XXX_Merge(src proto.Message)
- func (m *DirectMessageProtocol) XXX_Size() int
- func (m *DirectMessageProtocol) XXX_Unmarshal(b []byte) error
- type EncryptionService
- func (s *EncryptionService) CreateBundle(privateKey *ecdsa.PrivateKey) (*Bundle, error)
- func (s *EncryptionService) DecryptPayload(myIdentityKey *ecdsa.PrivateKey, theirIdentityKey *ecdsa.PublicKey, ...) ([]byte, error)
- func (s *EncryptionService) DecryptWithDH(myIdentityKey *ecdsa.PrivateKey, theirEphemeralKey *ecdsa.PublicKey, ...) ([]byte, error)
- func (s *EncryptionService) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
- func (s *EncryptionService) EnableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
- func (s *EncryptionService) EncryptPayload(theirIdentityKey *ecdsa.PublicKey, myIdentityKey *ecdsa.PrivateKey, ...) (map[string]*DirectMessageProtocol, error)
- func (s *EncryptionService) EncryptPayloadWithDH(theirIdentityKey *ecdsa.PublicKey, payload []byte) (map[string]*DirectMessageProtocol, error)
- func (s *EncryptionService) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, b *Bundle) ([]IdentityAndIDPair, error)
- type HandleMessageResponse
- type IdentityAndIDPair
- type OneToOneRPC
- func (*OneToOneRPC) Descriptor() ([]byte, []int)
- func (m *OneToOneRPC) GetDst() string
- func (m *OneToOneRPC) GetPayload() []byte
- func (m *OneToOneRPC) GetSrc() string
- func (*OneToOneRPC) ProtoMessage()
- func (m *OneToOneRPC) Reset()
- func (m *OneToOneRPC) String() string
- func (m *OneToOneRPC) XXX_DiscardUnknown()
- func (m *OneToOneRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *OneToOneRPC) XXX_Merge(src proto.Message)
- func (m *OneToOneRPC) XXX_Size() int
- func (m *OneToOneRPC) XXX_Unmarshal(b []byte) error
- type PersistenceService
- type ProtocolMessage
- func (*ProtocolMessage) Descriptor() ([]byte, []int)
- func (m *ProtocolMessage) GetBundle() *Bundle
- func (m *ProtocolMessage) GetDirectMessage() map[string]*DirectMessageProtocol
- func (m *ProtocolMessage) GetInstallationId() string
- func (m *ProtocolMessage) GetPublicMessage() []byte
- func (*ProtocolMessage) ProtoMessage()
- func (m *ProtocolMessage) Reset()
- func (m *ProtocolMessage) String() string
- func (m *ProtocolMessage) XXX_DiscardUnknown()
- func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProtocolMessage) XXX_Merge(src proto.Message)
- func (m *ProtocolMessage) XXX_Size() int
- func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error
- type ProtocolService
- func (p *ProtocolService) BuildDirectMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte, ...) (map[*ecdsa.PublicKey][]byte, error)
- func (p *ProtocolService) BuildPairingMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte) ([]byte, error)
- func (p *ProtocolService) BuildPublicMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte) ([]byte, error)
- func (p *ProtocolService) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
- func (p *ProtocolService) EnableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
- func (p *ProtocolService) GetBundle(myIdentityKey *ecdsa.PrivateKey) (*Bundle, error)
- func (p *ProtocolService) HandleMessage(myIdentityKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, ...) (*HandleMessageResponse, error)
- func (p *ProtocolService) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *Bundle) ([]IdentityAndIDPair, error)
- type RatchetInfo
- type SQLLiteKeysStorage
- func (s *SQLLiteKeysStorage) All() (map[dr.Key]map[uint]dr.Key, error)
- func (s *SQLLiteKeysStorage) Count(pubKey dr.Key) (uint, error)
- func (s *SQLLiteKeysStorage) DeleteMk(pubKey dr.Key, msgNum uint) error
- func (s *SQLLiteKeysStorage) DeleteOldMks(sessionID []byte, deleteUntil uint) error
- func (s *SQLLiteKeysStorage) Get(pubKey dr.Key, msgNum uint) (dr.Key, bool, error)
- func (s *SQLLiteKeysStorage) Put(sessionID []byte, pubKey dr.Key, msgNum uint, mk dr.Key, seqNum uint) error
- func (s *SQLLiteKeysStorage) TruncateMks(sessionID []byte, maxKeysPerSession int) error
- type SQLLitePersistence
- func (s *SQLLitePersistence) AddInstallations(identity []byte, timestamp int64, installationIDs []string, ...) error
- func (s *SQLLitePersistence) AddPrivateBundle(b *BundleContainer) error
- func (s *SQLLitePersistence) AddPublicBundle(b *Bundle) error
- func (s *SQLLitePersistence) AddRatchetInfo(key []byte, identity []byte, bundleID []byte, ephemeralKey []byte, ...) error
- func (s *SQLLitePersistence) DisableInstallation(identity []byte, installationID string) error
- func (s *SQLLitePersistence) EnableInstallation(identity []byte, installationID string) error
- func (s *SQLLitePersistence) GetActiveInstallations(maxInstallations uint, identity []byte) ([]string, error)
- func (s *SQLLitePersistence) GetAnyPrivateBundle(myIdentityKey []byte, installationIDs []string) (*BundleContainer, error)
- func (s *SQLLitePersistence) GetAnyRatchetInfo(identity []byte, installationID string) (*RatchetInfo, error)
- func (s *SQLLitePersistence) GetKeysStorage() dr.KeysStorage
- func (s *SQLLitePersistence) GetPrivateKeyBundle(bundleID []byte) ([]byte, error)
- func (s *SQLLitePersistence) GetPublicBundle(publicKey *ecdsa.PublicKey, installationIDs []string) (*Bundle, error)
- func (s *SQLLitePersistence) GetRatchetInfo(bundleID []byte, theirIdentity []byte, installationID string) (*RatchetInfo, error)
- func (s *SQLLitePersistence) GetSessionStorage() dr.SessionStorage
- func (s *SQLLitePersistence) MarkBundleExpired(identity []byte) error
- func (s *SQLLitePersistence) Open(path string, key string) error
- func (s *SQLLitePersistence) RatchetInfoConfirmed(bundleID []byte, theirIdentity []byte, installationID string) error
- type SQLLiteSessionStorage
- type SendDirectMessageRPC
- type SendGroupMessageRPC
- type SendPublicMessageRPC
- type SignedPreKey
- func (*SignedPreKey) Descriptor() ([]byte, []int)
- func (m *SignedPreKey) GetSignedPreKey() []byte
- func (m *SignedPreKey) GetVersion() uint32
- func (*SignedPreKey) ProtoMessage()
- func (m *SignedPreKey) Reset()
- func (m *SignedPreKey) String() string
- func (m *SignedPreKey) XXX_DiscardUnknown()
- func (m *SignedPreKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SignedPreKey) XXX_Merge(src proto.Message)
- func (m *SignedPreKey) XXX_Size() int
- func (m *SignedPreKey) XXX_Unmarshal(b []byte) error
- type X3DHHeader
- func (*X3DHHeader) Descriptor() ([]byte, []int)
- func (m *X3DHHeader) GetId() []byte
- func (m *X3DHHeader) GetKey() []byte
- func (*X3DHHeader) ProtoMessage()
- func (m *X3DHHeader) Reset()
- func (m *X3DHHeader) String() string
- func (m *X3DHHeader) XXX_DiscardUnknown()
- func (m *X3DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *X3DHHeader) XXX_Merge(src proto.Message)
- func (m *X3DHHeader) XXX_Size() int
- func (m *X3DHHeader) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrSessionNotFound = errors.New("session not found")
Functions ¶
func DirectMessageToWhisper ¶
func DirectMessageToWhisper(rpcMsg SendDirectMessageRPC, payload []byte) whisper.NewMessage
func ExtractIdentity ¶
ExtractIdentity extracts the identity key from a given bundle
func PerformActiveDH ¶
PerformActiveDH performs a Diffie-Hellman exchange using a public key and a generated ephemeral key. Returns the key resulting from the DH exchange as well as the ephemeral public key.
func PerformActiveX3DH ¶
func PerformActiveX3DH(identity []byte, signedPreKey []byte, prv *ecdsa.PrivateKey) ([]byte, *ecdsa.PublicKey, error)
PerformActiveX3DH takes someone else's bundle and calculates shared secret. Returns the shared secret and the ephemeral key used.
func PerformPassiveX3DH ¶
func PerformPassiveX3DH(theirIdentityKey *ecdsa.PublicKey, mySignedPreKey *ecdsa.PrivateKey, theirEphemeralKey *ecdsa.PublicKey, myPrivateKey *ecdsa.PrivateKey) ([]byte, error)
PerformPassiveX3DH handles the part of the protocol where our interlocutor used our bundle, with ID of the signedPreKey, we loaded our identity key and the correct signedPreKey and we perform X3DH
func PublicMessageToWhisper ¶
func PublicMessageToWhisper(rpcMsg SendPublicMessageRPC, payload []byte) whisper.NewMessage
func SignBundle ¶
func SignBundle(identity *ecdsa.PrivateKey, bundleContainer *BundleContainer) error
func VerifyBundle ¶
VerifyBundle checks that a bundle is valid
Types ¶
type Bundle ¶
type Bundle struct { // Identity key Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // Installation id SignedPreKeys map[string]*SignedPreKey `` /* 190-byte string literal not displayed */ // Prekey signature Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` // When the bundle was created locally Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
X3DH prekey bundle
func FromBase64 ¶
FromBase64 unmarshals a Bundle from a Base64 encoding representation of the protobuf Bundle message
func (*Bundle) Descriptor ¶
func (*Bundle) GetIdentity ¶
func (*Bundle) GetSignature ¶
func (*Bundle) GetSignedPreKeys ¶
func (m *Bundle) GetSignedPreKeys() map[string]*SignedPreKey
func (*Bundle) GetTimestamp ¶
func (*Bundle) ProtoMessage ¶
func (*Bundle) ProtoMessage()
func (*Bundle) ToBase64 ¶
ToBase64 returns a Base64 encoding representation of the protobuf Bundle message
func (*Bundle) XXX_DiscardUnknown ¶
func (m *Bundle) XXX_DiscardUnknown()
func (*Bundle) XXX_Marshal ¶
func (*Bundle) XXX_Unmarshal ¶
type BundleContainer ¶
type BundleContainer struct { // X3DH prekey bundle Bundle *Bundle `protobuf:"bytes,1,opt,name=bundle,proto3" json:"bundle,omitempty"` // Private signed prekey PrivateSignedPreKey []byte `protobuf:"bytes,2,opt,name=private_signed_pre_key,json=privateSignedPreKey,proto3" json:"private_signed_pre_key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func NewBundleContainer ¶
func NewBundleContainer(identity *ecdsa.PrivateKey, installationID string) (*BundleContainer, error)
NewBundleContainer creates a new BundleContainer from an identity private key
func (*BundleContainer) Descriptor ¶
func (*BundleContainer) Descriptor() ([]byte, []int)
func (*BundleContainer) GetBundle ¶
func (m *BundleContainer) GetBundle() *Bundle
func (*BundleContainer) GetPrivateSignedPreKey ¶
func (m *BundleContainer) GetPrivateSignedPreKey() []byte
func (*BundleContainer) ProtoMessage ¶
func (*BundleContainer) ProtoMessage()
func (*BundleContainer) Reset ¶
func (m *BundleContainer) Reset()
func (*BundleContainer) String ¶
func (m *BundleContainer) String() string
func (*BundleContainer) XXX_DiscardUnknown ¶
func (m *BundleContainer) XXX_DiscardUnknown()
func (*BundleContainer) XXX_Marshal ¶
func (m *BundleContainer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BundleContainer) XXX_Merge ¶
func (m *BundleContainer) XXX_Merge(src proto.Message)
func (*BundleContainer) XXX_Size ¶
func (m *BundleContainer) XXX_Size() int
func (*BundleContainer) XXX_Unmarshal ¶
func (m *BundleContainer) XXX_Unmarshal(b []byte) error
type ChatMessagePayload ¶
type ChatMessagePayload struct { // Message content Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // MIME type ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` // Message type MessageType string `protobuf:"bytes,3,opt,name=message_type,json=messageType,proto3" json:"message_type,omitempty"` // Sender's clock value for message ordering ClockValue float64 `protobuf:"fixed64,4,opt,name=clock_value,json=clockValue,proto3" json:"clock_value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
What is sent through the wire
func (*ChatMessagePayload) Descriptor ¶
func (*ChatMessagePayload) Descriptor() ([]byte, []int)
func (*ChatMessagePayload) GetClockValue ¶
func (m *ChatMessagePayload) GetClockValue() float64
func (*ChatMessagePayload) GetContent ¶
func (m *ChatMessagePayload) GetContent() string
func (*ChatMessagePayload) GetContentType ¶
func (m *ChatMessagePayload) GetContentType() string
func (*ChatMessagePayload) GetMessageType ¶
func (m *ChatMessagePayload) GetMessageType() string
func (*ChatMessagePayload) ProtoMessage ¶
func (*ChatMessagePayload) ProtoMessage()
func (*ChatMessagePayload) Reset ¶
func (m *ChatMessagePayload) Reset()
func (*ChatMessagePayload) String ¶
func (m *ChatMessagePayload) String() string
func (*ChatMessagePayload) XXX_DiscardUnknown ¶
func (m *ChatMessagePayload) XXX_DiscardUnknown()
func (*ChatMessagePayload) XXX_Marshal ¶
func (m *ChatMessagePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ChatMessagePayload) XXX_Merge ¶
func (m *ChatMessagePayload) XXX_Merge(src proto.Message)
func (*ChatMessagePayload) XXX_Size ¶
func (m *ChatMessagePayload) XXX_Size() int
func (*ChatMessagePayload) XXX_Unmarshal ¶
func (m *ChatMessagePayload) XXX_Unmarshal(b []byte) error
type ChatProtocolMessage ¶
type ChatProtocolMessage struct { Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Incoming messages
func (*ChatProtocolMessage) Descriptor ¶
func (*ChatProtocolMessage) Descriptor() ([]byte, []int)
func (*ChatProtocolMessage) GetPayload ¶
func (m *ChatProtocolMessage) GetPayload() []byte
func (*ChatProtocolMessage) ProtoMessage ¶
func (*ChatProtocolMessage) ProtoMessage()
func (*ChatProtocolMessage) Reset ¶
func (m *ChatProtocolMessage) Reset()
func (*ChatProtocolMessage) String ¶
func (m *ChatProtocolMessage) String() string
func (*ChatProtocolMessage) XXX_DiscardUnknown ¶
func (m *ChatProtocolMessage) XXX_DiscardUnknown()
func (*ChatProtocolMessage) XXX_Marshal ¶
func (m *ChatProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ChatProtocolMessage) XXX_Merge ¶
func (m *ChatProtocolMessage) XXX_Merge(src proto.Message)
func (*ChatProtocolMessage) XXX_Size ¶
func (m *ChatProtocolMessage) XXX_Size() int
func (*ChatProtocolMessage) XXX_Unmarshal ¶
func (m *ChatProtocolMessage) XXX_Unmarshal(b []byte) error
type ContactUpdatePayload ¶
type ContactUpdatePayload struct { // Contact display name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Contact profile image, using the data URI scheme (e.g. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAA...") ProfileImage string `protobuf:"bytes,2,opt,name=profile_image,json=profileImage,proto3" json:"profile_image,omitempty"` // Contact address Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` // Contact Firebase Cloud Messaging token FcmToken string `protobuf:"bytes,4,opt,name=fcm_token,json=fcmToken,proto3" json:"fcm_token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
ContactUpdatePayload is sent when a user updates its profile
func (*ContactUpdatePayload) Descriptor ¶
func (*ContactUpdatePayload) Descriptor() ([]byte, []int)
func (*ContactUpdatePayload) GetAddress ¶
func (m *ContactUpdatePayload) GetAddress() string
func (*ContactUpdatePayload) GetFcmToken ¶
func (m *ContactUpdatePayload) GetFcmToken() string
func (*ContactUpdatePayload) GetName ¶
func (m *ContactUpdatePayload) GetName() string
func (*ContactUpdatePayload) GetProfileImage ¶
func (m *ContactUpdatePayload) GetProfileImage() string
func (*ContactUpdatePayload) ProtoMessage ¶
func (*ContactUpdatePayload) ProtoMessage()
func (*ContactUpdatePayload) Reset ¶
func (m *ContactUpdatePayload) Reset()
func (*ContactUpdatePayload) String ¶
func (m *ContactUpdatePayload) String() string
func (*ContactUpdatePayload) XXX_DiscardUnknown ¶
func (m *ContactUpdatePayload) XXX_DiscardUnknown()
func (*ContactUpdatePayload) XXX_Marshal ¶
func (m *ContactUpdatePayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ContactUpdatePayload) XXX_Merge ¶
func (m *ContactUpdatePayload) XXX_Merge(src proto.Message)
func (*ContactUpdatePayload) XXX_Size ¶
func (m *ContactUpdatePayload) XXX_Size() int
func (*ContactUpdatePayload) XXX_Unmarshal ¶
func (m *ContactUpdatePayload) XXX_Unmarshal(b []byte) error
type ContactUpdateRPC ¶
type ContactUpdateRPC struct { Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` Dst string `protobuf:"bytes,2,opt,name=dst,proto3" json:"dst,omitempty"` Payload *ContactUpdatePayload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ContactUpdateRPC) Descriptor ¶
func (*ContactUpdateRPC) Descriptor() ([]byte, []int)
func (*ContactUpdateRPC) GetDst ¶
func (m *ContactUpdateRPC) GetDst() string
func (*ContactUpdateRPC) GetPayload ¶
func (m *ContactUpdateRPC) GetPayload() *ContactUpdatePayload
func (*ContactUpdateRPC) GetSrc ¶
func (m *ContactUpdateRPC) GetSrc() string
func (*ContactUpdateRPC) ProtoMessage ¶
func (*ContactUpdateRPC) ProtoMessage()
func (*ContactUpdateRPC) Reset ¶
func (m *ContactUpdateRPC) Reset()
func (*ContactUpdateRPC) String ¶
func (m *ContactUpdateRPC) String() string
func (*ContactUpdateRPC) XXX_DiscardUnknown ¶
func (m *ContactUpdateRPC) XXX_DiscardUnknown()
func (*ContactUpdateRPC) XXX_Marshal ¶
func (m *ContactUpdateRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ContactUpdateRPC) XXX_Merge ¶
func (m *ContactUpdateRPC) XXX_Merge(src proto.Message)
func (*ContactUpdateRPC) XXX_Size ¶
func (m *ContactUpdateRPC) XXX_Size() int
func (*ContactUpdateRPC) XXX_Unmarshal ¶
func (m *ContactUpdateRPC) XXX_Unmarshal(b []byte) error
type DHHeader ¶
type DHHeader struct { // Compressed ephemeral public key Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DHHeader) Descriptor ¶
func (*DHHeader) ProtoMessage ¶
func (*DHHeader) ProtoMessage()
func (*DHHeader) XXX_DiscardUnknown ¶
func (m *DHHeader) XXX_DiscardUnknown()
func (*DHHeader) XXX_Marshal ¶
func (*DHHeader) XXX_Unmarshal ¶
type DRHeader ¶
type DRHeader struct { // Current ratchet public key Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Number of the message in the sending chain N uint32 `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"` // Length of the previous sending chain Pn uint32 `protobuf:"varint,3,opt,name=pn,proto3" json:"pn,omitempty"` // Bundle ID Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*DRHeader) Descriptor ¶
func (*DRHeader) ProtoMessage ¶
func (*DRHeader) ProtoMessage()
func (*DRHeader) XXX_DiscardUnknown ¶
func (m *DRHeader) XXX_DiscardUnknown()
func (*DRHeader) XXX_Marshal ¶
func (*DRHeader) XXX_Unmarshal ¶
type DirectMessageProtocol ¶
type DirectMessageProtocol struct { X3DHHeader *X3DHHeader `protobuf:"bytes,1,opt,name=X3DH_header,json=X3DHHeader,proto3" json:"X3DH_header,omitempty"` DRHeader *DRHeader `protobuf:"bytes,2,opt,name=DR_header,json=DRHeader,proto3" json:"DR_header,omitempty"` DHHeader *DHHeader `protobuf:"bytes,101,opt,name=DH_header,json=DHHeader,proto3" json:"DH_header,omitempty"` // Encrypted payload Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Direct message value
func (*DirectMessageProtocol) Descriptor ¶
func (*DirectMessageProtocol) Descriptor() ([]byte, []int)
func (*DirectMessageProtocol) GetDHHeader ¶
func (m *DirectMessageProtocol) GetDHHeader() *DHHeader
func (*DirectMessageProtocol) GetDRHeader ¶
func (m *DirectMessageProtocol) GetDRHeader() *DRHeader
func (*DirectMessageProtocol) GetPayload ¶
func (m *DirectMessageProtocol) GetPayload() []byte
func (*DirectMessageProtocol) GetX3DHHeader ¶
func (m *DirectMessageProtocol) GetX3DHHeader() *X3DHHeader
func (*DirectMessageProtocol) ProtoMessage ¶
func (*DirectMessageProtocol) ProtoMessage()
func (*DirectMessageProtocol) Reset ¶
func (m *DirectMessageProtocol) Reset()
func (*DirectMessageProtocol) String ¶
func (m *DirectMessageProtocol) String() string
func (*DirectMessageProtocol) XXX_DiscardUnknown ¶
func (m *DirectMessageProtocol) XXX_DiscardUnknown()
func (*DirectMessageProtocol) XXX_Marshal ¶
func (m *DirectMessageProtocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*DirectMessageProtocol) XXX_Merge ¶
func (m *DirectMessageProtocol) XXX_Merge(src proto.Message)
func (*DirectMessageProtocol) XXX_Size ¶
func (m *DirectMessageProtocol) XXX_Size() int
func (*DirectMessageProtocol) XXX_Unmarshal ¶
func (m *DirectMessageProtocol) XXX_Unmarshal(b []byte) error
type EncryptionService ¶
type EncryptionService struct {
// contains filtered or unexported fields
}
EncryptionService defines a service that is responsible for the encryption aspect of the protocol.
func NewEncryptionService ¶
func NewEncryptionService(p PersistenceService, installationID string) *EncryptionService
NewEncryptionService creates a new EncryptionService instance.
func (*EncryptionService) CreateBundle ¶
func (s *EncryptionService) CreateBundle(privateKey *ecdsa.PrivateKey) (*Bundle, error)
CreateBundle retrieves or creates an X3DH bundle given a private key
func (*EncryptionService) DecryptPayload ¶
func (s *EncryptionService) DecryptPayload(myIdentityKey *ecdsa.PrivateKey, theirIdentityKey *ecdsa.PublicKey, theirInstallationID string, msgs map[string]*DirectMessageProtocol) ([]byte, error)
DecryptPayload decrypts the payload of a DirectMessageProtocol, given an identity private key and the sender's public key
func (*EncryptionService) DecryptWithDH ¶
func (s *EncryptionService) DecryptWithDH(myIdentityKey *ecdsa.PrivateKey, theirEphemeralKey *ecdsa.PublicKey, payload []byte) ([]byte, error)
DecryptWithDH decrypts message sent with a DH key exchange, and throws away the key after decryption
func (*EncryptionService) DisableInstallation ¶
func (s *EncryptionService) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
func (*EncryptionService) EnableInstallation ¶
func (s *EncryptionService) EnableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
func (*EncryptionService) EncryptPayload ¶
func (s *EncryptionService) EncryptPayload(theirIdentityKey *ecdsa.PublicKey, myIdentityKey *ecdsa.PrivateKey, payload []byte) (map[string]*DirectMessageProtocol, error)
EncryptPayload returns a new DirectMessageProtocol with a given payload encrypted, given a recipient's public key and the sender private identity key TODO: refactor this nolint: gocyclo
func (*EncryptionService) EncryptPayloadWithDH ¶ added in v0.16.4
func (s *EncryptionService) EncryptPayloadWithDH(theirIdentityKey *ecdsa.PublicKey, payload []byte) (map[string]*DirectMessageProtocol, error)
func (*EncryptionService) ProcessPublicBundle ¶
func (s *EncryptionService) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, b *Bundle) ([]IdentityAndIDPair, error)
ProcessPublicBundle persists a bundle and returns a list of tuples identity/installationID
type HandleMessageResponse ¶ added in v0.16.4
type HandleMessageResponse struct { AddedBundles []IdentityAndIDPair Message []byte }
type IdentityAndIDPair ¶ added in v0.16.4
type IdentityAndIDPair [2]string
type OneToOneRPC ¶
type OneToOneRPC struct { Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` Dst string `protobuf:"bytes,2,opt,name=dst,proto3" json:"dst,omitempty"` Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Incoming RPC messages
func (*OneToOneRPC) Descriptor ¶
func (*OneToOneRPC) Descriptor() ([]byte, []int)
func (*OneToOneRPC) GetDst ¶
func (m *OneToOneRPC) GetDst() string
func (*OneToOneRPC) GetPayload ¶
func (m *OneToOneRPC) GetPayload() []byte
func (*OneToOneRPC) GetSrc ¶
func (m *OneToOneRPC) GetSrc() string
func (*OneToOneRPC) ProtoMessage ¶
func (*OneToOneRPC) ProtoMessage()
func (*OneToOneRPC) Reset ¶
func (m *OneToOneRPC) Reset()
func (*OneToOneRPC) String ¶
func (m *OneToOneRPC) String() string
func (*OneToOneRPC) XXX_DiscardUnknown ¶
func (m *OneToOneRPC) XXX_DiscardUnknown()
func (*OneToOneRPC) XXX_Marshal ¶
func (m *OneToOneRPC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*OneToOneRPC) XXX_Merge ¶
func (m *OneToOneRPC) XXX_Merge(src proto.Message)
func (*OneToOneRPC) XXX_Size ¶
func (m *OneToOneRPC) XXX_Size() int
func (*OneToOneRPC) XXX_Unmarshal ¶
func (m *OneToOneRPC) XXX_Unmarshal(b []byte) error
type PersistenceService ¶
type PersistenceService interface { // GetKeysStorage returns the associated double ratchet KeysStorage object. GetKeysStorage() dr.KeysStorage // GetSessionStorage returns the associated double ratchet SessionStorage object. GetSessionStorage() dr.SessionStorage // GetPublicBundle retrieves an existing Bundle for the specified public key & installationIDs. GetPublicBundle(*ecdsa.PublicKey, []string) (*Bundle, error) // AddPublicBundle persists a specified Bundle AddPublicBundle(*Bundle) error // GetAnyPrivateBundle retrieves any bundle for our identity & installationIDs GetAnyPrivateBundle([]byte, []string) (*BundleContainer, error) // GetPrivateKeyBundle retrieves a BundleContainer with the specified signed prekey. GetPrivateKeyBundle([]byte) ([]byte, error) // AddPrivateBundle persists a BundleContainer. AddPrivateBundle(*BundleContainer) error // MarkBundleExpired marks a private bundle as expired, not to be used for encryption anymore. MarkBundleExpired([]byte) error // AddRatchetInfo persists the specified ratchet info AddRatchetInfo([]byte, []byte, []byte, []byte, string) error // GetRatchetInfo retrieves the existing RatchetInfo for a specified bundle ID and interlocutor public key. GetRatchetInfo([]byte, []byte, string) (*RatchetInfo, error) // GetAnyRatchetInfo retrieves any existing RatchetInfo for a specified interlocutor public key. GetAnyRatchetInfo([]byte, string) (*RatchetInfo, error) // RatchetInfoConfirmed clears the ephemeral key in the RatchetInfo // associated with the specified bundle ID and interlocutor identity public key. RatchetInfoConfirmed([]byte, []byte, string) error // GetActiveInstallations returns the active installations for a given identity. GetActiveInstallations(maxInstallations uint, identity []byte) ([]string, error) // AddInstallations adds the installations for a given identity. AddInstallations(identity []byte, timestamp int64, installationIDs []string, enabled bool) error // EnableInstallation enables the installation. EnableInstallation(identity []byte, installationID string) error // DisableInstallation disable the installation. DisableInstallation(identity []byte, installationID string) error }
PersistenceService defines the interface for a storage service
type ProtocolMessage ¶
type ProtocolMessage struct { // An optional bundle is exchanged with each message Bundle *Bundle `protobuf:"bytes,1,opt,name=bundle,proto3" json:"bundle,omitempty"` // The device id of the sender InstallationId string `protobuf:"bytes,2,opt,name=installation_id,json=installationId,proto3" json:"installation_id,omitempty"` // One to one message, encrypted, indexed by installation_id DirectMessage map[string]*DirectMessageProtocol `` /* 190-byte string literal not displayed */ // Public chats, not encrypted PublicMessage []byte `protobuf:"bytes,102,opt,name=public_message,json=publicMessage,proto3" json:"public_message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Top-level protocol message
func (*ProtocolMessage) Descriptor ¶
func (*ProtocolMessage) Descriptor() ([]byte, []int)
func (*ProtocolMessage) GetBundle ¶
func (m *ProtocolMessage) GetBundle() *Bundle
func (*ProtocolMessage) GetDirectMessage ¶
func (m *ProtocolMessage) GetDirectMessage() map[string]*DirectMessageProtocol
func (*ProtocolMessage) GetInstallationId ¶ added in v0.16.4
func (m *ProtocolMessage) GetInstallationId() string
func (*ProtocolMessage) GetPublicMessage ¶
func (m *ProtocolMessage) GetPublicMessage() []byte
func (*ProtocolMessage) ProtoMessage ¶
func (*ProtocolMessage) ProtoMessage()
func (*ProtocolMessage) Reset ¶
func (m *ProtocolMessage) Reset()
func (*ProtocolMessage) String ¶
func (m *ProtocolMessage) String() string
func (*ProtocolMessage) XXX_DiscardUnknown ¶
func (m *ProtocolMessage) XXX_DiscardUnknown()
func (*ProtocolMessage) XXX_Marshal ¶
func (m *ProtocolMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProtocolMessage) XXX_Merge ¶
func (m *ProtocolMessage) XXX_Merge(src proto.Message)
func (*ProtocolMessage) XXX_Size ¶
func (m *ProtocolMessage) XXX_Size() int
func (*ProtocolMessage) XXX_Unmarshal ¶
func (m *ProtocolMessage) XXX_Unmarshal(b []byte) error
type ProtocolService ¶
type ProtocolService struct { Enabled bool // contains filtered or unexported fields }
func NewProtocolService ¶
func NewProtocolService(encryption *EncryptionService) *ProtocolService
NewProtocolService creates a new ProtocolService instance
func (*ProtocolService) BuildDirectMessage ¶
func (p *ProtocolService) BuildDirectMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte, theirPublicKeys ...*ecdsa.PublicKey) (map[*ecdsa.PublicKey][]byte, error)
BuildDirectMessage marshals a 1:1 chat message given the user identity private key, the recipient's public key, and a payload
func (*ProtocolService) BuildPairingMessage ¶ added in v0.16.4
func (p *ProtocolService) BuildPairingMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte) ([]byte, error)
BuildPairingMessage sends a message to our own devices using DH so that it can be decrypted by any other device
func (*ProtocolService) BuildPublicMessage ¶
func (p *ProtocolService) BuildPublicMessage(myIdentityKey *ecdsa.PrivateKey, payload []byte) ([]byte, error)
BuildPublicMessage marshals a public chat message given the user identity private key and a payload
func (*ProtocolService) DisableInstallation ¶
func (p *ProtocolService) DisableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
DisableInstallation disables an installation for multi-device sync
func (*ProtocolService) EnableInstallation ¶
func (p *ProtocolService) EnableInstallation(myIdentityKey *ecdsa.PublicKey, installationID string) error
EnableInstallation enables an installation for multi-device sync
func (*ProtocolService) GetBundle ¶
func (p *ProtocolService) GetBundle(myIdentityKey *ecdsa.PrivateKey) (*Bundle, error)
GetBundle retrieves or creates a X3DH bundle, given a private identity key
func (*ProtocolService) HandleMessage ¶
func (p *ProtocolService) HandleMessage(myIdentityKey *ecdsa.PrivateKey, theirPublicKey *ecdsa.PublicKey, payload []byte) (*HandleMessageResponse, error)
HandleMessage unmarshals a message and processes it, decrypting it if it is a 1:1 message
func (*ProtocolService) ProcessPublicBundle ¶
func (p *ProtocolService) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *Bundle) ([]IdentityAndIDPair, error)
ProcessPublicBundle processes a received X3DH bundle
type RatchetInfo ¶
type RatchetInfo struct { ID []byte Sk []byte PrivateKey []byte PublicKey []byte Identity []byte BundleID []byte EphemeralKey []byte InstallationID string }
RatchetInfo holds the current ratchet state
type SQLLiteKeysStorage ¶
type SQLLiteKeysStorage struct {
// contains filtered or unexported fields
}
SQLLiteKeysStorage represents a keys persistence service tied to an SQLite database
func NewSQLLiteKeysStorage ¶
func NewSQLLiteKeysStorage(db *sql.DB) *SQLLiteKeysStorage
NewSQLLiteKeysStorage creates a new SQLLiteKeysStorage instance associated with the specified database
func (*SQLLiteKeysStorage) Count ¶
func (s *SQLLiteKeysStorage) Count(pubKey dr.Key) (uint, error)
Count returns the count of keys with the specified public key
func (*SQLLiteKeysStorage) DeleteMk ¶
func (s *SQLLiteKeysStorage) DeleteMk(pubKey dr.Key, msgNum uint) error
DeleteMk deletes the key with the specified public key and message key
func (*SQLLiteKeysStorage) DeleteOldMks ¶
func (s *SQLLiteKeysStorage) DeleteOldMks(sessionID []byte, deleteUntil uint) error
DeleteOldMks caps remove any key < seq_num, included
func (*SQLLiteKeysStorage) Get ¶
Get retrieves the message key for a specified public key and message number
func (*SQLLiteKeysStorage) Put ¶
func (s *SQLLiteKeysStorage) Put(sessionID []byte, pubKey dr.Key, msgNum uint, mk dr.Key, seqNum uint) error
Put stores a key with the specified public key, message number and message key
func (*SQLLiteKeysStorage) TruncateMks ¶
func (s *SQLLiteKeysStorage) TruncateMks(sessionID []byte, maxKeysPerSession int) error
TruncateMks caps the number of keys to maxKeysPerSession deleting them in FIFO fashion
type SQLLitePersistence ¶
type SQLLitePersistence struct {
// contains filtered or unexported fields
}
SQLLitePersistence represents a persistence service tied to an SQLite database
func NewSQLLitePersistence ¶
func NewSQLLitePersistence(path string, key string) (*SQLLitePersistence, error)
NewSQLLitePersistence creates a new SQLLitePersistence instance, given a path and a key
func (*SQLLitePersistence) AddInstallations ¶
func (s *SQLLitePersistence) AddInstallations(identity []byte, timestamp int64, installationIDs []string, defaultEnabled bool) error
AddInstallations adds the installations for a given identity, maintaining the enabled flag
func (*SQLLitePersistence) AddPrivateBundle ¶
func (s *SQLLitePersistence) AddPrivateBundle(b *BundleContainer) error
AddPrivateBundle adds the specified BundleContainer to the database
func (*SQLLitePersistence) AddPublicBundle ¶
func (s *SQLLitePersistence) AddPublicBundle(b *Bundle) error
AddPublicBundle adds the specified Bundle to the database
func (*SQLLitePersistence) AddRatchetInfo ¶
func (s *SQLLitePersistence) AddRatchetInfo(key []byte, identity []byte, bundleID []byte, ephemeralKey []byte, installationID string) error
AddRatchetInfo persists the specified ratchet info into the database
func (*SQLLitePersistence) DisableInstallation ¶
func (s *SQLLitePersistence) DisableInstallation(identity []byte, installationID string) error
DisableInstallation disable the installation
func (*SQLLitePersistence) EnableInstallation ¶
func (s *SQLLitePersistence) EnableInstallation(identity []byte, installationID string) error
EnableInstallation enables the installation
func (*SQLLitePersistence) GetActiveInstallations ¶
func (s *SQLLitePersistence) GetActiveInstallations(maxInstallations uint, identity []byte) ([]string, error)
GetActiveInstallations returns the active installations for a given identity
func (*SQLLitePersistence) GetAnyPrivateBundle ¶
func (s *SQLLitePersistence) GetAnyPrivateBundle(myIdentityKey []byte, installationIDs []string) (*BundleContainer, error)
GetAnyPrivateBundle retrieves any bundle from the database containing a private key
func (*SQLLitePersistence) GetAnyRatchetInfo ¶
func (s *SQLLitePersistence) GetAnyRatchetInfo(identity []byte, installationID string) (*RatchetInfo, error)
GetAnyRatchetInfo retrieves any existing RatchetInfo for a specified interlocutor public key from the database
func (*SQLLitePersistence) GetKeysStorage ¶
func (s *SQLLitePersistence) GetKeysStorage() dr.KeysStorage
GetKeysStorage returns the associated double ratchet KeysStorage object
func (*SQLLitePersistence) GetPrivateKeyBundle ¶
func (s *SQLLitePersistence) GetPrivateKeyBundle(bundleID []byte) ([]byte, error)
GetPrivateKeyBundle retrieves a private key for a bundle from the database
func (*SQLLitePersistence) GetPublicBundle ¶
func (s *SQLLitePersistence) GetPublicBundle(publicKey *ecdsa.PublicKey, installationIDs []string) (*Bundle, error)
GetPublicBundle retrieves an existing Bundle for the specified public key from the database
func (*SQLLitePersistence) GetRatchetInfo ¶
func (s *SQLLitePersistence) GetRatchetInfo(bundleID []byte, theirIdentity []byte, installationID string) (*RatchetInfo, error)
GetRatchetInfo retrieves the existing RatchetInfo for a specified bundle ID and interlocutor public key from the database
func (*SQLLitePersistence) GetSessionStorage ¶
func (s *SQLLitePersistence) GetSessionStorage() dr.SessionStorage
GetSessionStorage returns the associated double ratchet SessionStorage object
func (*SQLLitePersistence) MarkBundleExpired ¶
func (s *SQLLitePersistence) MarkBundleExpired(identity []byte) error
MarkBundleExpired expires any private bundle for a given identity
func (*SQLLitePersistence) Open ¶
func (s *SQLLitePersistence) Open(path string, key string) error
Open opens a file at the specified path
func (*SQLLitePersistence) RatchetInfoConfirmed ¶
func (s *SQLLitePersistence) RatchetInfoConfirmed(bundleID []byte, theirIdentity []byte, installationID string) error
RatchetInfoConfirmed clears the ephemeral key in the RatchetInfo associated with the specified bundle ID and interlocutor identity public key
type SQLLiteSessionStorage ¶
type SQLLiteSessionStorage struct {
// contains filtered or unexported fields
}
SQLLiteSessionStorage represents a session persistence service tied to an SQLite database
func NewSQLLiteSessionStorage ¶
func NewSQLLiteSessionStorage(db *sql.DB) *SQLLiteSessionStorage
NewSQLLiteSessionStorage creates a new SQLLiteSessionStorage instance associated with the specified database
type SendDirectMessageRPC ¶
SendDirectMessageRPC represents the RPC payload for the SendDirectMessage RPC method
type SendGroupMessageRPC ¶
SendGroupMessageRPC represents the RPC payload for the SendGroupMessage RPC method
type SendPublicMessageRPC ¶
SendPublicMessageRPC represents the RPC payload for the SendPublicMessage RPC method
type SignedPreKey ¶
type SignedPreKey struct { SignedPreKey []byte `protobuf:"bytes,1,opt,name=signed_pre_key,json=signedPreKey,proto3" json:"signed_pre_key,omitempty"` Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SignedPreKey) Descriptor ¶
func (*SignedPreKey) Descriptor() ([]byte, []int)
func (*SignedPreKey) GetSignedPreKey ¶
func (m *SignedPreKey) GetSignedPreKey() []byte
func (*SignedPreKey) GetVersion ¶
func (m *SignedPreKey) GetVersion() uint32
func (*SignedPreKey) ProtoMessage ¶
func (*SignedPreKey) ProtoMessage()
func (*SignedPreKey) Reset ¶
func (m *SignedPreKey) Reset()
func (*SignedPreKey) String ¶
func (m *SignedPreKey) String() string
func (*SignedPreKey) XXX_DiscardUnknown ¶
func (m *SignedPreKey) XXX_DiscardUnknown()
func (*SignedPreKey) XXX_Marshal ¶
func (m *SignedPreKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SignedPreKey) XXX_Merge ¶
func (m *SignedPreKey) XXX_Merge(src proto.Message)
func (*SignedPreKey) XXX_Size ¶
func (m *SignedPreKey) XXX_Size() int
func (*SignedPreKey) XXX_Unmarshal ¶
func (m *SignedPreKey) XXX_Unmarshal(b []byte) error
type X3DHHeader ¶
type X3DHHeader struct { // Ephemeral key used Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Used bundle's signed prekey Id []byte `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*X3DHHeader) Descriptor ¶
func (*X3DHHeader) Descriptor() ([]byte, []int)
func (*X3DHHeader) GetId ¶
func (m *X3DHHeader) GetId() []byte
func (*X3DHHeader) GetKey ¶
func (m *X3DHHeader) GetKey() []byte
func (*X3DHHeader) ProtoMessage ¶
func (*X3DHHeader) ProtoMessage()
func (*X3DHHeader) Reset ¶
func (m *X3DHHeader) Reset()
func (*X3DHHeader) String ¶
func (m *X3DHHeader) String() string
func (*X3DHHeader) XXX_DiscardUnknown ¶
func (m *X3DHHeader) XXX_DiscardUnknown()
func (*X3DHHeader) XXX_Marshal ¶
func (m *X3DHHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*X3DHHeader) XXX_Merge ¶
func (m *X3DHHeader) XXX_Merge(src proto.Message)
func (*X3DHHeader) XXX_Size ¶
func (m *X3DHHeader) XXX_Size() int
func (*X3DHHeader) XXX_Unmarshal ¶
func (m *X3DHHeader) XXX_Unmarshal(b []byte) error