Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates to support future ACA-Py 0.12.0 release #44

Merged
merged 10 commits into from
Feb 21, 2024
3 changes: 2 additions & 1 deletion .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: psf/black@24.1.1
with:
src: "./proxy_mediator"
- uses: chartboost/ruff-action@v1
with:
src: "./proxy_mediator"
version: 0.1.2
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ repos:
args: ["--config", ".commitlint.config.js"]
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.1.1
hooks:
- id: black
stages: [commit]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
rev: v0.1.2
hooks:
- id: ruff
stages: [commit]
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix]
2 changes: 1 addition & 1 deletion docker-compose.public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
LOG_LEVEL: DEBUG

agent:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-indy-1.16.0-0.11.0
volumes:
- indy:/home/indy/.indy_client
command: >
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
entrypoint: /bin/sh -c '/app/wait && python -m proxy_mediator "$$@"' --

agent:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
volumes:
- indy:/home/indy/.indy_client
command: >
Expand Down Expand Up @@ -62,7 +62,7 @@ services:
- mediator

mediator:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
volumes:
- ./docker/acapy-endpoint.sh:/home/indy/acapy-endpoint.sh:z
- indy:/home/indy/.indy_client
Expand Down
6 changes: 3 additions & 3 deletions int/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
retries: 5

alice:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
command: >
start --label alice
-it http 0.0.0.0 3000
Expand All @@ -45,7 +45,7 @@ services:


bob:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
command: >
start --label bob
-it http 0.0.0.0 3000
Expand All @@ -69,7 +69,7 @@ services:
retries: 5

external_mediator:
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.10.1
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0
command: >
start --label external_mediator
-it http 0.0.0.0 3000
Expand Down
1,386 changes: 662 additions & 724 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions proxy_mediator/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Connections Protocol Starter Kit."""

import asyncio
from contextlib import asynccontextmanager, suppress
import logging
Expand Down
1 change: 1 addition & 0 deletions proxy_mediator/agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Proxy Mediator Agent."""

import asyncio
from contextvars import ContextVar
import logging
Expand Down
1 change: 1 addition & 0 deletions proxy_mediator/connection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Connection object."""

import asyncio
from asyncio.futures import Future
import json
Expand Down
1 change: 0 additions & 1 deletion proxy_mediator/error.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Errors and error related utilities."""


from abc import ABC
import functools
import logging
Expand Down
1 change: 1 addition & 0 deletions proxy_mediator/protocols/basicmessage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic Message Module."""

from aries_staticagent.module import Module, ModuleRouter
from aries_staticagent.utils import timestamp

Expand Down
8 changes: 4 additions & 4 deletions proxy_mediator/protocols/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def doc_for_connection(
"""Return a DID Doc for the given connection."""
return {
"@context": "https://w3id.org/did/v1",
"id": connection.did,
"id": "did:sov:" + connection.did,
"publicKey": [
{
"id": connection.did + "#keys-1",
Expand All @@ -119,9 +119,9 @@ def doc_for_connection(
"type": "IndyAgent",
"recipientKeys": [connection.verkey_b58],
"routingKeys": [],
"serviceEndpoint": endpoint
if endpoint is not None
else self.endpoint,
"serviceEndpoint": (
endpoint if endpoint is not None else self.endpoint
),
}
],
}
Expand Down
9 changes: 6 additions & 3 deletions proxy_mediator/protocols/coordinate_mediation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Coordinate mediation protocol."""

import asyncio
from contextvars import ContextVar
import logging
Expand Down Expand Up @@ -156,9 +157,11 @@ async def mediate_request(self, msg, conn):
"routing_keys": [
verkey_to_didkey(agent.mediator_connection.verkey),
*[
verkey_b58_to_didkey(key)
if not key.startswith("did:key:")
else key
(
verkey_b58_to_didkey(key)
if not key.startswith("did:key:")
else key
)
for key in self.external_mediator_routing_keys
],
],
Expand Down
15 changes: 11 additions & 4 deletions proxy_mediator/protocols/oob_didexchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ def verkey_to_didkey(verkey: bytes) -> str:

def didkey_to_verkey(didkey: str) -> bytes:
"""Convert didkey to verkey."""
codec, unwrapped = multicodec.unwrap(multibase.decode(didkey[8:]))
try:
multikey = didkey[8:].split("#")[0]
except Exception:
raise ProtocolError(f"Invalid did:key: {didkey}")

codec, unwrapped = multicodec.unwrap(multibase.decode(multikey))
if codec.name != "ed25519-pub":
raise ProtocolError(f"Unsupported did:key: {codec.name}")

Expand Down Expand Up @@ -252,9 +257,11 @@ async def response(self, msg: Message, conn: Connection):
"@type": self.type("complete"),
"~thread": {
"thid": msg.thread["thid"],
"pthid": msg.thread["pthid"]
if "pthid" in msg.thread
else msg.thread["thid"],
"pthid": (
msg.thread["pthid"]
if "pthid" in msg.thread
else msg.thread["thid"]
),
},
}
)
Expand Down
1 change: 1 addition & 0 deletions proxy_mediator/protocols/routing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Routing protocol."""

import json
import logging
from typing import Any, Dict
Expand Down
1 change: 1 addition & 0 deletions proxy_mediator/store.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper for working with Askar store."""

from contextlib import asynccontextmanager
from contextvars import ContextVar
import logging
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ license = "Apache-2.0"

[tool.poetry.dependencies]
python = "^3.9"
aries-staticagent = "^0.9.0-rc3"
aries-staticagent = "^0.9.0-rc1"
pydantic = "^1.8.2"
python-statemachine = "^0.8.0"
inflection = "^0.5.1"
ConfigArgParse = "^1.5.3"
aries-askar = "^0.2.2"
multiformats = "^0.2.1"
typing-extensions = "4.5.0" # Pin to fix issue in multiformats
multiformats = "^0.3.1"

[tool.poetry.dev-dependencies]
pre-commit = "^2.15.0"
black = "23.7.0"
ruff = "0.0.287"
black = "24.1.1"
ruff = "0.1.2"
pytest = "^6.2.5"
pytest-cov = "^2.12.1"
pytest-asyncio = "^0.15.1"
Expand Down
Loading