Struct identity_iota::verification::VerificationMethod
source · pub struct VerificationMethod { /* private fields */ }
Expand description
A DID Document Verification Method.
Implementations§
source§impl VerificationMethod
impl VerificationMethod
sourcepub fn builder(properties: BTreeMap<String, Value>) -> MethodBuilder
pub fn builder(properties: BTreeMap<String, Value>) -> MethodBuilder
Creates a MethodBuilder
to configure a new Method
.
This is the same as MethodBuilder::new()
.
sourcepub fn from_builder(builder: MethodBuilder) -> Result<VerificationMethod, Error>
pub fn from_builder(builder: MethodBuilder) -> Result<VerificationMethod, Error>
Returns a new Method
based on the MethodBuilder
configuration.
sourcepub fn set_id(&mut self, id: DIDUrl) -> Result<(), Error>
pub fn set_id(&mut self, id: DIDUrl) -> Result<(), Error>
Sets the VerificationMethod
id.
§Errors
Error::MissingIdFragment
if there is no fragment on the DIDUrl
.
sourcepub fn controller(&self) -> &CoreDID
pub fn controller(&self) -> &CoreDID
Returns a reference to the VerificationMethod
controller.
sourcepub fn controller_mut(&mut self) -> &mut CoreDID
pub fn controller_mut(&mut self) -> &mut CoreDID
Returns a mutable reference to the VerificationMethod
controller.
sourcepub fn type_(&self) -> &MethodType
pub fn type_(&self) -> &MethodType
Returns a reference to the VerificationMethod
type.
sourcepub fn type_mut(&mut self) -> &mut MethodType
pub fn type_mut(&mut self) -> &mut MethodType
Returns a mutable reference to the VerificationMethod
type.
sourcepub fn data(&self) -> &MethodData
pub fn data(&self) -> &MethodData
Returns a reference to the VerificationMethod
data.
sourcepub fn data_mut(&mut self) -> &mut MethodData
pub fn data_mut(&mut self) -> &mut MethodData
Returns a mutable reference to the VerificationMethod
data.
sourcepub fn properties(&self) -> &BTreeMap<String, Value>
pub fn properties(&self) -> &BTreeMap<String, Value>
Returns a reference to the custom VerificationMethod
properties.
sourcepub fn properties_mut(&mut self) -> &mut BTreeMap<String, Value>
pub fn properties_mut(&mut self) -> &mut BTreeMap<String, Value>
Returns a mutable reference to the custom VerificationMethod
properties.
sourcepub fn into_method_ref(self) -> MethodRef
pub fn into_method_ref(self) -> MethodRef
Creates a new MethodRef
from self
.
sourcepub fn map<F>(self, f: F) -> VerificationMethod
pub fn map<F>(self, f: F) -> VerificationMethod
Maps the VerificationMethod
by applying a function f
to
the CoreDID
components of id and controller. Useful when working with DID methods where the identifier
is not known before publishing.
sourcepub fn try_map<F, E>(self, f: F) -> Result<VerificationMethod, E>
pub fn try_map<F, E>(self, f: F) -> Result<VerificationMethod, E>
Fallible version of VerificationMethod::map
.
source§impl VerificationMethod
impl VerificationMethod
sourcepub fn new_from_jwk<D>(
did: D,
key: Jwk,
fragment: Option<&str>
) -> Result<VerificationMethod, Error>where
D: DID,
pub fn new_from_jwk<D>(
did: D,
key: Jwk,
fragment: Option<&str>
) -> Result<VerificationMethod, Error>where
D: DID,
Creates a new VerificationMethod
from the given did
and Jwk
. If fragment
is not given
the kid
value of the given key
will be used, if present, otherwise an error is returned.
§Recommendations
The following recommendations are essentially taken from the publicKeyJwk
description from
the DID specification:
- It is recommended that verification methods that use
Jwks
to represent their public keys use the value ofkid
as their fragment identifier. This is done automatically ifNone
is passed in as the fragment. - It is recommended that
Jwk
kid values are set to the public key fingerprint. SeeJwk::thumbprint_sha256_b64
.
Trait Implementations§
source§impl AsRef<DIDUrl> for VerificationMethod
impl AsRef<DIDUrl> for VerificationMethod
source§impl Clone for VerificationMethod
impl Clone for VerificationMethod
source§fn clone(&self) -> VerificationMethod
fn clone(&self) -> VerificationMethod
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§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<VerificationMethod, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<VerificationMethod, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Display for VerificationMethod
impl Display for VerificationMethod
source§impl From<VerificationMethod> for MethodRef
impl From<VerificationMethod> for MethodRef
source§fn from(other: VerificationMethod) -> MethodRef
fn from(other: VerificationMethod) -> MethodRef
source§impl From<_VerificationMethod> for VerificationMethod
impl From<_VerificationMethod> for VerificationMethod
source§fn from(value: _VerificationMethod) -> VerificationMethod
fn from(value: _VerificationMethod) -> VerificationMethod
source§impl KeyComparable for VerificationMethod
impl KeyComparable for VerificationMethod
source§fn key(&self) -> &<VerificationMethod as KeyComparable>::Key
fn key(&self) -> &<VerificationMethod as KeyComparable>::Key
source§impl PartialEq for VerificationMethod
impl PartialEq for VerificationMethod
source§fn eq(&self, other: &VerificationMethod) -> bool
fn eq(&self, other: &VerificationMethod) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for VerificationMethod
impl Serialize for VerificationMethod
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq 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 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
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
key
and return true
if they are equal.source§impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
source§fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>
Self
from a string of JSON text.source§fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>
Self
from bytes of JSON text.source§fn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Self
from a serde_json::Value
.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> ToJson for Twhere
T: Serialize,
impl<T> ToJson for Twhere
T: Serialize,
source§fn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
self
as a serde_json::Value
.