pub struct VerificationMethod { /* private fields */ }Expand description
A DID Document Verification Method.
Implementations§
source§impl VerificationMethod
impl VerificationMethod
sourcepub fn builder(properties: Object) -> MethodBuilder
pub fn builder(properties: Object) -> MethodBuilder
Creates a MethodBuilder to configure a new Method.
This is the same as MethodBuilder::new().
sourcepub fn from_builder(builder: MethodBuilder) -> Result<Self>
pub fn from_builder(builder: MethodBuilder) -> Result<Self>
Returns a new Method based on the MethodBuilder configuration.
sourcepub fn set_id(&mut self, id: DIDUrl) -> Result<()>
pub fn set_id(&mut self, id: DIDUrl) -> Result<()>
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) -> &Object
pub fn properties(&self) -> &Object
Returns a reference to the custom VerificationMethod properties.
sourcepub fn properties_mut(&mut self) -> &mut Object
pub fn properties_mut(&mut self) -> &mut Object
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>(
did: D,
key: Jwk,
fragment: Option<&str>,
) -> Result<Self>
pub fn new_from_jwk<D: DID>( did: D, key: Jwk, fragment: Option<&str>, ) -> Result<Self>
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
Jwksto represent their public keys use the value ofkidas their fragment identifier. This is done automatically ifNoneis passed in as the fragment. - It is recommended that
Jwkkid 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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) -> Self
fn from(other: VerificationMethod) -> Self
source§impl KeyComparable for VerificationMethod
impl KeyComparable for VerificationMethod
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
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> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.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.