From 06707d1a34438bdc1ed62c228bd06c491012e2ce Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Tue, 27 Dec 2022 12:43:18 +0100 Subject: [PATCH] feat: Compute the fingerprint of a bundle --- lib/src/omemo/bundle.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/omemo/bundle.dart b/lib/src/omemo/bundle.dart index 7896a7b..c2da915 100644 --- a/lib/src/omemo/bundle.dart +++ b/lib/src/omemo/bundle.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'package:cryptography/cryptography.dart'; +import 'package:hex/hex.dart'; import 'package:omemo_dart/src/keys.dart'; class OmemoBundle { @@ -43,4 +44,10 @@ class OmemoBundle { } List get spkSignature => base64Decode(spkSignatureEncoded); + + /// Calculates the fingerprint of the bundle (See + /// https://xmpp.org/extensions/xep-0384.html#security ยง 2). + Future getFingerprint() async { + return HEX.encode(await ik.getBytes()); + } }