Improve identites listing

This commit is contained in:
AsamK 2023-08-26 16:33:39 +02:00
parent 884fa2748e
commit bc3bdbbf21
2 changed files with 11 additions and 2 deletions

View file

@ -1147,7 +1147,12 @@ public class ManagerImpl implements Manager {
@Override
public List<Identity> getIdentities() {
return account.getIdentityKeyStore().getIdentities().stream().map(this::toIdentity).toList();
return account.getIdentityKeyStore()
.getIdentities()
.stream()
.map(this::toIdentity)
.filter(Objects::nonNull)
.toList();
}
private Identity toIdentity(final IdentityInfo identityInfo) {
@ -1157,6 +1162,10 @@ public class ManagerImpl implements Manager {
final var address = account.getRecipientAddressResolver()
.resolveRecipientAddress(account.getRecipientResolver().resolveRecipient(identityInfo.getServiceId()));
if (address.serviceId().isPresent() && !Objects.equals(address.serviceId().get(),
identityInfo.getServiceId())) {
return null;
}
final var scannableFingerprint = context.getIdentityHelper()
.computeSafetyNumberForScanning(identityInfo.getServiceId(), identityInfo.getIdentityKey());
return new Identity(address.toApiRecipientAddress(),