#[non_exhaustive]pub struct VerificationMethod {
pub id: DidUrl,
pub method_type: MethodType,
pub controller: Did,
pub material: VerificationMaterial,
pub properties: IndexMap<String, Value>,
}Expand description
A verification method (DID Core §5.2): a public key with an id, a type and a controller.
Members other than the four core ones live in properties, in insertion order.
§Examples
use identity_kit::did::{MethodType, VerificationMaterial, VerificationMethod};
let json = r#"{
"id": "did:example:123#key-1",
"type": "Multikey",
"controller": "did:example:123",
"publicKeyMultibase": "z6MkmM42vxfqZQsv4ehtTjFFxQ4sQKS2w6WR7emozFAn5cxu"
}"#;
let method: VerificationMethod = serde_json::from_str(json)?;
assert_eq!(method.method_type, MethodType::MULTIKEY);
assert_eq!(method.controller.as_str(), "did:example:123");
assert_eq!(
method.material.as_multibase(),
Some("z6MkmM42vxfqZQsv4ehtTjFFxQ4sQKS2w6WR7emozFAn5cxu")
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: DidUrlThe DID URL identifying the method, usually the document DID with a fragment.
method_type: MethodTypeThe type, which tells which cryptographic suite reads the material.
controller: DidThe DID of the controller of the key.
material: VerificationMaterialpublicKeyJwk or publicKeyMultibase.
properties: IndexMap<String, Value>Every other member, in insertion order.
Implementations§
Source§impl VerificationMethod
impl VerificationMethod
Sourcepub fn new(
id: DidUrl,
method_type: MethodType,
controller: Did,
material: VerificationMaterial,
) -> Self
pub fn new( id: DidUrl, method_type: MethodType, controller: Did, material: VerificationMaterial, ) -> Self
A verification method with the four core members.
Sourcepub fn public_key_jwk(&self) -> Option<&Jwk>
pub fn public_key_jwk(&self) -> Option<&Jwk>
The publicKeyJwk, if that is the material.
Sourcepub fn public_key_multibase(&self) -> Option<&str>
pub fn public_key_multibase(&self) -> Option<&str>
The publicKeyMultibase, if that is the material.
Trait Implementations§
Source§impl Clone for VerificationMethod
impl Clone for VerificationMethod
Source§impl Debug for VerificationMethod
impl Debug for VerificationMethod
Source§impl<'de> Deserialize<'de> for VerificationMethod
impl<'de> Deserialize<'de> for VerificationMethod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for VerificationMethod
Source§impl From<VerificationMethod> for MethodRef
impl From<VerificationMethod> for MethodRef
Source§fn from(method: VerificationMethod) -> Self
fn from(method: VerificationMethod) -> Self
Converts to this type from the input type.
Source§impl PartialEq for VerificationMethod
impl PartialEq for VerificationMethod
Source§impl PartialSchema for VerificationMethod
Available on crate feature utoipa only.
impl PartialSchema for VerificationMethod
Available on crate feature
utoipa only.Source§impl Serialize for VerificationMethod
impl Serialize for VerificationMethod
impl StructuralPartialEq for VerificationMethod
Auto Trait Implementations§
impl Freeze for VerificationMethod
impl RefUnwindSafe for VerificationMethod
impl Send for VerificationMethod
impl Sync for VerificationMethod
impl Unpin for VerificationMethod
impl UnsafeUnpin for VerificationMethod
impl UnwindSafe for VerificationMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.