OpenAgentID documentation
Source referencesRust module referenceoas-lineage

oas-lineage · crate

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

Source: oas/oas/oas-lineage/src/lib.rs. SHA-256: b334f1b452eb9c64f265f349c4a530fa82ee13b20bb2827ca7476fc7e3e07177.

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.

config

oas-lineage

Agent lineage verification for the Open Agent Specification (OAS).

This crate implements the lineage verification algorithm from OAS Specification §8 and Appendix C, including full cryptographic chain walking, structural validation, and child entity derivation.

Key Types

Example: Verify a lineage chain

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;

// Root entities require an explicit verifier-controlled trust anchor.
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).unwrap();
assert_eq!(result.chain_length, 1);

Example: Derive a child entity

use oas_lineage::derive::derive_child_entity;
use oas_document::builder::DocumentBuilder;
use oas_document::conformance::ConformanceLevel;
use oas_crypto::keypair::OasKeyPair;

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

let child = derive_child_entity(
    &root_keypair,
    &root_doc,
    "did:oas:test:agent:bot",
    "/agent-bot",
).unwrap();

assert_eq!(child.lineage.generation, 1);
assert_eq!(child.lineage.human_root_did, "did:oas:test:hmr:alice");
pub mod config;

Source line: 73.

derive

pub mod derive;

Source line: 74.

error

pub mod error;

Source line: 75.

provider

pub mod provider;

Source line: 76.

verify

pub mod verify;

Source line: 77.

pub use error::LineageError;

pub use error::LineageError;

Source line: 79.

On this page