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)), 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) 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"]