Skip to content

Commit 5b3d0e3

Browse files
authored
refactor: update oid4vc flows (#1471)
* refactor: update oid4vc flows Signed-off-by: Tipu_Singh <[email protected]> * refactor: removed commented code Signed-off-by: Tipu_Singh <[email protected]> * refactor: changed example Signed-off-by: Tipu_Singh <[email protected]> --------- Signed-off-by: Tipu_Singh <[email protected]>
1 parent bae6498 commit 5b3d0e3

File tree

7 files changed

+257
-150
lines changed

7 files changed

+257
-150
lines changed

apps/api-gateway/src/oid4vc-issuance/dtos/oid4vc-issuer-template.dto.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@ export class AppearanceDto {
7979
@ApiPropertyOptional({
8080
example: [
8181
{
82-
locale: 'en',
83-
name: 'Birth Certificate',
84-
description: 'Official record of birth',
82+
locale: 'de',
83+
name: 'Geburtsurkunde',
84+
description: 'Offizielle Geburtsbescheinigung',
8585
logo: {
8686
uri: 'https://upload.wikimedia.org/wikipedia/commons/2/2f/ABC-2021-LOGO.svg',
8787
alt_text: 'abc_logo'
8888
}
8989
},
9090
{
91-
locale: 'ar',
92-
name: 'شهادة الميلاد',
93-
description: 'سجل رسمي للولادة',
91+
locale: 'en',
92+
name: 'Birth Certificate',
93+
description: 'Official record of birth',
9494
logo: {
9595
uri: 'https://upload.wikimedia.org/wikipedia/commons/2/2f/ABC-2021-LOGO.svg',
96-
alt_text: 'شعار abc'
96+
alt_text: 'abc_logo'
9797
}
9898
}
9999
]
@@ -146,7 +146,7 @@ export class CreateCredentialTemplateDto {
146146
@ApiPropertyOptional({
147147
description:
148148
'Verifiable Credential Type (required when format is "vc+sd-jwt"; must NOT be provided when format is "mso_mdoc")',
149-
example: 'org.iso.18013.5.1.mDL'
149+
example: 'BirthCertificateCredential-sdjwt'
150150
})
151151
@ValidateIf((o: CreateCredentialTemplateDto) => 'vc+sd-jwt' === o.format)
152152
@IsString()

apps/api-gateway/src/oid4vc-issuance/oid4vc-issuance.controller.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ export class Oid4vcIssuanceController {
135135
return res.status(HttpStatus.CREATED).json(finalResponse);
136136
}
137137

138-
@Get('/orgs/:orgId/oid4vc/issuers/:issuerId')
139-
@ApiOperation({ summary: 'Get OID4VC issuer', description: 'Retrieves an OID4VC issuer by issuerId.' })
138+
@Get('/orgs/:orgId/oid4vc/issuers/:id')
139+
@ApiOperation({ summary: 'Get OID4VC issuer', description: 'Retrieves an OID4VC issuer by id.' })
140140
@ApiResponse({ status: HttpStatus.OK, description: 'Issuer fetched successfully.', type: ApiResponseDto })
141141
@ApiBearerAuth()
142142
@Roles(OrgRoles.OWNER)
@@ -151,17 +151,17 @@ export class Oid4vcIssuanceController {
151151
})
152152
)
153153
orgId: string,
154-
@Param('issuerId')
155-
issuerId: string,
154+
@Param('id')
155+
id: string,
156156
@Res() res: Response
157157
): Promise<Response> {
158-
const oidcIssuer = await this.oid4vcIssuanceService.oidcGetIssuerById(issuerId, orgId);
158+
const oidcIssuer = await this.oid4vcIssuanceService.oidcGetIssuerById(id, orgId);
159159
const finalResponse: IResponse = {
160-
statusCode: HttpStatus.CREATED,
160+
statusCode: HttpStatus.OK,
161161
message: ResponseMessages.oidcIssuer.success.fetch,
162162
data: oidcIssuer
163163
};
164-
return res.status(HttpStatus.CREATED).json(finalResponse);
164+
return res.status(HttpStatus.OK).json(finalResponse);
165165
}
166166

167167
@Get('/orgs/:orgId/oid4vc/issuers')
@@ -194,7 +194,7 @@ export class Oid4vcIssuanceController {
194194
return res.status(HttpStatus.OK).json(finalResponse);
195195
}
196196

197-
@Delete('/orgs/:orgId/oid4vc/:issuerId')
197+
@Delete('/orgs/:orgId/oid4vc/:id')
198198
@ApiOperation({
199199
summary: 'Delete OID4VC issuer',
200200
description: 'Deletes an OID4VC issuer for the specified organization.'
@@ -213,18 +213,18 @@ export class Oid4vcIssuanceController {
213213
)
214214
orgId: string,
215215
@Param(
216-
'issuerId',
216+
'id',
217217
new ParseUUIDPipe({
218218
exceptionFactory: (): Error => {
219219
throw new BadRequestException(ResponseMessages.organisation.error.invalidOrgId);
220220
}
221221
})
222222
)
223-
issuerId: string,
223+
id: string,
224224
@User() user: user,
225225
@Res() res: Response
226226
): Promise<Response> {
227-
await this.oid4vcIssuanceService.oidcDeleteIssuer(user, orgId, issuerId);
227+
await this.oid4vcIssuanceService.oidcDeleteIssuer(user, orgId, id);
228228

229229
const finalResponse: IResponse = {
230230
statusCode: HttpStatus.OK,
@@ -253,7 +253,6 @@ export class Oid4vcIssuanceController {
253253
@Res() res: Response
254254
): Promise<Response> {
255255
CredentialTemplate.issuerId = issuerId;
256-
console.log('THis is dto', JSON.stringify(CredentialTemplate, null, 2));
257256
const template = await this.oid4vcIssuanceService.createTemplate(CredentialTemplate, user, orgId, issuerId);
258257

259258
const finalResponse: IResponse = {

apps/api-gateway/src/oid4vc-issuance/oid4vc-issuance.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class Oid4vcIssuanceService extends BaseService {
3737
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'oid4vc-issuer-update', payload);
3838
}
3939

40-
async oidcGetIssuerById(issuerId: string, orgId: string): Promise<object> {
41-
const payload = { issuerId, orgId };
40+
async oidcGetIssuerById(id: string, orgId: string): Promise<object> {
41+
const payload = { id, orgId };
4242
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'oid4vc-issuer-get-by-id', payload);
4343
}
4444

@@ -47,8 +47,8 @@ export class Oid4vcIssuanceService extends BaseService {
4747
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'oid4vc-get-issuers-issuance', payload);
4848
}
4949

50-
async oidcDeleteIssuer(userDetails: user, orgId: string, issuerId: string): Promise<object> {
51-
const payload = { issuerId, orgId, userDetails };
50+
async oidcDeleteIssuer(userDetails: user, orgId: string, id: string): Promise<object> {
51+
const payload = { id, orgId, userDetails };
5252
return this.natsClient.sendNatsMessage(this.issuanceProxy, 'oid4vc-delete-issuer', payload);
5353
}
5454

0 commit comments

Comments
 (0)