oas-document · proof_format
Declared module signatures, types, configuration, and source documentation.
Source: oas/oas/oas-document/src/proof_format.rs. SHA-256: ef0aa12184d48759fd268ee0af6899f0b746a90969c8a0d9867cbd3f69777835.
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.
proof_format::DOCUMENT_PROOF_TYPE
The fixed proof type for OAS document proofs.
pub const DOCUMENT_PROOF_TYPE: &str;Source line: 16.
proof_format::DocumentProof
An Ed25519Signature2020 document proof.
See OAS Specification §5.5 for the complete format.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DocumentProof {
/// Fixed: `"Ed25519Signature2020"`
#[serde(rename = "type")]
pub proof_type: String,
/// ISO 8601 timestamp of when the proof was created.
pub created: String,
/// Reference to the verification method used (e.g., `did:oas:ns:hmr:a#key-1`).
pub verification_method: String,
/// The purpose of this proof (e.g., `"assertionMethod"`).
pub proof_purpose: String,
/// The multibase-encoded Ed25519 signature (base58btc with `z` prefix).
pub proof_value: String
}Source line: 23.
proof_format::DocumentProof::generate
Generates a document proof by signing the canonical document bytes.
Implements OAS Specification §5.5:
- Canonicalize the document (without proof) via JCS
- Sign the canonical bytes with the signing key
- Encode as multibase base58btc
Arguments
document_json- The document as a JSON value (proof field MUST be absent/null).keypair- The signing keypair.verification_method_id- Full ID of the verification method (e.g.,did:oas:ns:hmr:a#key-1).created- ISO 8601 timestamp for the proof.
Returns
A [DocumentProof] containing the signature.
Errors
Returns [DocumentError::ProofGenerationFailed] if canonicalization or signing fails.
pub fn generate(
document_json: &serde_json::Value,
keypair: &OasKeyPair,
verification_method_id: &str,
created: &str,
) -> Result<Self, DocumentError>;Source line: 63.
proof_format::DocumentProof::verify
Verifies this document proof against the canonical document bytes.
Implements OAS Specification §5.5 verification:
- Canonicalize the document (without proof) via JCS
- Decode the proof value from multibase
- Verify the Ed25519 signature
Arguments
document_json- The document as a JSON value (proof field MUST be absent/null).public_key_bytes- The 32-byte Ed25519 public key.
Returns
Ok(()) if the proof is valid.
Errors
Returns [DocumentError::ProofVerificationFailed] if verification fails.
pub fn verify(
&self,
document_json: &serde_json::Value,
public_key_bytes: &[u8],
) -> Result<(), DocumentError>;Source line: 106.