Skip to main content

maybe_decrypt_bound

Function maybe_decrypt_bound 

Source
pub fn maybe_decrypt_bound(
    key: Option<&TokenEncryptionKey>,
    stored: &str,
    aad: &[u8],
) -> Result<String, AuthError>
Expand description

Attempt to decrypt stored if it carries the "enc2:" or "enc:" prefix, verifying aad for the bound format. If no key is provided but the value is encrypted, return an error — the caller should not silently return ciphertext as the token value.