Skip to content

Commit a11eb45

Browse files
authored
Load connections didcomm protocols (openwallet-foundation#1468)
* Load connections didcomm protocols Signed-off-by: jamshale <[email protected]> * Check and deserialize OOBInvitation Signed-off-by: jamshale <[email protected]> * Use get for dict value check Signed-off-by: jamshale <[email protected]> * Change get_limit_offset to get_paginated_query_params Signed-off-by: jamshale <[email protected]> * Fix pyproject.toml Signed-off-by: jamshale <[email protected]> * Update poetry.lock file Signed-off-by: jamshale <[email protected]> * Update acapy-agent to git main Signed-off-by: jamshale <[email protected]> * Upgrade python image to bookworm Signed-off-by: jamshale <[email protected]> --------- Signed-off-by: jamshale <[email protected]>
1 parent 1f237c2 commit a11eb45

File tree

10 files changed

+530
-483
lines changed

10 files changed

+530
-483
lines changed

connections/.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
"justMyCode": false,
1313
"args": ["start", "--arg-file=${workspaceRoot}/docker/default.yml"]
1414
},
15+
{
16+
"name": "Run/Debug Invitee",
17+
"type": "debugpy",
18+
"request": "launch",
19+
"module": "acapy_agent",
20+
"justMyCode": false,
21+
"args": ["start", "--arg-file=${workspaceRoot}/docker/invitee.yml"]
22+
},
1523
{
1624
"name": "ruff - connections",
1725
"type": "debugpy",

connections/connections/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""Integrate Connections Protocol Plugin."""
22

33
import logging
4+
45
from acapy_agent.config.injection_context import InjectionContext
56
from acapy_agent.config.provider import ClassProvider
67
from acapy_agent.connections.base_manager import BaseConnectionManager
78
from acapy_agent.core.profile import Profile
9+
from acapy_agent.core.protocol_registry import ProtocolRegistry
810

911
from connections.v1_0.manager import ConnectionManager
10-
12+
from connections.v1_0.message_types import MESSAGE_TYPES
1113

1214
LOGGER = logging.getLogger(__name__)
1315

@@ -19,3 +21,7 @@ async def setup(context: InjectionContext):
1921
BaseConnectionManager,
2022
ClassProvider(ConnectionManager, ClassProvider.Inject(Profile)),
2123
)
24+
# Did-comm message types
25+
protocol_registry = context.inject(ProtocolRegistry)
26+
LOGGER.debug("Registering connection v1 message types")
27+
protocol_registry.register_message_types(MESSAGE_TYPES)

connections/connections/v1_0/models/conn_record.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ async def retrieve_invitation(self, session: ProfileSession) -> ConnectionInvita
4343
{"connection_id": self.connection_id},
4444
)
4545
ser = json.loads(result.value)
46+
if ser.get("@type") == "https://didcomm.org/out-of-band/1.1/invitation":
47+
return OOBInvitation.deserialize(ser)
4648
return ConnectionInvitation.deserialize(ser)
4749

4850
async def attach_request(self, session: ProfileSession, request: ConnectionRequest):

connections/connections/v1_0/routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from acapy_agent.messaging.models.openapi import OpenAPISchema
1111
from acapy_agent.messaging.models.paginated_query import (
1212
PaginatedQuerySchema,
13-
get_limit_offset,
13+
get_paginated_query_params,
1414
)
1515
from acapy_agent.messaging.valid import (
1616
ENDPOINT_EXAMPLE,
@@ -477,7 +477,7 @@ async def connections_list(request: web.BaseRequest):
477477
if request.query.get("connection_protocol"):
478478
post_filter["connection_protocol"] = request.query["connection_protocol"]
479479

480-
limit, offset, *_ = get_limit_offset(request)
480+
limit, offset, *_ = get_paginated_query_params(request)
481481

482482
profile = context.profile
483483
try:

connections/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-slim AS base
1+
FROM python:3.12-slim-bookworm AS base
22
WORKDIR /usr/src/app
33

44
# Install and configure poetry
@@ -19,7 +19,7 @@ ARG install_flags='--with integration --extras aca-py'
1919
RUN poetry install ${install_flags}
2020
USER $user
2121

22-
FROM python:3.12-bullseye
22+
FROM python:3.12-bookworm
2323
WORKDIR /usr/src/app
2424
COPY --from=base /usr/src/app/.venv /usr/src/app/.venv
2525
ENV PATH="/usr/src/app/.venv/bin:$PATH"

connections/docker/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
label: connections
1+
label: connections inviter
22

33
admin: [0.0.0.0, 3001]
44
admin-insecure-mode: false

connections/docker/invitee.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
label: connections invitee
2+
3+
admin: [0.0.0.0, 4001]
4+
admin-insecure-mode: false
5+
admin-api-key: change-me
6+
7+
inbound-transport:
8+
- [http, 0.0.0.0, 4000]
9+
- [ws, 0.0.0.0, 4002]
10+
outbound-transport: http
11+
endpoint:
12+
- http://localhost:4000
13+
14+
no-ledger: true
15+
16+
plugin:
17+
- connections
18+
19+
log-level: debug
20+
21+
auto-accept-invites: true
22+
auto-respond-messages: true
23+
24+
# Wallet
25+
auto-provision: true
26+
wallet-type: askar
27+
wallet-name: connections-wallet-invitee
28+
wallet-key: insecure

connections/integration/Dockerfile.test.runner

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-slim
1+
FROM python:3.12-slim-bookworm
22
WORKDIR /usr/src/app
33

44
# install poetry

connections/poetry.lock

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

connections/pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ python = "^3.12"
99

1010
# Define ACA-Py as an optional/extra dependency so it can be
1111
# explicitly installed with the plugin if desired.
12-
acapy-agent = { version = "~1.2.2", optional = true }
13-
12+
acapy-agent = { git = "https://github.com/openwallet-foundation/acapy.git", branch = "main", optional = true }
1413

1514
[tool.poetry.extras]
1615
aca-py = ["acapy-agent"]
@@ -84,4 +83,3 @@ output = ".test-reports/coverage.xml"
8483
[build-system]
8584
requires = ["setuptools", "poetry-core>=1.2"]
8685
build-backend = "poetry.core.masonry.api"
87-

0 commit comments

Comments
 (0)