[omemo] Add sqlite identity key converter

This commit is contained in:
Philipp Hörist
2019-02-21 22:05:33 +01:00
parent 16234036aa
commit 2e8c5a5a70
2 changed files with 24 additions and 7 deletions

View File

@@ -18,6 +18,8 @@ import binascii
import textwrap
from enum import IntEnum
from axolotl.identitykey import IdentityKey
DEFAULT_PREKEY_AMOUNT = 100
MIN_PREKEY_AMOUNT = 80
SPK_ARCHIVE_TIME = 86400 * 15 # 15 Days
@@ -43,3 +45,12 @@ def get_fingerprint(identity_key, formatted=False):
buf += '{0} '.format(fingerprint[w:w + wordsize])
buf = textwrap.fill(buf, width=36)
return buf.rstrip().upper()
class IdentityKeyExtended(IdentityKey):
def __hash__(self):
return hash(self.publicKey.serialize())
def get_fingerprint(self, formatted=False):
return get_fingerprint(self, formatted=formatted)