Skip to content

Commit

Permalink
Merge branch 'main' into fix/connection-invitation-key
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoGlastra authored Dec 21, 2021
2 parents f7ab1e0 + 953fd32 commit 8c1470e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aries_cloudagent/ledger/multiple_ledger/base_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ...core.error import BaseError
from ...core.profile import Profile
from ...ledger.base import BaseLedger
from ...messaging.valid import IndyDID


class MultipleLedgerManagerError(BaseError):
Expand Down Expand Up @@ -44,4 +45,7 @@ async def lookup_did_in_configured_ledgers(

def extract_did_from_identifier(self, identifier: str) -> str:
"""Return did from record identifier (REV_REG_ID, CRED_DEF_ID, SCHEMA_ID)."""
return identifier.split(":")[0]
if bool(IndyDID.PATTERN.match(identifier)):
return identifier.split(":")[-1]
else:
return identifier.split(":")[0]
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ def test_extract_did_from_identifier(self):
)
== "WgWxqztrNooG92RXvxSTWv"
)
assert (
self.manager.extract_did_from_identifier("WgWxqztrNooG92RXvxSTWv")
== "WgWxqztrNooG92RXvxSTWv"
)
assert (
self.manager.extract_did_from_identifier("did:sov:WgWxqztrNooG92RXvxSTWv")
== "WgWxqztrNooG92RXvxSTWv"
)

async def test_get_production_ledgers(self):
assert len(await self.manager.get_prod_ledgers()) == 2
Expand Down

0 comments on commit 8c1470e

Please sign in to comment.