Skip to content

Commit

Permalink
crypto/devicelist: remove unnecessary parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 7, 2024
1 parent 3a9061e commit 421bd5c
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions crypto/devicelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,19 @@ func (mach *OlmMachine) LoadDevices(ctx context.Context, user id.UserID) (keys m
return nil
}

type GetCachedDevicesParams struct {
IsUserTracked bool
}

type CachedDevices struct {
Devices []*id.Device
MasterKey *id.CrossSigningKey
HasValidSelfSigningKey bool
MasterKeySignedByUs bool
}

func (mach *OlmMachine) GetCachedDevices(ctx context.Context, userID id.UserID, extra ...GetCachedDevicesParams) (*CachedDevices, error) {
var params GetCachedDevicesParams
if len(extra) > 0 {
params = extra[0]
}
if !params.IsUserTracked {
userIDs, err := mach.CryptoStore.FilterTrackedUsers(ctx, []id.UserID{userID})
if err != nil {
return nil, fmt.Errorf("failed to check if user's devices are tracked: %w", err)
} else if len(userIDs) == 0 {
return nil, ErrUserNotTracked
}
func (mach *OlmMachine) GetCachedDevices(ctx context.Context, userID id.UserID) (*CachedDevices, error) {
userIDs, err := mach.CryptoStore.FilterTrackedUsers(ctx, []id.UserID{userID})
if err != nil {
return nil, fmt.Errorf("failed to check if user's devices are tracked: %w", err)
} else if len(userIDs) == 0 {
return nil, ErrUserNotTracked
}
ownKeys := mach.GetOwnCrossSigningPublicKeys(ctx)
var ownUserSigningKey id.Ed25519
Expand Down

0 comments on commit 421bd5c

Please sign in to comment.