Documentation
¶
Index ¶
- Variables
- type ContactStore
- type Device
- type DeviceData
- type DeviceStore
- type GroupStore
- type PreKeyStoreExtras
- type ProfileKeyStore
- type SQLStore
- func (s *SQLStore) AllContacts(ctx context.Context) ([]*types.Contact, error)
- func (s *SQLStore) AllNormalKyberPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.KyberPreKeyRecord, error)
- func (s *SQLStore) AllPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.PreKeyRecord, error)
- func (s *SQLStore) AllSessionsForUUID(ctx context.Context, theirUUID uuid.UUID) ([]*libsignalgo.Address, []*libsignalgo.SessionRecord, error)
- func (s *SQLStore) DeleteAllPreKeys(ctx context.Context) error
- func (s *SQLStore) DeleteKyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
- func (s *SQLStore) DeletePreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
- func (s *SQLStore) DeleteSignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
- func (s *SQLStore) GetIdentityKey(ctx context.Context, address *libsignalgo.Address) (*libsignalgo.IdentityKey, error)
- func (s *SQLStore) GetIdentityKeyPair(ctx context.Context) (*libsignalgo.IdentityKeyPair, error)
- func (s *SQLStore) GetLocalRegistrationID(ctx context.Context) (uint32, error)
- func (s *SQLStore) GetNextKyberPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
- func (s *SQLStore) GetNextPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
- func (s *SQLStore) GetSignedNextPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
- func (s *SQLStore) IsKyberPreKeyLastResort(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (bool, error)
- func (s *SQLStore) IsTrustedIdentity(ctx context.Context, address *libsignalgo.Address, ...) (bool, error)
- func (s *SQLStore) KyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.KyberPreKeyRecord, error)
- func (s *SQLStore) LoadContact(ctx context.Context, theirUUID uuid.UUID) (*types.Contact, error)
- func (s *SQLStore) LoadContactByE164(ctx context.Context, e164 string) (*types.Contact, error)
- func (s *SQLStore) LoadKyberPreKey(ctx context.Context, id uint32) (*libsignalgo.KyberPreKeyRecord, error)
- func (s *SQLStore) LoadPreKey(ctx context.Context, id uint32) (*libsignalgo.PreKeyRecord, error)
- func (s *SQLStore) LoadProfileKey(ctx context.Context, theirACI uuid.UUID) (*libsignalgo.ProfileKey, error)
- func (s *SQLStore) LoadSenderKey(ctx context.Context, sender *libsignalgo.Address, distributionID uuid.UUID) (*libsignalgo.SenderKeyRecord, error)
- func (s *SQLStore) LoadSession(ctx context.Context, address *libsignalgo.Address) (*libsignalgo.SessionRecord, error)
- func (s *SQLStore) LoadSignedPreKey(ctx context.Context, id uint32) (*libsignalgo.SignedPreKeyRecord, error)
- func (s *SQLStore) MarkKyberPreKeyUsed(ctx context.Context, id uint32) error
- func (s *SQLStore) MarkPreKeysAsUploaded(ctx context.Context, uuidKind types.UUIDKind, upToID uint) error
- func (s *SQLStore) MarkSignedPreKeysAsUploaded(ctx context.Context, uuidKind types.UUIDKind, upToID uint) error
- func (s *SQLStore) MasterKeyFromGroupIdentifier(ctx context.Context, groupID types.GroupIdentifier) (types.SerializedGroupMasterKey, error)
- func (s *SQLStore) MyProfileKey(ctx context.Context) (*libsignalgo.ProfileKey, error)
- func (s *SQLStore) PreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.PreKeyRecord, error)
- func (s *SQLStore) RemoveAllSessions(ctx context.Context) error
- func (s *SQLStore) RemovePreKey(ctx context.Context, id uint32) error
- func (s *SQLStore) RemoveSession(ctx context.Context, address *libsignalgo.Address) error
- func (s *SQLStore) RemoveSignedPreKey(ctx context.Context, id uint32) error
- func (s *SQLStore) SaveIdentityKey(ctx context.Context, address *libsignalgo.Address, ...) (bool, error)
- func (s *SQLStore) SaveKyberPreKey(ctx context.Context, uuidKind types.UUIDKind, ...) error
- func (s *SQLStore) SavePreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.PreKeyRecord, ...) error
- func (s *SQLStore) SaveSignedPreKey(ctx context.Context, uuidKind types.UUIDKind, ...) error
- func (s *SQLStore) SignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.SignedPreKeyRecord, error)
- func (s *SQLStore) StoreContact(ctx context.Context, contact types.Contact) error
- func (s *SQLStore) StoreKyberPreKey(ctx context.Context, id uint32, ...) error
- func (s *SQLStore) StoreMasterKey(ctx context.Context, groupID types.GroupIdentifier, ...) error
- func (s *SQLStore) StorePreKey(ctx context.Context, id uint32, preKeyRecord *libsignalgo.PreKeyRecord) error
- func (s *SQLStore) StoreProfileKey(ctx context.Context, theirACI uuid.UUID, key libsignalgo.ProfileKey) error
- func (s *SQLStore) StoreSenderKey(ctx context.Context, sender *libsignalgo.Address, distributionID uuid.UUID, ...) error
- func (s *SQLStore) StoreSession(ctx context.Context, address *libsignalgo.Address, ...) error
- func (s *SQLStore) StoreSignedPreKey(ctx context.Context, id uint32, ...) error
- func (s *SQLStore) UpdatePhone(ctx context.Context, theirUUID uuid.UUID, newE164 string) error
- type SessionStoreExtras
- type StoreContainer
- func (c *StoreContainer) DeleteDevice(ctx context.Context, device *DeviceData) error
- func (c *StoreContainer) DeviceByACI(ctx context.Context, aci uuid.UUID) (*Device, error)
- func (c *StoreContainer) GetAllDevices(ctx context.Context) ([]*Device, error)
- func (c *StoreContainer) PutDevice(ctx context.Context, device *DeviceData) error
- func (c *StoreContainer) Upgrade(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrDeviceIDMustBeSet = errors.New("device aci_uuid must be known before accessing database")
ErrDeviceIDMustBeSet is the error returned by PutDevice if you try to save a device before knowing its ACI UUID.
Functions ¶
This section is empty.
Types ¶
type ContactStore ¶
type ContactStore interface {
LoadContact(ctx context.Context, theirUUID uuid.UUID) (*types.Contact, error)
LoadContactByE164(ctx context.Context, e164 string) (*types.Contact, error)
StoreContact(ctx context.Context, contact types.Contact) error
AllContacts(ctx context.Context) ([]*types.Contact, error)
UpdatePhone(ctx context.Context, theirUUID uuid.UUID, newE164 string) error
}
type Device ¶
type Device struct {
DeviceData
// libsignalgo store interfaces
PreKeyStore libsignalgo.PreKeyStore
SignedPreKeyStore libsignalgo.SignedPreKeyStore
KyberPreKeyStore libsignalgo.KyberPreKeyStore
IdentityStore libsignalgo.IdentityKeyStore
SessionStore libsignalgo.SessionStore
SenderKeyStore libsignalgo.SenderKeyStore
// internal store interfaces
PreKeyStoreExtras PreKeyStoreExtras
SessionStoreExtras SessionStoreExtras
ProfileKeyStore ProfileKeyStore
GroupStore GroupStore
ContactStore ContactStore
DeviceStore DeviceStore
}
Device is a wrapper for a signalmeow session, including device data, and interfaces for operating on the DB within the session.
func (*Device) IsDeviceLoggedIn ¶
type DeviceData ¶
type DeviceData struct {
ACIIdentityKeyPair *libsignalgo.IdentityKeyPair
PNIIdentityKeyPair *libsignalgo.IdentityKeyPair
RegistrationID int
PNIRegistrationID int
ACI uuid.UUID
PNI uuid.UUID
DeviceID int
Number string
Password string
}
func (*DeviceData) BasicAuthCreds ¶
func (d *DeviceData) BasicAuthCreds() (string, string)
type DeviceStore ¶
type GroupStore ¶
type GroupStore interface {
MasterKeyFromGroupIdentifier(ctx context.Context, groupID types.GroupIdentifier) (types.SerializedGroupMasterKey, error)
StoreMasterKey(ctx context.Context, groupID types.GroupIdentifier, key types.SerializedGroupMasterKey) error
}
type PreKeyStoreExtras ¶
type PreKeyStoreExtras interface {
PreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.PreKeyRecord, error)
SignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.SignedPreKeyRecord, error)
KyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.KyberPreKeyRecord, error)
SavePreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.PreKeyRecord, markUploaded bool) error
SaveSignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.SignedPreKeyRecord, markUploaded bool) error
SaveKyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.KyberPreKeyRecord, lastResort bool) error
DeletePreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
DeleteSignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
DeleteKyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) error
GetNextPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
GetSignedNextPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
GetNextKyberPreKeyID(ctx context.Context, uuidKind types.UUIDKind) (uint, error)
MarkPreKeysAsUploaded(ctx context.Context, uuidKind types.UUIDKind, upToID uint) error
MarkSignedPreKeysAsUploaded(ctx context.Context, uuidKind types.UUIDKind, upToID uint) error
IsKyberPreKeyLastResort(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (bool, error)
AllPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.PreKeyRecord, error)
AllNormalKyberPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.KyberPreKeyRecord, error)
DeleteAllPreKeys(ctx context.Context) error
}
type ProfileKeyStore ¶
type ProfileKeyStore interface {
// LoadProfileKey loads the profile key for the given address.
// If the address is not found, nil is returned.
LoadProfileKey(ctx context.Context, theirACI uuid.UUID) (*libsignalgo.ProfileKey, error)
StoreProfileKey(ctx context.Context, theirACI uuid.UUID, key libsignalgo.ProfileKey) error
MyProfileKey(ctx context.Context) (*libsignalgo.ProfileKey, error)
}
type SQLStore ¶
type SQLStore struct {
*StoreContainer
ACI uuid.UUID
}
SQLStore is basically a StoreContainer with an ACI UUID attached to it, reperesenting a store for a single user
func (*SQLStore) AllContacts ¶
func (*SQLStore) AllNormalKyberPreKeys ¶
func (s *SQLStore) AllNormalKyberPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.KyberPreKeyRecord, error)
func (*SQLStore) AllPreKeys ¶
func (s *SQLStore) AllPreKeys(ctx context.Context, uuidKind types.UUIDKind) ([]*libsignalgo.PreKeyRecord, error)
func (*SQLStore) AllSessionsForUUID ¶
func (s *SQLStore) AllSessionsForUUID(ctx context.Context, theirUUID uuid.UUID) ([]*libsignalgo.Address, []*libsignalgo.SessionRecord, error)
func (*SQLStore) DeleteKyberPreKey ¶
func (*SQLStore) DeletePreKey ¶
func (*SQLStore) DeleteSignedPreKey ¶
func (*SQLStore) GetIdentityKey ¶
func (s *SQLStore) GetIdentityKey(ctx context.Context, address *libsignalgo.Address) (*libsignalgo.IdentityKey, error)
func (*SQLStore) GetIdentityKeyPair ¶
func (s *SQLStore) GetIdentityKeyPair(ctx context.Context) (*libsignalgo.IdentityKeyPair, error)
func (*SQLStore) GetLocalRegistrationID ¶
func (*SQLStore) GetNextKyberPreKeyID ¶
func (*SQLStore) GetNextPreKeyID ¶
func (*SQLStore) GetSignedNextPreKeyID ¶
func (*SQLStore) IsKyberPreKeyLastResort ¶
func (*SQLStore) IsTrustedIdentity ¶
func (s *SQLStore) IsTrustedIdentity(ctx context.Context, address *libsignalgo.Address, identityKey *libsignalgo.IdentityKey, direction libsignalgo.SignalDirection) (bool, error)
func (*SQLStore) KyberPreKey ¶
func (s *SQLStore) KyberPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.KyberPreKeyRecord, error)
func (*SQLStore) LoadContact ¶
func (*SQLStore) LoadContactByE164 ¶
func (*SQLStore) LoadKyberPreKey ¶
func (s *SQLStore) LoadKyberPreKey(ctx context.Context, id uint32) (*libsignalgo.KyberPreKeyRecord, error)
func (*SQLStore) LoadPreKey ¶
func (s *SQLStore) LoadPreKey(ctx context.Context, id uint32) (*libsignalgo.PreKeyRecord, error)
func (*SQLStore) LoadProfileKey ¶
func (s *SQLStore) LoadProfileKey(ctx context.Context, theirACI uuid.UUID) (*libsignalgo.ProfileKey, error)
func (*SQLStore) LoadSenderKey ¶
func (s *SQLStore) LoadSenderKey(ctx context.Context, sender *libsignalgo.Address, distributionID uuid.UUID) (*libsignalgo.SenderKeyRecord, error)
func (*SQLStore) LoadSession ¶
func (s *SQLStore) LoadSession(ctx context.Context, address *libsignalgo.Address) (*libsignalgo.SessionRecord, error)
func (*SQLStore) LoadSignedPreKey ¶
func (s *SQLStore) LoadSignedPreKey(ctx context.Context, id uint32) (*libsignalgo.SignedPreKeyRecord, error)
func (*SQLStore) MarkKyberPreKeyUsed ¶
func (*SQLStore) MarkPreKeysAsUploaded ¶
func (*SQLStore) MarkSignedPreKeysAsUploaded ¶
func (*SQLStore) MasterKeyFromGroupIdentifier ¶
func (s *SQLStore) MasterKeyFromGroupIdentifier(ctx context.Context, groupID types.GroupIdentifier) (types.SerializedGroupMasterKey, error)
func (*SQLStore) MyProfileKey ¶
func (s *SQLStore) MyProfileKey(ctx context.Context) (*libsignalgo.ProfileKey, error)
func (*SQLStore) PreKey ¶
func (s *SQLStore) PreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.PreKeyRecord, error)
func (*SQLStore) RemoveAllSessions ¶
func (*SQLStore) RemovePreKey ¶
func (*SQLStore) RemoveSession ¶
func (*SQLStore) RemoveSignedPreKey ¶
func (*SQLStore) SaveIdentityKey ¶
func (s *SQLStore) SaveIdentityKey(ctx context.Context, address *libsignalgo.Address, identityKey *libsignalgo.IdentityKey) (bool, error)
func (*SQLStore) SaveKyberPreKey ¶
func (s *SQLStore) SaveKyberPreKey(ctx context.Context, uuidKind types.UUIDKind, kyberPreKeyRecord *libsignalgo.KyberPreKeyRecord, lastResort bool) error
func (*SQLStore) SavePreKey ¶
func (s *SQLStore) SavePreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.PreKeyRecord, markUploaded bool) error
func (*SQLStore) SaveSignedPreKey ¶
func (s *SQLStore) SaveSignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKey *libsignalgo.SignedPreKeyRecord, markUploaded bool) error
func (*SQLStore) SignedPreKey ¶
func (s *SQLStore) SignedPreKey(ctx context.Context, uuidKind types.UUIDKind, preKeyID int) (*libsignalgo.SignedPreKeyRecord, error)
func (*SQLStore) StoreContact ¶
func (*SQLStore) StoreKyberPreKey ¶
func (s *SQLStore) StoreKyberPreKey(ctx context.Context, id uint32, kyberPreKeyRecord *libsignalgo.KyberPreKeyRecord) error
func (*SQLStore) StoreMasterKey ¶
func (s *SQLStore) StoreMasterKey(ctx context.Context, groupID types.GroupIdentifier, key types.SerializedGroupMasterKey) error
func (*SQLStore) StorePreKey ¶
func (s *SQLStore) StorePreKey(ctx context.Context, id uint32, preKeyRecord *libsignalgo.PreKeyRecord) error
func (*SQLStore) StoreProfileKey ¶
func (s *SQLStore) StoreProfileKey(ctx context.Context, theirACI uuid.UUID, key libsignalgo.ProfileKey) error
func (*SQLStore) StoreSenderKey ¶
func (s *SQLStore) StoreSenderKey(ctx context.Context, sender *libsignalgo.Address, distributionID uuid.UUID, record *libsignalgo.SenderKeyRecord) error
func (*SQLStore) StoreSession ¶
func (s *SQLStore) StoreSession(ctx context.Context, address *libsignalgo.Address, record *libsignalgo.SessionRecord) error
func (*SQLStore) StoreSignedPreKey ¶
func (s *SQLStore) StoreSignedPreKey(ctx context.Context, id uint32, signedPreKeyRecord *libsignalgo.SignedPreKeyRecord) error
type SessionStoreExtras ¶
type SessionStoreExtras interface {
// AllSessionsForUUID returns all sessions for the given UUID.
AllSessionsForUUID(ctx context.Context, theirUUID uuid.UUID) ([]*libsignalgo.Address, []*libsignalgo.SessionRecord, error)
// RemoveSession removes the session for the given address.
RemoveSession(ctx context.Context, address *libsignalgo.Address) error
// RemoveAllSessions removes all sessions for our ACI UUID
RemoveAllSessions(ctx context.Context) error
}
type StoreContainer ¶
type StoreContainer struct {
// contains filtered or unexported fields
}
StoreContainer is a wrapper for a SQL database that can contain multiple signalmeow sessions.
func NewStore ¶
func NewStore(db *dbutil.Database, log dbutil.DatabaseLogger) *StoreContainer
func (*StoreContainer) DeleteDevice ¶
func (c *StoreContainer) DeleteDevice(ctx context.Context, device *DeviceData) error
DeleteDevice deletes the given device from this database
func (*StoreContainer) DeviceByACI ¶
GetDevice finds the device with the specified ACI UUID in the database. If the device is not found, nil is returned instead.
func (*StoreContainer) GetAllDevices ¶
func (c *StoreContainer) GetAllDevices(ctx context.Context) ([]*Device, error)
GetAllDevices finds all the devices in the database.
func (*StoreContainer) PutDevice ¶
func (c *StoreContainer) PutDevice(ctx context.Context, device *DeviceData) error
PutDevice stores the given device in this database.