Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi ledger: IndyDID resolver bug fix #1569

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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