pub struct OasDocument {Show 31 fields
pub context: Vec<String>,
pub id: String,
pub controller: String,
pub verification_method: Vec<VerificationMethod>,
pub authentication: Vec<String>,
pub assertion_method: Vec<String>,
pub capability_invocation: Vec<String>,
pub capability_delegation: Vec<String>,
pub service: Vec<ServiceEndpoint>,
pub oas_version: String,
pub kind: String,
pub name: Option<String>,
pub description: Option<String>,
pub lineage: Option<LineageSection>,
pub governance: Option<GovernanceSection>,
pub conformance_level: ConformanceLevel,
pub lifecycle_status: Option<LifecycleStatus>,
pub sequence: u64,
pub metadata: DocumentMetadata,
pub proof: Option<DocumentProof>,
pub revoked: Option<bool>,
pub revoked_at: Option<String>,
pub profile: Option<ProfileSection>,
pub contact: Option<ContactSection>,
pub calendar: Option<CalendarSection>,
pub operational: Option<OperationalSection>,
pub pricing: Option<PricingSection>,
pub interoperability: Option<InteroperabilitySection>,
pub reputation: Option<ReputationSection>,
pub compliance: Option<ComplianceSection>,
pub relationships: Option<RelationshipsSection>,
}Expand description
An OAS Identity Document as defined in OAS Specification §5.
This is the canonical representation of an autonomous entity’s identity, extending the W3C DID Document with OAS-specific properties.
§Examples
use oas_document::OasDocument;
let json = r#"{
"@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/ed25519-2020/v1", "https://openagent.id/ns/oas/v1"],
"id": "did:oas:test:hmr:alice",
"controller": "did:oas:test:hmr:alice",
"verificationMethod": [{"id": "did:oas:test:hmr:alice#key-1", "type": "Ed25519VerificationKey2020", "controller": "did:oas:test:hmr:alice", "publicKeyMultibase": "zTest"}],
"authentication": ["did:oas:test:hmr:alice#key-1"],
"oasVersion": "1.0.0",
"kind": "hmr",
"conformanceLevel": "L1",
"sequence": 1,
"metadata": {"created": "2026-01-15T00:00:00Z"}
}"#;
let doc: OasDocument = serde_json::from_str(json).unwrap();
assert_eq!(doc.id, "did:oas:test:hmr:alice");Fields§
§context: Vec<String>JSON-LD contexts. MUST include the OAS context.
id: StringThe did:oas identifier.
controller: StringDID of the controlling entity.
verification_method: Vec<VerificationMethod>At least one Ed25519VerificationKey2020.
authentication: Vec<String>References to keys authorized for authentication.
assertion_method: Vec<String>References to keys authorized for assertions.
capability_invocation: Vec<String>References to keys authorized for capability invocation.
capability_delegation: Vec<String>References to keys authorized for capability delegation.
service: Vec<ServiceEndpoint>Service endpoints.
oas_version: StringOAS specification version (currently "1.0.0").
kind: StringEntity kind from the taxonomy.
name: Option<String>Human-readable name (max 256 chars).
description: Option<String>Human-readable description (max 4096 chars).
lineage: Option<LineageSection>Lineage information (required for L1+ non-root entities).
governance: Option<GovernanceSection>Governance section (ENR entities only). Tracks which MHR governs this enterprise identity, epoch, and transition history.
conformance_level: ConformanceLevelConformance level: L0, L1, or L2.
lifecycle_status: Option<LifecycleStatus>Lifecycle status.
sequence: u64Monotonically increasing version counter (starting at 1).
metadata: DocumentMetadataDocument metadata.
proof: Option<DocumentProof>Document proof (Ed25519Signature2020).
revoked: Option<bool>Whether this identity has been revoked.
revoked_at: Option<String>Timestamp of revocation.
profile: Option<ProfileSection>Profile / presentation data (§5.8): avatar, tagline, categories.
contact: Option<ContactSection>Contact directory (§5.9): phones, emails, socials, websites.
calendar: Option<CalendarSection>Calendar & scheduling (§5.10): booking links, office hours.
operational: Option<OperationalSection>Operational specification (§5.11): SLA, rate limits, formats.
pricing: Option<PricingSection>Pricing & economics (§5.12): cost model, billing, free tier.
interoperability: Option<InteroperabilitySection>Interoperability (§5.13): protocols, API schemas, auth methods.
reputation: Option<ReputationSection>Reputation summary (§5.14): interactions, endorsements, uptime.
compliance: Option<ComplianceSection>Compliance & jurisdiction (§5.15): certifications, policy URLs.
relationships: Option<RelationshipsSection>Relationships & affiliations (§5.16): org structure, partnerships.
Implementations§
Source§impl OasDocument
impl OasDocument
Sourcepub fn default_context() -> Vec<String>
pub fn default_context() -> Vec<String>
Returns the default JSON-LD context array for OAS documents.
Sourcepub fn is_root(&self) -> bool
pub fn is_root(&self) -> bool
Returns true if this document represents a root entity (HMR, MHR, or ENR).
Sourcepub fn is_revoked(&self) -> bool
pub fn is_revoked(&self) -> bool
Returns true if this document has been revoked.
Sourcepub fn canonical_digest(&self) -> Result<String, DocumentError>
pub fn canonical_digest(&self) -> Result<String, DocumentError>
Computes the canonical BLAKE3 commitment for this complete document.
The digest covers the RFC 8785 canonical JSON representation, including the document proof and all status, relationship, key, and lineage fields. Lineage proofs bind this value to the authenticated parent state used at issuance time.
§Returns
A lowercase blake3:-prefixed digest.
§Errors
Returns DocumentError::Crypto if canonicalization fails.
Sourcepub fn primary_public_key_multibase(&self) -> Option<&str>
pub fn primary_public_key_multibase(&self) -> Option<&str>
Returns the primary public key multibase string, if available.
Looks for the first verification method’s public key.
Sourcepub fn find_verification_method(
&self,
id_or_fragment: &str,
) -> Option<&VerificationMethod>
pub fn find_verification_method( &self, id_or_fragment: &str, ) -> Option<&VerificationMethod>
Finds a verification method by its full ID or fragment.