pub trait DIDMethod: Sync {
fn name(&self) -> &'static str;
fn to_resolver(&self) -> &dyn DIDResolver;
fn generate(&self, _source: &Source<'_>) -> Option<String> { ... }
fn did_from_transaction(
&self,
_tx: DIDMethodTransaction
) -> Result<String, DIDMethodError> { ... }
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
_tx: DIDMethodTransaction
) -> Pin<Box<dyn Future<Output = Result<Value, DIDMethodError>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn create(
&self,
_create: DIDCreate
) -> Result<DIDMethodTransaction, DIDMethodError> { ... }
fn update(
&self,
_update: DIDUpdate
) -> Result<DIDMethodTransaction, DIDMethodError> { ... }
fn recover(
&self,
_recover: DIDRecover
) -> Result<DIDMethodTransaction, DIDMethodError> { ... }
fn deactivate(
&self,
_deactivate: DIDDeactivate
) -> Result<DIDMethodTransaction, DIDMethodError> { ... }
}
Expand description
An implementation of a DID method.
Depends on the DIDResolver trait. Also includes functionality to generate DIDs.
Some DID Methods are registered in the DID Specification Registries.
Required methods
Get the DID method’s name.
method-name
in DID Syntax.
fn to_resolver(&self) -> &dyn DIDResolver
fn to_resolver(&self) -> &dyn DIDResolver
Upcast the DID method as a DID resolver.
This is a workaround for not being able to cast a trait object to a supertrait object.
Implementations should simply return self
.
Provided methods
fn did_from_transaction(
&self,
_tx: DIDMethodTransaction
) -> Result<String, DIDMethodError>
fn did_from_transaction(
&self,
_tx: DIDMethodTransaction
) -> Result<String, DIDMethodError>
Retrieve a DID from a DID method transaction
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
_tx: DIDMethodTransaction
) -> Pin<Box<dyn Future<Output = Result<Value, DIDMethodError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn submit_transaction<'life0, 'async_trait>(
&'life0 self,
_tx: DIDMethodTransaction
) -> Pin<Box<dyn Future<Output = Result<Value, DIDMethodError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Submit a DID transaction
fn create(
&self,
_create: DIDCreate
) -> Result<DIDMethodTransaction, DIDMethodError>
fn create(
&self,
_create: DIDCreate
) -> Result<DIDMethodTransaction, DIDMethodError>
Create a DID
fn update(
&self,
_update: DIDUpdate
) -> Result<DIDMethodTransaction, DIDMethodError>
fn update(
&self,
_update: DIDUpdate
) -> Result<DIDMethodTransaction, DIDMethodError>
Update a DID
fn recover(
&self,
_recover: DIDRecover
) -> Result<DIDMethodTransaction, DIDMethodError>
fn recover(
&self,
_recover: DIDRecover
) -> Result<DIDMethodTransaction, DIDMethodError>
Recover a DID
fn deactivate(
&self,
_deactivate: DIDDeactivate
) -> Result<DIDMethodTransaction, DIDMethodError>
fn deactivate(
&self,
_deactivate: DIDDeactivate
) -> Result<DIDMethodTransaction, DIDMethodError>
Deactivate a DID