aries_cloudagent.resolver.default package

Resolvers included in ACA-Py by Default.

Submodules

aries_cloudagent.resolver.default.indy module

aries_cloudagent.resolver.default.key module

Key DID Resolver.

Resolution is performed using the IndyLedger class.

class aries_cloudagent.resolver.default.key.KeyDIDResolver[source]

Bases: aries_cloudagent.resolver.base.BaseDIDResolver

Key DID Resolver.

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

Perform required setup for Key DID resolution.

property supported_did_regex: Pattern

Return supported_did_regex of Key DID Resolver.

aries_cloudagent.resolver.default.legacy_peer module

Resolve legacy peer DIDs.

Resolution is performed by looking up a stored DID Document.

class aries_cloudagent.resolver.default.legacy_peer.LegacyDocCorrections[source]

Bases: object

Legacy peer DID document corrections.

These corrections align the document with updated DID spec and DIDComm conventions. This also helps with consistent processing of DID Docs.

Input example: {

“@context”: “https://w3id.org/did/v1”, “id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ”, “publicKey”: [

{

“id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ#1”, “type”: “Ed25519VerificationKey2018”, “controller”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ”, “publicKeyBase58”: “AU2FFjtkVzjFuirgWieqGGqtNrAZWS9LDuB8TDp6EUrG”

}

], “authentication”: [

{

“type”: “Ed25519SignatureAuthentication2018”, “publicKey”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ#1”

}

], “service”: [

{

“id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ;indy”, “type”: “IndyAgent”, “priority”: 0, “recipientKeys”: [

“AU2FFjtkVzjFuirgWieqGGqtNrAZWS9LDuB8TDp6EUrG”

], “routingKeys”: [“9NnKFUZoYcCqYC2PcaXH3cnaGsoRfyGgyEHbvbLJYh8j”], “serviceEndpoint”: “http://bob:3000

}

]

}

Output example: {

“@context”: “https://w3id.org/did/v1”, “id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ”, “verificationMethod”: [

{

“id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ#1”, “type”: “Ed25519VerificationKey2018”, “controller”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ”, “publicKeyBase58”: “AU2FFjtkVzjFuirgWieqGGqtNrAZWS9LDuB8TDp6EUrG”

}

], “authentication”: [“did:sov:JNKL9kJxQi5pNCfA8QBXdJ#1”], “service”: [

{

“id”: “did:sov:JNKL9kJxQi5pNCfA8QBXdJ#didcomm”, “type”: “did-communication”, “priority”: 0, “recipientKeys”: [“did:sov:JNKL9kJxQi5pNCfA8QBXdJ#1”], “routingKeys”: [

“did:key:z6Mknq3MqipEt9hJegs6J9V7tiLa6T5H5rX3fFCXksJKTuv7#z6Mknq3MqipEt9hJegs6J9V7tiLa6T5H5rX3fFCXksJKTuv7”

], “serviceEndpoint”: “http://bob:3000

}

]

}

classmethod apply(value: dict) dict[source]

Apply all corrections to the given DID document.

static authentication_is_list_of_verification_methods_and_refs(value: dict) dict[source]

Update authentication to be a list of methods and references.

classmethod did_key_to_did_key_ref(key: str)[source]

Convert did:key to did:key ref.

classmethod didcomm_services_recip_keys_are_refs_routing_keys_are_did_key_ref(value: dict) dict[source]

Update DIDComm service recips to use refs and routingKeys to use did:key.

static didcomm_services_use_updated_conventions(value: dict) dict[source]

Update DIDComm services to use updated conventions.

classmethod fully_qualified_ids_and_controllers(value: dict) dict[source]

Make sure IDs and controllers are fully qualified.

static public_key_is_verification_method(value: dict) dict[source]

Replace publicKey with verificationMethod.

static qualified(did_or_did_url: str) str[source]

Make sure DID or DID URL is fully qualified.

static recip_base58_to_ref(vms: List[dict], recip: str) str[source]

Convert base58 public key to ref.

classmethod remove_routing_keys_from_verification_method(value: dict) dict[source]

Remove routing keys from verification methods.

This was an old convention; routing keys were added to the public keys of the doc even though they’re usually not owned by the doc sender.

This correction should be applied before turning the routing keys into did keys.

static remove_verification_method(vms: List[dict], public_key_base58: str) List[dict][source]

Remove the verification method with the given key.

class aries_cloudagent.resolver.default.legacy_peer.LegacyPeerDIDResolver[source]

Bases: aries_cloudagent.resolver.base.BaseDIDResolver

Resolve legacy peer DIDs.

async fetch_did_document(profile: aries_cloudagent.core.profile.Profile, did: str, *, ttl: Optional[int] = None)[source]

Fetch DID from wallet if available.

Return value is cached.

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

Resolve a Legacy Peer DID to a DID document by fetching from the wallet.

This overrides the default resolve method so we can take care of caching ourselves since we use it for the supports method as well.

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

Perform required setup for the resolver.

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

Return whether this resolver supports the given DID.

This resolver resolves unqualified DIDs and dids prefixed with did:sov:.

These DIDs have the unfortunate characteristic of overlapping with what ACA-Py uses for DIDs written to Indy ledgers. This means that we will need to attempt to resolve but defer to the Indy resolver if we don’t find anything locally. This has the side effect that this resolver will never raise DIDNotFound since it won’t even be selected for resolution unless we have the DID in our wallet.

This will check if the DID matches the IndyDID regex. If it does, attempt a lookup in the wallet for a document. If found, return True. Else, return False.

class aries_cloudagent.resolver.default.legacy_peer.RetrieveResult(is_local: bool, doc: Optional[dict] = None)[source]

Bases: object

Entry in the peer DID cache.

doc: Optional[dict] = None
is_local: bool

aries_cloudagent.resolver.default.peer2 module

aries_cloudagent.resolver.default.peer3 module

aries_cloudagent.resolver.default.universal module

HTTP Universal DID Resolver.

class aries_cloudagent.resolver.default.universal.UniversalResolver(*, endpoint: Optional[str] = None, supported_did_regex: Optional[Pattern] = None, bearer_token: Optional[str] = None)[source]

Bases: aries_cloudagent.resolver.base.BaseDIDResolver

Universal DID Resolver with HTTP bindings.

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

Perform setup, populate supported method list, configuration.

property supported_did_regex: Pattern

Return supported methods regex.

aries_cloudagent.resolver.default.web module

Web DID Resolver.

class aries_cloudagent.resolver.default.web.WebDIDResolver[source]

Bases: aries_cloudagent.resolver.base.BaseDIDResolver

Web DID Resolver.

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

Perform required setup for Web DID resolution.

property supported_did_regex: Pattern

Return supported_did_regex of Web DID Resolver.