diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ded2aaaf..4a9a4e61d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,83 @@ +# 0.7.3-RC0 + +## December 13, 2021 + +This release includes some new AIP 2.0 features out (Revocation Notification and +Discover Features 2.0), a major new feature for those using Indy ledger (multi-ledger support), +and a fix for a critical bug in some mediator scenarios. The release also includes several new +pieces of documentation (storage database information and logging) and some other documentation +updates that make the ACA-Py [Read The Docs site](https://aries-cloud-agent-python.readthedocs.io/en/latest/) +useful again. And of course, some recent bug fixes and cleanups are included. + +There is a **BREAKING CHANGE** for those deploying ACA-Py with an external outbound queue +implementation (see [PR #1501](https://github.com/hyperledger/aries-cloudagent-python/pull/1501)). +As far as we know, there is only one organization that has such an implementation and they +were involved in the creation of this PR, so we are not making this release a minor or major update. +However, anyone else using an external queue should be aware of the impact of this PR that is +included in the release. + +For those that have an existing deployment of ACA-Py with long-lasting connection records, some action +may be required in order to use [RFC 434 Out of Band](https://github.com/hyperledger/aries-rfcs/tree/main/features/0434-outofband) and the "reuse connection" as the invitee. In PR #1453 +(details below) a performance improvement was made when finding a connection for reuse. The new approach +(adding a tag to the connection to enable searching) applies only to connections made using this ACA-Py +release and later, and "as-is" connections made using earlier releases of ACA-Py will not be found as reuse +candidates. We don't think this will affect (m)any deployments and so have not implemented a migration +approach. However, if this issue might affect your deployment, please submit an issue and the ACA-Py +team will work with you to find a solution. + +The [Supported RFCs document](/SupportedRFCs.md) has been updated to reflect the addition of the +AIP 2.0 RFCs for which support was added. + +The following is an annotated list of PRs in the release, including a link to each PR. + +- **AIP 2.0 Features** + - Discover Features Protocol: v1_0 refactoring and v2_0 implementation [[#1500](https://github.com/hyperledger/aries-cloudagent-python/pull/1500)](https://github.com/hyperledger/aries-cloudagent-python/pull/1500) + - Updates the Discover Features 1.0 (AIP 1.0) implementation and implements the new 2.0 version. In doing so, adds generalized support for goal codes to ACA-Py. + - Implement Revocation Notification v1.0 [#1464](https://github.com/hyperledger/aries-cloudagent-python/pull/1464) + - Fix integration tests (revocation notifications) [#1528](https://github.com/hyperledger/aries-cloudagent-python/pull/1528) + - Add Revocation notification support to alice/faber [#1527](https://github.com/hyperledger/aries-cloudagent-python/pull/1527) +- **Other New Features** + - Multiple Indy Ledger support and State Proof verification [#1425](https://github.com/hyperledger/aries-cloudagent-python/pull/1425) + - Remove required dependencies from multi-ledger code that was requiring the import of Aries Askar even when not being used[#1550](https://github.com/hyperledger/aries-cloudagent-python/pull/1550) + - Outbound Queue - more usability improvements [#1501](https://github.com/hyperledger/aries-cloudagent-python/pull/1501) + - Display QR code when generating/displaying invites on startup [#1526](https://github.com/hyperledger/aries-cloudagent-python/pull/1526) + - Enable WS Pings for WS Inbound Transport [#1530](https://github.com/hyperledger/aries-cloudagent-python/pull/1530) + - Faster detection of lost Web Socket connections; implementation verified with an existing mediator. + - Performance Improvement when using connection reuse in OOB and there are many DID connections. ConnRecord tags - their_public_did and invitation_msg_id [#1543](https://github.com/hyperledger/aries-cloudagent-python/pull/1543) + - In previous releases, a "their_public_did" was not a tag, so to see if you can reuse a connection, all connections were retrieved from the database to see if a matching public DID can be found. Now, connections created after deploying this release will have a tag on the connection such that an indexed query can be used. See "Breaking Change" note above. + - Follow up to [#1543](https://github.com/hyperledger/aries-cloudagent-python/pull/1543) - Adding invitation_msg_id and their_public_did back to record_value [#1553](https://github.com/hyperledger/aries-cloudagent-python/pull/1553) +- **Critical Fixes** + - Fix connection record response for mobile [#1469](https://github.com/hyperledger/aries-cloudagent-python/pull/1469) +- **Documentation Additions and Updates** + - added documentation for wallet storage databases [#1523](https://github.com/hyperledger/aries-cloudagent-python/pull/1523) + - added logging documentation [#1519](https://github.com/hyperledger/aries-cloudagent-python/pull/1519) + - Fix warnings when generating ReadTheDocs [#1509](https://github.com/hyperledger/aries-cloudagent-python/pull/1509) + - Remove Streetcred references [#1504](https://github.com/hyperledger/aries-cloudagent-python/pull/1504) + - Add RTD configs to get generator working [#1496](https://github.com/hyperledger/aries-cloudagent-python/pull/1496) +- **Other Fixes** + - Connection Handling / Out of Band Invitations Fixes + - OOB: Fixes issues with multiple public explicit invitation and unused 0160 connection [#1525](https://github.com/hyperledger/aries-cloudagent-python/pull/1525) + - Delete unused ConnRecord generated - OOB invitation (use_exising_connection) [#1521](https://github.com/hyperledger/aries-cloudagent-python/pull/1521) + - When an invitee responded with a "reuse" message, the connection record associated with the invitation was not being deleted. Now it is. + - Await asyncio.sleeps to cleanup warnings in Python 3.8/3.9 [#1558](https://github.com/hyperledger/aries-cloudagent-python/pull/1558) + - DIF Presentation Exchange Cleanups + - Fix DIF Presentation Request Input Validation [#1517](https://github.com/hyperledger/aries-cloudagent-python/pull/1517) + - Some validation checking of a DIF presentation request to prevent uncaught errors later in the process. + - DIF PresExch - ProblemReport and "is_holder" [#1493](https://github.com/hyperledger/aries-cloudagent-python/pull/1493) + - Cleanups related to when "is_holder" is or is not required. Related to [Issue #1486](https://github.com/hyperledger/aries-cloudagent-python/issues/1486) + - Indy SDK Related Fixes + - Fix AttributeError when writing an Indy Cred Def record [#1516](https://github.com/hyperledger/aries-cloudagent-python/pull/1516) + - Fix TypeError when calling credential_definitions_fix_cred_def_wallet… [#1515](https://github.com/hyperledger/aries-cloudagent-python/pull/1515) + - Fix TypeError when writing a Schema record [#1494](https://github.com/hyperledger/aries-cloudagent-python/pull/1494) + - Fix validation for range checks [#1538](https://github.com/hyperledger/aries-cloudagent-python/pull/1538) + - Back out some of the validation checking for proof requests with predicates as they were preventing valid proof requests from being processed. + - Aries Askar Related Fixes: + - Fix bug when getting credentials on askar-profile [#1510](https://github.com/hyperledger/aries-cloudagent-python/pull/1510) + - Fix error when removing a wallet on askar-profile [#1518](https://github.com/hyperledger/aries-cloudagent-python/pull/1518) + - Fix error when connection request is received (askar, public invitation) [#1508](https://github.com/hyperledger/aries-cloudagent-python/pull/1508) + - Release Adminstration: + - Changelog and RTD updates for the pending 0.7.3 release [#1553](https://github.com/hyperledger/aries-cloudagent-python/pull/1553) + # 0.7.2 ## November 15, 2021 diff --git a/PUBLISHING.md b/PUBLISHING.md index c05a8bca5e..9f97266bad 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -1,13 +1,30 @@ # How to Publish a New Version -0. The code to be published should be in the `main` branch. +The code to be published should be in the `main` branch. Make sure that all the PRs to go in the release are +merged, and decide on the release tag. Should it be a release candidate or the final tag, and should it be +a major, minor or patch release, per [semver](https://semver.org/) rules. -1. Update CHANGELOG.md to include details of the closed PRs included in this release. +Once ready to do a release, create a PR that includes the following updates: -2. Update the version number listed in [aries_cloudagent/version.py](aries_cloudagent/version.py). The incremented version number should adhere to the [Semantic Versioning Specification](https://semver.org/#semantic-versioning-specification-semver) based on the changes since the last published release. +1. Update the CHANGELOG.md to add the new release. If transitioning for a Release Candidate to the final release for the tag, do not create a new section -- just drop the "RC" designation. -3. Create a new GitHub release. The tag name and title of the release should be the same as the version in [aries_cloudagent/version.py](aries_cloudagent/version.py). Include the additions to CHANGELOG.md in the release notes. +2. include details of the closed PRs included in this release. General process to follow: -4. Create a new [distribution package](https://packaging.python.org/glossary/#term-distribution-package) with `python setup.py sdist bdist_wheel` +- Gather the set of PRs since the last release and put them into a list. + - An example query to use to get the list of PRs is: [https://github.com/hyperledger/aries-cloudagent-python/pulls?q=is%3Apr+is%3Amerged+sort%3Aupdated+merged%3A%3E2021-11-15](https://github.com/hyperledger/aries-cloudagent-python/pulls?q=is%3Apr+is%3Amerged+sort%3Aupdated+merged%3A%3E2021-11-15), where the date at the end is the date of the previous release. + - Organize the list into suitable categories, update (if necessary) the PR description and add notes to clarify the changes. + - Add a link to each PR on the PR number. + - A regular expression you can use in VS Code to add the links to the list (assuming each line ends with the PR number) is `#([0-9]*)` (find) and `[#$1](https://github.com/hyperledger/aries-cloudagent-python/pull/$1)` (replace). Use regular expressions in the search, highlight the list and choose "Find in Selection" before replacing. + - Add a narrative about the release above the PR that highlights what has gone into the release. -5. Publish the release to [PyPI](https://pypi.org) using [twine](https://pypi.org/project/twine/) with `twine upload dist/*` +3. Update the ReadTheDocs in the `/docs` folder by following the instructions in the `docs/README.md` file. That will likely add a number of new and modified files to the PR. Eliminate all of the errors in the generation process, either by mocking external dependencies or by fixing ACA-Py code. If necessary, create an issue with the errors and assign it to the appropriate developer. Experience has demonstrated to use that documentation generation errors should be fixed in the code. + +4. Update the version number listed in [aries_cloudagent/version.py](aries_cloudagent/version.py) and, prefixed with a "v" in [open-api/openapi.json](open-api/openapi.json) (e.g. "v0.7.2" in the openapi.json file, and "0.7.2" in the version.py file). The incremented version number should adhere to the [Semantic Versioning Specification](https://semver.org/#semantic-versioning-specification-semver) based on the changes since the last published release. For Release Candidates, the form of the tag is "0.7.2-rc0". + +5. An extra search of the repo for the existing tag is recommended to see if there are any other instances of the tag in the repo. If any are found to be required, finding a way to not need them is best, but if they are needed, please update this document to note where the tag can be found. + +6. Create a new GitHub release. The tag name and title of the release should be the same as the version in [aries_cloudagent/version.py](aries_cloudagent/version.py). Include the additions to CHANGELOG.md in the release notes. + +7. Publish a new docker container on Docker Hub ([bcgovimages/aries-cloudagent](https://hub.docker.com/r/bcgovimages/aries-cloudagent/)) by following the instructions to create a PR for the release in the repository [https://github.com/bcgov/aries-cloudagent-container](https://github.com/bcgov/aries-cloudagent-container). Appropriate permissions are required to publish the image. + +8. Update the ACA-Py Read The Docs site by building the new "latest" (main branch) and activating and building the new release. Appropriate permissions are required to publish the new documentation version. diff --git a/SupportedRFCs.md b/SupportedRFCs.md index 17e85e94a2..dca001abc4 100644 --- a/SupportedRFCs.md +++ b/SupportedRFCs.md @@ -8,7 +8,7 @@ ACA-Py or the repository `main` branch. Reminders (and PRs!) to update this page welcome! If you have any questions, please contact us on the #aries channel on [Hyperledger Rocketchat](https://chat.hyperledger.org) or through an issue in this repo. -**Last Update**: 2021-11-12, Release 0.7.2 +**Last Update**: 2021-12-06, Release 0.7.3 > The checklist version of this document was created as a joint effort > between [Northern Block](https://northernblock.io/) and [Animo Solutions](https://animo.id/). @@ -85,8 +85,8 @@ A summary of the Aries Interop Profiles and Aries RFCs supported in ACA-Py can b | Connection-less (non OOB protocol / AIP 1.0) | :white_check_mark: | Only for issue credential and present proof | | Connection-less (OOB protocol / AIP 2.0) | :white_check_mark: | Only for present proof | | Signed Attachments | :white_check_mark: | Used for OOB | -| Multi ledger support (with automatic detection) | :construction: | [Pull Request](https://github.com/hyperledger/aries-cloudagent-python/pull/1425) | -| Persistence of mediated messages | :x: | Messages are currently stored in an in-memory and so are subject to loss in the case of a sudden termination of an ACA-Py process. The in-memory queue is properly handled in the case of a graceful shutdown of an ACA-Py process (e.g. processing of the queue completes and no new messages are accepted). | +| Multi Indy ledger support (with automatic detection) | :white_check_mark: | Support added in the 0.7.3 Release. | +| Persistence of mediated messages | :construction: | Messages are currently stored in an in-memory and so are subject to loss in the case of a sudden termination of an ACA-Py process. The in-memory queue is properly handled in the case of a graceful shutdown of an ACA-Py process (e.g. processing of the queue completes and no new messages are accepted). Work is underway to add useful external queues handling, including support for multiple external queue implementations (e.g., redis and kafka). | | Storage Import & Export | :warning: | Supported by directly interacting with the indy-sdk or Aries Askar (e.g., no Admin API endpoint available for wallet import & export). Aries Askar support includes the ability to import storage exported from the Indy SDK's "indy-wallet" component. | ## Supported RFCs @@ -108,13 +108,13 @@ are fully supported in ACA-Py **EXCEPT** as noted in the table below. | RFC | Supported | Notes | --- | :--: | -- | -| [0023-did-exchange](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0023-did-exchange) | :warning: | Not using DIDDoc conventions yet, still using DID format of 0160-connections (which is incorrect and outdated). Also using incorrect format for `did:peer` (or not using a `did:` prefix at all) | -| [0183-revocation-notification](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0183-revocation-notification) | :construction: | [PR is in review](https://github.com/hyperledger/aries-cloudagent-python/pull/1464) | -| [0211-route-coordination](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0211-route-coordination) | :warning: | Only pre-AIP 2.0 version. Must be updated to use `did:key` for full AIP 2.0 support | +| [0023-did-exchange](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0023-did-exchange) | :warning: | Not using DIDDoc conventions yet, still using DID format of 0160-connections (which is incorrect and outdated). Also using incorrect format for `did:peer` (or not using a `did:` prefix at all) | +| [0183-revocation-notification](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0183-revocation-notification) | :white_check_mark: | :new: This was added in release 0.7.3 and will be removed from this list with the next update. | +| [0211-route-coordination](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0211-route-coordination) | :warning: | Only pre-AIP 2.0 version. Must be updated to use `did:key` for full AIP 2.0 support | | [0317-please-ack](https://github.com/hyperledger/aries-rfcs/tree/main/features/0317-please-ack) | :x: | | | [0360-use-did-key](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0360-use-did-key) | :warning: | Creating and resolving `did:key` DIDs is supported, but not all protocols are updated yet to use `did:key`. This is a breaking change for AIP 1.0 -> AIP 2.0. | -| [0519-goal-codes](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/concepts/0519-goal-codes) | :x: | To be implemented as part of the work on RFC 0557 Discover Features V2 (below) | -| [0557-discover-features-v2](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0557-discover-features-v2) | :x: | [Issue exists](https://github.com/hyperledger/aries-cloudagent-python/issues/1466) and is being implemented. | +| [0519-goal-codes](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/concepts/0519-goal-codes) | :white_check_mark: | :new: This was added in release 0.7.3 and will be removed from this list with the next update. | +| [0557-discover-features-v2](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0557-discover-features-v2) | :white_check_mark: | :new: This was added in release 0.7.3 and will be removed from this list with the next update. | | [0587-encryption-envelope-v2](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0587-encryption-envelope-v2) | :construction: | Support for the DIDComm V2 envelope format is a work in progress, including the PRs ([AIP-2 base64url consistency](https://github.com/hyperledger/aries-cloudagent-python/pull/1188) and [Small AIP-2 updates](https://github.com/hyperledger/aries-cloudagent-python/pull/1056)) | | [0627-static-peer-dids](https://github.com/hyperledger/aries-rfcs/tree/b3a3942ef052039e73cd23d847f42947f8287da2/features/0627-static-peer-dids) | :x: | | @@ -122,6 +122,6 @@ are fully supported in ACA-Py **EXCEPT** as noted in the table below. | RFC | Supported | Notes | | --- | :--: | -- | -| [0031-discover-features](https://github.com/hyperledger/aries-rfcs/blob/main/features/0031-discover-features/README.md) | :warning: | Rarely (never?) used, and in implementing the V2 version of the protocol, the V1 version was found to be incomplete. It will be updated as part of the V2 work. | +| [0031-discover-features](https://github.com/hyperledger/aries-rfcs/blob/main/features/0031-discover-features/README.md) | :white_check_mark: | Rarely (never?) used, and in implementing the V2 version of the protocol, the V1 version was found to be incomplete and was updated as part of Release 0.7.3 | | [0028-introduce](https://github.com/hyperledger/aries-rfcs/blob/main/features/0028-introduce/README.md) | :white_check_mark: | | | [00509-action-menu](https://github.com/hyperledger/aries-rfcs/blob/main/features/0509-action-menu/README.md) | :white_check_mark: | | diff --git a/aries_cloudagent/connections/models/conn_record.py b/aries_cloudagent/connections/models/conn_record.py index 4e5981e777..672d9359e0 100644 --- a/aries_cloudagent/connections/models/conn_record.py +++ b/aries_cloudagent/connections/models/conn_record.py @@ -3,7 +3,7 @@ import json from enum import Enum -from typing import Any, Union +from typing import Any, Optional, Union from marshmallow import fields, validate @@ -167,7 +167,14 @@ def __eq__(self, other: Union[str, "ConnRecord.State"]) -> bool: RECORD_ID_NAME = "connection_id" RECORD_TOPIC = "connections" LOG_STATE_FLAG = "debug.connections" - TAG_NAMES = {"my_did", "their_did", "request_id", "invitation_key"} + TAG_NAMES = { + "my_did", + "their_did", + "request_id", + "invitation_key", + "their_public_did", + "invitation_msg_id", + } RECORD_TYPE = "connection" RECORD_TYPE_INVITATION = "connection_invitation" @@ -269,8 +276,8 @@ def record_value(self) -> dict: "alias", "error_msg", "their_label", - "state", "their_public_did", + "state", "connection_protocol", ) } @@ -325,7 +332,7 @@ async def retrieve_by_invitation_key( @classmethod async def retrieve_by_invitation_msg_id( cls, session: ProfileSession, invitation_msg_id: str, their_role: str = None - ) -> "ConnRecord": + ) -> Optional["ConnRecord"]: """Retrieve a connection record by invitation_msg_id. Args: @@ -333,13 +340,36 @@ async def retrieve_by_invitation_msg_id( invitation_msg_id: Invitation message identifier initiator: Filter by the initiator value """ + tag_filter = {"invitation_msg_id": invitation_msg_id} post_filter = { "state": cls.State.INVITATION.rfc160, - "invitation_msg_id": invitation_msg_id, } if their_role: post_filter["their_role"] = cls.Role.get(their_role).rfc160 - return await cls.query(session, post_filter_positive=post_filter) + try: + return await cls.retrieve_by_tag_filter(session, tag_filter, post_filter) + except StorageNotFoundError: + return None + + @classmethod + async def find_existing_connection( + cls, session: ProfileSession, their_public_did: str + ) -> Optional["ConnRecord"]: + """Retrieve existing active connection records (public did). + + Args: + session: The active profile session + their_public_did: Inviter public DID + """ + tag_filter = {"their_public_did": their_public_did} + conn_records = await cls.query( + session, + tag_filter=tag_filter, + ) + for conn_record in conn_records: + if conn_record.state == ConnRecord.State.COMPLETED: + return conn_record + return None @classmethod async def retrieve_by_request_id( diff --git a/aries_cloudagent/connections/models/tests/test_conn_record.py b/aries_cloudagent/connections/models/tests/test_conn_record.py index d11caf9804..e315670729 100644 --- a/aries_cloudagent/connections/models/tests/test_conn_record.py +++ b/aries_cloudagent/connections/models/tests/test_conn_record.py @@ -187,19 +187,54 @@ async def test_retrieve_by_invitation_msg_id(self): invitation_msg_id="test123", ) await record.save(self.session) - results = await ConnRecord.retrieve_by_invitation_msg_id( + result = await ConnRecord.retrieve_by_invitation_msg_id( session=self.session, invitation_msg_id="test123", their_role=ConnRecord.Role.RESPONDER.rfc160, ) - assert len(results) == 1 - assert results[0] == record - results = await ConnRecord.retrieve_by_invitation_msg_id( + assert result + assert result == record + result = await ConnRecord.retrieve_by_invitation_msg_id( session=self.session, invitation_msg_id="test123", their_role=ConnRecord.Role.REQUESTER.rfc160, ) - assert len(results) == 0 + assert not result + + async def test_find_existing_connection(self): + record_a = ConnRecord( + my_did=self.test_did, + their_did=self.test_target_did, + their_role=ConnRecord.Role.RESPONDER.rfc160, + state=ConnRecord.State.COMPLETED.rfc160, + invitation_msg_id="test123", + their_public_did="test_did_1", + ) + await record_a.save(self.session) + record_b = ConnRecord( + my_did=self.test_did, + their_did=self.test_target_did, + their_role=ConnRecord.Role.RESPONDER.rfc160, + state=ConnRecord.State.INVITATION.rfc160, + invitation_msg_id="test123", + their_public_did="test_did_1", + ) + await record_b.save(self.session) + record_c = ConnRecord( + my_did=self.test_did, + their_did=self.test_target_did, + their_role=ConnRecord.Role.RESPONDER.rfc160, + state=ConnRecord.State.COMPLETED.rfc160, + invitation_msg_id="test123", + ) + await record_c.save(self.session) + result = await ConnRecord.find_existing_connection( + session=self.session, + their_public_did="test_did_1", + ) + assert result + assert result.state == "active" + assert result.their_public_did == "test_did_1" async def test_retrieve_by_request_id(self): record = ConnRecord( diff --git a/aries_cloudagent/core/conductor.py b/aries_cloudagent/core/conductor.py index 6b99dcaffa..d89d226b5d 100644 --- a/aries_cloudagent/core/conductor.py +++ b/aries_cloudagent/core/conductor.py @@ -15,7 +15,6 @@ from ..admin.base_server import BaseAdminServer from ..admin.server import AdminResponder, AdminServer -from ..askar.profile import AskarProfile from ..config.default_context import ContextBuilder from ..config.injection_context import InjectionContext from ..config.provider import ClassProvider @@ -27,12 +26,9 @@ from ..config.logging import LoggingConfigurator from ..config.wallet import wallet_config from ..core.profile import Profile -from ..indy.sdk.profile import IndySdkProfile from ..indy.verifier import IndyVerifier from ..ledger.base import BaseLedger from ..ledger.error import LedgerConfigError, LedgerTransactionError -from ..ledger.indy import IndySdkLedger -from ..ledger.indy_vdr import IndyVdrLedger from ..ledger.multiple_ledger.base_manager import ( BaseMultipleLedgerManager, MultipleLedgerManagerError, @@ -67,6 +63,7 @@ from ..utils.task_queue import CompletedTask, TaskQueue from ..vc.ld_proofs.document_loader import DocumentLoader from ..wallet.did_info import DIDInfo + from .dispatcher import Dispatcher from .util import STARTUP_EVENT_TOPIC, SHUTDOWN_EVENT_TOPIC @@ -139,8 +136,9 @@ async def setup(self): BaseMultipleLedgerManager ).get_write_ledger() )[1] - if isinstance(self.root_profile, AskarProfile) and isinstance( - ledger, IndyVdrLedger + if ( + self.root_profile.BACKEND_NAME == "askar" + and ledger.BACKEND_NAME == "indy-vdr" ): context.injector.bind_instance(BaseLedger, ledger) context.injector.bind_provider( @@ -150,8 +148,9 @@ async def setup(self): self.root_profile, ), ) - elif isinstance(self.root_profile, IndySdkProfile) and isinstance( - ledger, IndySdkLedger + elif ( + self.root_profile.BACKEND_NAME == "indy" + and ledger.BACKEND_NAME == "indy" ): context.injector.bind_instance(BaseLedger, ledger) context.injector.bind_provider( diff --git a/aries_cloudagent/core/profile.py b/aries_cloudagent/core/profile.py index 6cbce6423f..e5de864d6e 100644 --- a/aries_cloudagent/core/profile.py +++ b/aries_cloudagent/core/profile.py @@ -21,8 +21,8 @@ class Profile(ABC): """Base abstraction for handling identity-related state.""" - BACKEND_NAME = None - DEFAULT_NAME = "default" + BACKEND_NAME: str = None + DEFAULT_NAME: str = "default" def __init__( self, diff --git a/aries_cloudagent/indy/credx/tests/test_cred_issuance.py b/aries_cloudagent/indy/credx/tests/test_cred_issuance.py index d35962ba35..0c23eda904 100644 --- a/aries_cloudagent/indy/credx/tests/test_cred_issuance.py +++ b/aries_cloudagent/indy/credx/tests/test_cred_issuance.py @@ -80,7 +80,7 @@ async def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=mock_ledger + return_value=(None, mock_ledger) ) ), ) diff --git a/aries_cloudagent/indy/models/pres_preview.py b/aries_cloudagent/indy/models/pres_preview.py index 28af5b5c1d..7ab771309f 100644 --- a/aries_cloudagent/indy/models/pres_preview.py +++ b/aries_cloudagent/indy/models/pres_preview.py @@ -352,14 +352,12 @@ def non_revoc(cred_def_id: str) -> IndyNonRevocationInterval: if cd_id: if profile: ledger_exec_inst = profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cd_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cd_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] if ledger: async with ledger: revoc_support = (await ledger.get_credential_definition(cd_id))[ @@ -413,14 +411,12 @@ def non_revoc(cred_def_id: str) -> IndyNonRevocationInterval: if cd_id: if profile: ledger_exec_inst = profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cd_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cd_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] if ledger: async with ledger: revoc_support = (await ledger.get_credential_definition(cd_id))[ diff --git a/aries_cloudagent/indy/models/tests/test_pres_preview.py b/aries_cloudagent/indy/models/tests/test_pres_preview.py index 9e3fc6d59c..eee3071e49 100644 --- a/aries_cloudagent/indy/models/tests/test_pres_preview.py +++ b/aries_cloudagent/indy/models/tests/test_pres_preview.py @@ -403,10 +403,13 @@ async def test_to_indy_proof_request_revo_default_interval(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = async_mock.MagicMock( - get_credential_definition=async_mock.CoroutineMock( - return_value={"value": {"revocation": {"...": "..."}}} - ) + mock_get_ledger.return_value = ( + None, + async_mock.MagicMock( + get_credential_definition=async_mock.CoroutineMock( + return_value={"value": {"revocation": {"...": "..."}}} + ) + ), ) indy_proof_req_revo = await pres_preview.indy_proof_request( **{k: INDY_PROOF_REQ[k] for k in ("name", "version", "nonce")}, @@ -443,10 +446,13 @@ async def test_to_indy_proof_request_revo(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = async_mock.MagicMock( - get_credential_definition=async_mock.CoroutineMock( - return_value={"value": {"revocation": {"...": "..."}}} - ) + mock_get_ledger.return_value = ( + None, + async_mock.MagicMock( + get_credential_definition=async_mock.CoroutineMock( + return_value={"value": {"revocation": {"...": "..."}}} + ) + ), ) indy_proof_req_revo = await pres_preview.indy_proof_request( **{k: INDY_PROOF_REQ[k] for k in ("name", "version", "nonce")}, diff --git a/aries_cloudagent/indy/sdk/tests/test_verifier.py b/aries_cloudagent/indy/sdk/tests/test_verifier.py index be02bb8ead..44784b1ad5 100644 --- a/aries_cloudagent/indy/sdk/tests/test_verifier.py +++ b/aries_cloudagent/indy/sdk/tests/test_verifier.py @@ -334,7 +334,7 @@ async def test_verify_presentation(self, mock_verify): ) as mock_non_revox, async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) INDY_PROOF_REQ_X = deepcopy(INDY_PROOF_REQ_PRED_NAMES) verified = await self.verifier.verify_presentation( INDY_PROOF_REQ_X, @@ -395,7 +395,7 @@ async def test_check_encoding_attr(self, mock_verify): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) mock_verify.return_value = True verified = await self.verifier.verify_presentation( INDY_PROOF_REQ_NAME, @@ -448,7 +448,7 @@ async def test_check_encoding_attr_tamper_encoded(self, mock_verify): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) verified = await self.verifier.verify_presentation( INDY_PROOF_REQ_NAME, INDY_PROOF_X, @@ -501,7 +501,7 @@ async def test_check_pred_names_tamper_pred_value(self, mock_verify): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) verified = await self.verifier.verify_presentation( deepcopy(INDY_PROOF_REQ_PRED_NAMES), INDY_PROOF_X, @@ -522,7 +522,7 @@ async def test_check_pred_names_tamper_pred_req_attr(self, mock_verify): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) verified = await self.verifier.verify_presentation( INDY_PROOF_REQ_X, INDY_PROOF_PRED_NAMES, diff --git a/aries_cloudagent/indy/tests/test_verifier.py b/aries_cloudagent/indy/tests/test_verifier.py index ef10428d8e..7a00c7276d 100644 --- a/aries_cloudagent/indy/tests/test_verifier.py +++ b/aries_cloudagent/indy/tests/test_verifier.py @@ -341,7 +341,7 @@ async def test_check_timestamps(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) await self.verifier.check_timestamps( mock_profile, INDY_PROOF_REQ_NAME, @@ -353,13 +353,16 @@ async def test_check_timestamps(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = async_mock.MagicMock( - get_credential_definition=async_mock.CoroutineMock( - return_value={ - "...": "...", - "value": {"no": "revocation"}, - } - ) + mock_get_ledger.return_value = ( + None, + async_mock.MagicMock( + get_credential_definition=async_mock.CoroutineMock( + return_value={ + "...": "...", + "value": {"no": "revocation"}, + } + ) + ), ) with self.assertRaises(ValueError) as context: await self.verifier.check_timestamps( @@ -374,7 +377,7 @@ async def test_check_timestamps(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) proof_x = deepcopy(INDY_PROOF_NAME) proof_x["identifiers"][0]["timestamp"] = None proof_x["identifiers"][0]["rev_reg_id"] = None @@ -420,7 +423,7 @@ async def test_check_timestamps(self): ) as mock_logger, async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) pre_logger_calls = mock_logger.info.call_count await self.verifier.check_timestamps( mock_profile, @@ -437,7 +440,7 @@ async def test_check_timestamps(self): with async_mock.patch.object( IndyLedgerRequestsExecutor, "get_ledger_for_identifier" ) as mock_get_ledger: - mock_get_ledger.return_value = self.ledger + mock_get_ledger.return_value = (None, self.ledger) with self.assertRaises(ValueError) as context: await self.verifier.check_timestamps( mock_profile, @@ -824,3 +827,71 @@ async def test_pre_verify(self): ], }, ) + await self.verifier.pre_verify( + { + "nonce": "15606741555044336341559", + "name": "proof_req", + "version": "0.0", + "requested_attributes": {}, + "requested_predicates": { + "18_id_GE_uuid": { + "name": "id", + "p_type": ">=", + "p_value": 4, + "restrictions": [ + {"cred_def_id": "LjgpST2rjsoxYegQDRm7EL:3:CL:19:tag"} + ], + }, + "18_id_LE_uuid": { + "name": "id", + "p_type": "<=", + "p_value": 11198760, + "restrictions": [ + {"cred_def_id": "LjgpST2rjsoxYegQDRm7EL:3:CL:19:tag"} + ], + }, + }, + }, + { + "proof": { + "proofs": [ + { + "primary_proof": { + "eq_proof": {}, + "ge_proofs": [ + { + "predicate": { + "attr_name": "id", + "value": 11198760, + } + }, + { + "predicate": { + "attr_name": "id", + "value": 4, + } + }, + ], + } + } + ], + }, + "requested_proof": { + "revealed_attrs": {}, + "self_attested_attrs": {}, + "unrevealed_attrs": {}, + "predicates": { + "18_id_LE_uuid": {"sub_proof_index": 0}, + "18_id_GE_uuid": {"sub_proof_index": 0}, + }, + }, + "identifiers": [ + { + "schema_id": "LjgpST2rjsoxYegQDRm7EL:2:non-revo:1579888926.0", + "cred_def_id": "LjgpST2rjsoxYegQDRm7EL:3:CL:19:tag", + "rev_reg_id": "LjgpST2rjsoxYegQDRm7EL:4:LjgpST2rjsoxYegQDRm7EL:3:CL:18:tag:CL_ACCUM:0", + "timestamp": 1579892963, + } + ], + }, + ) diff --git a/aries_cloudagent/indy/verifier.py b/aries_cloudagent/indy/verifier.py index 743b071c76..7c219ec136 100644 --- a/aries_cloudagent/indy/verifier.py +++ b/aries_cloudagent/indy/verifier.py @@ -106,14 +106,12 @@ async def check_timestamps( if ident.get("timestamp"): cred_def_id = ident["cred_def_id"] ledger_exec_inst = profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: cred_def = await ledger.get_credential_definition(cred_def_id) if not cred_def["value"].get("revocation"): @@ -255,17 +253,21 @@ async def pre_verify(self, pres_req: dict, pres: dict): for (uuid, req_pred) in pres_req["requested_predicates"].items(): try: canon_attr = canon(req_pred["name"]) + matched = False + found = False for ge_proof in pres["proof"]["proofs"][ pres["requested_proof"]["predicates"][uuid]["sub_proof_index"] ]["primary_proof"]["ge_proofs"]: pred = ge_proof["predicate"] if pred["attr_name"] == canon_attr: - if pred["value"] != req_pred["p_value"]: - raise ValueError( - f"Predicate value != p_value: {pred['attr_name']}" - ) - break - else: + found = True + if pred["value"] == req_pred["p_value"]: + matched = True + break + if not matched: + raise ValueError(f"Predicate value != p_value: {pred['attr_name']}") + break + elif not found: raise ValueError(f"Missing requested predicate '{uuid}'") except (KeyError, TypeError): raise ValueError(f"Missing requested predicate '{uuid}'") diff --git a/aries_cloudagent/ledger/base.py b/aries_cloudagent/ledger/base.py index 3a1868b6c1..3ceaa7e1f3 100644 --- a/aries_cloudagent/ledger/base.py +++ b/aries_cloudagent/ledger/base.py @@ -17,7 +17,7 @@ class BaseLedger(ABC, metaclass=ABCMeta): """Base class for ledger.""" - BACKEND_NAME = None + BACKEND_NAME: str = None async def __aenter__(self) -> "BaseLedger": """ diff --git a/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py b/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py index c8205e5a63..80c3adfaf4 100644 --- a/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py +++ b/aries_cloudagent/ledger/merkel_validation/tests/test_domain_txn_handler.py @@ -6,8 +6,6 @@ from unittest import TestCase -from aries_cloudagent.ledger.multiple_ledger.base_manager import T - from ..domain_txn_handler import ( _extract_attr_typed_value, parse_attr_txn, diff --git a/aries_cloudagent/ledger/multiple_ledger/base_manager.py b/aries_cloudagent/ledger/multiple_ledger/base_manager.py index 0e34da32c1..49af0efe3c 100644 --- a/aries_cloudagent/ledger/multiple_ledger/base_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/base_manager.py @@ -1,12 +1,11 @@ """Manager for multiple ledger.""" from abc import ABC, abstractmethod -from typing import TypeVar, Optional, Tuple, Mapping +from typing import Optional, Tuple, Mapping from ...core.error import BaseError from ...core.profile import Profile - -T = TypeVar("T") +from ...ledger.base import BaseLedger class MultipleLedgerManagerError(BaseError): @@ -20,7 +19,7 @@ def __init__(self, profile: Profile): """Initialize Multiple Ledger Manager.""" @abstractmethod - async def get_write_ledger(self) -> Tuple[str, T]: + async def get_write_ledger(self) -> Tuple[str, BaseLedger]: """Return write ledger.""" @abstractmethod @@ -34,13 +33,13 @@ async def get_nonprod_ledgers(self) -> Mapping: @abstractmethod async def _get_ledger_by_did( self, ledger_id: str, did: str - ) -> Optional[Tuple[str, T, bool]]: + ) -> Optional[Tuple[str, BaseLedger, bool]]: """Build and submit GET_NYM request and process response.""" @abstractmethod async def lookup_did_in_configured_ledgers( self, did: str, cache_did: bool - ) -> Tuple[str, T]: + ) -> Tuple[str, BaseLedger]: """Lookup given DID in configured ledgers in parallel.""" def extract_did_from_identifier(self, identifier: str) -> str: diff --git a/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py b/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py index 701b058a14..a56d93dfef 100644 --- a/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py +++ b/aries_cloudagent/ledger/multiple_ledger/ledger_requests_executor.py @@ -1,11 +1,9 @@ """Ledger Request Executor.""" -from typing import Tuple, Union, Optional +from typing import Optional, Tuple from ...config.base import InjectionError from ...core.profile import Profile from ...ledger.base import BaseLedger -from ...ledger.indy import IndySdkLedger -from ...ledger.indy_vdr import IndyVdrLedger from ...ledger.multiple_ledger.base_manager import ( BaseMultipleLedgerManager, MultipleLedgerManagerError, @@ -41,16 +39,11 @@ def __init__( async def get_ledger_for_identifier( self, identifier: str, txn_record_type: int - ) -> Union[ - Optional[IndyVdrLedger], - Optional[IndySdkLedger], - Tuple[str, IndyVdrLedger], - Tuple[str, IndySdkLedger], - ]: + ) -> Tuple[Optional[str], Optional[BaseLedger]]: """Return ledger info given the record identifier.""" # For seqNo if identifier.isdigit(): - return self.profile.inject(BaseLedger) + return (None, self.profile.inject(BaseLedger)) elif ( self.profile.settings.get("ledger.ledger_config_list") and len(self.profile.settings.get("ledger.ledger_config_list")) > 0 @@ -66,6 +59,5 @@ async def get_ledger_for_identifier( extracted_did, cache_did=cache_did ) except (MultipleLedgerManagerError, InjectionError): - return self.profile.inject_or(BaseLedger) - else: - return self.profile.inject_or(BaseLedger) + pass + return (None, self.profile.inject_or(BaseLedger)) diff --git a/aries_cloudagent/ledger/multiple_ledger/manager_provider.py b/aries_cloudagent/ledger/multiple_ledger/manager_provider.py index 26a7496804..8ea62eac52 100644 --- a/aries_cloudagent/ledger/multiple_ledger/manager_provider.py +++ b/aries_cloudagent/ledger/multiple_ledger/manager_provider.py @@ -4,17 +4,13 @@ from collections import OrderedDict -from ...askar.profile import AskarProfile +from ...cache.base import BaseCache from ...config.provider import BaseProvider from ...config.settings import BaseSettings from ...config.injector import BaseInjector, InjectionError -from ...cache.base import BaseCache -from ...indy.sdk.profile import IndySdkProfile +from ...core.profile import Profile from ...ledger.base import BaseLedger -from ...utils.classloader import ClassLoader, ClassNotFoundError - -from ..indy import IndySdkLedgerPool, IndySdkLedger -from ..indy_vdr import IndyVdrLedgerPool, IndyVdrLedger +from ...utils.classloader import ClassNotFoundError, DeferLoad from .base_manager import MultipleLedgerManagerError @@ -24,39 +20,53 @@ class MultiIndyLedgerManagerProvider(BaseProvider): """Multiple Indy ledger support manager provider.""" - askar_manager_path = ( - "aries_cloudagent.ledger.multiple_ledger." - "indy_vdr_manager.MultiIndyVDRLedgerManager" - ) - basic_manager_path = ( - "aries_cloudagent.ledger.multiple_ledger." "indy_manager.MultiIndyLedgerManager" - ) MANAGER_TYPES = { - "basic": basic_manager_path, - "askar-profile": askar_manager_path, + "basic": ( + DeferLoad( + "aries_cloudagent.ledger.multiple_ledger." + "indy_manager.MultiIndyLedgerManager" + ) + ), + "askar-profile": ( + DeferLoad( + "aries_cloudagent.ledger.multiple_ledger." + "indy_vdr_manager.MultiIndyVDRLedgerManager" + ) + ), + } + LEDGER_TYPES = { + "basic": { + "pool": DeferLoad("aries_cloudagent.ledger.indy.IndySdkLedgerPool"), + "ledger": DeferLoad("aries_cloudagent.ledger.indy.IndySdkLedger"), + }, + "askar-profile": { + "pool": DeferLoad("aries_cloudagent.ledger.indy_vdr.IndyVdrLedgerPool"), + "ledger": DeferLoad("aries_cloudagent.ledger.indy_vdr.IndyVdrLedger"), + }, } def __init__(self, root_profile): """Initialize the multiple Indy ledger profile manager provider.""" self._inst = {} - self.root_profile = root_profile + self.root_profile: Profile = root_profile def provide(self, settings: BaseSettings, injector: BaseInjector): """Create the multiple Indy ledger manager instance.""" - if isinstance(self.root_profile, IndySdkProfile): + if self.root_profile.BACKEND_NAME == "indy": manager_type = "basic" - elif isinstance(self.root_profile, AskarProfile): + elif self.root_profile.BACKEND_NAME == "askar": manager_type = "askar-profile" else: raise MultipleLedgerManagerError( - "MultiIndyLedgerManagerProvider expects an IndySDKProfile [indy] " + "MultiIndyLedgerManagerProvider expects an IndySdkProfile [indy] " " or AskarProfile [indy_vdr] as root_profile" ) - manager_class = self.MANAGER_TYPES.get(manager_type) - - if manager_class not in self._inst: + if manager_type not in self._inst: + manager_class = self.MANAGER_TYPES.get(manager_type) + pool_class = self.LEDGER_TYPES[manager_type]["pool"] + ledger_class = self.LEDGER_TYPES[manager_type]["ledger"] LOGGER.info("Create multiple Indy ledger manager: %s", manager_type) try: if manager_type == "basic": @@ -74,7 +84,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): pool_name = config.get("pool_name") ledger_is_production = config.get("is_production") ledger_is_write = config.get("is_write") - ledger_pool = IndySdkLedgerPool( + ledger_pool = pool_class( pool_name, keepalive=keepalive, cache=cache, @@ -82,7 +92,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): read_only=read_only, socks_proxy=socks_proxy, ) - ledger_instance = IndySdkLedger( + ledger_instance = ledger_class( pool=ledger_pool, profile=self.root_profile, ) @@ -101,7 +111,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): indy_sdk_production_ledgers.move_to_end( ledger_id, last=False ) - self._inst[manager_class] = ClassLoader.load_class(manager_class)( + self._inst[manager_type] = manager_class( self.root_profile, production_ledgers=indy_sdk_production_ledgers, non_production_ledgers=indy_sdk_non_production_ledgers, @@ -122,7 +132,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): pool_name = config.get("pool_name") ledger_is_production = config.get("is_production") ledger_is_write = config.get("is_write") - ledger_pool = IndyVdrLedgerPool( + ledger_pool = pool_class( pool_name, keepalive=keepalive, cache=cache, @@ -130,7 +140,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): read_only=read_only, socks_proxy=socks_proxy, ) - ledger_instance = IndyVdrLedger( + ledger_instance = ledger_class( pool=ledger_pool, profile=self.root_profile, ) @@ -149,7 +159,7 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): indy_vdr_non_production_ledgers.move_to_end( ledger_id, last=False ) - self._inst[manager_class] = ClassLoader.load_class(manager_class)( + self._inst[manager_type] = manager_class( self.root_profile, production_ledgers=indy_vdr_production_ledgers, non_production_ledgers=indy_vdr_non_production_ledgers, @@ -160,4 +170,4 @@ def provide(self, settings: BaseSettings, injector: BaseInjector): f"Unknown multiple Indy ledger manager type: {manager_type}" ) from err - return self._inst[manager_class] + return self._inst[manager_type] diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py index f2e8a60f61..52e6d52f41 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_ledger_requests.py @@ -54,7 +54,10 @@ async def test_get_ledger_for_identifier(self): assert ledger_inst.pool.name == "test_prod_1" async def test_get_ledger_for_identifier_is_digit(self): - ledger = await self.indy_ledger_requestor.get_ledger_for_identifier("123", 0) + ledger_id, ledger = await self.indy_ledger_requestor.get_ledger_for_identifier( + "123", 0 + ) + assert ledger_id is None assert ledger == self.ledger async def test_get_ledger_for_identifier_x(self): @@ -70,17 +73,19 @@ async def test_get_ledger_for_identifier_x(self): ), ) self.indy_ledger_requestor = IndyLedgerRequestsExecutor(self.profile) - ledger = await self.indy_ledger_requestor.get_ledger_for_identifier( + ledger_id, ledger = await self.indy_ledger_requestor.get_ledger_for_identifier( "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", 0 ) + assert ledger_id is None assert ledger == self.ledger async def test_get_ledger_for_identifier_mult_ledger_not_set(self): self.profile.settings["ledger.ledger_config_list"] = None self.indy_ledger_requestor = IndyLedgerRequestsExecutor(self.profile) - ledger = await self.indy_ledger_requestor.get_ledger_for_identifier( + ledger_id, ledger = await self.indy_ledger_requestor.get_ledger_for_identifier( "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0", 0 ) + assert ledger_id is None assert ledger == self.ledger async def test_get_ledger_for_identifier_mult_ledger_not_cached(self): diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_manager.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_manager.py index b59408c028..8b7d4740dc 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_manager.py @@ -1,5 +1,6 @@ import asyncio from copy import deepcopy +import pytest import json from asynctest import TestCase as AsyncTestCase @@ -21,6 +22,7 @@ from ..indy_manager import MultiIndyLedgerManager +@pytest.mark.indy class TestMultiIndyLedgerManager(AsyncTestCase): async def setUp(self): self.profile = InMemoryProfile.test_profile(bind={BaseCache: InMemoryCache()}) diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py index 19f440ca38..78942ff83e 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_indy_vdr_manager.py @@ -1,5 +1,6 @@ import asyncio import json +import pytest from asynctest import TestCase as AsyncTestCase from asynctest import mock as async_mock @@ -21,6 +22,7 @@ from ..indy_vdr_manager import MultiIndyVDRLedgerManager +@pytest.mark.indy_vdr class TestMultiIndyVDRLedgerManager(AsyncTestCase): async def setUp(self): self.profile = InMemoryProfile.test_profile(bind={BaseCache: InMemoryCache()}) diff --git a/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py b/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py index c050bd15d0..bf876a7a51 100644 --- a/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py +++ b/aries_cloudagent/ledger/multiple_ledger/tests/test_manager_provider.py @@ -1,10 +1,11 @@ -from asynctest import TestCase as AsyncTestCase, mock as async_mock +import pytest -from aries_cloudagent.indy.sdk.profile import IndySdkProfile +from asynctest import TestCase as AsyncTestCase, mock as async_mock from ....askar.profile import AskarProfileManager from ....config.injection_context import InjectionContext from ....core.in_memory import InMemoryProfile +from ....indy.sdk.profile import IndySdkProfile from ....indy.sdk.wallet_setup import IndyOpenWallet, IndyWalletConfig from ....ledger.base import BaseLedger from ....ledger.indy import IndySdkLedgerPool, IndySdkLedger @@ -62,6 +63,7 @@ async def test_provide_invalid_manager(self): with self.assertRaises(MultipleLedgerManagerError): provider.provide(context.settings, context.injector) + @pytest.mark.indy async def test_provide_indy_manager(self): context = InjectionContext() profile = IndySdkProfile( @@ -84,6 +86,7 @@ async def test_provide_indy_manager(self): "MultiIndyLedgerManager", ) + @pytest.mark.askar async def test_provide_askar_manager(self): context = InjectionContext() profile = await AskarProfileManager().provision( diff --git a/aries_cloudagent/ledger/routes.py b/aries_cloudagent/ledger/routes.py index ad51fb3d0e..dda91013fd 100644 --- a/aries_cloudagent/ledger/routes.py +++ b/aries_cloudagent/ledger/routes.py @@ -242,18 +242,12 @@ async def get_nym_role(request: web.BaseRequest): if not did: raise web.HTTPBadRequest(reason="Request query must include DID") - ledger_id = None async with context.profile.session() as session: ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( did, txn_record_type=GET_NYM_ROLE, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No Indy ledger available" if not session.settings.get_value("wallet.type"): @@ -269,6 +263,7 @@ async def get_nym_role(request: web.BaseRequest): raise web.HTTPNotFound(reason=err.roll_up) except LedgerError as err: raise web.HTTPBadRequest(reason=err.roll_up) + if ledger_id: return web.json_response({"ledger_id": ledger_id, "role": role.name}) else: @@ -320,18 +315,12 @@ async def get_did_verkey(request: web.BaseRequest): if not did: raise web.HTTPBadRequest(reason="Request query must include DID") - ledger_id = None async with context.profile.session() as session: ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( did, txn_record_type=GET_KEY_FOR_DID, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No ledger available" if not session.settings.get_value("wallet.type"): @@ -345,6 +334,7 @@ async def get_did_verkey(request: web.BaseRequest): raise web.HTTPNotFound(reason=f"DID {did} is not on the ledger") except LedgerError as err: raise web.HTTPBadRequest(reason=err.roll_up) from err + if ledger_id: return web.json_response({"ledger_id": ledger_id, "verkey": result}) else: @@ -370,18 +360,12 @@ async def get_did_endpoint(request: web.BaseRequest): if not did: raise web.HTTPBadRequest(reason="Request query must include DID") - ledger_id = None async with context.profile.session() as session: ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( did, txn_record_type=GET_ENDPOINT_FOR_DID, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No Indy ledger available" if not session.settings.get_value("wallet.type"): @@ -396,6 +380,7 @@ async def get_did_endpoint(request: web.BaseRequest): r = await ledger.get_endpoint_for_did(did, endpoint_type) except LedgerError as err: raise web.HTTPBadRequest(reason=err.roll_up) from err + if ledger_id: return web.json_response({"ledger_id": ledger_id, "endpoint": r}) else: diff --git a/aries_cloudagent/ledger/tests/test_routes.py b/aries_cloudagent/ledger/tests/test_routes.py index ea085cfff4..8b2ed92a1a 100644 --- a/aries_cloudagent/ledger/tests/test_routes.py +++ b/aries_cloudagent/ledger/tests/test_routes.py @@ -45,7 +45,9 @@ async def test_missing_ledger(self): self.profile.context.injector.bind_instance( IndyLedgerRequestsExecutor, async_mock.MagicMock( - get_ledger_for_identifier=async_mock.CoroutineMock(return_value=None) + get_ledger_for_identifier=async_mock.CoroutineMock( + return_value=(None, None) + ) ), ) self.profile.context.injector.clear_binding(BaseLedger) @@ -79,7 +81,7 @@ async def test_get_verkey_a(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) @@ -141,7 +143,7 @@ async def test_get_verkey_x(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) @@ -155,7 +157,7 @@ async def test_get_endpoint(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) @@ -269,7 +271,7 @@ async def test_get_nym_role_a(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) @@ -346,7 +348,7 @@ async def test_get_nym_role_ledger_error(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/messaging/credential_definitions/routes.py b/aries_cloudagent/messaging/credential_definitions/routes.py index 61f0624e6b..d547027d6d 100644 --- a/aries_cloudagent/messaging/credential_definitions/routes.py +++ b/aries_cloudagent/messaging/credential_definitions/routes.py @@ -357,18 +357,12 @@ async def credential_definitions_get_credential_definition(request: web.BaseRequ context: AdminRequestContext = request["context"] cred_def_id = request.match_info["cred_def_id"] - ledger_id = None async with context.profile.session() as session: ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( cred_def_id, txn_record_type=GET_CRED_DEF, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No ledger available" if not context.settings.get_value("wallet.type"): @@ -407,19 +401,13 @@ async def credential_definitions_fix_cred_def_wallet_record(request: web.BaseReq cred_def_id = request.match_info["cred_def_id"] - ledger_id = None async with context.profile.session() as session: storage = session.inject(BaseStorage) ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( cred_def_id, txn_record_type=GET_CRED_DEF, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No ledger available" if not context.settings.get_value("wallet.type"): @@ -445,6 +433,7 @@ async def credential_definitions_fix_cred_def_wallet_record(request: web.BaseReq await add_cred_def_non_secrets_record( session.profile, schema_id, iss_did, cred_def_id ) + if ledger_id: return web.json_response( {"ledger_id": ledger_id, "credential_definition": cred_def} diff --git a/aries_cloudagent/messaging/credential_definitions/tests/test_routes.py b/aries_cloudagent/messaging/credential_definitions/tests/test_routes.py index dd0ae0c716..a1e72ddf6e 100644 --- a/aries_cloudagent/messaging/credential_definitions/tests/test_routes.py +++ b/aries_cloudagent/messaging/credential_definitions/tests/test_routes.py @@ -350,7 +350,9 @@ async def test_get_credential_definition_no_ledger(self): self.profile_injector.bind_instance( IndyLedgerRequestsExecutor, async_mock.MagicMock( - get_ledger_for_identifier=async_mock.CoroutineMock(return_value=None) + get_ledger_for_identifier=async_mock.CoroutineMock( + return_value=(None, None) + ) ), ) self.request.match_info = {"cred_def_id": CRED_DEF_ID} diff --git a/aries_cloudagent/messaging/schemas/routes.py b/aries_cloudagent/messaging/schemas/routes.py index 5f73364ccd..5c7c6eb7fb 100644 --- a/aries_cloudagent/messaging/schemas/routes.py +++ b/aries_cloudagent/messaging/schemas/routes.py @@ -337,18 +337,12 @@ async def schemas_get_schema(request: web.BaseRequest): context: AdminRequestContext = request["context"] schema_id = request.match_info["schema_id"] - ledger_id = None async with context.profile.session() as session: ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( schema_id, txn_record_type=GET_SCHEMA, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No ledger available" if not context.settings.get_value("wallet.type"): @@ -360,6 +354,7 @@ async def schemas_get_schema(request: web.BaseRequest): schema = await ledger.get_schema(schema_id) except LedgerError as err: raise web.HTTPBadRequest(reason=err.roll_up) from err + if ledger_id: return web.json_response({"ledger_id": ledger_id, "schema": schema}) else: @@ -386,19 +381,13 @@ async def schemas_fix_schema_wallet_record(request: web.BaseRequest): schema_id = request.match_info["schema_id"] - ledger_id = None async with profile.session() as session: storage = session.inject(BaseStorage) ledger_exec_inst = session.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( + ledger_id, ledger = await ledger_exec_inst.get_ledger_for_identifier( schema_id, txn_record_type=GET_SCHEMA, ) - if isinstance(ledger_info, tuple): - ledger_id = ledger_info[0] - ledger = ledger_info[1] - else: - ledger = ledger_info if not ledger: reason = "No ledger available" if not context.settings.get_value("wallet.type"): @@ -420,6 +409,7 @@ async def schemas_fix_schema_wallet_record(request: web.BaseRequest): await add_schema_non_secrets_record(profile, schema_id) except LedgerError as err: raise web.HTTPBadRequest(reason=err.roll_up) from err + if ledger_id: return web.json_response({"ledger_id": ledger_id, "schema": schema}) else: diff --git a/aries_cloudagent/messaging/schemas/tests/test_routes.py b/aries_cloudagent/messaging/schemas/tests/test_routes.py index ca45372902..ff445535ff 100644 --- a/aries_cloudagent/messaging/schemas/tests/test_routes.py +++ b/aries_cloudagent/messaging/schemas/tests/test_routes.py @@ -311,7 +311,7 @@ async def test_get_schema_on_seq_no(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) @@ -327,7 +327,9 @@ async def test_get_schema_no_ledger(self): self.profile_injector.bind_instance( IndyLedgerRequestsExecutor, async_mock.MagicMock( - get_ledger_for_identifier=async_mock.CoroutineMock(return_value=None) + get_ledger_for_identifier=async_mock.CoroutineMock( + return_value=(None, None) + ) ), ) self.request.match_info = {"schema_id": SCHEMA_ID} @@ -344,7 +346,7 @@ async def test_get_schema_x_ledger(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/protocols/connections/v1_0/manager.py b/aries_cloudagent/protocols/connections/v1_0/manager.py index 5841945bb6..96e72b8b37 100644 --- a/aries_cloudagent/protocols/connections/v1_0/manager.py +++ b/aries_cloudagent/protocols/connections/v1_0/manager.py @@ -603,14 +603,12 @@ async def receive_request( if multitenant_mgr and wallet_id: await multitenant_mgr.add_key(wallet_id, my_info.verkey) async with self.profile.session() as session: - conn_records = await ConnRecord.retrieve_by_invitation_msg_id( + connection = await ConnRecord.retrieve_by_invitation_msg_id( session=session, invitation_msg_id=request._thread.pthid, their_role=ConnRecord.Role.REQUESTER.rfc160, ) - if len(conn_records) == 1: - connection = conn_records[0] - else: + if not connection: connection = ConnRecord() connection.invitation_key = connection_key connection.my_did = my_info.did diff --git a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py index e3b88a1dd5..c986cb88cf 100644 --- a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py @@ -709,7 +709,7 @@ async def test_receive_request_public_did_oob_invite(self): ), async_mock.patch.object( ConnRecord, "retrieve_by_invitation_msg_id", async_mock.CoroutineMock() ) as mock_conn_retrieve_by_invitation_msg_id: - mock_conn_retrieve_by_invitation_msg_id.return_value = [ConnRecord()] + mock_conn_retrieve_by_invitation_msg_id.return_value = ConnRecord() conn_rec = await self.manager.receive_request(mock_request, receipt) assert conn_rec @@ -745,7 +745,7 @@ async def test_receive_request_public_did_conn_invite(self): ), async_mock.patch.object( ConnRecord, "retrieve_by_invitation_msg_id", async_mock.CoroutineMock() ) as mock_conn_retrieve_by_invitation_msg_id: - mock_conn_retrieve_by_invitation_msg_id.return_value = [] + mock_conn_retrieve_by_invitation_msg_id.return_value = None conn_rec = await self.manager.receive_request(mock_request, receipt) assert conn_rec @@ -836,7 +836,7 @@ async def test_receive_request_public_multitenant(self): ) as mock_wallet_get_local_did, async_mock.patch.object( ConnRecord, "retrieve_by_invitation_msg_id", async_mock.CoroutineMock() ) as mock_conn_retrieve_by_invitation_msg_id: - mock_conn_retrieve_by_invitation_msg_id.return_value = [ConnRecord()] + mock_conn_retrieve_by_invitation_msg_id.return_value = ConnRecord() mock_wallet_create_local_did.return_value = DIDInfo( new_info.did, new_info.verkey, @@ -979,7 +979,7 @@ async def test_receive_request_public_did_no_auto_accept(self): ), async_mock.patch.object( ConnRecord, "retrieve_by_invitation_msg_id", async_mock.CoroutineMock() ) as mock_conn_retrieve_by_invitation_msg_id: - mock_conn_retrieve_by_invitation_msg_id.return_value = [ConnRecord()] + mock_conn_retrieve_by_invitation_msg_id.return_value = ConnRecord() conn_rec = await self.manager.receive_request(mock_request, receipt) assert conn_rec diff --git a/aries_cloudagent/protocols/didexchange/v1_0/manager.py b/aries_cloudagent/protocols/didexchange/v1_0/manager.py index cd4f0d2079..282bbb8335 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/manager.py @@ -166,6 +166,7 @@ async def create_request_implicit( my_endpoint: str = None, mediation_id: str = None, use_public_did: bool = False, + alias: str = None, ) -> ConnRecord: """ Create and send a request against a public DID only (no explicit invitation). @@ -199,7 +200,7 @@ async def create_request_implicit( invitation_key=None, invitation_msg_id=None, accept=None, - alias=my_label, + alias=alias, their_public_did=their_public_did, connection_protocol=DIDX_PROTO, ) @@ -406,13 +407,11 @@ async def receive_request( connection_key = my_info.verkey async with self.profile.session() as session: - conn_records = await ConnRecord.retrieve_by_invitation_msg_id( + conn_rec = await ConnRecord.retrieve_by_invitation_msg_id( session=session, invitation_msg_id=request._thread.pthid, their_role=ConnRecord.Role.REQUESTER.rfc23, ) - if len(conn_records) == 1: - conn_rec = conn_records[0] if conn_rec: # invitation was explicit connection_key = conn_rec.invitation_key diff --git a/aries_cloudagent/protocols/didexchange/v1_0/routes.py b/aries_cloudagent/protocols/didexchange/v1_0/routes.py index 8e73832db9..83de695dc5 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/routes.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/routes.py @@ -44,6 +44,11 @@ class DIDXCreateRequestImplicitQueryStringSchema(OpenAPISchema): description="Qualified public DID to which to request connection", **GENERIC_DID, ) + alias = fields.Str( + description="Alias for connection", + required=False, + example="Barry", + ) my_endpoint = fields.Str(description="My URL endpoint", required=False, **ENDPOINT) my_label = fields.Str( description="Label for connection request", required=False, example="Broker" @@ -183,6 +188,7 @@ async def didx_create_request_implicit(request: web.BaseRequest): my_label = request.query.get("my_label") or None my_endpoint = request.query.get("my_endpoint") or None mediation_id = request.query.get("mediation_id") or None + alias = request.query.get("alias") or None use_public_did = json.loads(request.query.get("use_public_did", "null")) profile = context.profile @@ -194,6 +200,7 @@ async def didx_create_request_implicit(request: web.BaseRequest): my_endpoint=my_endpoint, mediation_id=mediation_id, use_public_did=use_public_did, + alias=alias, ) except StorageNotFoundError as err: raise web.HTTPNotFound(reason=err.roll_up) from err diff --git a/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py index 13c7f169f4..aee31fa30b 100644 --- a/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/didexchange/v1_0/tests/test_manager.py @@ -235,6 +235,7 @@ async def test_create_request_implicit(self): my_label=None, my_endpoint=None, mediation_id=mediation_record._id, + alias="Tester", ) assert conn_rec @@ -260,6 +261,7 @@ async def test_create_request_implicit_use_public_did(self): my_endpoint=None, mediation_id=mediation_record._id, use_public_did=True, + alias="Tester", ) assert info_public.did == conn_rec.my_did @@ -272,6 +274,7 @@ async def test_create_request_implicit_no_public_did(self): my_endpoint=None, mediation_id=None, use_public_did=True, + alias="Tester", ) assert "No public DID configured" in str(context.exception) @@ -508,7 +511,7 @@ async def test_receive_request_explicit_public_did(self): return_value=async_mock.MagicMock(save=async_mock.CoroutineMock()) ) mock_conn_rec_cls.retrieve_by_invitation_msg_id = ( - async_mock.CoroutineMock(return_value=[mock_conn_record]) + async_mock.CoroutineMock(return_value=mock_conn_record) ) mock_conn_rec_cls.return_value = mock_conn_record @@ -779,7 +782,7 @@ async def test_receive_request_public_did_no_did_doc_attachment(self): ) mock_conn_rec_cls.return_value = mock_conn_record mock_conn_rec_cls.retrieve_by_invitation_msg_id = ( - async_mock.CoroutineMock(return_value=[mock_conn_record]) + async_mock.CoroutineMock(return_value=mock_conn_record) ) mock_did_posture.get = async_mock.MagicMock( @@ -886,7 +889,7 @@ async def test_receive_request_public_did_x_wrong_did(self): ) mock_conn_rec_cls.return_value = mock_conn_record mock_conn_rec_cls.retrieve_by_invitation_msg_id = ( - async_mock.CoroutineMock(return_value=[mock_conn_record]) + async_mock.CoroutineMock(return_value=mock_conn_record) ) mock_did_doc_from_json.return_value = async_mock.MagicMock( did="wrong-did" @@ -946,7 +949,7 @@ async def test_receive_request_public_did_x_did_doc_attach_bad_sig(self): ) mock_conn_rec_cls.return_value = mock_conn_record mock_conn_rec_cls.retrieve_by_invitation_msg_id = ( - async_mock.CoroutineMock(return_value=[mock_conn_record]) + async_mock.CoroutineMock(return_value=mock_conn_record) ) mock_did_posture.get = async_mock.MagicMock( @@ -1064,7 +1067,7 @@ async def test_receive_request_public_did_no_auto_accept(self): ) mock_conn_rec_cls.return_value = mock_conn_record mock_conn_rec_cls.retrieve_by_invitation_msg_id = ( - async_mock.CoroutineMock(return_value=[mock_conn_record]) + async_mock.CoroutineMock(return_value=mock_conn_record) ) mock_did_posture.get = async_mock.MagicMock( diff --git a/aries_cloudagent/protocols/discovery/v1_0/manager.py b/aries_cloudagent/protocols/discovery/v1_0/manager.py index b6d0094b7e..304d8ebb0c 100644 --- a/aries_cloudagent/protocols/discovery/v1_0/manager.py +++ b/aries_cloudagent/protocols/discovery/v1_0/manager.py @@ -133,7 +133,7 @@ async def check_if_disclosure_received( ) if ex_rec.disclose: return ex_rec - asyncio.sleep(0.5) + await asyncio.sleep(0.5) async def create_and_send_query( self, query: str, comment: str = None, connection_id: str = None diff --git a/aries_cloudagent/protocols/discovery/v2_0/manager.py b/aries_cloudagent/protocols/discovery/v2_0/manager.py index d229d188f4..f116fe8ba9 100644 --- a/aries_cloudagent/protocols/discovery/v2_0/manager.py +++ b/aries_cloudagent/protocols/discovery/v2_0/manager.py @@ -192,7 +192,7 @@ async def check_if_disclosure_received( ) if ex_rec.disclosures: return ex_rec - asyncio.sleep(0.5) + await asyncio.sleep(0.5) async def create_and_send_query( self, diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py index 1f5a736f5c..27c391222f 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py @@ -267,14 +267,12 @@ async def _create(cred_def_id): # vet attributes ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: schema_id = await ledger.credential_definition_id2schema_id(cred_def_id) schema = await ledger.get_schema(schema_id) @@ -407,14 +405,12 @@ async def create_request( async def _create(): ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - credential_definition_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + credential_definition_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: credential_definition = await ledger.get_credential_definition( credential_definition_id @@ -555,14 +551,12 @@ async def issue_credential( cred_offer_ser = cred_ex_record._credential_offer.ser cred_req_ser = cred_ex_record._credential_request.ser ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - schema_id, - txn_record_type=GET_SCHEMA, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + schema_id, + txn_record_type=GET_SCHEMA, + ) + )[1] async with ledger: schema = await ledger.get_schema(schema_id) credential_definition = await ledger.get_credential_definition( @@ -769,14 +763,12 @@ async def store_credential( raw_cred_serde = cred_ex_record._raw_credential revoc_reg_def = None ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - raw_cred_serde.de.cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + raw_cred_serde.de.cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: credential_definition = await ledger.get_credential_definition( raw_cred_serde.de.cred_def_id diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py index 4e8f52b4b7..5084eebcca 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/tests/test_manager.py @@ -74,7 +74,7 @@ async def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/handler.py index 9604b9e278..2257a91cd7 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/handler.py @@ -202,14 +202,12 @@ async def _create(): return json.loads(offer_json) ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: schema_id = await ledger.credential_definition_id2schema_id(cred_def_id) schema = await ledger.get_schema(schema_id) @@ -265,14 +263,12 @@ async def create_request( async def _create(): ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: cred_def = await ledger.get_credential_definition(cred_def_id) @@ -335,14 +331,12 @@ async def issue_credential( rev_reg_id = None rev_reg = None ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - schema_id, - txn_record_type=GET_SCHEMA, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + schema_id, + txn_record_type=GET_SCHEMA, + ) + )[1] async with ledger: schema = await ledger.get_schema(schema_id) cred_def = await ledger.get_credential_definition(cred_def_id) @@ -481,14 +475,12 @@ async def store_credential( rev_reg_def = None ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred["cred_def_id"], - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred["cred_def_id"], + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: cred_def = await ledger.get_credential_definition(cred["cred_def_id"]) if cred.get("rev_reg_id"): diff --git a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py index 55dfc0e378..9bffbad2a9 100644 --- a/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py +++ b/aries_cloudagent/protocols/issue_credential/v2_0/formats/indy/tests/test_handler.py @@ -221,7 +221,7 @@ async def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py index 4a0124238b..1c61cdedd0 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py @@ -4,7 +4,7 @@ import json import logging -from typing import Mapping, Sequence, Optional +from typing import Mapping, Sequence from ....connections.base_manager import BaseConnectionManager from ....connections.models.conn_record import ConnRecord @@ -460,13 +460,10 @@ async def receive_invitation( # Reuse Connection - only if started by an invitation with Public DID conn_rec = None if public_did is not None: # invite has public DID: seek existing connection - tag_filter = {} - post_filter = {} - # post_filter["state"] = ConnRecord.State.COMPLETED.rfc160 - post_filter["their_public_did"] = public_did - conn_rec = await self.find_existing_connection( - tag_filter=tag_filter, post_filter=post_filter - ) + async with self._profile.session() as session: + conn_rec = await ConnRecord.find_existing_connection( + session=session, their_public_did=public_did + ) if conn_rec is not None: num_included_protocols = len(unq_handshake_protos) num_included_req_attachments = len(invitation.requests_attach) @@ -893,38 +890,6 @@ async def _process_cred_offer_v2( ) ) - async def find_existing_connection( - self, - tag_filter: dict, - post_filter: dict, - ) -> Optional[ConnRecord]: - """ - Find existing ConnRecord. - - Args: - tag_filter: The filter dictionary to apply - post_filter: Additional value filters to apply matching positively, - with sequence values specifying alternatives to match (hit any) - - Returns: - ConnRecord or None - - """ - async with self.profile.session() as session: - conn_records = await ConnRecord.query( - session, - tag_filter=tag_filter, - post_filter_positive=post_filter, - alt=True, - ) - if not conn_records: - return None - else: - for conn_rec in conn_records: - if conn_rec.state == "active": - return conn_rec - return None - async def check_reuse_msg_state( self, conn_rec: ConnRecord, @@ -963,7 +928,7 @@ async def conn_rec_is_active(self, conn_rec_id: str) -> ConnRecord: conn_rec = await ConnRecord.retrieve_by_id(session, conn_rec_id) if conn_rec.is_ready: return conn_rec - asyncio.sleep(0.5) + await asyncio.sleep(0.5) async def create_handshake_reuse_message( self, @@ -1012,13 +977,15 @@ async def create_handshake_reuse_message( async def delete_stale_connection_by_invitation(self, invi_msg_id: str): """Delete unused connections, using existing an active connection instead.""" + tag_filter = {} post_filter = {} - post_filter["invitation_msg_id"] = invi_msg_id + tag_filter["invitation_msg_id"] = invi_msg_id post_filter["invitation_mode"] = "once" post_filter["state"] = "invitation" async with self.profile.session() as session: conn_records = await ConnRecord.query( session, + tag_filter=tag_filter, post_filter_positive=post_filter, ) for conn_rec in conn_records: diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py index b3582730db..da41ef156e 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/tests/test_manager.py @@ -750,9 +750,9 @@ async def test_dif_req_v2_attach_pres_existing_conn_auto_present_pres_msg_with_c "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -917,9 +917,9 @@ async def test_dif_req_v2_attach_pres_existing_conn_auto_present_pres_msg_with_n "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -1431,35 +1431,17 @@ async def test_find_existing_connection(self): their_public_did=self.their_public_did, ) await test_conn_rec.save(session) - - tag_filter = {} - post_filter = {} - post_filter["their_public_did"] = "not_addded" - conn_record = await self.manager.find_existing_connection( - tag_filter, post_filter + conn_record = await ConnRecord.find_existing_connection( + session=session, their_public_did="not_addded" ) assert conn_record == None - post_filter["their_public_did"] = self.their_public_did - conn_record = await self.manager.find_existing_connection( - tag_filter, post_filter + conn_record = await ConnRecord.find_existing_connection( + session=session, their_public_did=self.their_public_did ) assert conn_record == test_conn_rec await test_conn_rec.delete_record(session) - async def test_find_existing_connection_no_active(self): - async with self.profile.session() as session: - self.test_conn_rec.invitation_msg_id = "test_123" - self.test_conn_rec.state = ConnRecord.State.REQUEST.rfc160 - await self.test_conn_rec.save(session) - tag_filter = {} - post_filter = {} - post_filter["invitation_msg_id"] = "test_123" - conn_record = await self.manager.find_existing_connection( - tag_filter, post_filter - ) - assert conn_record is None - async def test_check_reuse_msg_state(self): async with self.profile.session() as session: await self.test_conn_rec.save(session) @@ -1548,9 +1530,9 @@ async def test_receive_reuse_message_existing_found(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( InvitationRecord, "retrieve_by_tag_filter", @@ -1574,8 +1556,8 @@ async def test_receive_reuse_message_existing_found(self): len( await ConnRecord.query( session=session, - tag_filter={}, - post_filter_positive={"invitation_msg_id": "test_123"}, + tag_filter={"invitation_msg_id": "test_123"}, + post_filter_positive={}, alt=True, ) ) @@ -1609,9 +1591,9 @@ async def test_receive_reuse_message_existing_not_found(self): "retrieve_by_tag_filter", autospec=True, ) as retrieve_invi_rec, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn: oob_mgr_find_existing_conn.return_value = None oob_mgr_fetch_conn.return_value = ConnectionTarget( @@ -1930,9 +1912,9 @@ async def test_existing_conn_record_public_did(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -1977,10 +1959,10 @@ async def test_existing_conn_record_public_did(self): ) retrieved_conn_records = await ConnRecord.query( session=session, - tag_filter={}, - post_filter_positive={ + tag_filter={ "invitation_msg_id": "12345678-0123-4567-1234-567812345678" }, + post_filter_positive={}, alt=True, ) assert ( @@ -2035,9 +2017,9 @@ async def test_existing_conn_record_public_did_not_accepted(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2083,10 +2065,10 @@ async def test_existing_conn_record_public_did_not_accepted(self): ) retrieved_conn_records = await ConnRecord.query( session=session, - tag_filter={}, - post_filter_positive={ + tag_filter={ "invitation_msg_id": "12345678-0123-4567-1234-567812345678" }, + post_filter_positive={}, alt=True, ) assert ( @@ -2122,9 +2104,9 @@ async def test_existing_conn_record_public_did_inverse_cases(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2146,10 +2128,10 @@ async def test_existing_conn_record_public_did_inverse_cases(self): ) retrieved_conn_records = await ConnRecord.query( session=session, - tag_filter={}, - post_filter_positive={ + tag_filter={ "invitation_msg_id": "12345678-0123-4567-1234-567812345678" }, + post_filter_positive={}, alt=True, ) assert result.connection_id != retrieved_conn_records[0].connection_id @@ -2183,9 +2165,9 @@ async def test_existing_conn_record_public_did_timeout(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2207,11 +2189,7 @@ async def test_existing_conn_record_public_did_timeout(self): ) retrieved_conn_records = await ConnRecord.query( session=session, - tag_filter={}, - post_filter_positive={ - "their_public_did": TestConfig.test_target_did - }, - alt=True, + tag_filter={"their_public_did": TestConfig.test_target_did}, ) assert ( retrieved_conn_records[0].state == ConnRecord.State.ABANDONED.rfc160 @@ -2246,9 +2224,9 @@ async def test_existing_conn_record_public_did_timeout_no_handshake_protocol(sel "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn: oob_mgr_find_existing_conn.return_value = test_exist_conn mock_oob_invi = async_mock.MagicMock( @@ -2298,9 +2276,9 @@ async def test_req_v1_attach_presentation_existing_conn_no_auto_present(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2385,9 +2363,9 @@ async def test_req_v1_attach_presentation_existing_conn_auto_present_pres_msg(se "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2503,9 +2481,9 @@ async def test_req_v1_attach_pres_catch_value_error(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2597,9 +2575,9 @@ async def test_req_v2_attach_presentation_existing_conn_no_auto_present(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2688,9 +2666,9 @@ async def test_req_v2_attach_presentation_existing_conn_auto_present_pres_msg(se "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2818,9 +2796,9 @@ async def test_req_v2_attach_pres_catch_value_error(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -2939,9 +2917,9 @@ async def test_req_attach_cred_offer_v1(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3033,9 +3011,9 @@ async def test_req_attach_cred_offer_v1_no_issue(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3123,9 +3101,9 @@ async def test_req_attach_cred_offer_v2(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3218,9 +3196,9 @@ async def test_req_attach_cred_offer_v2_no_issue(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3301,9 +3279,9 @@ async def test_catch_unsupported_request_attach(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3405,9 +3383,9 @@ async def test_request_attach_cred_offer_v1_check_conn_rec_active_timeout(self): "fetch_connection_targets", autospec=True, ), async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", @@ -3500,9 +3478,9 @@ async def test_request_attach_cred_offer_v2_check_conn_rec_active_timeout(self): "fetch_connection_targets", autospec=True, ) as oob_mgr_fetch_conn, async_mock.patch.object( - OutOfBandManager, + ConnRecord, "find_existing_connection", - autospec=True, + async_mock.CoroutineMock(), ) as oob_mgr_find_existing_conn, async_mock.patch.object( OutOfBandManager, "check_reuse_msg_state", diff --git a/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py b/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py index c2cce65d4b..56cec44dfd 100644 --- a/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py +++ b/aries_cloudagent/protocols/present_proof/indy/pres_exch_handler.py @@ -94,14 +94,12 @@ async def return_presentation( for credential in credentials.values(): schema_id = credential["schema_id"] ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - schema_id, - txn_record_type=GET_SCHEMA, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + schema_id, + txn_record_type=GET_SCHEMA, + ) + )[1] async with ledger: if schema_id not in schemas: schemas[schema_id] = await ledger.get_schema(schema_id) @@ -130,14 +128,12 @@ async def return_presentation( continue rev_reg_id = credentials[credential_id]["rev_reg_id"] ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - rev_reg_id, - txn_record_type=GET_REVOC_REG_DELTA, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + rev_reg_id, + txn_record_type=GET_REVOC_REG_DELTA, + ) + )[1] async with ledger: reft_non_revoc_interval = precis.get("non_revoked") if reft_non_revoc_interval: @@ -227,14 +223,12 @@ async def process_pres_identifiers( schema_ids.append(identifier["schema_id"]) cred_def_ids.append(identifier["cred_def_id"]) ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - identifier["schema_id"], - txn_record_type=GET_SCHEMA, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + identifier["schema_id"], + txn_record_type=GET_SCHEMA, + ) + )[1] async with ledger: # Build schemas for anoncreds if identifier["schema_id"] not in schemas: diff --git a/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py index 8fb587e37a..4e0d9d3580 100644 --- a/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/present_proof/v1_0/tests/test_manager.py @@ -267,7 +267,7 @@ async def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py index 150f1c7717..bf293f3cb6 100644 --- a/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/present_proof/v2_0/tests/test_manager.py @@ -427,7 +427,7 @@ async def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/resolver/default/indy.py b/aries_cloudagent/resolver/default/indy.py index 566e5ce22c..a7364306d9 100644 --- a/aries_cloudagent/resolver/default/indy.py +++ b/aries_cloudagent/resolver/default/indy.py @@ -45,14 +45,12 @@ def supported_did_regex(self) -> Pattern: async def _resolve(self, profile: Profile, did: str) -> dict: """Resolve an indy DID.""" ledger_exec_inst = profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - did, - txn_record_type=GET_KEY_FOR_DID, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + did, + txn_record_type=GET_KEY_FOR_DID, + ) + )[1] if not ledger: raise NoIndyLedger("No Indy ledger instance is configured.") diff --git a/aries_cloudagent/resolver/default/tests/test_indy.py b/aries_cloudagent/resolver/default/tests/test_indy.py index 21c8744644..f9d4ad944a 100644 --- a/aries_cloudagent/resolver/default/tests/test_indy.py +++ b/aries_cloudagent/resolver/default/tests/test_indy.py @@ -45,7 +45,9 @@ def profile(ledger): profile.context.injector.bind_instance( IndyLedgerRequestsExecutor, async_mock.MagicMock( - get_ledger_for_identifier=async_mock.CoroutineMock(return_value=ledger) + get_ledger_for_identifier=async_mock.CoroutineMock( + return_value=(None, ledger) + ) ), ) yield profile @@ -71,7 +73,9 @@ async def test_resolve_x_no_ledger( profile.context.injector.bind_instance( IndyLedgerRequestsExecutor, async_mock.MagicMock( - get_ledger_for_identifier=async_mock.CoroutineMock(return_value=None) + get_ledger_for_identifier=async_mock.CoroutineMock( + return_value=(None, None) + ) ), ) with pytest.raises(ResolverError): diff --git a/aries_cloudagent/revocation/indy.py b/aries_cloudagent/revocation/indy.py index 70c2877d5e..3dcab450f7 100644 --- a/aries_cloudagent/revocation/indy.py +++ b/aries_cloudagent/revocation/indy.py @@ -33,14 +33,12 @@ async def init_issuer_registry( ) -> "IssuerRevRegRecord": """Create a new revocation registry record for a credential definition.""" ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - cred_def_id, - txn_record_type=GET_CRED_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + cred_def_id, + txn_record_type=GET_CRED_DEF, + ) + )[1] async with ledger: cred_def = await ledger.get_credential_definition(cred_def_id) if not cred_def: @@ -111,14 +109,12 @@ async def get_ledger_registry(self, revoc_reg_id: str) -> "RevocationRegistry": return IndyRevocation.REV_REG_CACHE[revoc_reg_id] ledger_exec_inst = self._profile.inject(IndyLedgerRequestsExecutor) - ledger_info = await ledger_exec_inst.get_ledger_for_identifier( - revoc_reg_id, - txn_record_type=GET_REVOC_REG_DEF, - ) - if isinstance(ledger_info, tuple): - ledger = ledger_info[1] - else: - ledger = ledger_info + ledger = ( + await ledger_exec_inst.get_ledger_for_identifier( + revoc_reg_id, + txn_record_type=GET_REVOC_REG_DEF, + ) + )[1] async with ledger: rev_reg = RevocationRegistry.from_definition( await ledger.get_revoc_reg_def(revoc_reg_id), True diff --git a/aries_cloudagent/revocation/tests/test_indy.py b/aries_cloudagent/revocation/tests/test_indy.py index 2a4a0445cd..10708c6d28 100644 --- a/aries_cloudagent/revocation/tests/test_indy.py +++ b/aries_cloudagent/revocation/tests/test_indy.py @@ -35,7 +35,7 @@ def setUp(self): IndyLedgerRequestsExecutor, async_mock.MagicMock( get_ledger_for_identifier=async_mock.CoroutineMock( - return_value=self.ledger + return_value=(None, self.ledger) ) ), ) diff --git a/aries_cloudagent/version.py b/aries_cloudagent/version.py index 66773e2793..63ca7dd10c 100644 --- a/aries_cloudagent/version.py +++ b/aries_cloudagent/version.py @@ -1,3 +1,3 @@ """Library version information.""" -__version__ = "0.7.2" +__version__ = "0.7.3-rc0" diff --git a/demo/requirements.txt b/demo/requirements.txt index 722b7267ad..276088d6b5 100644 --- a/demo/requirements.txt +++ b/demo/requirements.txt @@ -1,4 +1,5 @@ -asyncpg~=0.22.0 +asyncpg~=0.25.0 prompt_toolkit~=2.0.9 git+https://github.com/webpy/webpy.git#egg=web.py +pygments~=2.10 qrcode[pil]~=6.1 diff --git a/docs/conf.py b/docs/conf.py index 9fb915245e..cbf20e1fd0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,6 +43,8 @@ "dateutil", "jsonpath_ng", "unflatten", + "qrcode", + "rlp", ] # "aries_cloudagent.tests.test_conductor", diff --git a/docs/generated/aries_cloudagent.core.rst b/docs/generated/aries_cloudagent.core.rst index b93c0a7166..b708e02226 100644 --- a/docs/generated/aries_cloudagent.core.rst +++ b/docs/generated/aries_cloudagent.core.rst @@ -49,6 +49,14 @@ aries\_cloudagent.core.event\_bus module :undoc-members: :show-inheritance: +aries\_cloudagent.core.goal\_code\_registry module +-------------------------------------------------- + +.. automodule:: aries_cloudagent.core.goal_code_registry + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.core.plugin\_registry module ---------------------------------------------- diff --git a/docs/generated/aries_cloudagent.ledger.merkel_validation.rst b/docs/generated/aries_cloudagent.ledger.merkel_validation.rst new file mode 100644 index 0000000000..2aba21f5ce --- /dev/null +++ b/docs/generated/aries_cloudagent.ledger.merkel_validation.rst @@ -0,0 +1,58 @@ +aries\_cloudagent.ledger.merkel\_validation package +=================================================== + +.. automodule:: aries_cloudagent.ledger.merkel_validation + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.ledger.merkel\_validation.constants module +------------------------------------------------------------ + +.. automodule:: aries_cloudagent.ledger.merkel_validation.constants + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.merkel\_validation.domain\_txn\_handler module +----------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.merkel_validation.domain_txn_handler + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.merkel\_validation.hasher module +--------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.merkel_validation.hasher + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.merkel\_validation.merkel\_verifier module +------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.merkel_validation.merkel_verifier + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.merkel\_validation.trie module +------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.merkel_validation.trie + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.merkel\_validation.utils module +-------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.merkel_validation.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.ledger.multiple_ledger.rst b/docs/generated/aries_cloudagent.ledger.multiple_ledger.rst new file mode 100644 index 0000000000..ed257bc7cf --- /dev/null +++ b/docs/generated/aries_cloudagent.ledger.multiple_ledger.rst @@ -0,0 +1,58 @@ +aries\_cloudagent.ledger.multiple\_ledger package +================================================= + +.. automodule:: aries_cloudagent.ledger.multiple_ledger + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.ledger.multiple\_ledger.base\_manager module +-------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.base_manager + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.multiple\_ledger.indy\_manager module +-------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.indy_manager + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.multiple\_ledger.indy\_vdr\_manager module +------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.indy_vdr_manager + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.multiple\_ledger.ledger\_config\_schema module +----------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.ledger_config_schema + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.multiple\_ledger.ledger\_requests\_executor module +--------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.ledger_requests_executor + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.ledger.multiple\_ledger.manager\_provider module +------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.ledger.multiple_ledger.manager_provider + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.ledger.rst b/docs/generated/aries_cloudagent.ledger.rst index 66a6bda1c8..aff0574fef 100644 --- a/docs/generated/aries_cloudagent.ledger.rst +++ b/docs/generated/aries_cloudagent.ledger.rst @@ -6,6 +6,15 @@ aries\_cloudagent.ledger package :undoc-members: :show-inheritance: +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aries_cloudagent.ledger.merkel_validation + aries_cloudagent.ledger.multiple_ledger + Submodules ---------- diff --git a/docs/generated/aries_cloudagent.protocols.coordinate_mediation.v1_0.rst b/docs/generated/aries_cloudagent.protocols.coordinate_mediation.v1_0.rst index 40c1bb1da7..80c49734be 100644 --- a/docs/generated/aries_cloudagent.protocols.coordinate_mediation.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.coordinate_mediation.v1_0.rst @@ -19,6 +19,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.coordinate\_mediation.v1\_0.controller module +------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.coordinate_mediation.v1_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.coordinate\_mediation.v1\_0.manager module ---------------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.discovery.rst b/docs/generated/aries_cloudagent.protocols.discovery.rst index c93818adc0..4c736183c7 100644 --- a/docs/generated/aries_cloudagent.protocols.discovery.rst +++ b/docs/generated/aries_cloudagent.protocols.discovery.rst @@ -13,6 +13,7 @@ Subpackages :maxdepth: 4 aries_cloudagent.protocols.discovery.v1_0 + aries_cloudagent.protocols.discovery.v2_0 Submodules ---------- diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v1_0.models.rst b/docs/generated/aries_cloudagent.protocols.discovery.v1_0.models.rst new file mode 100644 index 0000000000..baec81e6d7 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.discovery.v1_0.models.rst @@ -0,0 +1,18 @@ +aries\_cloudagent.protocols.discovery.v1\_0.models package +========================================================== + +.. automodule:: aries_cloudagent.protocols.discovery.v1_0.models + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.discovery.v1\_0.models.discovery\_record module +--------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v1_0.models.discovery_record + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v1_0.rst b/docs/generated/aries_cloudagent.protocols.discovery.v1_0.rst index aa83c1dae8..f221130077 100644 --- a/docs/generated/aries_cloudagent.protocols.discovery.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.discovery.v1_0.rst @@ -14,10 +14,19 @@ Subpackages aries_cloudagent.protocols.discovery.v1_0.handlers aries_cloudagent.protocols.discovery.v1_0.messages + aries_cloudagent.protocols.discovery.v1_0.models Submodules ---------- +aries\_cloudagent.protocols.discovery.v1\_0.manager module +---------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v1_0.manager + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.discovery.v1\_0.message\_types module ----------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v2_0.handlers.rst b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.handlers.rst new file mode 100644 index 0000000000..b79d280002 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.handlers.rst @@ -0,0 +1,26 @@ +aries\_cloudagent.protocols.discovery.v2\_0.handlers package +============================================================ + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.handlers + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.discovery.v2\_0.handlers.disclosures\_handler module +-------------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.handlers.disclosures_handler + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.protocols.discovery.v2\_0.handlers.queries\_handler module +---------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.handlers.queries_handler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v2_0.messages.rst b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.messages.rst new file mode 100644 index 0000000000..99fdbc332b --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.messages.rst @@ -0,0 +1,26 @@ +aries\_cloudagent.protocols.discovery.v2\_0.messages package +============================================================ + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.messages + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.discovery.v2\_0.messages.disclosures module +----------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.messages.disclosures + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.protocols.discovery.v2\_0.messages.queries module +------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.messages.queries + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v2_0.models.rst b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.models.rst new file mode 100644 index 0000000000..767db8e92e --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.models.rst @@ -0,0 +1,18 @@ +aries\_cloudagent.protocols.discovery.v2\_0.models package +========================================================== + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.models + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.discovery.v2\_0.models.discovery\_record module +--------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.models.discovery_record + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.discovery.v2_0.rst b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.rst new file mode 100644 index 0000000000..d12fef9348 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.discovery.v2_0.rst @@ -0,0 +1,44 @@ +aries\_cloudagent.protocols.discovery.v2\_0 package +=================================================== + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0 + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aries_cloudagent.protocols.discovery.v2_0.handlers + aries_cloudagent.protocols.discovery.v2_0.messages + aries_cloudagent.protocols.discovery.v2_0.models + +Submodules +---------- + +aries\_cloudagent.protocols.discovery.v2\_0.manager module +---------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.manager + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.protocols.discovery.v2\_0.message\_types module +----------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.message_types + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.protocols.discovery.v2\_0.routes module +--------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.discovery.v2_0.routes + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.endorse_transaction.v1_0.rst b/docs/generated/aries_cloudagent.protocols.endorse_transaction.v1_0.rst index 62f8d5b47d..eaf4c9eb32 100644 --- a/docs/generated/aries_cloudagent.protocols.endorse_transaction.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.endorse_transaction.v1_0.rst @@ -19,6 +19,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.endorse\_transaction.v1\_0.controller module +------------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.protocols.endorse_transaction.v1_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.endorse\_transaction.v1\_0.manager module --------------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.issue_credential.v1_0.rst b/docs/generated/aries_cloudagent.protocols.issue_credential.v1_0.rst index d380f5f12f..6221c61954 100644 --- a/docs/generated/aries_cloudagent.protocols.issue_credential.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.issue_credential.v1_0.rst @@ -19,6 +19,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.issue\_credential.v1\_0.controller module +--------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.issue_credential.v1_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.issue\_credential.v1\_0.manager module ------------------------------------------------------------------ diff --git a/docs/generated/aries_cloudagent.protocols.issue_credential.v2_0.rst b/docs/generated/aries_cloudagent.protocols.issue_credential.v2_0.rst index b218bf8826..daf64871a1 100644 --- a/docs/generated/aries_cloudagent.protocols.issue_credential.v2_0.rst +++ b/docs/generated/aries_cloudagent.protocols.issue_credential.v2_0.rst @@ -20,6 +20,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.issue\_credential.v2\_0.controller module +--------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.issue_credential.v2_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.issue\_credential.v2\_0.manager module ------------------------------------------------------------------ diff --git a/docs/generated/aries_cloudagent.protocols.out_of_band.v1_0.rst b/docs/generated/aries_cloudagent.protocols.out_of_band.v1_0.rst index 424c8c5b9a..80443da521 100644 --- a/docs/generated/aries_cloudagent.protocols.out_of_band.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.out_of_band.v1_0.rst @@ -19,6 +19,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.out\_of\_band.v1\_0.controller module +----------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.out_of_band.v1_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.out\_of\_band.v1\_0.manager module -------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.present_proof.v1_0.rst b/docs/generated/aries_cloudagent.protocols.present_proof.v1_0.rst index 7fb3dd5dd0..1a18103b2d 100644 --- a/docs/generated/aries_cloudagent.protocols.present_proof.v1_0.rst +++ b/docs/generated/aries_cloudagent.protocols.present_proof.v1_0.rst @@ -19,6 +19,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.present\_proof.v1\_0.controller module +------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.protocols.present_proof.v1_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.present\_proof.v1\_0.manager module --------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.present_proof.v2_0.rst b/docs/generated/aries_cloudagent.protocols.present_proof.v2_0.rst index 19a5e02281..ad4e408035 100644 --- a/docs/generated/aries_cloudagent.protocols.present_proof.v2_0.rst +++ b/docs/generated/aries_cloudagent.protocols.present_proof.v2_0.rst @@ -20,6 +20,14 @@ Subpackages Submodules ---------- +aries\_cloudagent.protocols.present\_proof.v2\_0.controller module +------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.protocols.present_proof.v2_0.controller + :members: + :undoc-members: + :show-inheritance: + aries\_cloudagent.protocols.present\_proof.v2\_0.manager module --------------------------------------------------------------- diff --git a/docs/generated/aries_cloudagent.protocols.revocation_notification.rst b/docs/generated/aries_cloudagent.protocols.revocation_notification.rst new file mode 100644 index 0000000000..013c0319ac --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.revocation_notification.rst @@ -0,0 +1,26 @@ +aries\_cloudagent.protocols.revocation\_notification package +============================================================ + +.. automodule:: aries_cloudagent.protocols.revocation_notification + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aries_cloudagent.protocols.revocation_notification.v1_0 + +Submodules +---------- + +aries\_cloudagent.protocols.revocation\_notification.definition module +---------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.revocation_notification.definition + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.handlers.rst b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.handlers.rst new file mode 100644 index 0000000000..205b069dc4 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.handlers.rst @@ -0,0 +1,18 @@ +aries\_cloudagent.protocols.revocation\_notification.v1\_0.handlers package +=========================================================================== + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.handlers + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.revocation\_notification.v1\_0.handlers.revoke\_handler module +------------------------------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.handlers.revoke_handler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.messages.rst b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.messages.rst new file mode 100644 index 0000000000..d623d66dc8 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.messages.rst @@ -0,0 +1,18 @@ +aries\_cloudagent.protocols.revocation\_notification.v1\_0.messages package +=========================================================================== + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.messages + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.revocation\_notification.v1\_0.messages.revoke module +--------------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.messages.revoke + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.models.rst b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.models.rst new file mode 100644 index 0000000000..48164ca2bf --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.models.rst @@ -0,0 +1,18 @@ +aries\_cloudagent.protocols.revocation\_notification.v1\_0.models package +========================================================================= + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.models + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +aries\_cloudagent.protocols.revocation\_notification.v1\_0.models.rev\_notification\_record module +-------------------------------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.models.rev_notification_record + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.rst b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.rst new file mode 100644 index 0000000000..06a3b4ace0 --- /dev/null +++ b/docs/generated/aries_cloudagent.protocols.revocation_notification.v1_0.rst @@ -0,0 +1,36 @@ +aries\_cloudagent.protocols.revocation\_notification.v1\_0 package +================================================================== + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0 + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aries_cloudagent.protocols.revocation_notification.v1_0.handlers + aries_cloudagent.protocols.revocation_notification.v1_0.messages + aries_cloudagent.protocols.revocation_notification.v1_0.models + +Submodules +---------- + +aries\_cloudagent.protocols.revocation\_notification.v1\_0.message\_types module +-------------------------------------------------------------------------------- + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.message_types + :members: + :undoc-members: + :show-inheritance: + +aries\_cloudagent.protocols.revocation\_notification.v1\_0.routes module +------------------------------------------------------------------------ + +.. automodule:: aries_cloudagent.protocols.revocation_notification.v1_0.routes + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/generated/aries_cloudagent.protocols.rst b/docs/generated/aries_cloudagent.protocols.rst index 825fad65f1..c569e1d81b 100644 --- a/docs/generated/aries_cloudagent.protocols.rst +++ b/docs/generated/aries_cloudagent.protocols.rst @@ -25,6 +25,7 @@ Subpackages aries_cloudagent.protocols.out_of_band aries_cloudagent.protocols.present_proof aries_cloudagent.protocols.problem_report + aries_cloudagent.protocols.revocation_notification aries_cloudagent.protocols.routing aries_cloudagent.protocols.trustping diff --git a/open-api/openapi.json b/open-api/openapi.json index 8fbc56d531..726cfa2cdb 100644 --- a/open-api/openapi.json +++ b/open-api/openapi.json @@ -1,7 +1,7 @@ { "swagger" : "2.0", "info" : { - "version" : "v0.7.2", + "version" : "v0.7.3-rc0", "title" : "Aries Cloud Agent" }, "tags" : [ { diff --git a/requirements.txt b/requirements.txt index 56c789a25d..757a40408c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ pyld~=2.0.3 pyyaml~=5.4.0 ConfigArgParse~=1.2.3 pyjwt~=1.7.1 -pydid~=0.3.2.post1 +pydid~=0.3.3 jsonpath_ng==1.5.2 pytz~=2021.1 python-dateutil~=2.8.1