Skip to main content

open_message

Function open_message 

Source
pub fn open_message(
    recipient_sk: &SecretKey,
    envelope: &DigMessageEnvelope,
    resolve_sender_pub: impl Fn(Bytes32, u32) -> Option<[u8; 48]>,
    guard: &mut ReplayGuard,
    now_ms: u64,
) -> Result<OpenedMessage>
Expand description

Open + fully verify a sealed envelope (SPEC §5.2 / §5.7), advancing the anti-replay guard.

resolve_sender_pub maps (sender DID, sender_epoch) to the sender’s 48-byte BLS G1 key (wire a dig-identity chain resolution here); returning None fails closed with MessageError::UnresolvableSender. now_ms is the receiver’s wall clock for the freshness + expiry checks.

§Errors

Fail-closed at each step: MessageError::UnresolvableSender, MessageError::InvalidPoint, MessageError::OpenFailed, MessageError::BadSignature, MessageError::HeaderMismatch, MessageError::TtlTooLong, MessageError::Expired, MessageError::Replay, MessageError::DecompressionBomb, and the codec/compression errors.