Summary
The createCredentialDefinition endpoint in src/controllers/anoncreds/cred-def/CredentialDefinitionController.ts currently returns only credentialDefinitionState (dropping jobId, credentialDefinitionMetadata, and registrationMetadata) for internally endorsed credential definitions, while all other branches (Wait, Action, external endorsement) return the full RegisterCredentialDefinitionReturn wrapper.
This inconsistency makes the response shape dependent on the endorse flag, which breaks API contract uniformity.
Expected Behaviour
After computing and replacing the unqualified credentialDefinitionId via parseIndyCredentialDefinitionId and getUnqualifiedCredentialDefinitionId, the full registerCredentialDefinitionResult object should be returned (preserving jobId, credentialDefinitionMetadata, and registrationMetadata). The controller/type signature should then be simplified to a single RegisterCredentialDefinitionReturn return type and TSOA artifacts regenerated.
Current Behaviour
// In createCredentialDefinition (internal endorsement path)
return registerCredentialDefinitionResult.credentialDefinitionState // ❌ drops envelope fields
Proposed Fix
return registerCredentialDefinitionResult // ✅ preserves full envelope
Note: This change also requires platform-side handling to accommodate the updated response shape.
References
Requested by @GHkrishna
Summary
The
createCredentialDefinitionendpoint insrc/controllers/anoncreds/cred-def/CredentialDefinitionController.tscurrently returns onlycredentialDefinitionState(droppingjobId,credentialDefinitionMetadata, andregistrationMetadata) for internally endorsed credential definitions, while all other branches (Wait, Action, external endorsement) return the fullRegisterCredentialDefinitionReturnwrapper.This inconsistency makes the response shape dependent on the
endorseflag, which breaks API contract uniformity.Expected Behaviour
After computing and replacing the unqualified
credentialDefinitionIdviaparseIndyCredentialDefinitionIdandgetUnqualifiedCredentialDefinitionId, the fullregisterCredentialDefinitionResultobject should be returned (preservingjobId,credentialDefinitionMetadata, andregistrationMetadata). The controller/type signature should then be simplified to a singleRegisterCredentialDefinitionReturnreturn type and TSOA artifacts regenerated.Current Behaviour
Proposed Fix
References
Requested by @GHkrishna