From 0124e307251493830a5a11fad941592f6a7e0575 Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Indicio work address)" Date: Mon, 18 Dec 2023 12:14:56 -0700 Subject: [PATCH 1/3] chore: exclude example files from ruff Signed-off-by: Colton Wolkins (Indicio work address) --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c827dd9..5935c6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,8 @@ ignore = [ line-length = 90 +extend-exclude = ["example*.py"] + [tool.ruff.per-file-ignores] "**/{tests}/*" = ["F841", "D", "E501"] From 800bc791d17a644fea1d9985deda4f1df844c4a9 Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Indicio work address)" Date: Mon, 18 Dec 2023 12:20:07 -0700 Subject: [PATCH 2/3] fix: add "typ" to encrypted messages Signed-off-by: Colton Wolkins (Indicio work address) --- didcomm_messaging/crypto/backend/askar.py | 1 + 1 file changed, 1 insertion(+) diff --git a/didcomm_messaging/crypto/backend/askar.py b/didcomm_messaging/crypto/backend/askar.py index 5755a84..5322a7c 100644 --- a/didcomm_messaging/crypto/backend/askar.py +++ b/didcomm_messaging/crypto/backend/askar.py @@ -306,6 +306,7 @@ async def ecdh_1pu_encrypt( builder.set_protected( OrderedDict( [ + ("typ", "application/didcomm+encrypted"), ("alg", alg_id), ("enc", enc_id), ("apu", b64url(apu)), From cb7b848f9927f35d438ab201a44bdaa8b100c9ba Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Indicio work address)" Date: Mon, 18 Dec 2023 12:21:24 -0700 Subject: [PATCH 3/3] fix: fix issue when the target is the final destination Signed-off-by: Colton Wolkins (Indicio work address) --- didcomm_messaging/routing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/didcomm_messaging/routing.py b/didcomm_messaging/routing.py index b9d9003..4388dd7 100644 --- a/didcomm_messaging/routing.py +++ b/didcomm_messaging/routing.py @@ -105,7 +105,8 @@ async def prepare_forward( # Grab our target to pack the initial message to, then pack the message # for the DID target - next_target = chain.pop(0)["did"] + final_destination = chain.pop(0) + next_target = final_destination["did"] packed_message = encoded_message # Loop through the entire services chain and pack the message for each @@ -130,4 +131,7 @@ async def prepare_forward( # Return the forward-packed message as well as the last service in the # chain, which is the destination of the top-level forward message. - return (packed_message, chain[-1]["service"]) + service = final_destination["service"] + if len(chain): + service = chain[-1]["service"] + return (packed_message, service)