Skip to content

Commit

Permalink
Load connections didcomm protocols (#1468)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
jamshale authored Feb 11, 2025
1 parent 1f237c2 commit a11eb45
Show file tree
Hide file tree
Showing 10 changed files with 530 additions and 483 deletions.
8 changes: 8 additions & 0 deletions connections/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
"justMyCode": false,
"args": ["start", "--arg-file=${workspaceRoot}/docker/default.yml"]
},
{
"name": "Run/Debug Invitee",
"type": "debugpy",
"request": "launch",
"module": "acapy_agent",
"justMyCode": false,
"args": ["start", "--arg-file=${workspaceRoot}/docker/invitee.yml"]
},
{
"name": "ruff - connections",
"type": "debugpy",
Expand Down
8 changes: 7 additions & 1 deletion connections/connections/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
"""Integrate Connections Protocol Plugin."""

import logging

from acapy_agent.config.injection_context import InjectionContext
from acapy_agent.config.provider import ClassProvider
from acapy_agent.connections.base_manager import BaseConnectionManager
from acapy_agent.core.profile import Profile
from acapy_agent.core.protocol_registry import ProtocolRegistry

from connections.v1_0.manager import ConnectionManager

from connections.v1_0.message_types import MESSAGE_TYPES

LOGGER = logging.getLogger(__name__)

Expand All @@ -19,3 +21,7 @@ async def setup(context: InjectionContext):
BaseConnectionManager,
ClassProvider(ConnectionManager, ClassProvider.Inject(Profile)),
)
# Did-comm message types
protocol_registry = context.inject(ProtocolRegistry)
LOGGER.debug("Registering connection v1 message types")
protocol_registry.register_message_types(MESSAGE_TYPES)
2 changes: 2 additions & 0 deletions connections/connections/v1_0/models/conn_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ async def retrieve_invitation(self, session: ProfileSession) -> ConnectionInvita
{"connection_id": self.connection_id},
)
ser = json.loads(result.value)
if ser.get("@type") == "https://didcomm.org/out-of-band/1.1/invitation":
return OOBInvitation.deserialize(ser)
return ConnectionInvitation.deserialize(ser)

async def attach_request(self, session: ProfileSession, request: ConnectionRequest):
Expand Down
4 changes: 2 additions & 2 deletions connections/connections/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from acapy_agent.messaging.models.openapi import OpenAPISchema
from acapy_agent.messaging.models.paginated_query import (
PaginatedQuerySchema,
get_limit_offset,
get_paginated_query_params,
)
from acapy_agent.messaging.valid import (
ENDPOINT_EXAMPLE,
Expand Down Expand Up @@ -477,7 +477,7 @@ async def connections_list(request: web.BaseRequest):
if request.query.get("connection_protocol"):
post_filter["connection_protocol"] = request.query["connection_protocol"]

limit, offset, *_ = get_limit_offset(request)
limit, offset, *_ = get_paginated_query_params(request)

profile = context.profile
try:
Expand Down
4 changes: 2 additions & 2 deletions connections/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim AS base
FROM python:3.12-slim-bookworm AS base
WORKDIR /usr/src/app

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

FROM python:3.12-bullseye
FROM python:3.12-bookworm
WORKDIR /usr/src/app
COPY --from=base /usr/src/app/.venv /usr/src/app/.venv
ENV PATH="/usr/src/app/.venv/bin:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion connections/docker/default.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
label: connections
label: connections inviter

admin: [0.0.0.0, 3001]
admin-insecure-mode: false
Expand Down
28 changes: 28 additions & 0 deletions connections/docker/invitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
label: connections invitee

admin: [0.0.0.0, 4001]
admin-insecure-mode: false
admin-api-key: change-me

inbound-transport:
- [http, 0.0.0.0, 4000]
- [ws, 0.0.0.0, 4002]
outbound-transport: http
endpoint:
- http://localhost:4000

no-ledger: true

plugin:
- connections

log-level: debug

auto-accept-invites: true
auto-respond-messages: true

# Wallet
auto-provision: true
wallet-type: askar
wallet-name: connections-wallet-invitee
wallet-key: insecure
2 changes: 1 addition & 1 deletion connections/integration/Dockerfile.test.runner
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim
FROM python:3.12-slim-bookworm
WORKDIR /usr/src/app

# install poetry
Expand Down
951 changes: 478 additions & 473 deletions connections/poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions connections/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ python = "^3.12"

# Define ACA-Py as an optional/extra dependency so it can be
# explicitly installed with the plugin if desired.
acapy-agent = { version = "~1.2.2", optional = true }

acapy-agent = { git = "https://github.com/openwallet-foundation/acapy.git", branch = "main", optional = true }

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

0 comments on commit a11eb45

Please sign in to comment.