@@ -145,4 +145,65 @@ describe("Presentation - SD-JWT Credential", () => {
145145 expect ( submitRes ) . toBeDefined ( ) ;
146146 expect ( submitRes . response . status ) . toBe ( 200 ) ;
147147 } ) ;
148+
149+ test ( "present sd jwt credential with A256GCM encryption" , async ( ) => {
150+ const requestBody : PresentationRequest = {
151+ response_type : ResponseType . URI ,
152+ requestId : "pid-no-hook" ,
153+ } ;
154+
155+ const res = await createPresentationRequest (
156+ app ,
157+ authToken ,
158+ requestBody ,
159+ ) ;
160+
161+ const authRequest = client . parseOpenid4vpAuthorizationRequest ( {
162+ authorizationRequest : res . body . uri ,
163+ } ) ;
164+
165+ const resolved = await client . resolveOpenId4vpAuthorizationRequest ( {
166+ authorizationRequestPayload : authRequest . params ,
167+ } ) ;
168+
169+ const x5c = [
170+ issuerCert
171+ . replace ( "-----BEGIN CERTIFICATE-----" , "" )
172+ . replace ( "-----END CERTIFICATE-----" , "" )
173+ . replaceAll ( / \r ? \n | \r / g, "" ) ,
174+ ] ;
175+ const vp_token = await preparePresentation (
176+ {
177+ iat : Math . floor ( Date . now ( ) / 1000 ) ,
178+ aud : resolved . authorizationRequestPayload . aud as string ,
179+ nonce : resolved . authorizationRequestPayload . nonce ,
180+ } ,
181+ privateIssuerKey ,
182+ x5c ,
183+ statusListService ,
184+ credentialConfigId ,
185+ ) ;
186+
187+ // Use A256GCM encryption instead of A128GCM
188+ const jwt = await encryptVpToken ( vp_token , "pid" , resolved , "A256GCM" ) ;
189+
190+ const authorizationResponse =
191+ await client . createOpenid4vpAuthorizationResponse ( {
192+ authorizationRequestPayload : authRequest . params ,
193+ authorizationResponsePayload : {
194+ response : jwt ,
195+ } ,
196+ ...callbacks ,
197+ } ) ;
198+
199+ const submitRes = await client . submitOpenid4vpAuthorizationResponse ( {
200+ authorizationResponsePayload :
201+ authorizationResponse . authorizationResponsePayload ,
202+ authorizationRequestPayload :
203+ resolved . authorizationRequestPayload as Openid4vpAuthorizationRequest ,
204+ } ) ;
205+
206+ expect ( submitRes ) . toBeDefined ( ) ;
207+ expect ( submitRes . response . status ) . toBe ( 200 ) ;
208+ } ) ;
148209} ) ;
0 commit comments