@@ -422,6 +422,87 @@ describe('Parse Credential Request', () => {
422422 } )
423423 } )
424424
425+ test ( 'parse draft 14 credential request with known di_vp proof_type' , ( ) => {
426+ expect (
427+ parseCredentialRequest ( {
428+ issuerMetadata : {
429+ authorizationServers : [ ] ,
430+ credentialIssuer : issuerMetadata ,
431+ originalDraftVersion : Openid4vciVersion . Draft14 ,
432+ knownCredentialConfigurations : {
433+ my_credential : {
434+ format : 'dc+sd-jwt' ,
435+ vct : 'hello' ,
436+ } ,
437+ } ,
438+ } ,
439+ credentialRequest : {
440+ credential_identifier : 'some-identifier' ,
441+ extra_prop : 'should-stay' ,
442+ proof : {
443+ proof_type : 'di_vp' ,
444+ di_vp : {
445+ '@context' : [ 'https://www.w3.org/ns/credentials/v2' ] ,
446+ type : [ 'VerifiablePresentation' ] ,
447+ proof : {
448+ type : 'DataIntegrityProof' ,
449+ cryptosuite : 'eddsa-2022' ,
450+ proofPurpose : 'authentication' ,
451+ verificationMethod : 'did:key:z6Mk...#z6Mk...' ,
452+ created : '2023-03-01T14:56:29.280619Z' ,
453+ challenge : '82d4cb36-...' ,
454+ domain : 'https://issuer.com' ,
455+ proofValue : 'z5hrbHzZ...' ,
456+ } ,
457+ } ,
458+ } ,
459+ } ,
460+ } )
461+ ) . toStrictEqual ( {
462+ proofs : {
463+ di_vp : [
464+ {
465+ '@context' : [ 'https://www.w3.org/ns/credentials/v2' ] ,
466+ type : [ 'VerifiablePresentation' ] ,
467+ proof : {
468+ type : 'DataIntegrityProof' ,
469+ cryptosuite : 'eddsa-2022' ,
470+ proofPurpose : 'authentication' ,
471+ verificationMethod : 'did:key:z6Mk...#z6Mk...' ,
472+ created : '2023-03-01T14:56:29.280619Z' ,
473+ challenge : '82d4cb36-...' ,
474+ domain : 'https://issuer.com' ,
475+ proofValue : 'z5hrbHzZ...' ,
476+ } ,
477+ } ,
478+ ] ,
479+ } ,
480+ credentialIdentifier : 'some-identifier' ,
481+ credentialRequest : {
482+ credential_identifier : 'some-identifier' ,
483+ extra_prop : 'should-stay' ,
484+ proof : {
485+ proof_type : 'di_vp' ,
486+ di_vp : {
487+ '@context' : [ 'https://www.w3.org/ns/credentials/v2' ] ,
488+ type : [ 'VerifiablePresentation' ] ,
489+ proof : {
490+ type : 'DataIntegrityProof' ,
491+ cryptosuite : 'eddsa-2022' ,
492+ proofPurpose : 'authentication' ,
493+ verificationMethod : 'did:key:z6Mk...#z6Mk...' ,
494+ created : '2023-03-01T14:56:29.280619Z' ,
495+ challenge : '82d4cb36-...' ,
496+ domain : 'https://issuer.com' ,
497+ proofValue : 'z5hrbHzZ...' ,
498+ } ,
499+ } ,
500+ } ,
501+ } ,
502+ credentialResponseEncryption : undefined ,
503+ } )
504+ } )
505+
425506 test ( 'parse draft 14 credential request with unknown proof_type' , ( ) => {
426507 expect (
427508 parseCredentialRequest ( {
0 commit comments