Skip to content

Commit

Permalink
Add context to OLM machine LoadDevices
Browse files Browse the repository at this point in the history
As there's a side effect of going to the crypto store we want the
context to at least exist for now.
  • Loading branch information
hifi committed Jan 10, 2024
1 parent 25bc36b commit 8da3a17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions crypto/devicelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ var (
InvalidKeySignature = errors.New("invalid signature on device keys")
)

func (mach *OlmMachine) LoadDevices(user id.UserID) map[id.DeviceID]*id.Device {
// TODO proper context?
return mach.fetchKeys(context.TODO(), []id.UserID{user}, "", true)[user]
func (mach *OlmMachine) LoadDevices(ctx context.Context, user id.UserID) map[id.DeviceID]*id.Device {
return mach.fetchKeys(ctx, []id.UserID{user}, "", true)[user]
}

func (mach *OlmMachine) storeDeviceSelfSignatures(ctx context.Context, userID id.UserID, deviceID id.DeviceID, resp *mautrix.RespQueryKeys) {
Expand Down
2 changes: 1 addition & 1 deletion crypto/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func (mach *OlmMachine) GetOrFetchDeviceByKey(ctx context.Context, userID id.Use
Str("user_id", userID.String()).
Str("identity_key", identityKey.String()).
Msg("Didn't find identity in crypto store, fetching from server")
devices := mach.LoadDevices(userID)
devices := mach.LoadDevices(ctx, userID)
for _, device := range devices {
if device.IdentityKey == identityKey {
return device, nil
Expand Down

0 comments on commit 8da3a17

Please sign in to comment.