mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 20:36:22 +00:00
feat: Show active and trust status in /omemo fingerprint
The /omemo fingerprint command provided a list of all keys ever seen for a contact but did not indicate which keys were currently "active" (present in the latest server device list). This made it difficult for users to identify which fingerprints actually required verification to fix encryption issues. Users can now easily distinguish between devices currently in use and historical keys that no longer matter. When encryption fails users can immediately see which "active" key is "untrusted," allowing them to verify the correct fingerprint fast. Function `omemo_is_device_active` will check if a fingerprint belongs to a device currently announced by the contacts server.
This commit is contained in:
@@ -1313,6 +1313,39 @@ omemo_get_jid_untrusted_fingerprints(const char* const jid)
|
||||
return untrusted_fps;
|
||||
}
|
||||
|
||||
gboolean
|
||||
omemo_is_device_active(const char* const jid, const char* const fingerprint)
|
||||
{
|
||||
if (!omemo_loaded()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GList* device_list = g_hash_table_lookup(omemo_ctx.device_list, jid);
|
||||
if (!device_list) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GHashTable* known_identities = g_hash_table_lookup(omemo_ctx.known_devices, jid);
|
||||
if (!known_identities) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void* device_id = g_hash_table_lookup(known_identities, fingerprint);
|
||||
if (!device_id) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint32_t dev_id = GPOINTER_TO_INT(device_id);
|
||||
GList* iter;
|
||||
for (iter = device_list; iter != NULL; iter = iter->next) {
|
||||
if (GPOINTER_TO_INT(iter->data) == dev_id) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char*
|
||||
_omemo_fingerprint(ec_public_key* identity, gboolean formatted)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user