feat: Allow regerating a device's id

This commit is contained in:
2022-08-18 15:08:05 +02:00
parent 0a03483aaf
commit 73613e266f
2 changed files with 30 additions and 0 deletions

View File

@@ -163,6 +163,23 @@ class Device {
);
}
/// Returns a new device that is equal to this one with the exception that the new
/// device's id is a new number between 0 and 2**32 - 1.
@internal
Device withNewId() {
return Device(
jid,
generateRandom32BitNumber(),
ik,
spk,
spkId,
spkSignature,
oldSpk,
oldSpkId,
opks,
);
}
/// Converts this device into an OmemoBundle that could be used for publishing.
Future<OmemoBundle> toBundle() async {
final encodedOpks = <int, String>{};