- account.getSignalProtocolStore()
- .setIdentityTrustLevel(address, id.getIdentityKey(), TrustLevel.TRUSTED_VERIFIED);
- try {
- sendVerifiedMessage(address, id.getIdentityKey(), TrustLevel.TRUSTED_VERIFIED);
- } catch (IOException | UntrustedIdentityException e) {
- logger.warn("Failed to send verification sync message: {}", e.getMessage());
+ if (foundIdentity == null) {
+ return false;
+ }
+
+ account.getSignalProtocolStore()
+ .setIdentityTrustLevel(address, foundIdentity.getIdentityKey(), TrustLevel.TRUSTED_VERIFIED);
+ try {
+ sendVerifiedMessage(address, foundIdentity.getIdentityKey(), TrustLevel.TRUSTED_VERIFIED);
+ } catch (IOException | UntrustedIdentityException e) {
+ logger.warn("Failed to send verification sync message: {}", e.getMessage());
+ }
+
+ // Successfully trusted the new identity, now remove all other identities for that number
+ for (var id : ids) {
+ if (id == foundIdentity) {
+ continue;