affinidi-did-resolver-traits
Pluggable DID resolution traits for the Affinidi TDK. Implement these traits to add custom DID method support to the resolver.
Installation
[]
= "0.1"
Traits
Resolver(sync) — for methods requiring no IO (e.g.,did:key,did:peer)AsyncResolver(async, dyn-compatible) — for methods requiring network access
Every Resolver is automatically an AsyncResolver via a blanket impl, so the
SDK composes all resolvers uniformly.
Return Convention
Resolvers return Option<Result<Document, ResolverError>>:
| Return Value | Meaning |
|---|---|
None |
Not my DID method — pass to the next resolver |
Some(Ok(doc)) |
Resolved successfully |
Some(Err(e)) |
Recognised the DID but resolution failed |
Built-in Resolvers
KeyResolver— resolvesdid:key(Ed25519, P-256, P-384, secp256k1, X25519)PeerResolver— resolvesdid:peer(numalgo 0 and 2)
Custom Resolver Example
use ;
use DID;
use Future;
use Pin;
;
Related Crates
affinidi-did-common— DID Document types (dependency)affinidi-did-resolver-cache-sdk— SDK that uses these traits