Skip to main content

DidProducer

Trait DidProducer 

Source
pub trait DidProducer: Send + Sync {
    type Params: Send;

    // Required methods
    fn method(&self) -> &'static str;
    fn capabilities(&self) -> MethodCapabilities;
    fn produce<'life0, 'life1, 'async_trait>(
        &'life0 self,
        keys: &'life1 [Jwk],
        params: Self::Params,
    ) -> Pin<Box<dyn Future<Output = Result<DidDocument, ProduceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Produces the DID document of one method from public keys.

The keys are public JWKs, typically fetched from a KeyStore: producing a document never touches private material. Params carries whatever the method needs beyond the keys: the origin of a did:web, nothing (()) for an embedded method.

Required Associated Types§

Source

type Params: Send

Method-specific parameters.

Required Methods§

Source

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

The method name: web for did:web.

Source

fn capabilities(&self) -> MethodCapabilities

What the method can do.

Source

fn produce<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [Jwk], params: Self::Params, ) -> Pin<Box<dyn Future<Output = Result<DidDocument, ProduceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Produces the document for keys.

The same keys and parameters produce the same document; for a method whose DID depends on the keys, the id of the document is that DID.

§Errors

A ProduceError when the keys or the parameters do not fit the method, or writing the document (a registry method) fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl DidProducer for DidJwk

Available on crate feature did-jwk and (crate features did-jwk or did-key or did-web) only.
Source§

impl DidProducer for DidKey

Available on crate feature did-key and (crate features did-jwk or did-key or did-web) only.
Source§

impl<C: HttpClient> DidProducer for DidWeb<C>

Available on crate feature did-web and (crate features did-jwk or did-key or did-web) only.