2022-08-03 14:41:33 +00:00
|
|
|
/// Triggered during X3DH if the signature if the SPK does verify to the actual SPK.
|
2022-08-02 13:40:26 +00:00
|
|
|
class InvalidSignatureException implements Exception {
|
|
|
|
String errMsg() => 'The signature of the SPK does not match the provided signature';
|
|
|
|
}
|
2022-08-03 14:41:33 +00:00
|
|
|
|
2022-08-04 12:01:50 +00:00
|
|
|
/// Triggered by the Double Ratchet if the computed HMAC does not match the attached HMAC.
|
|
|
|
/// Triggered by the Session Manager if the computed HMAC does not match the attached HMAC.
|
2022-08-03 14:41:33 +00:00
|
|
|
class InvalidMessageHMACException implements Exception {
|
|
|
|
String errMsg() => 'The computed HMAC does not match the provided HMAC';
|
|
|
|
}
|
2022-08-03 14:44:18 +00:00
|
|
|
|
|
|
|
/// Triggered by the Double Ratchet if skipping messages would cause skipping more than
|
|
|
|
/// MAXSKIP messages
|
|
|
|
class SkippingTooManyMessagesException implements Exception {
|
|
|
|
String errMsg() => 'Skipping messages would cause a skip bigger than MAXSKIP';
|
|
|
|
}
|
2022-08-04 12:01:50 +00:00
|
|
|
|
|
|
|
/// Triggered by the Session Manager if the message key is not encrypted for the device.
|
|
|
|
class NotEncryptedForDeviceException implements Exception {
|
|
|
|
String errMsg() => 'Not encrypted for this device';
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Triggered by the Session Manager when there is no key for decrypting the message.
|
|
|
|
class NoDecryptionKeyException implements Exception {
|
|
|
|
String errMsg() => 'No key available for decrypting the message';
|
|
|
|
}
|
2022-08-08 13:48:09 +00:00
|
|
|
|
|
|
|
/// Triggered by the Session Manager when the identifier of the used Signed Prekey
|
|
|
|
/// is neither the current SPK's identifier nor the old one's.
|
|
|
|
class UnknownSignedPrekeyException implements Exception {
|
|
|
|
String errMsg() => 'Unknown Signed Prekey used.';
|
|
|
|
}
|
2022-10-02 12:56:20 +00:00
|
|
|
|
|
|
|
/// Triggered by the Session Manager when the received Key Exchange message does not
|
|
|
|
/// meet our expectations. This happens when the PN attribute of the message is not equal
|
|
|
|
/// to our receive number.
|
|
|
|
class InvalidKeyExchangeException implements Exception {
|
|
|
|
const InvalidKeyExchangeException(this.expectedPn, this.actualPn);
|
|
|
|
final int expectedPn;
|
|
|
|
final int actualPn;
|
|
|
|
String errMsg() => 'The pn attribute of the key exchange is invalid. Expected $expectedPn, got $actualPn';
|
|
|
|
}
|
2022-10-02 15:03:39 +00:00
|
|
|
|
|
|
|
/// Triggered by the Session Manager when a message's sequence number is smaller than we
|
|
|
|
/// expect it to be.
|
|
|
|
class MessageAlreadyDecryptedException implements Exception {
|
|
|
|
String errMsg() => 'The message has already been decrypted';
|
|
|
|
}
|