OpenAgentID documentation
Source referencesRust module referenceoas-document

oas-document · verification_method

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

Source: oas/oas/oas-document/src/verification_method.rs. SHA-256: 453af7775498ea48130015c72defb829d538d8060ed6ccf301b5f4c5f60a4b2d.

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.

verification_method::VERIFICATION_METHOD_TYPE

The fixed verification method type per OAS Specification §5.1.

pub const VERIFICATION_METHOD_TYPE: &str;

Source line: 7.

verification_method::VerificationMethod

An Ed25519 verification method as defined in OAS Identity Documents.

See OAS Specification §5.1 for the complete structure.

Examples

use oas_document::verification_method::VerificationMethod;

let vm = VerificationMethod {
    id: "did:oas:acme:hmr:alice#key-1".to_string(),
    method_type: "Ed25519VerificationKey2020".to_string(),
    controller: "did:oas:acme:hmr:alice".to_string(),
    public_key_multibase: "z6Mktest123".to_string(),
};
assert_eq!(vm.key_id(), "key-1");
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VerificationMethod {
/// The full key ID (e.g., `did:oas:acme:hmr:alice#key-1`).

pub id: String,
/// The verification method type. MUST be `Ed25519VerificationKey2020`.

#[serde(rename = "type")]
pub method_type: String,
/// The DID that controls this key.

pub controller: String,
/// The public key encoded as multibase base58btc (with `z` prefix).

pub public_key_multibase: String
}

Source line: 28.

verification_method::VerificationMethod::key_id

Extracts the key fragment (the part after #) from the ID.

Returns

The key fragment, or the full ID if no # is present.

Examples

use oas_document::verification_method::VerificationMethod;

let vm = VerificationMethod {
    id: "did:oas:ns:hmr:a#key-1".to_string(),
    method_type: "Ed25519VerificationKey2020".to_string(),
    controller: "did:oas:ns:hmr:a".to_string(),
    public_key_multibase: "zTest".to_string(),
};
assert_eq!(vm.key_id(), "key-1");
pub fn key_id(&self) -> &str;

Source line: 63.

verification_method::VerificationMethod::new

Creates a new verification method for an OAS entity.

Arguments

  • did - The entity's DID string.
  • key_num - The key number (used to form the fragment, e.g., key-1).
  • public_key_multibase - The multibase-encoded public key.
pub fn new(did: &str, key_num: u32, public_key_multibase: &str) -> Self;

Source line: 77.

On this page