Skip to content

Commit

Permalink
Have the identity key fingerprint formatting helper correctly convert…
Browse files Browse the repository at this point in the history
… the key to Curve25519 first
  • Loading branch information
Syndace committed Aug 20, 2022
1 parent 905acd2 commit 57bd046
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions omemo/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <https://xmpp.org/extensions/xep-0392.html>`__ 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 <https://xmpp.org/extensions/xep-0392.html>`__ 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) ]
Expand Down

0 comments on commit 57bd046

Please sign in to comment.