shared

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	DB                    *sql.DB
	Writer                sqlutil.Writer
	OneTimeKeysTable      tables.OneTimeKeys
	DeviceKeysTable       tables.DeviceKeys
	KeyChangesTable       tables.KeyChanges
	StaleDeviceListsTable tables.StaleDeviceLists
	CrossSigningKeysTable tables.CrossSigningKeys
	CrossSigningSigsTable tables.CrossSigningSigs
	sqlutil.PartitionOffsetStatements
}

func (*Database) ClaimKeys

func (d *Database) ClaimKeys(ctx context.Context, userToDeviceToAlgorithm map[string]map[string]string) ([]api.OneTimeKeys, error)

func (*Database) CrossSigningKeysDataForUser added in v0.5.0

func (d *Database) CrossSigningKeysDataForUser(ctx context.Context, userID string) (types.CrossSigningKeyMap, error)

CrossSigningKeysForUser returns the latest known cross-signing keys for a user, if any.

func (*Database) CrossSigningKeysForUser added in v0.5.0

CrossSigningKeysForUser returns the latest known cross-signing keys for a user, if any.

func (*Database) CrossSigningSigsForTarget added in v0.5.0

func (d *Database) CrossSigningSigsForTarget(ctx context.Context, targetUserID string, targetKeyID gomatrixserverlib.KeyID) (types.CrossSigningSigMap, error)

CrossSigningSigsForTarget returns the signatures for a given user's key ID, if any.

func (*Database) DeleteDeviceKeys added in v0.5.0

func (d *Database) DeleteDeviceKeys(ctx context.Context, userID string, deviceIDs []gomatrixserverlib.KeyID) error

DeleteDeviceKeys removes the device keys for a given user/device, and any accompanying cross-signing signatures relating to that device.

func (*Database) DeviceKeysForUser

func (d *Database) DeviceKeysForUser(ctx context.Context, userID string, deviceIDs []string) ([]api.DeviceMessage, error)

func (*Database) DeviceKeysJSON

func (d *Database) DeviceKeysJSON(ctx context.Context, keys []api.DeviceMessage) error

func (*Database) ExistingOneTimeKeys

func (d *Database) ExistingOneTimeKeys(ctx context.Context, userID, deviceID string, keyIDsWithAlgorithms []string) (map[string]json.RawMessage, error)

func (*Database) KeyChanges

func (d *Database) KeyChanges(ctx context.Context, partition int32, fromOffset, toOffset int64) (userIDs []string, latestOffset int64, err error)

func (*Database) MarkDeviceListStale

func (d *Database) MarkDeviceListStale(ctx context.Context, userID string, isStale bool) error

MarkDeviceListStale sets the stale bit for this user to isStale.

func (*Database) OneTimeKeysCount

func (d *Database) OneTimeKeysCount(ctx context.Context, userID, deviceID string) (*api.OneTimeKeysCount, error)

func (*Database) PrevIDsExists

func (d *Database) PrevIDsExists(ctx context.Context, userID string, prevIDs []int) (bool, error)

func (*Database) StaleDeviceLists

func (d *Database) StaleDeviceLists(ctx context.Context, domains []gomatrixserverlib.ServerName) ([]string, error)

StaleDeviceLists returns a list of user IDs ending with the domains provided who have stale device lists. If no domains are given, all user IDs with stale device lists are returned.

func (*Database) StoreCrossSigningKeysForUser added in v0.5.0

func (d *Database) StoreCrossSigningKeysForUser(ctx context.Context, userID string, keyMap types.CrossSigningKeyMap) error

StoreCrossSigningKeysForUser stores the latest known cross-signing keys for a user.

func (*Database) StoreCrossSigningSigsForTarget added in v0.5.0

func (d *Database) StoreCrossSigningSigsForTarget(
	ctx context.Context,
	originUserID string, originKeyID gomatrixserverlib.KeyID,
	targetUserID string, targetKeyID gomatrixserverlib.KeyID,
	signature gomatrixserverlib.Base64Bytes,
) error

StoreCrossSigningSigsForTarget stores a signature for a target user ID and key/dvice.

func (*Database) StoreKeyChange

func (d *Database) StoreKeyChange(ctx context.Context, partition int32, offset int64, userID string) error

func (*Database) StoreLocalDeviceKeys

func (d *Database) StoreLocalDeviceKeys(ctx context.Context, keys []api.DeviceMessage) error

func (*Database) StoreOneTimeKeys

func (d *Database) StoreOneTimeKeys(ctx context.Context, keys api.OneTimeKeys) (counts *api.OneTimeKeysCount, err error)

func (*Database) StoreRemoteDeviceKeys

func (d *Database) StoreRemoteDeviceKeys(ctx context.Context, keys []api.DeviceMessage, clearUserIDs []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL