@@ -146,7 +146,7 @@ public async Task<Option<Uri>> AcceptAuthorizationRequest(
146146
147147 var mdocNonce = Option < Nonce > . None ;
148148
149- var presentationMaps = new List < ( string Identifier , string Presentation , Format Format , ICredential PresentedCredential ) > ( ) ;
149+ var presentations = new List < ( PresentationMap PresentationMap , ICredential PresentedCredential ) > ( ) ;
150150 foreach ( var credential in credentials )
151151 {
152152 var credentialRequirement = authorizationRequest . Requirements . Match < OneOf < CredentialQuery , InputDescriptor > > (
@@ -245,13 +245,12 @@ public async Task<Option<Uri>> AcceptAuthorizationRequest(
245245 throw new ArgumentOutOfRangeException ( nameof ( credential . Credential ) ) ;
246246 }
247247
248- presentationMaps . Add ( ( Identifier : credentialRequirementId , Presentation : presentation , Format : format ,
249- PresentedCredential : presentedCredential ) ) ;
248+ presentations . Add ( ( PresentationMap : new PresentationMap ( credentialRequirementId , presentation , format ) , PresentedCredential : presentedCredential ) ) ;
250249 }
251250
252251 var authorizationResponse = await _oid4VpHaipClient . CreateAuthorizationResponseAsync (
253252 authorizationRequest ,
254- presentationMaps . Select ( tuple => ( tuple . Identifier , tuple . Presentation , tuple . Format ) ) . ToArray ( )
253+ presentations . Select ( tuple => tuple . PresentationMap ) . ToArray ( )
255254 ) ;
256255
257256 var content = authorizationRequest . ResponseMode switch
@@ -297,20 +296,20 @@ public async Task<Option<Uri>> AcceptAuthorizationRequest(
297296 throw new InvalidOperationException ( $ "Authorization Response failed with message { str } ") ;
298297 }
299298
300- var presentedCredentials = presentationMaps . Select ( presentationMap =>
299+ var presentedCredentials = presentations . Select ( presentation =>
301300 {
302301 PresentedCredentialSet result ;
303302
304- switch ( presentationMap . PresentedCredential )
303+ switch ( presentation . PresentedCredential )
305304 {
306305 case SdJwtRecord sdJwtRecord :
307306 var issuanceSdJwtDoc = sdJwtRecord . ToSdJwtDoc ( ) ;
308- var presentation = new SdJwtDoc ( presentationMap . Presentation ) ;
307+ var sdJwtDoc = new SdJwtDoc ( presentation . PresentationMap . Presentation ) ;
309308
310309 var nonDisclosed =
311310 from disclosure in issuanceSdJwtDoc . Disclosures
312311 let base64Encoded = disclosure . Base64UrlEncoded
313- where presentation . Disclosures . All ( itm => itm . Base64UrlEncoded != base64Encoded )
312+ where sdJwtDoc . Disclosures . All ( itm => itm . Base64UrlEncoded != base64Encoded )
314313 select disclosure ;
315314
316315 var presentedClaims =
@@ -344,7 +343,7 @@ from claim in sdJwtRecord.Claims
344343 } ;
345344 break ;
346345 default :
347- throw new ArgumentOutOfRangeException ( nameof ( presentationMap . PresentedCredential ) ) ;
346+ throw new ArgumentOutOfRangeException ( nameof ( presentation . PresentedCredential ) ) ;
348347 }
349348
350349 return result ;
@@ -355,7 +354,9 @@ from claim in sdJwtRecord.Claims
355354 Id = Guid . NewGuid ( ) . ToString ( ) ,
356355 ClientId = authorizationRequest . ClientId ,
357356 ClientMetadata = authorizationRequest . ClientMetadata ,
358- Name = authorizationRequest . PresentationDefinition . Name ,
357+ Name = authorizationRequest . Requirements . Match (
358+ dcqlQuery => Option < string > . None ,
359+ presentationDefinition => presentationDefinition . Name ) ,
359360 PresentedCredentialSets = presentedCredentials . ToList ( )
360361 } ;
361362
@@ -390,7 +391,7 @@ public async Task<Option<Uri>> AcceptOnDemandRequest(
390391
391392 var context = await _agentProvider . GetContextAsync ( ) ;
392393
393- var presentationMaps = new List < ( string Identifier , string Presentation , Format Format , ICredential PresentedCredential ) > ( ) ;
394+ var presentations = new List < ( PresentationMap PresentationMap , ICredential PresentedCredential ) > ( ) ;
394395 foreach ( var credential in credentials )
395396 {
396397 var credentialRequirement =
@@ -544,13 +545,12 @@ from keyAuths in mdoc.IssuerSigned.IssuerAuth.Payload.DeviceKeyInfo.KeyAuthoriza
544545 throw new ArgumentOutOfRangeException ( nameof ( credential . Credential ) ) ;
545546 }
546547
547- presentationMaps . Add ( ( Identifier : credentialRequirementId , Presentation : presentation , Format : format ,
548- PresentedCredential : presentedCredential ) ) ;
548+ presentations . Add ( ( PresentationMap : new PresentationMap ( credentialRequirementId , presentation , format ) , PresentedCredential : presentedCredential ) ) ;
549549 }
550550
551551 var authorizationResponse = await _oid4VpHaipClient . CreateAuthorizationResponseAsync (
552552 authorizationRequest ,
553- presentationMaps . Select ( tuple => ( tuple . Identifier , tuple . Presentation , tuple . Format ) ) . ToArray ( )
553+ presentations . Select ( tuple => tuple . PresentationMap ) . ToArray ( )
554554 ) ;
555555
556556 var content = authorizationRequest . ResponseMode switch
@@ -578,20 +578,20 @@ from keyAuths in mdoc.IssuerSigned.IssuerAuth.Payload.DeviceKeyInfo.KeyAuthoriza
578578 throw new InvalidOperationException ( $ "Authorization Response failed with message { str } ") ;
579579 }
580580
581- var presentedCredentials = presentationMaps . Select ( presentationMap =>
581+ var presentedCredentials = presentations . Select ( presentation =>
582582 {
583583 PresentedCredentialSet result ;
584584
585- switch ( presentationMap . PresentedCredential )
585+ switch ( presentation . PresentedCredential )
586586 {
587587 case SdJwtRecord sdJwtRecord :
588588 var issuanceSdJwtDoc = sdJwtRecord . ToSdJwtDoc ( ) ;
589- var presentation = new SdJwtDoc ( presentationMap . Presentation ) ;
589+ var sdJwtDoc = new SdJwtDoc ( presentation . PresentationMap . Presentation ) ;
590590
591591 var nonDisclosed =
592592 from disclosure in issuanceSdJwtDoc . Disclosures
593593 let base64Encoded = disclosure . Base64UrlEncoded
594- where presentation . Disclosures . All ( itm => itm . Base64UrlEncoded != base64Encoded )
594+ where sdJwtDoc . Disclosures . All ( itm => itm . Base64UrlEncoded != base64Encoded )
595595 select disclosure ;
596596
597597 var presentedClaims =
@@ -625,7 +625,7 @@ from claim in sdJwtRecord.Claims
625625 } ;
626626 break ;
627627 default :
628- throw new ArgumentOutOfRangeException ( nameof ( presentationMap . PresentedCredential ) ) ;
628+ throw new ArgumentOutOfRangeException ( nameof ( presentation . PresentedCredential ) ) ;
629629 }
630630
631631 return result ;
@@ -636,7 +636,9 @@ from claim in sdJwtRecord.Claims
636636 Id = Guid . NewGuid ( ) . ToString ( ) ,
637637 ClientId = authorizationRequest . ClientId ,
638638 ClientMetadata = authorizationRequest . ClientMetadata ,
639- Name = authorizationRequest . PresentationDefinition . Name ,
639+ Name = authorizationRequest . Requirements . Match (
640+ dcqlQuery => Option < string > . None ,
641+ presentationDefinition => presentationDefinition . Name ) ,
640642 PresentedCredentialSets = presentedCredentials . ToList ( )
641643 } ;
642644
@@ -672,11 +674,11 @@ public async Task<Validation<AuthorizationRequestCancellation, PresentationCandi
672674
673675 var uc5TxDataOption = presentationCandidates
674676 . AuthorizationRequest
675- . PresentationDefinition
676- . InputDescriptors
677- . TraverseAny ( descriptor =>
678- descriptor . TransactionData . OnSome ( list => new InputDescriptorTransactionData ( descriptor . Id , list ) )
679- ) ;
677+ . Requirements . Match (
678+ dcqlQuery => Option < IEnumerable < InputDescriptorTransactionData > > . None ,
679+ presentationDefinition => presentationDefinition . InputDescriptors . TraverseAny ( descriptor =>
680+ descriptor . TransactionData . OnSome ( list =>
681+ new InputDescriptorTransactionData ( descriptor . Id , list ) ) ) ) ;
680682
681683 switch ( vpTxDataOption . IsSome , uc5TxDataOption . IsSome )
682684 {
0 commit comments