hicli/profile: check device signature for own cross-signing keys

This commit is contained in:
Tulir Asokan 2024-12-06 16:34:07 +02:00
parent 544bd17a1d
commit 838a9ce106

View file

@ -140,13 +140,15 @@ func (h *HiClient) GetProfileView(ctx context.Context, roomID id.RoomID, userID
addError(fmt.Errorf("failed to get devices: %w", err))
return
}
if ownUserSigningKey != "" && theirMasterKey.Key != "" {
if userID == h.Account.UserID {
resp.UserTrusted, err = h.CryptoStore.IsKeySignedBy(ctx, userID, theirMasterKey.Key, userID, h.Crypto.OwnIdentity().SigningKey)
} else if ownUserSigningKey != "" && theirMasterKey.Key != "" {
resp.UserTrusted, err = h.CryptoStore.IsKeySignedBy(ctx, userID, theirMasterKey.Key, h.Account.UserID, ownUserSigningKey)
}
if err != nil {
log.Err(err).Msg("Failed to check if user is trusted")
addError(fmt.Errorf("failed to check if user is trusted: %w", err))
}
}
resp.Devices = make([]*ProfileViewDevice, len(devices))
i := 0
for _, device := range devices {