OpenAgentID documentation
Source referencesRust module referenceoas-lineage

oas-lineage · verify

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

Source: oas/oas/oas-lineage/src/verify.rs. SHA-256: fbe78af078f918131bde6fc1b752e4e451afd41b832f518fb5ac9c8d2b819b26.

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.

verify::VerifyResult

The result of a successful lineage verification.

Contains metadata about the verification process and any warnings that were encountered (e.g., expired liveness attestations).

Examples

use oas_lineage::verify::VerifyResult;

let result = VerifyResult {
    chain_length: 3,
    human_root_did: "did:oas:test:hmr:alice".to_string(),
    warnings: vec![],
};
assert!(result.is_clean());
#[derive(Debug, Clone)]
pub struct VerifyResult {
/// The total length of the verified chain (including the entity itself).

pub chain_length: usize,
/// The DID of the human root at the end of the chain.

pub human_root_did: String,
/// Non-fatal warnings encountered during verification.

///

/// Examples: expired liveness attestations.

pub warnings: Vec<String>
}

Source line: 49.

verify::VerifyResult::is_clean

Returns true if no warnings were raised.

pub fn is_clean(&self) -> bool;

Source line: 64.

verify::verify_lineage

Verifies the complete lineage chain of an OAS Identity Document.

Implements the normative verification algorithm from OAS Spec Appendix C:

  1. Root entities (HMR, MHR, or ENR) must match verifier trust anchors.
  2. Verifies the lineage section exists for non-root entities.
  3. Verifies the chain terminates at an HMR, MHR, or ENR.
  4. Verifies generation matches chain length minus one.
  5. Enforces maximum generation depth.
  6. Walks the chain, verifying each AgentLineageProof2025 signature against the resolved parent document's public key.
  7. Optionally checks human root liveness.

Arguments

  • document - The document whose lineage to verify.
  • provider - A [DocumentProvider] for resolving parent documents.
  • config - Configuration (timeouts, max depth).

Returns

A [VerifyResult] on success, containing chain metadata and any warnings.

Errors

Returns [LineageError] if any step of the verification fails. See the individual error variants for specific failure modes.

Examples

use oas_lineage::verify::verify_lineage;
use oas_lineage::config::{TrustAnchor, VerifyConfig};
use oas_lineage::provider::InMemoryProvider;
use oas_document::builder::DocumentBuilder;
use oas_document::conformance::ConformanceLevel;
use oas_crypto::keypair::OasKeyPair;

let keypair = OasKeyPair::generate();
let root = DocumentBuilder::new("did:oas:test:hmr:alice", "hmr")
    .conformance_level(ConformanceLevel::L1)
    .add_verification_method(&keypair)
    .build_and_sign(&keypair, "2026-01-15T00:00:00Z")
    .unwrap();

let provider = InMemoryProvider::new();
let anchor = TrustAnchor::new(
    &root.id,
    format!("{}#key-1", root.id),
    keypair.public_key_multibase(),
).with_document_digest(root.canonical_digest().unwrap());
let config = VerifyConfig::new().with_trust_anchor(anchor);
let result = verify_lineage(&root, &provider, &config);
assert!(result.is_ok());
pub fn verify_lineage(
    document: &OasDocument,
    provider: &dyn DocumentProvider,
    config: &VerifyConfig,
) -> Result<VerifyResult, LineageError>;

Source line: 124.

On this page