pub enum MessageError {
Show 19 variants
EnvelopeTooLarge {
size: usize,
max: usize,
},
Truncated(String),
UnsupportedVersion(u8),
UnsupportedCompression(u8),
DecompressionBomb {
declared: usize,
max: usize,
},
DecompressedLengthMismatch {
expected: usize,
actual: usize,
},
PayloadTooLarge(usize),
Codec(String),
UnsupportedType(u32),
DuplicateType(u32),
InvalidPoint,
UnresolvableSender,
SealFailed(String),
OpenFailed,
BadSignature,
HeaderMismatch,
Replay,
Expired,
TtlTooLong,
}Expand description
Every fail-cleanly outcome of encoding, framing, or (de)compressing a dig-message (SPEC §1, §1.1, §2). A receiver MUST reject — never panic — on any of these.
Variants§
EnvelopeTooLarge
The on-wire frame exceeds crate::MAX_ENVELOPE_BYTES (SPEC §1).
Truncated(String)
The frame ended before a complete envelope could be decoded (SPEC §1).
UnsupportedVersion(u8)
The envelope declares a version this reader does not support (SPEC §2 field 1).
UnsupportedCompression(u8)
The compression algorithm id is not recognized (SPEC §1.1). Never mis-decode with a wrong codec.
DecompressionBomb
The declared uncompressed length exceeds the bomb-guard cap (SPEC §1.1).
DecompressedLengthMismatch
The decoded output length did not match the declared uncompressed_len (SPEC §1.1).
PayloadTooLarge(usize)
A payload’s uncompressed length does not fit the u32 wire field (SPEC §5.2).
Codec(String)
A Streamable (de)serialization or codec-level failure with the underlying detail (SPEC §1).
UnsupportedType(u32)
The message_type is not registered (SPEC §4). Returned when the dispatch shape is a request or
stream frame so the caller can reply UNSUPPORTED_TYPE; an unknown one-shot/response is instead
silently dropped (never surfaced as an error — the forward-compat property).
DuplicateType(u32)
A crate::MessageType was registered twice (SPEC §4 additive-only: an id, once assigned, is
never renumbered or repurposed). A duplicate registration is a caller bug, reported — never
silently overwriting the existing handler.
InvalidPoint
A received G1 point (the kem_enc encapsulation or the resolved sender key) failed the
mandatory prime-order subgroup / non-identity check BEFORE any DH (SPEC §5.1). Fail-closed:
blocks small-subgroup / invalid-curve key-recovery attacks.
UnresolvableSender
The sender DID could not be resolved to a BLS G1 identity key at the claimed epoch (SPEC §5.2). An unknown/unresolvable sender means the seal cannot be authenticated — fail-closed.
SealFailed(String)
Sealing failed to produce ciphertext (an AEAD encrypt or ephemeral-key error, SPEC §5.1).
OpenFailed
The AEAD open failed — a wrong recipient key, wrong sender key, tampered ciphertext, or tampered AAD header all land here (SPEC §5.1/§5.2). Fail-closed, no plaintext is revealed.
BadSignature
The mandatory BLS G2 sender signature was absent, malformed, or did not verify against the
resolved sender key over SIG_DOMAIN || transcript (SPEC §5.1). Fail-closed REJECT.
HeaderMismatch
The sealed inner message_type/correlation_id did not equal the cleartext header — an
anti type-confusion / anti-splice REJECT (SPEC §5.2 step b).
Replay
The message is a replay or is stale: a duplicate counter, a counter below the sliding window,
or a timestamp_ms outside the freshness window (SPEC §5.6). Fail-closed DROP.
Expired
The message is past its sender-controlled expires_at TTL and is DISCARDED with no side
effect (SPEC §5.6b).
TtlTooLong
expires_at exceeds timestamp_ms + MAX_MESSAGE_TTL_MS — a near-infinite validity claim,
REJECTED (never clamped, since clamping would alter signed content) (SPEC §5.6b).
Trait Implementations§
Source§impl Debug for MessageError
impl Debug for MessageError
Source§impl Display for MessageError
impl Display for MessageError
impl Eq for MessageError
Source§impl Error for MessageError
impl Error for MessageError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for MessageError
impl PartialEq for MessageError
impl StructuralPartialEq for MessageError
Auto Trait Implementations§
impl Freeze for MessageError
impl RefUnwindSafe for MessageError
impl Send for MessageError
impl Sync for MessageError
impl Unpin for MessageError
impl UnsafeUnpin for MessageError
impl UnwindSafe for MessageError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.