From a4cc8c77d2d0bc1997a7f58551409c2ea17ecc79 Mon Sep 17 00:00:00 2001 From: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Date: Wed, 25 Sep 2024 22:17:22 -0400 Subject: [PATCH 1/6] Bug-fix Signed-off-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> --- aries_cloudagent/wallet/askar.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index d0ade2508d..6191ffcc82 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -192,8 +192,14 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: if not key: raise WalletNotFoundError("Unknown key: {}".format(verkey)) metadata = json.loads(key.metadata or "{}") - # FIXME implement key types - kid = key.tags["kid"] if "kid" in key.tags else None + + # Provisioned keys don't get tags by default + try: + kid = key.tags["kid"] if "kid" in key.tags else None + except Exception: + kid = None + + # FIXME implement key types return KeyInfo(verkey=verkey, metadata=metadata, key_type=ED25519, kid=kid) async def replace_signing_key_metadata(self, verkey: str, metadata: dict): From 60c901b7ef0d585efa61d57b560cfebc65ff999c Mon Sep 17 00:00:00 2001 From: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Date: Wed, 25 Sep 2024 22:20:05 -0400 Subject: [PATCH 2/6] Update in_memory.py Signed-off-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> --- aries_cloudagent/wallet/in_memory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aries_cloudagent/wallet/in_memory.py b/aries_cloudagent/wallet/in_memory.py index f798e2264a..337b176c97 100644 --- a/aries_cloudagent/wallet/in_memory.py +++ b/aries_cloudagent/wallet/in_memory.py @@ -165,7 +165,7 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: verkey=key["verkey"], metadata=key["metadata"].copy(), key_type=key["key_type"], - kid=key["kid"], + kid=key["kid"] if "kid" in key else None, ) async def replace_signing_key_metadata(self, verkey: str, metadata: dict): From 036f108a5ea4fbc4805b49be6bdc8fd02b1511f6 Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 26 Sep 2024 02:25:20 +0000 Subject: [PATCH 3/6] linting Signed-off-by: PatStLouis --- aries_cloudagent/wallet/askar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index 6191ffcc82..fbd5b58fb1 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -198,8 +198,8 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: kid = key.tags["kid"] if "kid" in key.tags else None except Exception: kid = None - - # FIXME implement key types + + # FIXME implement key types return KeyInfo(verkey=verkey, metadata=metadata, key_type=ED25519, kid=kid) async def replace_signing_key_metadata(self, verkey: str, metadata: dict): From 0e8b54d61c3a2f47c8229ba70dd4abee17106a8e Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 26 Sep 2024 02:32:59 +0000 Subject: [PATCH 4/6] apply better suggestion Signed-off-by: PatStLouis --- aries_cloudagent/wallet/askar.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index fbd5b58fb1..a7a2bf08ab 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -193,11 +193,7 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: raise WalletNotFoundError("Unknown key: {}".format(verkey)) metadata = json.loads(key.metadata or "{}") - # Provisioned keys don't get tags by default - try: - kid = key.tags["kid"] if "kid" in key.tags else None - except Exception: - kid = None + kid = key.tags.get("kid") # FIXME implement key types return KeyInfo(verkey=verkey, metadata=metadata, key_type=ED25519, kid=kid) From 3a844b5ca2cfb37bc25cd3c088c838e3788040da Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 26 Sep 2024 02:34:52 +0000 Subject: [PATCH 5/6] set empty tags object instead of none for consistency Signed-off-by: PatStLouis --- aries_cloudagent/wallet/askar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index a7a2bf08ab..bf024ab99d 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -97,7 +97,7 @@ async def create_key( if kid: tags = {"kid": kid} else: - tags = None + tags = {} try: keypair = _create_keypair(key_type, seed) From dfb4a7c82ca8935e9eb394158bb538a3afccad29 Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 26 Sep 2024 02:37:05 +0000 Subject: [PATCH 6/6] remove unnecessary change in the in memory wallet Signed-off-by: PatStLouis --- aries_cloudagent/wallet/in_memory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aries_cloudagent/wallet/in_memory.py b/aries_cloudagent/wallet/in_memory.py index 337b176c97..f798e2264a 100644 --- a/aries_cloudagent/wallet/in_memory.py +++ b/aries_cloudagent/wallet/in_memory.py @@ -165,7 +165,7 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: verkey=key["verkey"], metadata=key["metadata"].copy(), key_type=key["key_type"], - kid=key["kid"] if "kid" in key else None, + kid=key["kid"], ) async def replace_signing_key_metadata(self, verkey: str, metadata: dict):