OpenAgentID documentation
Source referencesRust module referenceoas-sdk

oas-sdk · anchor_policy

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

Source: oas/oas/oas-sdk/src/anchor_policy.rs. SHA-256: a7973d1474d6a9e82c69cdb9054b4e24f957fd1cb22400f09b3d3056bbf04710.

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.

Module condition:

#[cfg(feature = "resolve")]

anchor_policy::AnchorPolicy

The verifier's anchor policy.

trusted_schemes is ordered most-preferred-first. The default policy trusts Sigil only — the ecosystem's reference anchor and the home of the lineage economics (generation decay, publisher bonds), which only Sigil computes.

#[cfg(feature = "resolve")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AnchorPolicy {
/// Ordered anchor schemes, most preferred first.

pub trusted_schemes: Vec<String>
}

Source line: 38.

anchor_policy::AnchorPolicy::trusting

A policy trusting the given schemes in order.

#[cfg(feature = "resolve")]
pub fn trusting(schemes: impl IntoIterator<Item = impl Into<String>>) -> Self;

Source line: 53.

anchor_policy::AnchorPolicy::sigil_then_eas

Sigil preferred, EAS as fallback.

#[cfg(feature = "resolve")]
pub fn sigil_then_eas() -> Self;

Source line: 63.

anchor_policy::AnchorBackends

A registry of anchor backends by scheme name.

#[cfg(feature = "resolve")]
pub type AnchorBackends<'a> = HashMap<String, &'a (dyn LineageAnchor + Send + Sync)>;

Source line: 69.

anchor_policy::VerifyWithAnchorRequest

Typed policy inputs for [verify_with_anchor_policy].

Grouping these verifier-controlled values prevents positional argument mistakes and keeps the authority policy explicit at call sites.

#[cfg(feature = "resolve")]
pub struct VerifyWithAnchorRequest<'a> {
/// Ordered verifier trust policy for anchor backends.

pub policy: &'a AnchorPolicy,
/// Available anchor backends keyed by scheme.

pub backends: AnchorBackends<'a>,
/// Expected authority path from the trusted root to the subject.

pub path_kind: crate::lineage::AuthorityPathKind,
/// Scopes the confirmed authority must grant.

pub required_scopes: &'a [String],
/// Optional lower bound for backend finality.

pub min_finalized_block: Option<u64>
}

Source line: 75.

anchor_policy::AnchoredAuthoritySource

A [LineageAuthoritySource] that dispatches to anchor backends per the verifier's [AnchorPolicy].

#[cfg(feature = "resolve")]
pub struct AnchoredAuthoritySource<'a> {

}

Source line: 90.

anchor_policy::AnchoredAuthoritySource<'a>::new

Build the dispatcher.

A trusted scheme with no registered backend cannot confirm authority, so it contributes nothing to the decision: the dispatcher proceeds with the backends that exist and, if none confirms, fails closed with the policy named in the error. An unregistered trusted scheme is a legal state (a verifier may not run every backend it would trust); silently treating it as a pass is the failure this shape prevents.

#[cfg(feature = "resolve")]
pub fn new(policy: AnchorPolicy, backends: AnchorBackends<'a>) -> Self;

Source line: 104.

anchor_policy::verify_with_anchor_policy

Verify lineage with an explicit anchor policy, in one call.

The facade-level entry for the common case: offline lineage verification (portable) followed by authority confirmation against the trusted anchor schemes the document's lineage section points at. If you do not have a document-shaped anchor reference set, this composes identically to calling verify_privileged_authority with an [AnchoredAuthoritySource].

Errors

Fails closed: any backend error, absent anchor, non-active status, or unconfirmed finality means the privileged action is not authorized.

#[cfg(feature = "resolve")]
#[cfg(feature = "resolve")]
pub fn verify_with_anchor_policy(
    document: &OasDocument,
    provider: &dyn oas_lineage::provider::DocumentProvider,
    config: &oas_lineage::config::VerifyConfig,
    request: VerifyWithAnchorRequest<'_>,
) -> Result<crate::lineage::LineageAuthorityVerification, OasError>;

Source line: 275.

On this page