feat: Notify the user of a modified device

This commit is contained in:
2022-08-05 16:52:02 +02:00
parent 30e3bd78cd
commit 62fdf568aa
6 changed files with 76 additions and 21 deletions

View File

@@ -47,21 +47,15 @@ class Device {
/// This replaces the Onetime-Prekey with id [id] with a completely new one. Returns
/// a new Device object that copies over everything but replaces said key.
Future<Device> replaceOnetimePrekey(int id) async {
final newOpk = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
opks[id] = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
return Device(
id,
ik,
spk,
spkId,
spkSignature,
opks.map((keyId, opk) {
if (keyId == id) {
return MapEntry(id, newOpk);
}
return MapEntry(id, opk);
}),
opks,
);
}