From 785492445ed8f378c69f4cd09be6b8046ac1f028 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Thu, 26 Sep 2024 18:13:34 -0400 Subject: [PATCH 1/4] fix: enable refreshing did endpoint using mediator info Signed-off-by: Daniel Bluhm --- aries_cloudagent/wallet/routes.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/aries_cloudagent/wallet/routes.py b/aries_cloudagent/wallet/routes.py index 9e2045dc95..1f9f0b46e6 100644 --- a/aries_cloudagent/wallet/routes.py +++ b/aries_cloudagent/wallet/routes.py @@ -43,6 +43,8 @@ NON_SD_LIST_VALIDATE, SD_JWT_EXAMPLE, SD_JWT_VALIDATE, + UUID4_EXAMPLE, + UUID4_VALIDATE, IndyDID, StrOrDictField, Uri, @@ -172,6 +174,14 @@ class DIDEndpointWithTypeSchema(OpenAPISchema): "example": ENDPOINT_TYPE_EXAMPLE, }, ) + mediation_id = fields.Str( + required=False, + validate=UUID4_VALIDATE, + metadata={ + "description": "Medation ID to use for endpoint information.", + "example": UUID4_EXAMPLE, + }, + ) class JWSCreateSchema(OpenAPISchema): @@ -896,7 +906,7 @@ async def promote_wallet_public_did( async with ( context.session() if is_ctx_admin_request else profile.session() ) as session: - wallet = session.inject_or(BaseWallet) + wallet = session.inject(BaseWallet) did_info = await wallet.get_local_did(did) info = await wallet.set_public_did(did_info) @@ -951,6 +961,7 @@ async def wallet_set_did_endpoint(request: web.BaseRequest): did = body["did"] endpoint = body.get("endpoint") endpoint_type = EndpointType.get(body.get("endpoint_type", EndpointType.ENDPOINT.w3c)) + mediation_id = body.get("mediation_id") create_transaction_for_endorser = json.loads( request.query.get("create_transaction_for_endorser", "false") @@ -960,6 +971,17 @@ async def wallet_set_did_endpoint(request: web.BaseRequest): connection_id = request.query.get("conn_id") attrib_def = None + profile = context.profile + route_manager = profile.inject(RouteManager) + mediation_record = await route_manager.mediation_record_if_id( + profile=profile, mediation_id=mediation_id, or_default=True + ) + routing_keys, mediator_endpoint = await route_manager.routing_info( + profile, + mediation_record, + ) + LOGGER.debug("Mediation info: %s, %s", routing_keys, mediator_endpoint) + # check if we need to endorse if is_author_role(context.profile): # authors cannot write to the ledger @@ -1005,6 +1027,7 @@ async def wallet_set_did_endpoint(request: web.BaseRequest): if not wallet: raise web.HTTPForbidden(reason="No wallet available") try: + endpoint = mediator_endpoint or endpoint ledger = context.profile.inject_or(BaseLedger) attrib_def = await wallet.set_did_endpoint( did, @@ -1013,6 +1036,7 @@ async def wallet_set_did_endpoint(request: web.BaseRequest): endpoint_type, write_ledger=write_ledger, endorser_did=endorser_did, + routing_keys=routing_keys, ) except WalletNotFoundError as err: raise web.HTTPNotFound(reason=err.roll_up) from err From 8a20bfc101cbe603552b62ec967138c4125eb433 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Thu, 26 Sep 2024 18:52:38 -0400 Subject: [PATCH 2/4] fix: wallet routes tests Signed-off-by: Daniel Bluhm --- aries_cloudagent/wallet/tests/test_routes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/wallet/tests/test_routes.py b/aries_cloudagent/wallet/tests/test_routes.py index 7fb75df617..1e4a272ae7 100644 --- a/aries_cloudagent/wallet/tests/test_routes.py +++ b/aries_cloudagent/wallet/tests/test_routes.py @@ -29,11 +29,14 @@ class TestWalletRoutes(IsolatedAsyncioTestCase): def setUp(self): self.wallet = mock.create_autospec(BaseWallet) self.session_inject = {BaseWallet: self.wallet} + self.route_mgr = mock.MagicMock() + self.route_mgr.mediation_record_if_id = mock.CoroutineMock(return_value=None) + self.route_mgr.routing_info = mock.CoroutineMock(return_value=(None, None)) self.profile = InMemoryProfile.test_profile( - settings={"admin.admin_api_key": "secret-key"} + settings={"admin.admin_api_key": "secret-key"}, + bind={KeyTypes: KeyTypes(), RouteManager: self.route_mgr}, ) self.context = AdminRequestContext.test_context(self.session_inject, self.profile) - self.context.injector.bind_instance(KeyTypes, KeyTypes()) self.request_dict = { "context": self.context, "outbound_message_router": mock.CoroutineMock(), From 7ebf28c93111dbf08979d2c8cea45dd1828a4874 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:02:16 +0000 Subject: [PATCH 3/4] chore(deps-dev): Bump ruff from 0.6.7 to 0.6.8 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.7 to 0.6.8. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.7...0.6.8) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 40 ++++++++++++++++++++-------------------- pyproject.toml | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/poetry.lock b/poetry.lock index 7262c9605e..0a8175d32d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2364,29 +2364,29 @@ test = ["hypothesis (==5.19.0)", "pytest (>=7.0.0)", "pytest-xdist (>=2.4.0)"] [[package]] name = "ruff" -version = "0.6.7" +version = "0.6.8" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.6.7-py3-none-linux_armv6l.whl", hash = "sha256:08277b217534bfdcc2e1377f7f933e1c7957453e8a79764d004e44c40db923f2"}, - {file = "ruff-0.6.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c6707a32e03b791f4448dc0dce24b636cbcdee4dd5607adc24e5ee73fd86c00a"}, - {file = "ruff-0.6.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:533d66b7774ef224e7cf91506a7dafcc9e8ec7c059263ec46629e54e7b1f90ab"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:17a86aac6f915932d259f7bec79173e356165518859f94649d8c50b81ff087e9"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b3f8822defd260ae2460ea3832b24d37d203c3577f48b055590a426a722d50ef"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9ba4efe5c6dbbb58be58dd83feedb83b5e95c00091bf09987b4baf510fee5c99"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:525201b77f94d2b54868f0cbe5edc018e64c22563da6c5c2e5c107a4e85c1c0d"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8854450839f339e1049fdbe15d875384242b8e85d5c6947bb2faad33c651020b"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2f0b62056246234d59cbf2ea66e84812dc9ec4540518e37553513392c171cb18"}, - {file = "ruff-0.6.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b1462fa56c832dc0cea5b4041cfc9c97813505d11cce74ebc6d1aae068de36b"}, - {file = "ruff-0.6.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:02b083770e4cdb1495ed313f5694c62808e71764ec6ee5db84eedd82fd32d8f5"}, - {file = "ruff-0.6.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:0c05fd37013de36dfa883a3854fae57b3113aaa8abf5dea79202675991d48624"}, - {file = "ruff-0.6.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f49c9caa28d9bbfac4a637ae10327b3db00f47d038f3fbb2195c4d682e925b14"}, - {file = "ruff-0.6.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a0e1655868164e114ba43a908fd2d64a271a23660195017c17691fb6355d59bb"}, - {file = "ruff-0.6.7-py3-none-win32.whl", hash = "sha256:a939ca435b49f6966a7dd64b765c9df16f1faed0ca3b6f16acdf7731969deb35"}, - {file = "ruff-0.6.7-py3-none-win_amd64.whl", hash = "sha256:590445eec5653f36248584579c06252ad2e110a5d1f32db5420de35fb0e1c977"}, - {file = "ruff-0.6.7-py3-none-win_arm64.whl", hash = "sha256:b28f0d5e2f771c1fe3c7a45d3f53916fc74a480698c4b5731f0bea61e52137c8"}, - {file = "ruff-0.6.7.tar.gz", hash = "sha256:44e52129d82266fa59b587e2cd74def5637b730a69c4542525dfdecfaae38bd5"}, + {file = "ruff-0.6.8-py3-none-linux_armv6l.whl", hash = "sha256:77944bca110ff0a43b768f05a529fecd0706aac7bcce36d7f1eeb4cbfca5f0f2"}, + {file = "ruff-0.6.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:27b87e1801e786cd6ede4ada3faa5e254ce774de835e6723fd94551464c56b8c"}, + {file = "ruff-0.6.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cd48f945da2a6334f1793d7f701725a76ba93bf3d73c36f6b21fb04d5338dcf5"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:677e03c00f37c66cea033274295a983c7c546edea5043d0c798833adf4cf4c6f"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9f1476236b3eacfacfc0f66aa9e6cd39f2a624cb73ea99189556015f27c0bdeb"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f5a2f17c7d32991169195d52a04c95b256378bbf0de8cb98478351eb70d526f"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:5fd0d4b7b1457c49e435ee1e437900ced9b35cb8dc5178921dfb7d98d65a08d0"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8034b19b993e9601f2ddf2c517451e17a6ab5cdb1c13fdff50c1442a7171d87"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6cfb227b932ba8ef6e56c9f875d987973cd5e35bc5d05f5abf045af78ad8e098"}, + {file = "ruff-0.6.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ef0411eccfc3909269fed47c61ffebdcb84a04504bafa6b6df9b85c27e813b0"}, + {file = "ruff-0.6.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:007dee844738c3d2e6c24ab5bc7d43c99ba3e1943bd2d95d598582e9c1b27750"}, + {file = "ruff-0.6.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ce60058d3cdd8490e5e5471ef086b3f1e90ab872b548814e35930e21d848c9ce"}, + {file = "ruff-0.6.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1085c455d1b3fdb8021ad534379c60353b81ba079712bce7a900e834859182fa"}, + {file = "ruff-0.6.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:70edf6a93b19481affd287d696d9e311388d808671bc209fb8907b46a8c3af44"}, + {file = "ruff-0.6.8-py3-none-win32.whl", hash = "sha256:792213f7be25316f9b46b854df80a77e0da87ec66691e8f012f887b4a671ab5a"}, + {file = "ruff-0.6.8-py3-none-win_amd64.whl", hash = "sha256:ec0517dc0f37cad14a5319ba7bba6e7e339d03fbf967a6d69b0907d61be7a263"}, + {file = "ruff-0.6.8-py3-none-win_arm64.whl", hash = "sha256:8d3bb2e3fbb9875172119021a13eed38849e762499e3cfde9588e4b4d70968dc"}, + {file = "ruff-0.6.8.tar.gz", hash = "sha256:a5bf44b1aa0adaf6d9d20f86162b34f7c593bfedabc51239953e446aefc8ce18"}, ] [[package]] @@ -2898,4 +2898,4 @@ didcommv2 = ["didcomm-messaging"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "847f31447743aa5c76f2260811aac67009ff2279e10eea6bd9d1112e4c6e3345" +content-hash = "6f12628b988feacf357702b97af059abce6d5f5d5f50f57c1bf66841e24fe3c4" diff --git a/pyproject.toml b/pyproject.toml index edab10b8d9..26c307b440 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ didcomm-messaging = {version = "^0.1.1a0", optional = true } [tool.poetry.group.dev.dependencies] pre-commit = "~3.8.0" # Sync with version in .pre-commit-config.yaml -ruff = "0.6.7" +ruff = "0.6.8" sphinx="^5.3.0" sphinx-rtd-theme=">=0.4.3" From 97c75e77393d7f846c70eb1afdd7404be9fae44f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:08:08 +0000 Subject: [PATCH 4/4] chore(deps): Bump mkdocs-material from 9.5.36 to 9.5.39 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.5.36 to 9.5.39. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.5.36...9.5.39) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- mkdocs-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs-requirements.txt b/mkdocs-requirements.txt index 363b6d7a79..05cd7cb50c 100644 --- a/mkdocs-requirements.txt +++ b/mkdocs-requirements.txt @@ -1,3 +1,3 @@ -mkdocs-material==9.5.36 +mkdocs-material==9.5.39 mike==2.1.3