oas-sdk · attestation
Declared module signatures, types, configuration, and source documentation.
Source: oas/oas/oas-sdk/src/attestation.rs. SHA-256: ced1e63868a56de8ae5158a1d9cbce1540346b506bbd9d0c347fa152b578300a.
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.
attestation::create_attestation
Creates and signs an attestation credential in a single call.
Combines credential building and signing for the common case where you have all the information upfront.
Arguments
issuer_did- The issuer'sdid:oasidentifier.subject_did- The subject entity'sdid:oasidentifier.attestation_type- The OAS §13.2 attestation type.claims- Additional credential subject claims as key-value pairs.issuer_keypair- The issuer's Ed25519 keypair.verification_method_id- Full verification method ID (e.g.,"did:oas:test:hmr:a#key-1").issuance_date- ISO 8601 timestamp.expiration_date- Optional ISO 8601 expiration timestamp.
Returns
A signed [OasCredential].
Errors
Returns [OasError::Attestation] if building, validation, or signing fails.
Examples
use oas_sdk::attestation::create_attestation;
use oas_attestation::types::AttestationType;
use oas_crypto::keypair::OasKeyPair;
let keypair = OasKeyPair::generate();
let cred = create_attestation(
"did:oas:test:hmr:auditor",
"did:oas:test:agent:target",
AttestationType::SecurityAudit,
&[
("auditType", serde_json::json!("codeAudit")),
("result", serde_json::json!("pass")),
("severityFindings", serde_json::json!({"critical": 0})),
("toolOrMethodology", serde_json::json!("OWASP")),
("auditDate", serde_json::json!("2026-01-15T00:00:00Z")),
],
&keypair,
"did:oas:test:hmr:auditor#key-1",
"2026-01-15T00:00:00Z",
None,
);
assert!(cred.is_ok());#[allow(clippy::too_many_arguments)]
pub fn create_attestation(
issuer_did: &str,
subject_did: &str,
attestation_type: AttestationType,
claims: &[(&str, serde_json::Value)],
issuer_keypair: &OasKeyPair,
verification_method_id: &str,
issuance_date: &str,
expiration_date: Option<&str>,
) -> Result<OasCredential, OasError>;Source line: 65.
attestation::verify_attestation
Verifies an attestation credential's proof.
Validates structure and cryptographic proof against the issuer's public key.
Arguments
credential- The signed credential to verify.issuer_public_key- The 32-byte Ed25519 public key of the issuer.
Returns
Ok(()) if valid.
Errors
Returns [OasError::Attestation] if verification fails.
Examples
use oas_sdk::attestation::{create_attestation, verify_attestation};
use oas_attestation::types::AttestationType;
use oas_crypto::keypair::OasKeyPair;
let keypair = OasKeyPair::generate();
let cred = create_attestation(
"did:oas:test:hmr:auditor",
"did:oas:test:agent:target",
AttestationType::ExpertEndorsement,
&[
("expertDid", serde_json::json!("did:oas:test:hmr:auditor")),
("domain", serde_json::json!("security")),
("endorsementType", serde_json::json!("capability")),
("confidence", serde_json::json!(0.9)),
],
&keypair,
"did:oas:test:hmr:auditor#key-1",
"2026-01-15T00:00:00Z",
None,
).unwrap();
let result = verify_attestation(&cred, &keypair.verifying_key_bytes());
assert!(result.is_ok());pub fn verify_attestation(
credential: &OasCredential,
issuer_public_key: &[u8],
) -> Result<(), OasError>;Source line: 144.
attestation::verify_attestation_with_time
Verifies an attestation credential with temporal checks.
In addition to proof verification, checks that the credential is within its valid time window.
Arguments
credential- The signed credential to verify.issuer_public_key- The 32-byte Ed25519 public key of the issuer.now- Current time as ISO 8601 string.
Returns
Ok(()) if valid and within time window.
Errors
Returns [OasError::Attestation] if verification fails or the credential is expired/not yet valid.
pub fn verify_attestation_with_time(
credential: &OasCredential,
issuer_public_key: &[u8],
now: &str,
) -> Result<(), OasError>;Source line: 169.