From 916387148206b03f626cc82ea8c4ea3c6c0a9a8c Mon Sep 17 00:00:00 2001 From: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Date: Wed, 25 Sep 2024 22:46:51 -0400 Subject: [PATCH] [BUG] Handle get key operation when no tag has been set (#3256) * Bug-fix Signed-off-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> * Update in_memory.py Signed-off-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> * linting Signed-off-by: PatStLouis * apply better suggestion Signed-off-by: PatStLouis * set empty tags object instead of none for consistency Signed-off-by: PatStLouis * remove unnecessary change in the in memory wallet Signed-off-by: PatStLouis --------- Signed-off-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Signed-off-by: PatStLouis --- aries_cloudagent/wallet/askar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index d0ade2508d..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) @@ -192,8 +192,10 @@ async def get_signing_key(self, verkey: str) -> KeyInfo: if not key: raise WalletNotFoundError("Unknown key: {}".format(verkey)) metadata = json.loads(key.metadata or "{}") + + kid = key.tags.get("kid") + # FIXME implement key types - kid = key.tags["kid"] if "kid" in key.tags else None return KeyInfo(verkey=verkey, metadata=metadata, key_type=ED25519, kid=kid) async def replace_signing_key_metadata(self, verkey: str, metadata: dict):