Compare commits
No commits in common. "73613e266f4e537238314c5d52744179577570d3" and "fda06cef55909b02806366e103f58a38c5e957bc" have entirely different histories.
73613e266f
...
fda06cef55
@ -163,23 +163,6 @@ 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.
|
/// Converts this device into an OmemoBundle that could be used for publishing.
|
||||||
Future<OmemoBundle> toBundle() async {
|
Future<OmemoBundle> toBundle() async {
|
||||||
final encodedOpks = <int, String>{};
|
final encodedOpks = <int, String>{};
|
||||||
|
@ -457,28 +457,6 @@ class OmemoSessionManager {
|
|||||||
_eventStreamController.add(RatchetModifiedEvent(jid, deviceId, ratchet));
|
_eventStreamController.add(RatchetModifiedEvent(jid, deviceId, ratchet));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates an entirely new device. May be useful when the user wants to reset their cryptographic
|
|
||||||
/// identity. Triggers an event to commit it to storage.
|
|
||||||
Future<void> regenerateDevice({ int opkAmount = 100 }) async {
|
|
||||||
await _deviceLock.synchronized(() async {
|
|
||||||
_device = await Device.generateNewDevice(_device.jid, opkAmount: opkAmount);
|
|
||||||
|
|
||||||
// Commit it
|
|
||||||
_eventStreamController.add(DeviceModifiedEvent(_device));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Make our device have a new identifier. Only useful before publishing it as a bundle
|
|
||||||
/// to make sure that our device has a id that is account unique.
|
|
||||||
Future<void> regenerateDeviceId() async {
|
|
||||||
await _deviceLock.synchronized(() async {
|
|
||||||
_device = _device.withNewId();
|
|
||||||
|
|
||||||
// Commit it
|
|
||||||
_eventStreamController.add(DeviceModifiedEvent(_device));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
OmemoDoubleRatchet getRatchet(String jid, int deviceId) => _ratchetMap[RatchetMapKey(jid, deviceId)]!;
|
||||||
|
Loading…
Reference in New Issue
Block a user