feat: Implement getting fingerprints
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'dart:convert';
|
||||
import 'package:cryptography/cryptography.dart';
|
||||
import 'package:hex/hex.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
@@ -356,6 +355,7 @@ class OmemoDoubleRatchet {
|
||||
..message = headerBytes;
|
||||
}
|
||||
|
||||
/// Returns a copy of the ratchet.
|
||||
OmemoDoubleRatchet clone() {
|
||||
return OmemoDoubleRatchet(
|
||||
dhs,
|
||||
@@ -375,6 +375,15 @@ class OmemoDoubleRatchet {
|
||||
);
|
||||
}
|
||||
|
||||
/// Computes the fingerprint of the double ratchet, according to
|
||||
/// XEP-0384.
|
||||
Future<String> get fingerprint async {
|
||||
final curveKey = await ik.toCurve25519();
|
||||
return HEX.encode(
|
||||
await curveKey.getBytes(),
|
||||
);
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
Future<bool> equals(OmemoDoubleRatchet other) async {
|
||||
final dhrMatch = dhr == null
|
||||
|
||||
Reference in New Issue
Block a user