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