pub trait DIDMethod: Sync + Send {
// Required methods
fn name(&self) -> &'static str;
fn to_resolver(&self) -> &dyn DIDResolver;
// Provided methods
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§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Get the DID method’s name.
method-name in DID Syntax.
Sourcefn 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§
Sourcefn 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
Sourcefn 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
Sourcefn create(
&self,
_create: DIDCreate,
) -> Result<DIDMethodTransaction, DIDMethodError>
fn create( &self, _create: DIDCreate, ) -> Result<DIDMethodTransaction, DIDMethodError>
Create a DID
Sourcefn update(
&self,
_update: DIDUpdate,
) -> Result<DIDMethodTransaction, DIDMethodError>
fn update( &self, _update: DIDUpdate, ) -> Result<DIDMethodTransaction, DIDMethodError>
Update a DID
Sourcefn recover(
&self,
_recover: DIDRecover,
) -> Result<DIDMethodTransaction, DIDMethodError>
fn recover( &self, _recover: DIDRecover, ) -> Result<DIDMethodTransaction, DIDMethodError>
Recover a DID
Sourcefn deactivate(
&self,
_deactivate: DIDDeactivate,
) -> Result<DIDMethodTransaction, DIDMethodError>
fn deactivate( &self, _deactivate: DIDDeactivate, ) -> Result<DIDMethodTransaction, DIDMethodError>
Deactivate a DID