diff --git a/src/controllers/credentials/CredentialController.ts b/src/controllers/credentials/CredentialController.ts index 5a58d180..150a9f6b 100644 --- a/src/controllers/credentials/CredentialController.ts +++ b/src/controllers/credentials/CredentialController.ts @@ -295,4 +295,20 @@ export class CredentialController extends Controller { throw ErrorHandlingService.handle(error) } } -} \ No newline at end of file + + /** + * Return credentialRecord + * + * @param credentialRecordId + * @returns credentialRecord + */ + @Get('/:credentialRecordId/form-data') + public async credentialFormData(@Path('credentialRecordId') credentialRecordId: string) { + try { + const credentialDetails = await this.agent.credentials.getFormatData(credentialRecordId) + return credentialDetails + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } +} diff --git a/src/controllers/multi-tenancy/MultiTenancyController.ts b/src/controllers/multi-tenancy/MultiTenancyController.ts index 61da8b4e..9fe90c2f 100644 --- a/src/controllers/multi-tenancy/MultiTenancyController.ts +++ b/src/controllers/multi-tenancy/MultiTenancyController.ts @@ -1429,6 +1429,22 @@ export class MultiTenancyController extends Controller { throw ErrorHandlingService.handle(error) } } + @Security('apiKey') + @Get('/credentials/form-data/:tenantId/:credentialRecordId') + public async credentialFormData( + @Path('tenantId') tenantId: string, + @Path('credentialRecordId') credentialRecordId: string + ) { + let credentialDetails + try { + await this.agent.modules.tenants.withTenantAgent({ tenantId }, async (tenantAgent) => { + credentialDetails = await tenantAgent.credentials.getFormatData(credentialRecordId) + }) + return credentialDetails + } catch (error) { + throw ErrorHandlingService.handle(error) + } + } @Security('apiKey') @Get('/proofs/:tenantId') @@ -1888,4 +1904,4 @@ export class MultiTenancyController extends Controller { throw ErrorHandlingService.handle(error) } } -} \ No newline at end of file +}