DIDMethod

Trait DIDMethod 

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

Source

fn name(&self) -> &'static str

Get the DID method’s name.

method-name in DID Syntax.

Source

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§

Source

fn generate(&self, _source: &Source<'_>) -> Option<String>

Generate a DID from some source.

Source

fn did_from_transaction( &self, _tx: DIDMethodTransaction, ) -> Result<String, DIDMethodError>

Retrieve a DID from a DID method transaction

Source

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

Source

fn create( &self, _create: DIDCreate, ) -> Result<DIDMethodTransaction, DIDMethodError>

Create a DID

Source

fn update( &self, _update: DIDUpdate, ) -> Result<DIDMethodTransaction, DIDMethodError>

Update a DID

Source

fn recover( &self, _recover: DIDRecover, ) -> Result<DIDMethodTransaction, DIDMethodError>

Recover a DID

Source

fn deactivate( &self, _deactivate: DIDDeactivate, ) -> Result<DIDMethodTransaction, DIDMethodError>

Deactivate a DID

Implementations on Foreign Types§

Source§

impl DIDMethod for DIDEthr

Source§

fn name(&self) -> &'static str

Source§

fn generate(&self, source: &Source<'_>) -> Option<String>

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDJWK

Source§

fn name(&self) -> &'static str

Source§

fn generate(&self, source: &Source<'_>) -> Option<String>

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDKey

Source§

fn name(&self) -> &'static str

Source§

fn generate(&self, source: &Source<'_>) -> Option<String>

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDOnion

Source§

fn name(&self) -> &'static str

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDPKH

Source§

fn name(&self) -> &'static str

Source§

fn generate(&self, source: &Source<'_>) -> Option<String>

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDTz

Source§

fn name(&self) -> &'static str

Source§

fn generate(&self, source: &Source<'_>) -> Option<String>

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDWeb

Source§

fn name(&self) -> &'static str

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl DIDMethod for DIDWebKey

Source§

fn name(&self) -> &'static str

Source§

fn to_resolver(&self) -> &dyn DIDResolver

Source§

impl<S> DIDMethod for SidetreeClient<S>
where S: Sidetree + Send + Sync,

Implementors§