Struct identity_iota::did::CoreDocument
source · [−]pub struct CoreDocument<D = CoreDID, T = BTreeMap<String, Value, Global>, U = BTreeMap<String, Value, Global>, V = BTreeMap<String, Value, Global>> where
D: DID + KeyComparable, { /* private fields */ }
Expand description
A DID Document.
Implementations
sourceimpl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
impl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
sourcepub fn builder(properties: T) -> DocumentBuilder<D, T, U, V>
pub fn builder(properties: T) -> DocumentBuilder<D, T, U, V>
Creates a DocumentBuilder
to configure a new CoreDocument
.
This is the same as DocumentBuilder::new
.
sourcepub fn from_builder(
builder: DocumentBuilder<D, T, U, V>
) -> Result<CoreDocument<D, T, U, V>, Error>
pub fn from_builder(
builder: DocumentBuilder<D, T, U, V>
) -> Result<CoreDocument<D, T, U, V>, Error>
Returns a new CoreDocument
based on the DocumentBuilder
configuration.
sourcepub fn controller(&self) -> Option<&OneOrSet<D>>
pub fn controller(&self) -> Option<&OneOrSet<D>>
Returns a reference to the CoreDocument
controller.
sourcepub fn controller_mut(&mut self) -> &mut Option<OneOrSet<D>>
pub fn controller_mut(&mut self) -> &mut Option<OneOrSet<D>>
Returns a mutable reference to the CoreDocument
controller.
sourcepub fn also_known_as(&self) -> &OrderedSet<Url>
pub fn also_known_as(&self) -> &OrderedSet<Url>
Returns a reference to the CoreDocument
alsoKnownAs set.
sourcepub fn also_known_as_mut(&mut self) -> &mut OrderedSet<Url>
pub fn also_known_as_mut(&mut self) -> &mut OrderedSet<Url>
Returns a mutable reference to the CoreDocument
alsoKnownAs set.
sourcepub fn verification_method(&self) -> &OrderedSet<VerificationMethod<D, U>>
pub fn verification_method(&self) -> &OrderedSet<VerificationMethod<D, U>>
Returns a reference to the CoreDocument
verificationMethod set.
sourcepub fn verification_method_mut(
&mut self
) -> &mut OrderedSet<VerificationMethod<D, U>>
pub fn verification_method_mut(
&mut self
) -> &mut OrderedSet<VerificationMethod<D, U>>
Returns a mutable reference to the CoreDocument
verificationMethod set.
sourcepub fn authentication(&self) -> &OrderedSet<MethodRef<D, U>>
pub fn authentication(&self) -> &OrderedSet<MethodRef<D, U>>
Returns a reference to the CoreDocument
authentication set.
sourcepub fn authentication_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
pub fn authentication_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
Returns a mutable reference to the CoreDocument
authentication set.
sourcepub fn assertion_method(&self) -> &OrderedSet<MethodRef<D, U>>
pub fn assertion_method(&self) -> &OrderedSet<MethodRef<D, U>>
Returns a reference to the CoreDocument
assertionMethod set.
sourcepub fn assertion_method_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
pub fn assertion_method_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
Returns a mutable reference to the CoreDocument
assertionMethod set.
sourcepub fn key_agreement(&self) -> &OrderedSet<MethodRef<D, U>>
pub fn key_agreement(&self) -> &OrderedSet<MethodRef<D, U>>
Returns a reference to the CoreDocument
keyAgreement set.
sourcepub fn key_agreement_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
pub fn key_agreement_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
Returns a mutable reference to the CoreDocument
keyAgreement set.
sourcepub fn capability_delegation(&self) -> &OrderedSet<MethodRef<D, U>>
pub fn capability_delegation(&self) -> &OrderedSet<MethodRef<D, U>>
Returns a reference to the CoreDocument
capabilityDelegation set.
sourcepub fn capability_delegation_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
pub fn capability_delegation_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
Returns a mutable reference to the CoreDocument
capabilityDelegation set.
sourcepub fn capability_invocation(&self) -> &OrderedSet<MethodRef<D, U>>
pub fn capability_invocation(&self) -> &OrderedSet<MethodRef<D, U>>
Returns a reference to the CoreDocument
capabilityInvocation set.
sourcepub fn capability_invocation_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
pub fn capability_invocation_mut(&mut self) -> &mut OrderedSet<MethodRef<D, U>>
Returns a mutable reference to the CoreDocument
capabilityInvocation set.
sourcepub fn service(&self) -> &OrderedSet<Service<D, V>>
pub fn service(&self) -> &OrderedSet<Service<D, V>>
Returns a reference to the CoreDocument
service set.
sourcepub fn service_mut(&mut self) -> &mut OrderedSet<Service<D, V>>
pub fn service_mut(&mut self) -> &mut OrderedSet<Service<D, V>>
Returns a mutable reference to the CoreDocument
service set.
sourcepub fn properties(&self) -> &T
pub fn properties(&self) -> &T
Returns a reference to the custom CoreDocument
properties.
sourcepub fn properties_mut(&mut self) -> &mut T
pub fn properties_mut(&mut self) -> &mut T
Returns a mutable reference to the custom CoreDocument
properties.
sourcepub fn map<S, C, F, G>(self, f: F, g: G) -> CoreDocument<C, S, U, V> where
C: DID + KeyComparable,
F: FnMut(D) -> C,
G: FnOnce(T) -> S,
pub fn map<S, C, F, G>(self, f: F, g: G) -> CoreDocument<C, S, U, V> where
C: DID + KeyComparable,
F: FnMut(D) -> C,
G: FnOnce(T) -> S,
Maps CoreDocument<D,T>
to CoreDocument<C,U>
by applying a function f
to all DID
fields
and another function g
to the custom properties.
sourcepub fn try_map<S, C, F, G, E>(
self,
f: F,
g: G
) -> Result<CoreDocument<C, S, U, V>, E> where
C: DID + KeyComparable,
F: FnMut(D) -> Result<C, E>,
G: FnOnce(T) -> Result<S, E>,
pub fn try_map<S, C, F, G, E>(
self,
f: F,
g: G
) -> Result<CoreDocument<C, S, U, V>, E> where
C: DID + KeyComparable,
F: FnMut(D) -> Result<C, E>,
G: FnOnce(T) -> Result<S, E>,
Fallible version of CoreDocument::map
.
Errors
try_map
can fail if either of the provided functions fail.
sourcepub fn insert_method(
&mut self,
method: VerificationMethod<D, U>,
scope: MethodScope
) -> Result<(), Error>
pub fn insert_method(
&mut self,
method: VerificationMethod<D, U>,
scope: MethodScope
) -> Result<(), Error>
Adds a new VerificationMethod
to the document in the given MethodScope
.
Errors
Returns an error if a method with the same fragment already exists.
sourcepub fn remove_method(&mut self, did: &DIDUrl<D>) -> Result<(), Error>
pub fn remove_method(&mut self, did: &DIDUrl<D>) -> Result<(), Error>
Removes all references to the specified VerificationMethod
.
Errors
Returns an error if the method does not exist.
sourcepub fn attach_method_relationship<'query, Q>(
&mut self,
method_query: Q,
relationship: MethodRelationship
) -> Result<bool, Error> where
Q: Into<DIDUrlQuery<'query>>,
pub fn attach_method_relationship<'query, Q>(
&mut self,
method_query: Q,
relationship: MethodRelationship
) -> Result<bool, Error> where
Q: Into<DIDUrlQuery<'query>>,
Attaches the relationship to the method resolved by method_query
.
Errors
Returns an error if the method does not exist or if it is embedded.
To convert an embedded method into a generic verification method, remove it first
and insert it with MethodScope::VerificationMethod
.
sourcepub fn detach_method_relationship<'query, Q>(
&mut self,
method_query: Q,
relationship: MethodRelationship
) -> Result<bool, Error> where
Q: Into<DIDUrlQuery<'query>>,
pub fn detach_method_relationship<'query, Q>(
&mut self,
method_query: Q,
relationship: MethodRelationship
) -> Result<bool, Error> where
Q: Into<DIDUrlQuery<'query>>,
Detaches the relationship from the method resolved by method_query
.
Errors
Returns an error if the method does not exist or is embedded.
To remove an embedded method, use Self::remove_method
.
sourcepub fn methods(&self) -> impl Iterator<Item = &VerificationMethod<D, U>>
pub fn methods(&self) -> impl Iterator<Item = &VerificationMethod<D, U>>
Returns an iterator over all embedded verification methods in the DID Document.
This excludes verification methods that are referenced by the DID Document.
sourcepub fn verification_relationships(
&self
) -> impl Iterator<Item = &MethodRef<D, U>>
pub fn verification_relationships(
&self
) -> impl Iterator<Item = &MethodRef<D, U>>
Returns an iterator over all verification relationships.
This includes embedded and referenced VerificationMethods
.
sourcepub fn resolve_method<'query, Q>(
&'me self,
query: Q,
scope: Option<MethodScope>
) -> Option<&'me VerificationMethod<D, U>> where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_method<'query, Q>(
&'me self,
query: Q,
scope: Option<MethodScope>
) -> Option<&'me VerificationMethod<D, U>> where
Q: Into<DIDUrlQuery<'query>>,
Returns the first VerificationMethod
with an id
property matching the
provided query
and the verification relationship specified by scope
if present.
sourcepub fn resolve_method_mut<'query, Q>(
&'me mut self,
query: Q,
scope: Option<MethodScope>
) -> Option<&'me mut VerificationMethod<D, U>> where
Q: Into<DIDUrlQuery<'query>>,
pub fn resolve_method_mut<'query, Q>(
&'me mut self,
query: Q,
scope: Option<MethodScope>
) -> Option<&'me mut VerificationMethod<D, U>> where
Q: Into<DIDUrlQuery<'query>>,
Returns a mutable reference to the first VerificationMethod
with an id
property
matching the provided query
.
sourceimpl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
impl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
sourcepub fn verify_data<X>(
&self,
data: &X,
options: &VerifierOptions
) -> Result<(), Error> where
X: Serialize + GetSignature,
pub fn verify_data<X>(
&self,
data: &X,
options: &VerifierOptions
) -> Result<(), Error> where
X: Serialize + GetSignature,
Verifies the signature of the provided data.
Errors
Fails if an unsupported verification method is used, data serialization fails, or the verification operation fails.
sourceimpl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
impl<D, T, U, V> CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
sourcepub fn signer(
&'base self,
private: &'base Key<Private>
) -> DocumentSigner<'base, 'base, D, T, U, V>
pub fn signer(
&'base self,
private: &'base Key<Private>
) -> DocumentSigner<'base, 'base, D, T, U, V>
Creates a new DocumentSigner
that can be used to create digital
signatures from verification methods in this DID Document.
Trait Implementations
sourceimpl<D, T, U, V> Clone for CoreDocument<D, T, U, V> where
D: Clone + DID + KeyComparable,
T: Clone,
U: Clone,
V: Clone,
impl<D, T, U, V> Clone for CoreDocument<D, T, U, V> where
D: Clone + DID + KeyComparable,
T: Clone,
U: Clone,
V: Clone,
sourcefn clone(&self) -> CoreDocument<D, T, U, V>
fn clone(&self) -> CoreDocument<D, T, U, V>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<D, T, U, V> Debug for CoreDocument<D, T, U, V> where
D: Debug + DID + KeyComparable,
T: Debug,
U: Debug,
V: Debug,
impl<D, T, U, V> Debug for CoreDocument<D, T, U, V> where
D: Debug + DID + KeyComparable,
T: Debug,
U: Debug,
V: Debug,
sourceimpl<'de, D, T, U, V> Deserialize<'de> for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Deserialize<'de>,
T: Deserialize<'de>,
U: Deserialize<'de>,
V: Deserialize<'de>,
impl<'de, D, T, U, V> Deserialize<'de> for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Deserialize<'de>,
T: Deserialize<'de>,
U: Deserialize<'de>,
V: Deserialize<'de>,
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<CoreDocument<D, T, U, V>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<CoreDocument<D, T, U, V>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<D, T, U, V> Diff for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Diff + Serialize + for<'de> Deserialize<'de>,
T: Diff + Serialize + for<'de> Deserialize<'de> + Default,
U: Diff + Serialize + for<'de> Deserialize<'de> + Default,
V: Diff + Serialize + for<'de> Deserialize<'de> + Default,
impl<D, T, U, V> Diff for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Diff + Serialize + for<'de> Deserialize<'de>,
T: Diff + Serialize + for<'de> Deserialize<'de> + Default,
U: Diff + Serialize + for<'de> Deserialize<'de> + Default,
V: Diff + Serialize + for<'de> Deserialize<'de> + Default,
type Type = DiffDocument<D, T, U, V>
type Type = DiffDocument<D, T, U, V>
diff chain features are slated for removal
The Corresponding Diff Type for the implemented Type.
sourcefn diff(
&self,
other: &CoreDocument<D, T, U, V>
) -> Result<<CoreDocument<D, T, U, V> as Diff>::Type, Error>
fn diff(
&self,
other: &CoreDocument<D, T, U, V>
) -> Result<<CoreDocument<D, T, U, V> as Diff>::Type, Error>
diff chain features are slated for removal
Finds the difference between two types; self
and other
and returns Self::Type
sourcefn merge(
&self,
diff: <CoreDocument<D, T, U, V> as Diff>::Type
) -> Result<CoreDocument<D, T, U, V>, Error>
fn merge(
&self,
diff: <CoreDocument<D, T, U, V> as Diff>::Type
) -> Result<CoreDocument<D, T, U, V>, Error>
diff chain features are slated for removal
Merges a Self::Type
with Self
sourcefn from_diff(
diff: <CoreDocument<D, T, U, V> as Diff>::Type
) -> Result<CoreDocument<D, T, U, V>, Error>
fn from_diff(
diff: <CoreDocument<D, T, U, V> as Diff>::Type
) -> Result<CoreDocument<D, T, U, V>, Error>
diff chain features are slated for removal
Converts a diff
of type Self::Type
to a Self
.
sourceimpl<D, T, U, V> Display for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Serialize,
T: Serialize,
U: Serialize,
V: Serialize,
impl<D, T, U, V> Display for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Serialize,
T: Serialize,
U: Serialize,
V: Serialize,
sourceimpl From<IotaDocument> for CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
impl From<IotaDocument> for CoreDocument<IotaDID, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>, BTreeMap<String, Value, Global>>
sourceimpl<D, T, U, V> PartialEq<CoreDocument<D, T, U, V>> for CoreDocument<D, T, U, V> where
D: PartialEq<D> + DID + KeyComparable,
T: PartialEq<T>,
U: PartialEq<U>,
V: PartialEq<V>,
impl<D, T, U, V> PartialEq<CoreDocument<D, T, U, V>> for CoreDocument<D, T, U, V> where
D: PartialEq<D> + DID + KeyComparable,
T: PartialEq<T>,
U: PartialEq<U>,
V: PartialEq<V>,
sourcefn eq(&self, other: &CoreDocument<D, T, U, V>) -> bool
fn eq(&self, other: &CoreDocument<D, T, U, V>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &CoreDocument<D, T, U, V>) -> bool
fn ne(&self, other: &CoreDocument<D, T, U, V>) -> bool
This method tests for !=
.
sourceimpl<D, T, U, V> Serialize for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Serialize,
T: Serialize,
U: Serialize,
V: Serialize,
impl<D, T, U, V> Serialize for CoreDocument<D, T, U, V> where
D: DID + KeyComparable + Serialize,
T: Serialize,
U: Serialize,
V: Serialize,
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
sourceimpl<D, T, U, V> TryMethod for CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
impl<D, T, U, V> TryMethod for CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
sourceconst TYPE: MethodUriType = MethodUriType::Relative
const TYPE: MethodUriType = MethodUriType::Relative
Flag that determines whether absolute or rleative URI
sourcefn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
fn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
Returns an absolute or relative method URI, if any, depending on the MethodUriType
. Read more
sourcefn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
fn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
Returns String representation of absolute or relative method URI. Read more
impl<D, T, U, V> StructuralPartialEq for CoreDocument<D, T, U, V> where
D: DID + KeyComparable,
Auto Trait Implementations
impl<D, T, U, V> RefUnwindSafe for CoreDocument<D, T, U, V> where
D: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
V: RefUnwindSafe,
impl<D, T, U, V> Send for CoreDocument<D, T, U, V> where
D: Send,
T: Send,
U: Send,
V: Send,
impl<D, T, U, V> Sync for CoreDocument<D, T, U, V> where
D: Sync,
T: Sync,
U: Sync,
V: Sync,
impl<D, T, U, V> Unpin for CoreDocument<D, T, U, V> where
D: Unpin,
T: Unpin,
U: Unpin,
V: Unpin,
impl<D, T, U, V> UnwindSafe for CoreDocument<D, T, U, V> where
D: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
impl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
sourcefn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
fn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
Deserialize Self
from a string of JSON text.
sourcefn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
fn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
Deserialize Self
from bytes of JSON text.
sourcefn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Deserialize Self
from a [serde_json::Value
].
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToJson for T where
T: Serialize,
impl<T> ToJson for T where
T: Serialize,
sourcefn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
Serialize self
as a [serde_json::Value
].
sourcefn to_json_pretty(&self) -> Result<String, Error>
fn to_json_pretty(&self) -> Result<String, Error>
Serialize self
as a pretty-printed string of JSON.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more