aries_cloudagent.resolver package

Interfaces and base classes for DID Resolution.

async aries_cloudagent.resolver.setup(context: InjectionContext)[source]

Set up default resolvers.

Subpackages

Submodules

aries_cloudagent.resolver.base module

Base Class for DID Resolvers.

class aries_cloudagent.resolver.base.BaseDIDResolver(type_: Optional[ResolverType] = None)[source]

Bases: ABC

Base Class for DID Resolvers.

DEFAULT_TTL = 3600
property native

Return if this resolver is native.

async resolve(profile: Profile, did: Union[str, pydid.DID], service_accept: Optional[Sequence[str]] = None) dict[source]

Resolve a DID using this resolver.

Handles caching of results.

abstract async setup(context: InjectionContext)[source]

Do asynchronous resolver setup.

property supported_did_regex: Pattern

Supported DID regex for matching this resolver to DIDs it can resolve.

Override this property with a class var or similar to use regex matching on DIDs to determine if this resolver supports a given DID.

property supported_methods: Sequence[str]

Return supported methods.

DEPRECATED: Use supported_did_regex instead.

async supports(profile: Profile, did: str) bool[source]

Return if this resolver supports the given DID.

Override this method to determine if this resolver supports a DID based on information other than just a regular expression; i.e. check a value in storage, query a resolver connection record, etc.

exception aries_cloudagent.resolver.base.DIDMethodNotSupported(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: ResolverError

Raised when no resolver is registered for a given did method.

exception aries_cloudagent.resolver.base.DIDNotFound(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: ResolverError

Raised when DID is not found in verifiable data registry.

class aries_cloudagent.resolver.base.ResolutionMetadata(resolver_type: ResolverType, resolver: str, retrieved_time: str, duration: int)[source]

Bases: NamedTuple

Resolution Metadata.

duration: int

Alias for field number 3

resolver: str

Alias for field number 1

resolver_type: ResolverType

Alias for field number 0

retrieved_time: str

Alias for field number 2

serialize() dict[source]

Return serialized resolution metadata.

class aries_cloudagent.resolver.base.ResolutionResult(did_document: dict, metadata: ResolutionMetadata)[source]

Bases: object

Resolution Class to pack the DID Doc and the resolution information.

serialize() dict[source]

Return serialized resolution result.

exception aries_cloudagent.resolver.base.ResolverError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: BaseError

Base class for resolver exceptions.

class aries_cloudagent.resolver.base.ResolverType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Resolver Type declarations.

NATIVE = 'native'
NON_NATIVE = 'non-native'

aries_cloudagent.resolver.did_resolver module

the did resolver.

responsible for keeping track of all resolvers. more importantly retrieving did’s from different sources provided by the method type.

class aries_cloudagent.resolver.did_resolver.DIDResolver(resolvers: Optional[List[BaseDIDResolver]] = None)[source]

Bases: object

did resolver singleton.

DEFAULT_TIMEOUT = 30
async dereference(profile: Profile, did_url: str, *, document: Optional[pydid.doc.doc.BaseDIDDocument] = None) pydid.Resource[source]

Dereference a DID URL to its corresponding DID Doc object.

async dereference_verification_method(profile: Profile, did_url: str, *, document: Optional[pydid.doc.doc.BaseDIDDocument] = None) pydid.VerificationMethod[source]

Dereference a DID URL to a verification method.

register_resolver(resolver: BaseDIDResolver)[source]

Register a new resolver.

async resolve(profile: Profile, did: Union[str, pydid.DID], service_accept: Optional[Sequence[str]] = None, *, timeout: Optional[int] = None) dict[source]

Resolve a DID.

async resolve_with_metadata(profile: Profile, did: Union[str, pydid.DID], *, timeout: Optional[int] = None) ResolutionResult[source]

Resolve a DID and return the ResolutionResult.

aries_cloudagent.resolver.routes module

Resolve did document admin routes.

class aries_cloudagent.resolver.routes.DIDMatchInfoSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Path parameters and validators for request taking DID.

class aries_cloudagent.resolver.routes.ResolutionResultSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for did document query.

class aries_cloudagent.resolver.routes.W3cDID(*args: Any, **kwargs: Any)[source]

Bases: Regexp

Validate value against w3c DID.

EXAMPLE = 'did:ted:WgWxqztrNooG92RXvxSTWv'
aries_cloudagent.resolver.routes.post_process_routes(app: aiohttp.web.Application)[source]

Amend swagger API.

async aries_cloudagent.resolver.routes.register(app: aiohttp.web.Application)[source]

Register routes.