pub struct AnyDidMethod { /* private fields */ }Expand description
DID resolver for any known DID method.
This type regroups all the DIDMethod implementations provided by ssi
into a single DIDResolver trait implementation.
§Supported methods
Here is the list of DID methods currently supported by this resolver:
did:key: for static cryptographic keys, implemented byDIDKey.did:jwk: for Json Web Keys (JWK) implemented byDIDJWK.did:web: for web-hosted DID documents, implemented byDIDWeb.did:pkh: implemented byDIDPKH.did:ethr: implemented byDIDEthr.did:ion: implemented byDIDION.did:tz: implemented byDIDTz.
Implementations§
Source§impl AnyDidMethod
impl AnyDidMethod
Sourcepub fn new(ion: DIDION, tz: DIDTz) -> Self
pub fn new(ion: DIDION, tz: DIDTz) -> Self
Creates a new resolver using the following did:ion and did:tz method
resolvers.
Use the Default implementation if you don’t want to configure
DIDION and DIDTz yourself.
Sourcepub fn generate(
&self,
key: &JWK,
method_pattern: &str,
) -> Result<DIDBuf, GenerateError>
pub fn generate( &self, key: &JWK, method_pattern: &str, ) -> Result<DIDBuf, GenerateError>
Generate a new DID from a JWK.
The method_pattern argument is used to select and configure the DID
method. Accepted patterns are
keyto generate adid:keyDID,jwkto generate adid:jwkDID,ethrto generate adid:ethrDID,pkh:{pkh_name}to generate adid:pkhDID, where{pkh_name}should be replaced by the network id as specified by theDIDPKH::generatefunction.tzto generate adid:tzDID.
§Example
use ssi_jwk::JWK;
use ssi_dids::AnyDidMethod;
// Create a DID resolver.
let resolver = AnyDidMethod::default();
// Create a JWK.
let jwk = JWK::generate_p256();
// Generate a `did:jwk` DID for this JWK:
let did = resolver.generate(&jwk, "jwk").unwrap();Trait Implementations§
Source§impl Clone for AnyDidMethod
impl Clone for AnyDidMethod
Source§fn clone(&self) -> AnyDidMethod
fn clone(&self) -> AnyDidMethod
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 DIDResolver for AnyDidMethod
impl DIDResolver for AnyDidMethod
Source§async fn resolve_representation<'a>(
&'a self,
did: &'a DID,
options: Options,
) -> Result<Output<Vec<u8>>, Error>
async fn resolve_representation<'a>( &'a self, did: &'a DID, options: Options, ) -> Result<Output<Vec<u8>>, Error>
Resolves a DID representation. Read more
Source§async fn resolve_with<'a>(
&'a self,
did: &'a DID,
options: Options,
) -> Result<Output, Error>
async fn resolve_with<'a>( &'a self, did: &'a DID, options: Options, ) -> Result<Output, Error>
Resolves a DID with the given options. Read more
Source§async fn resolve<'a>(&'a self, did: &'a DID) -> Result<Output, Error>
async fn resolve<'a>(&'a self, did: &'a DID) -> Result<Output, Error>
Resolves a DID. Read more
Source§async fn resolve_into_any_verification_method<'a>(
&'a self,
did: &'a DID,
) -> Result<Option<DIDVerificationMethod>, Error>
async fn resolve_into_any_verification_method<'a>( &'a self, did: &'a DID, ) -> Result<Option<DIDVerificationMethod>, Error>
Resolves a DID and extracts one of the verification methods it defines. Read more
Source§async fn dereference_primary<'a>(
&'a self,
primary_did_url: &'a PrimaryDIDURL,
) -> Result<DerefOutput<PrimaryContent>, DerefError>
async fn dereference_primary<'a>( &'a self, primary_did_url: &'a PrimaryDIDURL, ) -> Result<DerefOutput<PrimaryContent>, DerefError>
Dereference a DID URL to retrieve the primary content. Read more
Source§async fn dereference_primary_with<'a>(
&'a self,
primary_did_url: &'a PrimaryDIDURL,
resolve_options: Options,
) -> Result<DerefOutput<PrimaryContent>, DerefError>
async fn dereference_primary_with<'a>( &'a self, primary_did_url: &'a PrimaryDIDURL, resolve_options: Options, ) -> Result<DerefOutput<PrimaryContent>, DerefError>
Dereference a DID URL to retrieve the primary content. Read more
Source§async fn dereference_primary_with_path_or_query<'a>(
&'a self,
_primary_did_url: &'a PrimaryDIDURL,
) -> Result<DerefOutput<PrimaryContent>, DerefError>
async fn dereference_primary_with_path_or_query<'a>( &'a self, _primary_did_url: &'a PrimaryDIDURL, ) -> Result<DerefOutput<PrimaryContent>, DerefError>
Dereference a DID URL with a path or query to retrieve the primary
content. Read more
Source§async fn dereference_with<'a>(
&'a self,
did_url: &'a DIDURL,
options: Options,
) -> Result<DerefOutput, DerefError>
async fn dereference_with<'a>( &'a self, did_url: &'a DIDURL, options: Options, ) -> Result<DerefOutput, DerefError>
Dereference a DID URL. Read more
Source§async fn dereference<'a>(
&'a self,
did_url: &'a DIDURL,
) -> Result<DerefOutput, DerefError>
async fn dereference<'a>( &'a self, did_url: &'a DIDURL, ) -> Result<DerefOutput, DerefError>
Dereference a DID URL. Read more
Source§fn into_vm_resolver_with<M>(
self,
options: Options,
) -> VerificationMethodDIDResolver<Self, M>where
Self: Sized,
fn into_vm_resolver_with<M>(
self,
options: Options,
) -> VerificationMethodDIDResolver<Self, M>where
Self: Sized,
Turns this DID resolver into a verification method resolver. Read more
Source§fn into_vm_resolver<M>(self) -> VerificationMethodDIDResolver<Self, M>where
Self: Sized,
fn into_vm_resolver<M>(self) -> VerificationMethodDIDResolver<Self, M>where
Self: Sized,
Turns this DID resolver into a verification method resolver. Read more
Source§impl Default for AnyDidMethod
impl Default for AnyDidMethod
Source§fn default() -> AnyDidMethod
fn default() -> AnyDidMethod
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AnyDidMethod
impl RefUnwindSafe for AnyDidMethod
impl Send for AnyDidMethod
impl Sync for AnyDidMethod
impl Unpin for AnyDidMethod
impl UnwindSafe for AnyDidMethod
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
Source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
Source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Called to initialize a place to a valid value, after it is set
to all-bits-zero. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
Returns a reference to the resource of type
T.