pub struct Document {
pub context: Option<Vec<Value>>,
pub id: Did,
pub also_known_as: Option<Vec<String>>,
pub controller: Option<Vec<Did>>,
pub verification_method: Option<Vec<VerificationMethodMap>>,
pub authentication: Option<Vec<VerificationMethod>>,
pub assertion_method: Option<Vec<VerificationMethod>>,
pub key_agreement: Option<Vec<VerificationMethod>>,
pub capability_invocation: Option<Vec<VerificationMethod>>,
pub capability_delegation: Option<Vec<VerificationMethod>>,
pub service: Option<Vec<ServiceEndpoint>>,
}Fields§
§context: Option<Vec<Value>>Held as opaque JSON so that re-serializing a resolved document does not drop it; entries may be strings or objects and are never interpreted.
id: Did§also_known_as: Option<Vec<String>>§controller: Option<Vec<Did>>§verification_method: Option<Vec<VerificationMethodMap>>§authentication: Option<Vec<VerificationMethod>>§assertion_method: Option<Vec<VerificationMethod>>§key_agreement: Option<Vec<VerificationMethod>>§capability_invocation: Option<Vec<VerificationMethod>>§capability_delegation: Option<Vec<VerificationMethod>>§service: Option<Vec<ServiceEndpoint>>Implementations§
Source§impl Document
impl Document
Sourcepub fn resolve_verification_method_url(
&self,
url: &DidUrl,
role: VerificationRole,
) -> Option<&VerificationMethodMap>
pub fn resolve_verification_method_url( &self, url: &DidUrl, role: VerificationRole, ) -> Option<&VerificationMethodMap>
Returns the verification method that the provided DidUrl is
referencing, restricted to a given VerificationRole.
Runs in O(roles + methods). Resolving every entry and then comparing
would be quadratic, which a hostile document can turn into seconds of
CPU for a few megabytes of input.
Sourcepub fn resolve_verification_method<'a>(
&'a self,
method: &'a VerificationMethod,
) -> Option<&'a VerificationMethodMap>
pub fn resolve_verification_method<'a>( &'a self, method: &'a VerificationMethod, ) -> Option<&'a VerificationMethodMap>
Resolves a VerificationMethod to its VerificationMethodMap.
For embedded maps, returns the map directly. For URL references,
resolves them against this document’s verification_method array.
A method whose id names a different DID is never returned: otherwise a
document could embed a method claiming to be another identifier’s key.
Its controller may name another DID, which this does not verify.