Skip to content

Commit

Permalink
Add profile to get_shcema_info_by_id
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <[email protected]>
  • Loading branch information
jamshale committed Dec 19, 2024
1 parent aeb255f commit b5630c4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion acapy_agent/anoncreds/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ async def get_revocation_list(
"""Get a revocation list from the registry."""

@abstractmethod
async def get_schema_info_by_id(self, schema_id: str) -> AnoncredsSchemaInfo:
async def get_schema_info_by_id(
self, profile: Profile, schema_id: str
) -> AnoncredsSchemaInfo:
"""Get a schema info from the registry."""


Expand Down
4 changes: 3 additions & 1 deletion acapy_agent/anoncreds/default/did_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ async def update_revocation_list(
"""Update a revocation list on the registry."""
raise NotImplementedError()

async def get_schema_info_by_id(self, schema_id: str) -> AnoncredsSchemaInfo:
async def get_schema_info_by_id(
self, profile: Profile, schema_id: str
) -> AnoncredsSchemaInfo:
"""Get a schema info from the registry."""
return await super().get_schema_info_by_id(schema_id)
4 changes: 3 additions & 1 deletion acapy_agent/anoncreds/default/did_web/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ async def update_revocation_list(
"""Update a revocation list on the registry."""
raise NotImplementedError()

async def get_schema_info_by_id(self, schema_id: str) -> AnoncredsSchemaInfo:
async def get_schema_info_by_id(
self, profile: Profile, schema_id: str
) -> AnoncredsSchemaInfo:
"""Get a schema info from the registry."""
return await super().get_schema_info_by_id(schema_id)
4 changes: 3 additions & 1 deletion acapy_agent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,9 @@ async def txn_submit(
except LedgerError as err:
raise AnonCredsRegistrationError(err.roll_up) from err

async def get_schema_info_by_id(self, schema_id: str) -> AnoncredsSchemaInfo:
async def get_schema_info_by_id(
self, profile: Profile, schema_id: str
) -> AnoncredsSchemaInfo:
"""Get schema info by schema id."""
schema_id_parts = re.match(r"^(\w+):2:([^:]+):([^:]+)$", schema_id)
return AnoncredsSchemaInfo(
Expand Down
4 changes: 3 additions & 1 deletion acapy_agent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ async def _finish_store_credential(
) -> str:
credential_data = cred_recvd.to_dict()
registry = self.profile.inject(AnonCredsRegistry)
schema_info = await registry.get_schema_info_by_id(credential_data["schema_id"])
schema_info = await registry.get_schema_info_by_id(
self.profile, credential_data["schema_id"]
)

credential_id = credential_id or str(uuid4())
tags = {
Expand Down
6 changes: 4 additions & 2 deletions acapy_agent/anoncreds/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ async def get_credential_definition(
credential_definition_id,
)

async def get_schema_info_by_id(self, schema_id: str) -> AnoncredsSchemaInfo:
async def get_schema_info_by_id(
self, profile: Profile, schema_id: str
) -> AnoncredsSchemaInfo:
"""Get a schema info from the registry."""
resolver = await self._resolver_for_identifier(schema_id)
return await resolver.get_schema_info_by_id(schema_id)
return await resolver.get_schema_info_by_id(profile, schema_id)

async def register_credential_definition(
self,
Expand Down

0 comments on commit b5630c4

Please sign in to comment.