pub struct VerifiedContext {
pub inner: FullContext,
pub key_status: KeyAuthorization,
pub verified_receipt: Option<RegistryReceipt>,
}Expand description
A retrieved context that has been cryptographically verified.
Fields§
§inner: FullContext§key_status: KeyAuthorizationWhether the body verified against a currently authorized key or a receipt-attested historical one (ACDP 0.2, WS-B).
verified_receipt: Option<RegistryReceipt>The verified registry receipt, when one was present and the
policy verified it (RFC-ACDP-0010). None under
ReceiptPolicy::Ignore or when the registry minted none.
Implementations§
Source§impl VerifiedContext
impl VerifiedContext
Sourcepub async fn fetch(
client: &RegistryClient,
resolver: &WebResolver,
ctx_id: &CtxId,
) -> Result<Self, AcdpError>
pub async fn fetch( client: &RegistryClient, resolver: &WebResolver, ctx_id: &CtxId, ) -> Result<Self, AcdpError>
Retrieve a context and verify its signature using the strict
default VerificationPolicy.
Sourcepub async fn fetch_with_policy(
client: &RegistryClient,
resolver: &WebResolver,
ctx_id: &CtxId,
policy: &VerificationPolicy,
) -> Result<Self, AcdpError>
pub async fn fetch_with_policy( client: &RegistryClient, resolver: &WebResolver, ctx_id: &CtxId, policy: &VerificationPolicy, ) -> Result<Self, AcdpError>
Retrieve a context and verify its signature with caller-controlled strictness.
- Fetches
body + registry_statefrom the registry. - Optionally runs
validate_body— structural schema checks plus embedded-DataRefhash verification (policy-controlled). - Recomputes
content_hashover ProducerContent. - Resolves the producer’s DID document.
did:webis required unconditionally for v0.1.0 (RFC-ACDP-0001 §5.4). - Verifies the Ed25519 signature (or other supported algorithm).
- Optionally verifies the
registry_receiptplaceholder. - Optionally rejects unknown statuses.
Sourcepub async fn fetch_report(
client: &RegistryClient,
resolver: &WebResolver,
ctx_id: &CtxId,
policy: &VerificationPolicy,
) -> Result<(Self, VerificationReport), AcdpError>
pub async fn fetch_report( client: &RegistryClient, resolver: &WebResolver, ctx_id: &CtxId, policy: &VerificationPolicy, ) -> Result<(Self, VerificationReport), AcdpError>
Retrieve + verify, returning a structured VerificationReport
alongside the verified context. Does NOT attempt external
DataRef fetches — use Self::fetch_report_with_fetcher for
that. Each data_ref_external slot in the returned report is
None.
Unlike Self::fetch_with_policy, per-DataRef embedded-hash
failures are recorded in the report instead of aborting the
verification. The top-level checks (schema, body hash,
signature) remain hard-fail: if any of them fails, the method
returns an AcdpError and produces no report.
For diagnostic callers that want a populated report even when
a top-level check fails (e.g. an audit walker that needs to
distinguish “wrong hash” from “wrong signature”), use
Self::fetch_report_diagnose instead.
Sourcepub async fn fetch_report_diagnose(
client: &RegistryClient,
resolver: &WebResolver,
ctx_id: &CtxId,
policy: &VerificationPolicy,
) -> Result<(Option<Self>, VerificationReport), AcdpError>
pub async fn fetch_report_diagnose( client: &RegistryClient, resolver: &WebResolver, ctx_id: &CtxId, policy: &VerificationPolicy, ) -> Result<(Option<Self>, VerificationReport), AcdpError>
Diagnostic variant of Self::fetch_report that never
short-circuits on a top-level failure — schema, body-hash, and
signature outcomes are each recorded individually in the
returned VerificationReport. Returns Ok((None, report))
when any top-level stage failed (the report shows which one);
Ok((Some(verified), report)) only when every check passed
(FEAT-05).
Use cases:
- Audit walkers that need to classify failures by stage.
- Admin tooling that wants to distinguish “hash mismatch” (probable tampering / encoding drift) from “signature verification failed” (key compromise / DID resolution problem).
Network errors (retrieve, DID resolution) still propagate as
Err — there’s no body to inspect when the registry is
unreachable.
Sourcepub async fn fetch_report_with_fetcher<F: DataRefFetcher>(
client: &RegistryClient,
resolver: &WebResolver,
ctx_id: &CtxId,
policy: &VerificationPolicy,
fetcher: &F,
) -> Result<(Self, VerificationReport), AcdpError>
pub async fn fetch_report_with_fetcher<F: DataRefFetcher>( client: &RegistryClient, resolver: &WebResolver, ctx_id: &CtxId, policy: &VerificationPolicy, fetcher: &F, ) -> Result<(Self, VerificationReport), AcdpError>
Retrieve + verify like Self::fetch_report, and additionally
fetch every DataRef whose location resolves through fetcher.
Each external fetch outcome is recorded in report.data_ref_external.
pub fn body(&self) -> &Body
pub fn registry_state(&self) -> &RegistryState
Sourcepub fn receipt(&self) -> Option<&Value>
pub fn receipt(&self) -> Option<&Value>
Raw registry receipt value as served on the wire
(RFC-ACDP-0010), preserved verbatim. For the verified, typed
form see Self::verified_receipt.
Sourcepub async fn verify_receipt(
&self,
resolver: &WebResolver,
) -> Result<Option<RegistryReceipt>, AcdpError>
pub async fn verify_receipt( &self, resolver: &WebResolver, ) -> Result<Option<RegistryReceipt>, AcdpError>
Verify the registry receipt, when one is present (RFC-ACDP-0010).
Standalone variant for contexts obtained via the report paths or
constructed externally; fetch_with_policy already does this
under ReceiptPolicy::VerifyIfPresent/Require. The serving
authority is taken from the context’s own ctx_id — correct
when the context was fetched from its home registry, which is
the only retrieval shape v0.2 defines.
Returns Ok(None) when no receipt is present, Ok(Some(_))
with the verified receipt otherwise.