OpenAgentID documentation
Source referencesRust module referenceoas-resolve

oas-resolve · resolver

Declared module signatures, types, configuration, and source documentation.

Source: oas/oas/oas-resolve/src/resolver.rs. SHA-256: 35b732ff5e27f260a8e97c59ed22c82404abd5508da9ec278b0992dab4524509.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

resolver::Resolver

An async resolver that maps did:oas identifiers to identity documents.

This is the critical abstraction per OAS Specification §12. OAS defines the trait; consumers implement it.

Implementation Requirements

Per OAS Spec §12.2:

  1. MUST return the most recent valid document for the given DID.
  2. MUST verify the document's signature before returning it.
  3. MUST check revocation status and indicate if revoked.
  4. SHOULD verify lineage for L1+ documents.
  5. MUST return a structured error on failure.

Examples

use oas_resolve::resolver::Resolver;
use oas_resolve::memory::InMemoryResolver;

let resolver = InMemoryResolver::new();
// The resolver is ready but empty — all lookups will return NotFound.
#[async_trait]
pub trait Resolver: Send + Sync {
    /// Resolves a `did:oas` identifier to its identity document.
    ///
    /// # Arguments
    ///
    /// * `did` - The `did:oas` identifier to resolve.
    ///
    /// # Returns
    ///
    /// The resolved [`OasDocument`].
    ///
    /// # Errors
    ///
    /// Returns a [`ResolveError`] if:
    /// - The DID is not found ([`ResolveError::NotFound`])
    /// - The document signature is invalid ([`ResolveError::InvalidSignature`])
    /// - The document is revoked ([`ResolveError::Revoked`])
    /// - Any other resolution error occurs
    async fn resolve(&self, did: &str) -> Result<OasDocument, ResolveError>;
}

Source line: 37.

On this page