feat: Compute the fingerprint of a bundle

This commit is contained in:
PapaTutuWawa 2022-12-27 12:43:18 +01:00
parent 4346b31637
commit 06707d1a34

View File

@ -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<int> get spkSignature => base64Decode(spkSignatureEncoded);
/// Calculates the fingerprint of the bundle (See
/// https://xmpp.org/extensions/xep-0384.html#security § 2).
Future<String> getFingerprint() async {
return HEX.encode(await ik.getBytes());
}
}