diff --git a/man/signal-cli-dbus.5.adoc b/man/signal-cli-dbus.5.adoc index 46b11734..a2df1674 100644 --- a/man/signal-cli-dbus.5.adoc +++ b/man/signal-cli-dbus.5.adoc @@ -531,6 +531,42 @@ removeDevice() -> <>:: Exceptions: Failure +=== Signal.Identity interface + +The following methods listen to the Identities object path, which is constructed as follows: + + + "/Identities/" + identity + +identity : Either the phone number of a contact with underscore (_) replacing plus (+) , or if not known its uuid + +Identities have the following (case-sensitive) properties: + +* Number (read-only) : Phone number of the contact +* Uuid (read-only) : Internal uuid representing the contact +* Fingerprint (read-only) : Byte array representing the fingerprint +* SafetyNumber (read-only) : String representation of the safety number used to verify trust +* TrustLevel (read-only) : Current trust level (UNSTRUSTED, TRUSTED_UNVERIFIED, TRUSTED_VERIFIED) +* AddedDate (read-only) : Long representing the number of milliseconds since the Unix epoch +* ScannableSafetyNumber (read-only) : Byte array representation of the safety number + +To get a property, use (replacing `--session` with `--system` if needed): +`dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Identity string:$PROPERTY_NAME` + +To get all properties, use: +`dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Identity` + +trust() -> <>:: + +Establish trust with the given identity. TrustLevel will become TRUSTED_UNVERFIED + +Exceptions: Failure + +trustVerified(SafetyNumber) -> <>:: + +Establish trust with the given identity using their safety number. TrustLevel will become TRUSTED_VERIFIED + +Exceptions: Failure + === Signal.Configuration interface The configuration's object path, which exists only for primary devices, is constructed as follows: diff --git a/src/main/java/org/asamk/Signal.java b/src/main/java/org/asamk/Signal.java index 777ca62f..2ca23dfb 100644 --- a/src/main/java/org/asamk/Signal.java +++ b/src/main/java/org/asamk/Signal.java @@ -585,13 +585,13 @@ public interface Signal extends DBusInterface { } } - @DBusProperty(name = "number", type = String.class, access = DBusProperty.Access.READ) - @DBusProperty(name = "uuid", type = String.class, access = DBusProperty.Access.READ) - @DBusProperty(name = "fingerprint", type = Byte[].class, access = DBusProperty.Access.READ) - @DBusProperty(name = "safetyNumber", type = String.class, access = DBusProperty.Access.READ) - @DBusProperty(name = "trustLevel", type = String.class, access = DBusProperty.Access.READ) - @DBusProperty(name = "addedDate", type = Integer.class, access = DBusProperty.Access.READ) - @DBusProperty(name = "scannableSafetyNumber", type = Byte[].class, access = DBusProperty.Access.READ) + @DBusProperty(name = "Number", type = String.class, access = DBusProperty.Access.READ) + @DBusProperty(name = "Uuid", type = String.class, access = DBusProperty.Access.READ) + @DBusProperty(name = "Fingerprint", type = Byte[].class, access = DBusProperty.Access.READ) + @DBusProperty(name = "SafetyNumber", type = String.class, access = DBusProperty.Access.READ) + @DBusProperty(name = "TrustLevel", type = String.class, access = DBusProperty.Access.READ) + @DBusProperty(name = "AddedDate", type = Integer.class, access = DBusProperty.Access.READ) + @DBusProperty(name = "ScannableSafetyNumber", type = Byte[].class, access = DBusProperty.Access.READ) interface Identity extends DBusInterface, Properties { void trust() throws Error.Failure; diff --git a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java index 4c0fb115..6a44ff97 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -1045,7 +1045,7 @@ public class DbusSignalImpl implements Signal { exportObject(object); this.identities.add(new StructIdentity(new DBusPath(object.getObjectPath()), emptyIfNull(i.recipient().getIdentifier()), - i.recipient().getLegacyIdentifier())); + i.recipient().getLegacyIdentifier())); }); } @@ -1084,13 +1084,13 @@ public class DbusSignalImpl implements Signal { public DbusSignalIdentityImpl(final org.asamk.signal.manager.api.Identity identity) { this.identity=identity; super.addPropertiesHandler(new DbusInterfacePropertiesHandler("org.asamk.Signal.Identity", - List.of(new DbusProperty<>("number", () -> identity.recipient().number().orElse("")), - new DbusProperty<>("uuid", () -> identity.recipient().uuid().map(UUID::toString).orElse("")), - new DbusProperty<>("fingerprint", () -> identity.getFingerprint()), - new DbusProperty<>("safetyNumber", identity::safetyNumber), - new DbusProperty<>("scannableSafetyNumber", identity::scannableSafetyNumber), - new DbusProperty<>("trustLevel", identity::trustLevel), - new DbusProperty<>("addedDate", identity::dateAddedTimestamp) + List.of(new DbusProperty<>("Number", () -> identity.recipient().number().orElse("")), + new DbusProperty<>("Uuid", () -> identity.recipient().uuid().map(UUID::toString).orElse("")), + new DbusProperty<>("Fingerprint", () -> identity.getFingerprint()), + new DbusProperty<>("SafetyNumber", identity::safetyNumber), + new DbusProperty<>("ScannableSafetyNumber", identity::scannableSafetyNumber), + new DbusProperty<>("TrustLevel", identity::trustLevel), + new DbusProperty<>("AddedDate", identity::dateAddedTimestamp) ))); }