Skip to content

Commit 83c6de7

Browse files
committed
refactor:updated example for issuer and added logic to fetch issuer details
Signed-off-by: Tipu_Singh <[email protected]>
1 parent a1c0335 commit 83c6de7

File tree

3 files changed

+58
-13
lines changed

3 files changed

+58
-13
lines changed

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

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,37 +179,69 @@ export enum AccessTokenSignerKeyType {
179179
// @ApiExtraModels(CredentialConfigurationDto)
180180
export class IssuerCreationDto {
181181
@ApiProperty({
182-
description: 'Name of the issuer',
183-
example: 'Credebl University'
182+
description: 'Unique identifier of the issuer (usually a short code or DID-based identifier)',
183+
example: 'credebl-university'
184184
})
185-
@IsString({ message: 'issuerId from IssuerCreationDto -> issuerId, must be a string' })
185+
@IsString({ message: 'issuerId must be a string' })
186186
issuerId: string;
187187

188188
@ApiPropertyOptional({
189-
description: 'Maximum number of credentials that can be issued in a batch',
190-
example: 50,
189+
description: 'Maximum number of credentials that can be issued in a single batch issuance operation',
190+
example: 100,
191191
type: Number
192192
})
193193
@IsOptional()
194194
@IsInt({ message: 'batchCredentialIssuanceSize must be an integer' })
195195
batchCredentialIssuanceSize?: number;
196196

197197
@ApiProperty({
198-
description: 'Localized display information for the credential',
199-
type: [IssuerDisplayDto]
198+
description:
199+
'Localized display information for the issuer — shown in wallet apps or credential metadata display (multi-lingual supported)',
200+
type: [IssuerDisplayDto],
201+
example: [
202+
{
203+
locale: 'en',
204+
name: 'Credebl University',
205+
description: 'Accredited institution issuing verified student credentials',
206+
logo: {
207+
uri: 'https://university.credebl.io/assets/logo-en.svg',
208+
alt_text: 'Credebl University logo'
209+
}
210+
},
211+
{
212+
locale: 'de',
213+
name: 'Credebl Universität',
214+
description: 'Akkreditierte Institution für digitale Studentenausweise',
215+
logo: {
216+
uri: 'https://university.credebl.io/assets/logo-de.svg',
217+
alt_text: 'Credebl Universität Logo'
218+
}
219+
}
220+
]
200221
})
201222
@IsArray()
202223
@ValidateNested({ each: true })
203224
@Type(() => IssuerDisplayDto)
204225
display: IssuerDisplayDto[];
205226

206-
@ApiProperty({ example: 'https://auth.example.org', description: 'Authorization URL' })
207-
@IsUrl({ require_tld: false })
227+
@ApiProperty({
228+
example: 'https://issuer.credebl.io/oid4vci',
229+
description: 'Base URL of the Authorization Server supporting OID4VC issuance flows'
230+
})
231+
@IsUrl({ require_tld: false }, { message: 'authorizationServerUrl must be a valid URL' })
208232
authorizationServerUrl: string;
209233

210234
@ApiProperty({
211-
description: 'Configuration of the authorization server',
212-
type: AuthorizationServerConfigDto
235+
description:
236+
'Additional configuration details for the authorization server (token endpoint, credential endpoint, grant types, etc.)',
237+
type: AuthorizationServerConfigDto,
238+
example: {
239+
issuer: 'https://id.sovio.ae:8443/realms/sovioid',
240+
clientAuthentication: {
241+
clientId: 'issuer-server',
242+
clientSecret: '1qKMWulZpMBzXIdfPO5AEs0xaTaKs1ym'
243+
}
244+
}
213245
})
214246
@IsOptional()
215247
@ValidateNested()

apps/oid4vc-issuance/src/oid4vc-issuance.repository.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,17 @@ export class Oid4vcIssuanceRepository {
307307
}
308308
}
309309

310+
async getIssuerDetailsByIssuerId(issuerId: string): Promise<oidc_issuer | null> {
311+
try {
312+
return await this.prisma.oidc_issuer.findUnique({
313+
where: { id: issuerId }
314+
});
315+
} catch (error) {
316+
this.logger.error(`Error in getIssuerDetailsByIssuerId: ${error.message}`);
317+
throw error;
318+
}
319+
}
320+
310321
async updateTemplate(templateId: string, data: Partial<credential_templates>): Promise<credential_templates> {
311322
try {
312323
return await this.prisma.credential_templates.update({

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,15 @@ export class Oid4vcIssuanceService {
524524
}
525525
//TODO: Implement x509 support and discuss with team
526526
//TODO: add logic to pass the issuer info
527+
const issuerDetailsFromDb = await this.oid4vcIssuanceRepository.getOidcIssuerDetailsById(issuerId);
528+
const { publicIssuerId, authorizationServerUrl } = issuerDetailsFromDb || {};
527529
const buildOidcCredentialOffer: CredentialOfferPayload = buildCredentialOfferPayload(
528530
createOidcCredentialOffer,
529531
//
530532
getAllOfferTemplates,
531533
{
532-
publicId: 'photoIdIssuer',
533-
authorizationServerUrl: 'http://localhost:4002/oid4vci/photoIdIssuer'
534+
publicId: publicIssuerId,
535+
authorizationServerUrl: `${authorizationServerUrl}/oid4vci/${publicIssuerId}`
534536
},
535537
signerOptions as any
536538
);

0 commit comments

Comments
 (0)