2026-01-15 08:47:02 +08:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
/// Errors produced by the Double Ratchet protocol
|
|
|
|
|
#[derive(Debug, Error, Clone, PartialEq, Eq)]
|
|
|
|
|
pub enum RatchetError {
|
|
|
|
|
#[error("ciphertext too short")]
|
|
|
|
|
CiphertextTooShort,
|
|
|
|
|
|
|
|
|
|
#[error("invalid nonce")]
|
|
|
|
|
InvalidNonce,
|
|
|
|
|
|
|
|
|
|
#[error("decryption failed")]
|
|
|
|
|
DecryptionFailed,
|
|
|
|
|
|
|
|
|
|
#[error("message replay detected")]
|
|
|
|
|
MessageReplay,
|
|
|
|
|
|
|
|
|
|
#[error("too many skipped messages")]
|
|
|
|
|
TooManySkippedMessages,
|
|
|
|
|
|
|
|
|
|
#[error("missing remote DH key")]
|
|
|
|
|
MissingRemoteDhKey,
|
|
|
|
|
|
|
|
|
|
#[error("missing receiving chain")]
|
|
|
|
|
MissingReceivingChain,
|
2026-01-29 09:19:52 +08:00
|
|
|
|
|
|
|
|
#[error("deserialization failed")]
|
|
|
|
|
DeserializationFailed,
|
2026-01-15 08:47:02 +08:00
|
|
|
}
|