aries_cloudagent.resolver.default package

Resolvers included in ACA-Py by Default.

Submodules

aries_cloudagent.resolver.default.indy module

aries_cloudagent.resolver.default.jwk module

did:jwk: resolver implementation.

class aries_cloudagent.resolver.default.jwk.JwkDIDResolver[source]

Bases: BaseDIDResolver

did:jwk: resolver implementation.

PATTERN = re.compile('^did:jwk:(?P<did>.*)$')
async setup(context: InjectionContext)[source]

Perform required setup for the resolver.

property supported_did_regex: Pattern

Return supported DID regex.

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: BaseDIDResolver

Key DID Resolver.

async setup(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: BaseDIDResolver

Resolve legacy peer DIDs.

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

Fetch DID from wallet if available.

Return value is cached.

async resolve(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: InjectionContext)[source]

Perform required setup for the resolver.

async supports(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.peer1 module

did:peer:1 resolver implementation.

class aries_cloudagent.resolver.default.peer1.PeerDID1Resolver[source]

Bases: BaseDIDResolver

Resolve legacy peer DIDs.

PEER1_PATTERN = re.compile('^did:peer:1zQm[base58.alphabet.decode]{44}$')
async setup(context: InjectionContext)[source]

Perform required setup for the resolver.

property supported_did_regex: Pattern

Return supported_did_regex of DID Peer 1 Resolver.

aries_cloudagent.resolver.default.peer1.contextualize(did: str, document: dict)[source]

Contextualize a peer DID document.

aries_cloudagent.resolver.default.peer2 module

Peer DID Resolver.

Resolution is performed using the peer-did-python library https://github.com/sicpa-dlab/peer-did-python.

class aries_cloudagent.resolver.default.peer2.PeerDID2Resolver[source]

Bases: BaseDIDResolver

Peer DID Resolver.

async setup(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.peer3 module

Peer DID Resolver.

Resolution is performed by converting did:peer:2 to did:peer:3 according to https://identity.foundation/peer-did-method-spec/#generation-method:~:text=Method%203%3A%20DID%20Shortening%20with%20SHA%2D256%20Hash

class aries_cloudagent.resolver.default.peer3.PeerDID3Resolver[source]

Bases: BaseDIDResolver

Peer DID Resolver.

RECORD_TYPE_3_TO_2 = 'peer3_to_peer2'
async create_and_store(profile: Profile, peer2: str)[source]

Injest did:peer:2 create did:peer:3 and store document.

async remove_record_for_deleted_conn(profile: Profile, event: Event)[source]

Remove record for deleted connection, if found.

async setup(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.peer4 module

Peer DID 4 Resolver.

Resolution is performed using the peer-did-python library https://github.com/decentralized-identity/did-peer-4.

class aries_cloudagent.resolver.default.peer4.PeerDID4Resolver[source]

Bases: BaseDIDResolver

Peer DID 4 Resolver.

RECORD_TYPE = 'long_peer_did_4_doc'
async setup(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.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: BaseDIDResolver

Universal DID Resolver with HTTP bindings.

async setup(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: BaseDIDResolver

Web DID Resolver.

async setup(context: InjectionContext)[source]

Perform required setup for Web DID resolution.

property supported_did_regex: Pattern

Return supported_did_regex of Web DID Resolver.