pub struct Response<'a> { /* private fields */ }Expand description
Complete DER response and its original optional token. Private fields keep the status/token association immutable; reading establishes no trust.
use std::sync::Arc;
use structured_asn1::{Parser, memory::{Memory, MemoryAccount}};
use structured_cms::timestamp::{Response, response::Status};
let memory = Memory::new(Arc::new(MemoryAccount::new(4096, 65536)));
let parser = Parser::der(memory);
let mut reader = parser.read(&[0x30, 5, 0x30, 3, 2, 1, 2], 400).unwrap();
let response = Response::read(&mut reader).unwrap();
assert_eq!(response.status().status(), Status::Rejection);
assert!(response.token().is_none()); // no signature evidence on failureImplementations§
Source§impl<'doc> Response<'doc>
impl<'doc> Response<'doc>
Sourcepub fn check<'a, P, S: Source, PE, RE>(
&'a self,
provider: &'a P,
query: &Reader<'a>,
context: &CheckContext<'a, '_>,
covered: &mut S,
recognizes: impl FnMut(&TokenExtension<'_>, &Execution<'_>) -> Result<bool, RE>,
) -> Result<CheckedResponse<'a>, CheckError<S::Error, PE, RE>>where
P: for<'scope> SignatureProvider<'scope, Error = PE>,
'doc: 'a,
pub fn check<'a, P, S: Source, PE, RE>(
&'a self,
provider: &'a P,
query: &Reader<'a>,
context: &CheckContext<'a, '_>,
covered: &mut S,
recognizes: impl FnMut(&TokenExtension<'_>, &Execution<'_>) -> Result<bool, RE>,
) -> Result<CheckedResponse<'a>, CheckError<S::Error, PE, RE>>where
P: for<'scope> SignatureProvider<'scope, Error = PE>,
'doc: 'a,
Check a response against its actual live parsed request. context.requested
is required; its absence is a caller-context InvalidLocation refusal, not
a malformed response or a downgrade to archival checking. Negative status
responses start no provider, profile, recognizer or covered-content work.
All token, request, source, callback and resource causes remain unchanged.
Sourcepub fn check_with_profile<'a, P, S: Source, PE, RE, FE>(
&'a self,
provider: &'a P,
query: &Reader<'a>,
context: &CheckContext<'a, '_>,
covered: &mut S,
recognizes: impl FnMut(&TokenExtension<'_>, &Execution<'_>) -> Result<bool, RE>,
profile: impl for<'view, 'scope> FnOnce(ProfileInput<'view, 'doc, 'a, 'scope>) -> Result<(), ProfileFailure<FE>>,
) -> Result<CheckedResponse<'a>, ProfileCheckError<S::Error, PE, RE, FE>>where
P: for<'scope> SignatureProvider<'scope, Error = PE>,
'doc: 'a,
pub fn check_with_profile<'a, P, S: Source, PE, RE, FE>(
&'a self,
provider: &'a P,
query: &Reader<'a>,
context: &CheckContext<'a, '_>,
covered: &mut S,
recognizes: impl FnMut(&TokenExtension<'_>, &Execution<'_>) -> Result<bool, RE>,
profile: impl for<'view, 'scope> FnOnce(ProfileInput<'view, 'doc, 'a, 'scope>) -> Result<(), ProfileFailure<FE>>,
) -> Result<CheckedResponse<'a>, ProfileCheckError<S::Error, PE, RE, FE>>where
P: for<'scope> SignatureProvider<'scope, Error = PE>,
'doc: 'a,
Same shared token kernel with its original pre-crypto profile hook. No response status, nonce or certificate hint bypasses the selected profile.
Source§impl<'a> Response<'a>
impl<'a> Response<'a>
Sourcepub fn read(parent: &mut Reader<'a>) -> Result<Self>
pub fn read(parent: &mut Reader<'a>) -> Result<Self>
Read exactly one complete response; refuse any trailing source bytes.
Sourcepub fn read_element(parent: &Reader<'a>, element: &Element<'a>) -> Result<Self>
pub fn read_element(parent: &Reader<'a>, element: &Element<'a>) -> Result<Self>
Read one original embedded response. The response’s own DER contract applies even in a BER carrier, without a replacement parser or account.
Sourcepub fn status(&self) -> &StatusInfo<'a>
pub fn status(&self) -> &StatusInfo<'a>
Original unauthenticated status metadata.
Sourcepub fn token(&self) -> Option<&Token<'a>>
pub fn token(&self) -> Option<&Token<'a>>
Original token, only present for granted/grantedWithMods.