From 57bd04645ebc20c37964f197c217ac7de1d2348c Mon Sep 17 00:00:00 2001 From: Tim Henkes Date: Sat, 20 Aug 2022 09:37:24 +0200 Subject: [PATCH] Have the identity key fingerprint formatting helper correctly convert the key to Curve25519 first --- omemo/session_manager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/omemo/session_manager.py b/omemo/session_manager.py index 0318f2b..feaedb6 100644 --- a/omemo/session_manager.py +++ b/omemo/session_manager.py @@ -6,6 +6,8 @@ import secrets from typing import Any, Dict, FrozenSet, List, NamedTuple, Optional, Set, Tuple, Type, TypeVar, Union, cast +import xeddsa + from .backend import Backend, KeyExchangeFailed from .bundle import Bundle from .identity_key_pair import IdentityKeyPair @@ -1433,12 +1435,13 @@ def format_identity_key(identity_key: bytes) -> List[str]: identity_key: The identity key to generate the fingerprint of. Returns: - The fingerprint of the identity key, as eight groups of eight lowercase hex chars each. Consider - applying `Consistent Color Generation `__ to each - individual group when displaying the fingerprint, if applicable. + The fingerprint of the identity key in its Curve25519 form as per the specficiaton, in eight + groups of eight lowercase hex chars each. Consider applying + `Consistent Color Generation `__ to each individual + group when displaying the fingerprint, if applicable. """ - ik_hex_string = identity_key.hex() + ik_hex_string = xeddsa.ed25519_pub_to_curve25519_pub(identity_key).hex() group_size = 8 return [ ik_hex_string[i:i + group_size] for i in range(0, len(ik_hex_string), group_size) ]