Struct ssi_dids_core::document::Document

source ·
pub struct Document {
    pub id: DIDBuf,
    pub also_known_as: Vec<IriBuf>,
    pub verification_relationships: VerificationRelationships,
    pub controller: Option<OneOrMany<DIDBuf>>,
    pub verification_method: Vec<DIDVerificationMethod>,
    pub public_key: Vec<DIDVerificationMethod>,
    pub service: Vec<Service>,
    pub property_set: BTreeMap<String, Value>,
}
Expand description

Fields§

§id: DIDBuf

DID subject identifier.

See: https://www.w3.org/TR/did-core/#did-subject

§also_known_as: Vec<IriBuf>

Other URIs for the DID subject.

See: https://www.w3.org/TR/did-core/#also-known-as

§verification_relationships: VerificationRelationships

Verification relationships.

Properties that express the relationship between the DID subject and a verification method using a verification relationship.

See: https://www.w3.org/TR/did-core/#verification-relationships

§controller: Option<OneOrMany<DIDBuf>>§verification_method: Vec<DIDVerificationMethod>

verificationMethod property of a DID document, expressing verification methods.

§public_key: Vec<DIDVerificationMethod>

publicKey property of a DID document (deprecated in favor of verificationMethod).

§service: Vec<Service>

service property of a DID document, expressing services, generally as endpoints.

§property_set: BTreeMap<String, Value>

Additional properties of a DID document. Some may be registered in DID Specification Registries.

Implementations§

source§

impl Document

source

pub fn new(id: DIDBuf) -> Document

Construct a new DID document with the given id (DID).

source

pub fn from_json(json: &str) -> Result<Json, Error>

Construct a DID document from JSON.

source

pub fn from_json_bytes(json: &[u8]) -> Result<Json, Error>

Construct a DID document from JSON bytes.

source

pub fn from_bytes( type_: MediaType, bytes: &[u8], ) -> Result<Represented, InvalidData>

source

pub fn find_resource(&self, id: &DIDURL) -> Option<ResourceRef<'_>>

source

pub fn into_resource(self, id: &DIDURL) -> Option<Resource>

source

pub fn service(&self, id: &str) -> Option<&Service>

Returns the service with the given id, if any.

source

pub fn into_representation(self, options: Options) -> Represented

source

pub fn into_any_verification_method(self) -> Option<DIDVerificationMethod>

Consumes the document and returns any verification method in contains.

This will return the first verification method found, although users should not expect the DID documents to always list verification methods in the same order.

Trait Implementations§

source§

impl Clone for Document

source§

fn clone(&self) -> Document

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Controller for Document

source§

fn allows_verification_method( &self, id: &Iri, proof_purposes: ProofPurposes, ) -> bool

Checks that the controller allows using the verification method for the given proof purposes.
source§

impl Debug for Document

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Document

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Document

source§

fn eq(&self, other: &Document) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Document

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Document

source§

impl StructuralPartialEq for Document

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> At for T

source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> BorrowStripped for T

source§

fn stripped(&self) -> &Stripped<T>

source§

impl<T> BorrowUnordered for T

source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<'de, T, C> DeserializeTyped<'de, C> for T
where T: Deserialize<'de>,

source§

fn deserialize_typed<S>( _: &C, deserializer: S, ) -> Result<T, <S as Deserializer<'de>>::Error>
where S: Deserializer<'de>,

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, C> FromWithContext<T, C> for T

source§

fn from_with(value: T, _context: &C) -> T

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

source§

fn into_with(self, context: &C) -> U

source§

impl<T> ResourceProvider<()> for T

source§

fn get_resource(&self) -> &()

Returns a reference to the resource of type T.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToOwned for T

source§

type Owned = T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

source§

type Error = Infallible

source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

source§

type Error = <U as TryFromWithContext<T, C>>::Error

source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithContext for T
where T: ?Sized,

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T, U> DeserializeTypedOwned<T> for U
where U: for<'de> DeserializeTyped<'de, T>,