diff --git a/aries_cloudagent/wallet/askar.py b/aries_cloudagent/wallet/askar.py index 1d08d528ff..69b5cb109e 100644 --- a/aries_cloudagent/wallet/askar.py +++ b/aries_cloudagent/wallet/askar.py @@ -258,6 +258,10 @@ async def create_local_did( verkey_bytes = keypair.get_public_bytes() verkey = bytes_to_b58(verkey_bytes) + did = did_validation.validate_or_derive_did( + method, key_type, verkey_bytes, did + ) + try: await self._session.handle.insert_key( verkey, keypair, metadata=json.dumps(metadata) @@ -269,10 +273,6 @@ async def create_local_did( else: raise WalletError("Error inserting key") from err - did = did_validation.validate_or_derive_did( - method, key_type, verkey_bytes, did - ) - item = await self._session.handle.fetch(CATEGORY_DID, did, for_update=True) if item: did_info = item.value_json