-
Notifications
You must be signed in to change notification settings - Fork 17
fix: return uniform response envelope for internally and externally endorsed credential definitions #351
Description
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 fieldsProposed Fix
return registerCredentialDefinitionResult // ✅ preserves full envelopeNote: This change also requires platform-side handling to accommodate the updated response shape.
References
- PR: fix: did, schema and cred-def controller #350
- Comment: fix: did, schema and cred-def controller #350 (comment)
Requested by @GHkrishna