mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Support serviceId based safety number for scannable safety numbers
This commit is contained in:
parent
04de0010b5
commit
54c3b19052
1 changed files with 7 additions and 4 deletions
|
@ -58,22 +58,25 @@ public class IdentityHelper {
|
|||
}
|
||||
|
||||
public String computeSafetyNumber(ServiceId serviceId, IdentityKey theirIdentityKey) {
|
||||
final Fingerprint fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey);
|
||||
final var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, false);
|
||||
return fingerprint == null ? null : fingerprint.getDisplayableFingerprint().getDisplayText();
|
||||
}
|
||||
|
||||
public ScannableFingerprint computeSafetyNumberForScanning(ServiceId serviceId, IdentityKey theirIdentityKey) {
|
||||
final Fingerprint fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey);
|
||||
var fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, false);
|
||||
if (fingerprint == null) {
|
||||
fingerprint = computeSafetyNumberFingerprint(serviceId, theirIdentityKey, true);
|
||||
}
|
||||
return fingerprint == null ? null : fingerprint.getScannableFingerprint();
|
||||
}
|
||||
|
||||
private Fingerprint computeSafetyNumberFingerprint(
|
||||
final ServiceId serviceId, final IdentityKey theirIdentityKey
|
||||
final ServiceId serviceId, final IdentityKey theirIdentityKey, boolean useServiceId
|
||||
) {
|
||||
final var recipientId = account.getRecipientResolver().resolveRecipient(serviceId);
|
||||
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
|
||||
|
||||
if (false) {
|
||||
if (useServiceId) {
|
||||
if (serviceId.isUnknown()) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue