oas-resolve · anchored
Declared module signatures, types, configuration, and source documentation.
Source: oas/oas/oas-resolve/src/anchored.rs. SHA-256: fa71502f19c501a71ac700d39ae94217811409ce35453a6b070dc94041069170.
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.
anchored::AnchorRecord
Minimal canonical view of a GAL root anchor (HMR / MHR / ENR).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct AnchorRecord {
/// Subject DID this anchor is bound to.
pub did: String,
/// Lifecycle status reported by the GAL: `"active"`, `"rotating"`,
/// `"revoked"`. Anything other than `"active"` is rejected.
pub status: String,
/// Block height at which this anchor version was published. Must be
/// less than or equal to the GAL's current finalized block.
pub anchored_at_block: u64,
/// BLAKE3 commitment to the canonical off-chain DID document.
pub metadata_commitment: String
}Source line: 87.
anchored::AnchorStatus
Result of a check_revocation call. Resolvers MUST call this first.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnchorStatus {
pub revoked: bool,
/// Optional human-readable reason commitment.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reason_commitment: Option<String>
}Source line: 102.
anchored::OrgLineageRoot
Minimal canonical view of a GAL OrgLineageRoot. Only the fields the
guard needs for inclusion verification are surfaced.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct OrgLineageRoot {
/// Org DID (typically MHR or ENR).
pub org_did: String,
/// `blake3:`-prefixed hex of the on-chain Merkle root.
pub merkle_root: String,
/// On-chain status: `"active"` / `"rotating"` / `"revoked"`.
pub status: String,
/// Block height at which this version of the root was published.
pub anchored_at_block: u64
}Source line: 113.
anchored::AnchorError
Errors returned by a LineageAnchor. Mapped into ResolveError
variants by [AnchoredResolver].
#[derive(Debug, thiserror::Error)]
pub enum AnchorError {
/// Underlying transport / RPC failure.
#[error("anchor transport error: {0}")]
Transport(String),
/// Backend returned a structurally invalid record.
#[error("invalid anchor record: {0}")]
InvalidRecord(String),
}Source line: 127.
anchored::LineageAnchor
Read-only view of the Sigil GAL needed by the verification guard.
This is intentionally a subset of mars-protocol::SigilAnchorClient —
resolvers do not need to submit anchors. A production adapter that
wraps mars-protocol::SigilAnchorClient lives in sigil-sdk.
#[async_trait]
pub trait LineageAnchor: Send + Sync {
/// Revocation-first check. Returns `revoked: true` for subjects with
/// any cascade kind (single, cascade-root, cascade-org).
async fn check_revocation(&self, did: &str) -> Result<AnchorStatus, AnchorError>;
/// Fetch the typed HMR anchor for a DID, or `None` if absent.
async fn get_hmr(&self, did: &str) -> Result<Option<AnchorRecord>, AnchorError>;
/// Fetch the typed MHR anchor for a DID, or `None` if absent.
async fn get_mhr(&self, did: &str) -> Result<Option<AnchorRecord>, AnchorError>;
/// Fetch the typed ENR anchor for a DID, or `None` if absent.
async fn get_enr(&self, did: &str) -> Result<Option<AnchorRecord>, AnchorError>;
/// Fetch the typed `OrgLineageRoot` for an org DID, or `None` if
/// the GAL has no Merkle commitment for that DID.
///
/// Default impl returns `None` — implementations that want to
/// participate in Rule 7 (org Merkle inclusion) override this.
async fn get_org_root(&self, _org_did: &str) -> Result<Option<OrgLineageRoot>, AnchorError> ;
/// Current finalized block height. The guard uses this to reject
/// anchors whose `anchored_at_block` lies in the future.
async fn current_finalized_block(&self) -> Result<u64, AnchorError>;
}Source line: 142.
anchored::MemoryAnchor
In-memory LineageAnchor for tests. Deterministic, no I/O.
pub struct MemoryAnchor {
}Source line: 171.
anchored::MemoryAnchor::new
Empty source with current_finalized_block = 0.
pub fn new() -> Self;Source line: 193.
anchored::MemoryAnchor::set_block
Set the current finalized block height.
pub fn set_block(&self, block: u64);Source line: 200.
anchored::MemoryAnchor::insert_hmr
Pre-populate an HMR anchor.
pub fn insert_hmr(&self, anchor: AnchorRecord);Source line: 207.
anchored::MemoryAnchor::insert_mhr
Pre-populate an MHR anchor.
pub fn insert_mhr(&self, anchor: AnchorRecord);Source line: 214.
anchored::MemoryAnchor::insert_enr
Pre-populate an ENR anchor.
pub fn insert_enr(&self, anchor: AnchorRecord);Source line: 221.
anchored::MemoryAnchor::insert_revocation
Mark a DID as revoked.
pub fn insert_revocation(&self, did: &str, reason: Option<&str>);Source line: 228.
anchored::MemoryAnchor::insert_org_root
Pre-populate an OrgLineageRoot (Rule 7 inclusion verification).
pub fn insert_org_root(&self, root: OrgLineageRoot);Source line: 241.
anchored::AnchoredResolver
Wraps any inner [Resolver] with a [LineageAnchor] backend and
enforces the GAL verification rules on every resolution.
pub struct AnchoredResolver<R, G>
where
R: Resolver,
G: LineageAnchor, {
}Source line: 308.
anchored::AnchoredResolver<R, G>::new
Build a guard around an inner resolver and GAL backend.
pub fn new(inner: R, anchor: G) -> Self;Source line: 323.
anchored::document_metadata_commitment
Compute the BLAKE3 hex digest of a DID document's canonical JSON (RFC 8785 / JCS). This is the value committed to by GAL anchors.
pub fn document_metadata_commitment(doc: &OasDocument) -> Result<String, ResolveError>;Source line: 330.
anchored::org_leaf_hash
BLAKE3 of the canonical org leaf — BLAKE3(child_did_utf8_bytes).
Exposed so test fixtures and indexers can compute the same value.
pub fn org_leaf_hash(child_did: &str) -> String;Source line: 729.