mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Use safety numbers with ACI by default
This commit is contained in:
parent
506dcfa6c0
commit
8d423adb4d
1 changed files with 8 additions and 13 deletions
|
@ -57,33 +57,28 @@ public class IdentityHelper {
|
|||
}
|
||||
|
||||
public String computeSafetyNumber(ServiceId serviceId, IdentityKey theirIdentityKey) {
|
||||
final var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, false);
|
||||
final var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey);
|
||||
return fingerprint == null ? null : fingerprint.getDisplayableFingerprint().getDisplayText();
|
||||
}
|
||||
|
||||
public ScannableFingerprint computeSafetyNumberForScanning(ServiceId serviceId, IdentityKey theirIdentityKey) {
|
||||
var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, false);
|
||||
if (fingerprint == null) {
|
||||
fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, true);
|
||||
}
|
||||
var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey);
|
||||
return fingerprint == null ? null : fingerprint.getScannableFingerprint();
|
||||
}
|
||||
|
||||
private Fingerprint computeSafetyNumberFingerprint(
|
||||
final ServiceId serviceId, final IdentityKey theirIdentityKey, boolean useServiceId
|
||||
final ServiceId serviceId, final IdentityKey theirIdentityKey
|
||||
) {
|
||||
final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId);
|
||||
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||
|
||||
if (useServiceId) {
|
||||
if (serviceId.isUnknown()) {
|
||||
return null;
|
||||
}
|
||||
if (!serviceId.isUnknown()) {
|
||||
return Utils.computeSafetyNumberForUuid(account.getAci(),
|
||||
account.getAciIdentityKeyPair().getPublicKey(),
|
||||
serviceId,
|
||||
theirIdentityKey);
|
||||
}
|
||||
|
||||
final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId);
|
||||
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||
|
||||
if (address.number().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue