Skip to main content

OasDocument

Struct OasDocument 

Source
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: String

The did:oas identifier.

§controller: String

DID 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: String

OAS specification version (currently "1.0.0").

§kind: String

Entity 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: ConformanceLevel

Conformance level: L0, L1, or L2.

§lifecycle_status: Option<LifecycleStatus>

Lifecycle status.

§sequence: u64

Monotonically increasing version counter (starting at 1).

§metadata: DocumentMetadata

Document 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

Source

pub fn default_context() -> Vec<String>

Returns the default JSON-LD context array for OAS documents.

Source

pub fn is_root(&self) -> bool

Returns true if this document represents a root entity (HMR, MHR, or ENR).

Source

pub fn is_revoked(&self) -> bool

Returns true if this document has been revoked.

Source

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.

Source

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.

Source

pub fn find_verification_method( &self, id_or_fragment: &str, ) -> Option<&VerificationMethod>

Finds a verification method by its full ID or fragment.

Trait Implementations§

Source§

impl Clone for OasDocument

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OasDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for OasDocument

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OasDocument

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OasDocument

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OasDocument

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V