...
 
Commits (2)
......@@ -25,10 +25,18 @@ import org.whispersystems.signalservice.api.push.SignalServiceAddress;
class JsonUntrustedIdentityException {
// address is the local account
public JsonAddress address;
// number is the remote account
public JsonAddress number;
// fingerprint is the legacy fingerprint of the untrusted identity
public String fingerprint;
// safety_number is the safety number between the local identity and the new remote identity
public String safety_number;
public JsonRequest request;
JsonUntrustedIdentityException(IdentityKey key, SignalServiceAddress address, Manager m, JsonRequest request) {
......@@ -39,8 +47,10 @@ class JsonUntrustedIdentityException {
this.request = request;
}
public JsonUntrustedIdentityException(UntrustedIdentityException exception) {
public JsonUntrustedIdentityException(UntrustedIdentityException exception, String username) {
this.address = new JsonAddress(username);
this.number = new JsonAddress(exception.getName());
this.fingerprint = Hex.toStringCondensed(exception.getUntrustedIdentity().getPublicKey().serialize());
// TODO: compute the safety_number
}
}
......@@ -85,7 +85,7 @@ class MessageReceiver implements Manager.ReceiveMessageHandler, Runnable {
try {
if(exception instanceof org.whispersystems.libsignal.UntrustedIdentityException) {
JsonUntrustedIdentityException message = new JsonUntrustedIdentityException((org.whispersystems.libsignal.UntrustedIdentityException) exception);
JsonUntrustedIdentityException message = new JsonUntrustedIdentityException((org.whispersystems.libsignal.UntrustedIdentityException) exception, username);
this.sockets.broadcast(new JsonMessageWrapper("inbound_identity_failure", message, (Throwable)null));
}
if(envelope != null) {
......
......@@ -272,12 +272,17 @@ public class IdentityKeyStore implements org.whispersystems.libsignal.state.Iden
return added.getTime();
}
@JsonGetter("trustLevel")
public int getTrustLevelJSON() {
@JsonGetter("trust")
public String getTrustLevelString() {
if(trustLevel == null) {
return trustLevel.TRUSTED_UNVERIFIED.ordinal();
return trustLevel.TRUSTED_UNVERIFIED.name();
}
return trustLevel.ordinal();
return trustLevel.name();
}
@JsonSetter("trust")
public void setTrustLevelString(String level) {
trustLevel = TrustLevel.valueOf(level);
}
@JsonSetter("trustLevel")
......