Skip to content

Commit d2033f8

Browse files
authored
⬆️ Upgrade wallet-group-id plugin and cloudcontroller (#1520)
* 🚧 Test group-id plugin changes didx-xyz/acapy-wallet-groups-plugin#80 * 🚧 Test latest cloudcontroller didx-xyz/aries-cloudcontroller-python#246 * 🎨 Update models * 🚧 Test latest changes * 🚧 * 🎨 Update model * 🚧 Test latest cloudcontroller * ⬆️ Use official release * ⬆️ Use official release * 📝 Update openapi spec
1 parent b074c02 commit d2033f8

File tree

10 files changed

+39
-44
lines changed

10 files changed

+39
-44
lines changed

app/models/tenants.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
from typing import Dict, List, Literal, Optional
33

4-
from aries_cloudcontroller import CreateWalletRequest, UpdateWalletRequest
54
from pydantic import BaseModel, Field, field_validator
65

76
from shared.exceptions import CloudApiValueError
@@ -49,10 +48,6 @@
4948
)
5049

5150

52-
class CreateWalletRequestWithGroups(CreateWalletRequest):
53-
group_id: Optional[str] = group_id_field
54-
55-
5651
class CreateTenantRequest(BaseModel):
5752
wallet_label: str = Field(
5853
..., description=label_description, examples=label_examples
@@ -140,12 +135,6 @@ def validate_wallet_label(cls, v):
140135
return v
141136

142137

143-
class UpdateWalletRequestWithGroupId(UpdateWalletRequest):
144-
"""Adds group_id to the default UpdateWalletRequest body"""
145-
146-
group_id: Optional[str] = Field(default=None, examples=["some_group_id"])
147-
148-
149138
class Tenant(BaseModel):
150139
wallet_id: str = Field(..., examples=["545135a4-ecbc-4400-8594-bdb74c51c88d"])
151140
wallet_label: str = Field(..., examples=["Alice"])

app/routes/admin/tenants.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from typing import List, Optional
33

44
import base58
5-
from aries_cloudcontroller import CreateWalletTokenRequest
5+
from aries_cloudcontroller import (
6+
CreateWalletRequestWithGroupId,
7+
CreateWalletTokenRequest,
8+
)
69
from fastapi import APIRouter, Depends, HTTPException, Query
710
from uuid_utils import uuid4
811

@@ -21,7 +24,6 @@
2124
from app.models.tenants import (
2225
CreateTenantRequest,
2326
CreateTenantResponse,
24-
CreateWalletRequestWithGroups,
2527
Tenant,
2628
TenantAuth,
2729
UpdateTenantRequest,
@@ -155,7 +157,7 @@ async def create_tenant(
155157
wallet_response = None
156158
body_request = handle_model_with_validation(
157159
logger=bound_logger,
158-
model_class=CreateWalletRequestWithGroups,
160+
model_class=CreateWalletRequestWithGroupId,
159161
image_url=body.image_url,
160162
key_management_mode="managed",
161163
label=wallet_label,

app/services/onboarding/tenants.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from typing import List
22

3-
from aries_cloudcontroller import AcaPyClient, UpdateWalletRequest, WalletRecord
3+
from aries_cloudcontroller import (
4+
AcaPyClient,
5+
UpdateWalletRequestWithGroupId,
6+
WalletRecordWithGroupId,
7+
)
48
from fastapi.exceptions import HTTPException
59

610
from app.dependencies.acapy_clients import (
@@ -26,7 +30,7 @@ async def handle_tenant_update(
2630
admin_controller: AcaPyClient,
2731
wallet_id: str,
2832
update_request: UpdateTenantRequest,
29-
) -> WalletRecord:
33+
) -> WalletRecordWithGroupId:
3034
bound_logger = logger.bind(body={"wallet_id": wallet_id})
3135
bound_logger.bind(body=update_request).debug("Handling tenant update")
3236

@@ -88,7 +92,7 @@ async def handle_tenant_update(
8892
bound_logger.debug("Updating wallet")
8993
request_body = handle_model_with_validation(
9094
logger=bound_logger,
91-
model_class=UpdateWalletRequest,
95+
model_class=UpdateWalletRequestWithGroupId,
9296
label=new_label,
9397
image_url=update_request.image_url,
9498
extra_settings=update_request.extra_settings,

app/tests/routes/admin_tenants/test_create_tenant.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
import base58
55
import pytest
6-
from aries_cloudcontroller import CreateWalletResponse
6+
from aries_cloudcontroller import CreateWalletRequestWithGroupId, CreateWalletResponse
77
from fastapi import HTTPException
88

99
from app.dependencies.acapy_clients import TENANT_ADMIN_AUTHED
1010
from app.exceptions import CloudApiException, TrustRegistryException
1111
from app.models.tenants import (
1212
CreateTenantRequest,
13-
CreateWalletRequestWithGroups,
1413
OnboardResult,
1514
)
1615
from app.routes.admin.tenants import create_tenant
@@ -60,7 +59,7 @@ async def test_create_tenant_success(roles):
6059

6160
mock_register_actor = AsyncMock()
6261

63-
expected_wallet_body = CreateWalletRequestWithGroups(
62+
expected_wallet_body = CreateWalletRequestWithGroupId(
6463
image_url=body.image_url,
6564
key_management_mode="managed",
6665
label=wallet_label,

app/util/tenants.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from logging import Logger
44
from typing import Optional
55

6-
from aries_cloudcontroller import AcaPyClient, WalletRecordWithGroups
6+
from aries_cloudcontroller import AcaPyClient, WalletRecordWithGroupId
77
from fastapi import HTTPException
88

99
from app.dependencies.acapy_clients import get_tenant_admin_controller
@@ -20,7 +20,7 @@ def __init__(self, wallet_id: str) -> None:
2020
)
2121

2222

23-
def tenant_from_wallet_record(wallet_record: WalletRecordWithGroups) -> Tenant:
23+
def tenant_from_wallet_record(wallet_record: WalletRecordWithGroupId) -> Tenant:
2424
label: str = wallet_record.settings.get("default_label") or ""
2525
wallet_name: str = wallet_record.settings.get("wallet.name") or ""
2626
image_url: Optional[str] = wallet_record.settings.get("image_url")
@@ -64,7 +64,7 @@ async def get_wallet_and_assert_valid_group(
6464
wallet_id: str,
6565
group_id: Optional[str],
6666
logger: Logger,
67-
) -> WalletRecordWithGroups:
67+
) -> WalletRecordWithGroupId:
6868
"""Fetch the wallet record for wallet_id, and assert it exists and belongs to group.
6969
7070
Args:
@@ -77,7 +77,7 @@ async def get_wallet_and_assert_valid_group(
7777
HTTPException: If the wallet does not exist or does not belong to group
7878
7979
Returns:
80-
WalletRecordWithGroups: When assertions pass, returns the wallet record.
80+
WalletRecordWithGroupId: When assertions pass, returns the wallet record.
8181
"""
8282
logger.debug("Retrieving the wallet record for {}", wallet_id)
8383
wallet = await handle_acapy_call(
@@ -98,15 +98,15 @@ async def get_wallet_and_assert_valid_group(
9898

9999

100100
def assert_valid_group(
101-
wallet: WalletRecordWithGroups,
101+
wallet: WalletRecordWithGroupId,
102102
wallet_id: str,
103103
group_id: Optional[str],
104104
logger: Logger,
105105
) -> None:
106106
"""Assert that wallet record belongs to group, and raise exception if not.
107107
108108
Args:
109-
wallet (WalletRecordWithGroups): The wallet record to check.
109+
wallet (WalletRecordWithGroupId): The wallet record to check.
110110
wallet_id (str): The wallet id for the wallet record.
111111
group_id (Optional[str]): The group to validate against.
112112
logger (Logger): A logger object.

dockerfiles/agents/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ USER root
55
# Install Google Protobuf and Plugins
66
ARG PROTOBUF_VERSION=5.29.3
77
RUN pip install --no-cache-dir protobuf==${PROTOBUF_VERSION} \
8-
acapy-wallet-groups-plugin==1.3.0.post20250505 \
8+
acapy-wallet-groups-plugin==1.3.0.post20250506 \
99
git+https://github.com/didx-xyz/aries-acapy-plugins@1.3.0-20250505#subdirectory=nats_events
1010

1111
COPY scripts/startup.sh startup.sh

docs/openapi/tenant-openapi.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6200,7 +6200,8 @@
62006200
"key",
62016201
"web",
62026202
"did:peer:2",
6203-
"did:peer:4"
6203+
"did:peer:4",
6204+
"cheqd"
62046205
],
62056206
"title": "Method",
62066207
"description": "Did method associated with the DID"

docs/openapi/tenant-openapi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,6 +3627,7 @@ components:
36273627
- web
36283628
- did:peer:2
36293629
- did:peer:4
3630+
- cheqd
36303631
title: Method
36313632
description: Did method associated with the DID
36323633
posture:

poetry.lock

Lines changed: 13 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ uvloop = "^0.21.0"
2727
[tool.poetry.group.app.dependencies]
2828
aiohttp = "~3.11.7"
2929
aiocache = "~0.12.0"
30-
aries-cloudcontroller = "==1.3.0rc1.post20250417"
30+
aries-cloudcontroller = "==1.3.0.post20250506"
3131
base58 = "~2.1.1"
3232
pyjwt = "~2.10.0"
3333
uuid_utils = "^0.10.0"
3434

3535
[tool.poetry.group.endorser.dependencies]
36-
aries-cloudcontroller = "==1.3.0rc1.post20250417"
36+
aries-cloudcontroller = "==1.3.0.post20250506"
3737
dependency-injector = "^4.46.0"
3838
nats-py = { extras = ["nkeys"], version = "^2.10.0" }
3939
tenacity = "^9.1.0"

0 commit comments

Comments
 (0)