pub enum DecryptOutcome {
Decrypted(String),
Plaintext(String),
}Expand description
Outcome of try_decrypt_message_typed — distinguishes a body that genuinely
AEAD-decrypted from one that was merely passed through (plaintext or a
fail-open decrypt failure).
SECURITY (fail-closed boundary support): try_decrypt_message returns a bare
String and is fail-OPEN — on AEAD-decrypt failure it returns the raw
encrypted envelope, and for non-encrypted bodies it returns the raw plaintext.
Callers that require sender provenance (e.g. the MPC transport, whose messages
are ALWAYS sent encrypted) cannot tell those apart from a real decrypt. This
typed sibling preserves that distinction so the caller can reject anything that
did not authenticate-decrypt against the claimed sender’s key.
Variants§
Decrypted(String)
The encrypted-envelope branch ran and decrypt_body returned Ok — the
body genuinely AEAD-decrypted against the claimed sender. The inner string
is the recovered plaintext.
Plaintext(String)
The body was NOT authenticated-decrypted: either a non-encrypted passthrough
(Case 3) or an {"encryptedMessage":...} body whose decrypt_body failed
(the Case-2 fail-open branch). The inner string is the raw body verbatim,
byte-for-byte identical to what try_decrypt_message would return.
Implementations§
Source§impl DecryptOutcome
impl DecryptOutcome
Sourcepub fn into_body(self) -> String
pub fn into_body(self) -> String
The recovered/passthrough body string, regardless of authenticity. Equals
exactly what try_decrypt_message returns for the same inputs.
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
true iff the body genuinely AEAD-decrypted (the Decrypted variant).
Trait Implementations§
Source§impl Clone for DecryptOutcome
impl Clone for DecryptOutcome
Source§fn clone(&self) -> DecryptOutcome
fn clone(&self) -> DecryptOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecryptOutcome
impl Debug for DecryptOutcome
impl Eq for DecryptOutcome
Source§impl PartialEq for DecryptOutcome
impl PartialEq for DecryptOutcome
impl StructuralPartialEq for DecryptOutcome
Auto Trait Implementations§
impl Freeze for DecryptOutcome
impl RefUnwindSafe for DecryptOutcome
impl Send for DecryptOutcome
impl Sync for DecryptOutcome
impl Unpin for DecryptOutcome
impl UnsafeUnpin for DecryptOutcome
impl UnwindSafe for DecryptOutcome
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.