@@ -282,44 +282,30 @@ export class CredentialV2Service {
282282 ) : OpenId4VcVerificationSessionCreateRequestDto {
283283 const MDL_ALG = [ 'ES256' , 'ES384' , 'ES512' , 'EdDSA' , 'ESB256' , 'ESB320' , 'ESB384' , 'ESB512' ]
284284
285+ let inputDescriptors : DifPresentationExchangeInputDescriptor [ ]
285286 if ( template . credentialFormat === OpenId4VcCredentialFormat . MsoMdoc ) {
286287 const doctype = template . schema . name ?? 'org.iso.18013.5.1.mDL'
287288 const namespace = template . schema . name ?? 'org.iso.18013.5.1'
288- return {
289- publicVerifierId : registration . did ,
290- requestSigner : {
291- method : 'did' ,
292- did : registration . did ,
293- } ,
294- presentationExchange : {
295- definition : {
296- id : v4 ( ) ,
297- name : template . name ,
298- input_descriptors : [
299- {
300- id : doctype ,
301- format : {
302- mso_mdoc : {
303- alg : MDL_ALG ,
304- } ,
305- } ,
306- constraints : {
307- limit_disclosure : 'required' ,
308- fields : fields . map ( ( field ) => ( {
309- path : [ `$['${ namespace } ']['${ field } ']` ] ,
310- intent_to_retain : false ,
311- } ) ) ,
312- } ,
313- name : template . name ,
314- } ,
315- ] ,
289+ inputDescriptors = [
290+ {
291+ id : doctype ,
292+ format : {
293+ mso_mdoc : {
294+ alg : MDL_ALG ,
295+ } ,
316296 } ,
297+ constraints : {
298+ limit_disclosure : 'required' ,
299+ fields : fields . map ( ( field ) => ( {
300+ path : [ `$['${ namespace } ']['${ field } ']` ] ,
301+ intent_to_retain : false ,
302+ } ) ) ,
303+ } ,
304+ name : template . name ,
305+ purpose : 'To obtain credential data' ,
317306 } ,
318- }
319- }
320-
321- let inputDescriptors : DifPresentationExchangeInputDescriptor [ ]
322- if ( template . credentialFormat === OpenId4VcCredentialFormat . SdJwtVc ) {
307+ ]
308+ } else if ( template . credentialFormat === OpenId4VcCredentialFormat . SdJwtVc ) {
323309 inputDescriptors = [
324310 {
325311 id : v4 ( ) ,
@@ -353,6 +339,7 @@ export class CredentialV2Service {
353339 } ,
354340 ]
355341 }
342+
356343 return {
357344 publicVerifierId : registration . did ,
358345 requestSigner : {
@@ -362,7 +349,7 @@ export class CredentialV2Service {
362349 presentationExchange : {
363350 definition : {
364351 id : v4 ( ) ,
365- name : template . schema . name ,
352+ name : template . name ,
366353 input_descriptors : inputDescriptors ,
367354 } ,
368355 } ,
0 commit comments