fix: Throw a custom exception
This commit is contained in:
parent
8d222a160f
commit
45d0c57305
@ -3,6 +3,7 @@ import 'package:meta/meta.dart';
|
|||||||
import 'package:omemo_dart/protobuf/schema.pb.dart';
|
import 'package:omemo_dart/protobuf/schema.pb.dart';
|
||||||
import 'package:omemo_dart/src/double_ratchet/crypto.dart';
|
import 'package:omemo_dart/src/double_ratchet/crypto.dart';
|
||||||
import 'package:omemo_dart/src/double_ratchet/kdf.dart';
|
import 'package:omemo_dart/src/double_ratchet/kdf.dart';
|
||||||
|
import 'package:omemo_dart/src/errors.dart';
|
||||||
import 'package:omemo_dart/src/helpers.dart';
|
import 'package:omemo_dart/src/helpers.dart';
|
||||||
import 'package:omemo_dart/src/key.dart';
|
import 'package:omemo_dart/src/key.dart';
|
||||||
import 'package:omemo_dart/src/x3dh.dart';
|
import 'package:omemo_dart/src/x3dh.dart';
|
||||||
@ -142,8 +143,7 @@ class OmemoDoubleRatchet {
|
|||||||
|
|
||||||
Future<void> skipMessageKeys(int until) async {
|
Future<void> skipMessageKeys(int until) async {
|
||||||
if (nr + maxSkip < until) {
|
if (nr + maxSkip < until) {
|
||||||
// TODO(PapaTutuWawa): Custom exception
|
throw SkippingTooManyMessagesException();
|
||||||
throw Exception();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ckr != null) {
|
if (ckr != null) {
|
||||||
|
@ -7,3 +7,9 @@ class InvalidSignatureException implements Exception {
|
|||||||
class InvalidMessageHMACException implements Exception {
|
class InvalidMessageHMACException implements Exception {
|
||||||
String errMsg() => 'The computed HMAC does not match the provided HMAC';
|
String errMsg() => 'The computed HMAC does not match the provided HMAC';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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';
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user