pub struct DidDocument {
pub id: String,
pub verification_method: Vec<VerificationMethod>,
pub assertion_method: Vec<Value>,
pub key_agreement: Vec<VerificationMethod>,
}Expand description
A DID Document, parsed to the fields APH needs.
Deliberately NOT deny_unknown_fields: a DID Document is a general W3C
artifact that legitimately carries much more than APH reads (services,
authentication relationships, other proof purposes). Rejecting those
would make APH unable to verify notaries with ordinary DID Documents.
Fields§
§id: StringThe document’s own DID.
verification_method: Vec<VerificationMethod>Published keys. Absent in a document that delegates all keys by reference, which APH cannot use.
assertion_method: Vec<Value>DID URLs approved for the assertionMethod proof purpose.
key_agreement: Vec<VerificationMethod>Key-agreement (encryption) keys — the surface RFC 0008’s sealed
payloads resolve readers from. APH’s profile carries EMBEDDED entries
(the same Multikey shape as verificationMethod), never bare
string references: a reference points at a key the resolver must
fetch AGAIN, and the §8.4 surfaces publish whole documents.
Implementations§
Source§impl DidDocument
impl DidDocument
Sourcepub fn key_agreement_x25519(&self, kid: &str) -> Result<[u8; 32], AphError>
pub fn key_agreement_x25519(&self, kid: &str) -> Result<[u8; 32], AphError>
Resolves the X25519 keyAgreement key named by kid — the reader
key a sealed payload (RFC 0008) points at. Refuses with APH_E023
when the document publishes no matching entry, when the entry carries
no publicKeyMultibase, or when the bytes are not an X25519 multikey
— all three are “the key you were told to use is not published”, and
which document surface came up empty is exactly what the code’s
distinctness from APH_E014 exists to say.
Sourcepub fn allows_assertion(&self, did_url: &str) -> bool
pub fn allows_assertion(&self, did_url: &str) -> bool
Returns true if did_url is listed for the assertionMethod proof
purpose, which is the purpose APH envelope proofs declare.
Entries may be plain DID URL strings or embedded objects with an id;
both forms are recognized.
Sourcepub fn resolve_key(&self, did_url: &str) -> Result<NotaryPublicKey, AphError>
pub fn resolve_key(&self, did_url: &str) -> Result<NotaryPublicKey, AphError>
Finds the key a proof’s verificationMethod names (spec §8.4.4
steps 5–6).
When the DID URL carries no fragment, the document must publish exactly one key: guessing among several would let the document’s ordering decide which key verifies a credential.