OpenAgentID documentation
Source referencesRust module referenceoas-attestation

oas-attestation · types

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

Source: oas/oas/oas-attestation/src/types.rs. SHA-256: c1a59688117ef835c95ecb653755d55fe6ab510ead834be9d686a0d69ccd360b.

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.

types::AttestationType

An OAS attestation type per Specification §13.2.

Six standard types are defined. Implementations MAY register custom attestation types by defining a new value and publishing its schema.

Examples

use oas_attestation::types::AttestationType;

let at = AttestationType::SecurityAudit;
assert_eq!(at.as_str(), "SecurityAudit");

let parsed: AttestationType = "BehaviorAttestation".parse().unwrap();
assert_eq!(parsed, AttestationType::BehaviorAttestation);
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AttestationType {
    /// Results of a security analysis (vulnerability scan, code audit, penetration test).
    SecurityAudit,
    /// Attestation about observed runtime behavior over a period.
    BehaviorAttestation,
    /// Verification that an entity possesses claimed capabilities.
    CapabilityVerification,
    /// Attestation of compliance with a regulatory framework or standard.
    ComplianceAttestation,
    /// Endorsement by a verified domain expert.
    ExpertEndorsement,
    /// Community-sourced review with aggregated trust score.
    CommunityReview,
    /// Lineage Attestation Bridge per OAS Spec §14.7 — opt-in lossless export
    /// of an `AgentLineageProof2025` (§10) into W3C VC form for
    /// interoperability with VC-native verifiers.
    LineageAttestation,
    /// A custom attestation type not defined in the specification.
    ///
    /// The string value SHOULD be published at a well-known URI within
    /// the issuer's namespace.
    Custom(String),
}

Source line: 30.

types::AttestationType::as_str

Returns the canonical string representation of this attestation type.

Returns

The OAS §13.2 type name (e.g., "SecurityAudit") or the custom value.

pub fn as_str(&self) -> &str;

Source line: 60.

types::AttestationType::required_fields

Returns the required credentialSubject fields for this attestation type.

Per OAS Specification §13.2, each standard type defines a minimum set of fields. Implementations MAY extend these schemas.

Returns

A slice of field names that MUST be present in the credential subject. Does not include "id" and "attestationType" which are always required.

pub fn required_fields(&self) -> &[&str];

Source line: 82.

types::AttestationType::validate_subject

Validates that a credential subject contains all required fields for this type.

Arguments

  • subject - The credential subject as a JSON object.

Returns

Ok(()) if all required fields are present.

Errors

Returns [AttestationError::MissingField] if a required field is absent.

pub fn validate_subject(&self, subject: &serde_json::Value) -> Result<(), AttestationError>;

Source line: 129.

On this page