mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-31 11:34:21 +01:00
Add json output listIdentities command
This commit is contained in:
@@ -2664,14 +2664,22 @@ public class Manager implements Closeable {
|
||||
}
|
||||
}
|
||||
|
||||
public String computeSafetyNumber(
|
||||
SignalServiceAddress theirAddress, IdentityKey theirIdentityKey
|
||||
) {
|
||||
return Utils.computeSafetyNumber(ServiceConfig.capabilities.isUuid(),
|
||||
public String computeSafetyNumber(SignalServiceAddress theirAddress, IdentityKey theirIdentityKey) {
|
||||
final var fingerprint = Utils.computeSafetyNumber(capabilities.isUuid(),
|
||||
account.getSelfAddress(),
|
||||
getIdentityKeyPair().getPublicKey(),
|
||||
theirAddress,
|
||||
theirIdentityKey);
|
||||
return fingerprint == null ? null : fingerprint.getDisplayableFingerprint().getDisplayText();
|
||||
}
|
||||
|
||||
public byte[] computeSafetyNumberForScanning(SignalServiceAddress theirAddress, IdentityKey theirIdentityKey) {
|
||||
final var fingerprint = Utils.computeSafetyNumber(capabilities.isUuid(),
|
||||
account.getSelfAddress(),
|
||||
getIdentityKeyPair().getPublicKey(),
|
||||
theirAddress,
|
||||
theirIdentityKey);
|
||||
return fingerprint == null ? null : fingerprint.getScannableFingerprint().getSerialized();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.asamk.signal.manager.util;
|
||||
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
import org.whispersystems.libsignal.fingerprint.Fingerprint;
|
||||
import org.whispersystems.libsignal.fingerprint.NumericFingerprintGenerator;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.util.StreamDetails;
|
||||
@@ -36,7 +37,7 @@ public class Utils {
|
||||
return new StreamDetails(stream, mime, size);
|
||||
}
|
||||
|
||||
public static String computeSafetyNumber(
|
||||
public static Fingerprint computeSafetyNumber(
|
||||
boolean isUuidCapable,
|
||||
SignalServiceAddress ownAddress,
|
||||
IdentityKey ownIdentityKey,
|
||||
@@ -56,18 +57,17 @@ public class Utils {
|
||||
// Version 1: E164 user
|
||||
version = 1;
|
||||
if (!ownAddress.getNumber().isPresent() || !theirAddress.getNumber().isPresent()) {
|
||||
return "INVALID ID";
|
||||
return null;
|
||||
}
|
||||
ownId = ownAddress.getNumber().get().getBytes();
|
||||
theirId = theirAddress.getNumber().get().getBytes();
|
||||
}
|
||||
|
||||
var fingerprint = new NumericFingerprintGenerator(5200).createFor(version,
|
||||
return new NumericFingerprintGenerator(5200).createFor(version,
|
||||
ownId,
|
||||
ownIdentityKey,
|
||||
theirId,
|
||||
theirIdentityKey);
|
||||
return fingerprint.getDisplayableFingerprint().getDisplayText();
|
||||
}
|
||||
|
||||
public static SignalServiceAddress getSignalServiceAddressFromIdentifier(final String identifier) {
|
||||
|
||||
Reference in New Issue
Block a user