pub struct DidDocument {
pub context: Vec<String>,
pub id: String,
pub controller: String,
pub verification_method: Vec<VerificationMethod>,
pub authentication: Vec<String>,
pub assertion_method: Option<Vec<String>>,
pub service: Option<Vec<Service>>,
pub created: DateTime<Utc>,
pub updated: DateTime<Utc>,
pub proof: Option<DocumentProof>,
}Expand description
A DID Document describing an agent’s keys and services.
Fields§
§context: Vec<String>JSON-LD context
id: StringThe DID this document describes
controller: StringController of this DID (usually self)
verification_method: Vec<VerificationMethod>Verification methods (public keys)
authentication: Vec<String>Keys that can authenticate as this DID
assertion_method: Option<Vec<String>>Keys that can make assertions
service: Option<Vec<Service>>Service endpoints
created: DateTime<Utc>When this document was created
updated: DateTime<Utc>When this document was last updated
proof: Option<DocumentProof>Proof of authenticity
Implementations§
Source§impl DidDocument
impl DidDocument
Sourcepub fn new(root_key: &RootKey) -> DidDocument
pub fn new(root_key: &RootKey) -> DidDocument
Create a new unsigned DID Document for a root key.
Sourcepub fn add_service(self, id: &str, type_: &str, endpoint: &str) -> DidDocument
pub fn add_service(self, id: &str, type_: &str, endpoint: &str) -> DidDocument
Add a service endpoint.
Sourcepub fn with_handshake_endpoint(self, endpoint: &str) -> DidDocument
pub fn with_handshake_endpoint(self, endpoint: &str) -> DidDocument
Add the handshake service endpoint.
Sourcepub fn sign(self, root_key: &RootKey) -> Result<DidDocument, Error>
pub fn sign(self, root_key: &RootKey) -> Result<DidDocument, Error>
Sign this document with the root key.
Sourcepub fn handshake_endpoint(&self) -> Option<&str>
pub fn handshake_endpoint(&self) -> Option<&str>
Get the handshake endpoint if present.
Trait Implementations§
Source§impl Clone for DidDocument
impl Clone for DidDocument
Source§fn clone(&self) -> DidDocument
fn clone(&self) -> DidDocument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DidDocument
impl Debug for DidDocument
Source§impl<'de> Deserialize<'de> for DidDocument
impl<'de> Deserialize<'de> for DidDocument
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DidDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DidDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for DidDocument
impl Serialize for DidDocument
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for DidDocument
impl RefUnwindSafe for DidDocument
impl Send for DidDocument
impl Sync for DidDocument
impl Unpin for DidDocument
impl UnwindSafe for DidDocument
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