Skip to content
Merged
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
17 changes: 16 additions & 1 deletion acapy_agent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,25 @@ async def get_credential_definition(
{"ledger_id": ledger_id},
)

# Convert seqNo to schema_id if needed
schema_id_from_cred_def = cred_def["schemaId"]
if schema_id_from_cred_def.isdigit():
# schemaId is a seqNo, fetch the actual schema to get its ID
try:
schema = await ledger.fetch_schema_by_seq_no(
int(schema_id_from_cred_def)
)
if schema and schema.get("id"):
schema_id_from_cred_def = schema["id"]
# If schema is None or missing id, fall back to seqNo
except LedgerError:
# If fetching fails, fall back to using seqNo as schemaId
pass

cred_def_value = CredDefValue.deserialize(cred_def["value"])
anoncreds_credential_definition = CredDef(
issuer_id=cred_def["id"].split(":")[0],
schema_id=cred_def["schemaId"],
schema_id=schema_id_from_cred_def,
type=cred_def["type"],
tag=cred_def["tag"],
value=cred_def_value,
Expand Down
Loading