Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#1569 from shaangill025/mult_…
Browse files Browse the repository at this point in the history
…indy_network_support

Multi ledger: IndyDID resolver bug fix
  • Loading branch information
ianco authored Dec 21, 2021
2 parents be0f462 + 86272bf commit 953fd32
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 953fd32

Please sign in to comment.