@@ -51,10 +51,14 @@ export function getJwtVerifyCallback({ verifyOpts }: { verifyOpts?: JWTVerifyOpt
51
51
52
52
const header = jwtDecode < JWTHeader > ( args . jwt , { header : true } )
53
53
const payload = jwtDecode < JWTPayload > ( args . jwt , { header : false } )
54
+ const kid = args . kid ?? header . kid
55
+ const jwk = ! kid ? jwkInfo . jwk : undefined // TODO double-check if this is correct
54
56
return {
55
57
alg,
56
58
...identifier ,
57
59
jwt : { header, payload } ,
60
+ ...( kid && { kid } ) ,
61
+ ...( jwk && { jwk } ) ,
58
62
} as JwtVerifyResult < DIDDocument >
59
63
}
60
64
@@ -326,20 +330,19 @@ export async function createVciIssuer(
326
330
) . build ( )
327
331
}
328
332
329
- export async function createAuthRequestUriCallback ( opts : { path : string , presentationDefinitionId : string } ) : Promise < ( ) => Promise < string > > {
333
+ export async function createAuthRequestUriCallback ( opts : { path : string ; presentationDefinitionId : string } ) : Promise < ( ) => Promise < string > > {
330
334
async function authRequestUriCallback ( ) : Promise < string > {
331
335
const path = opts . path . replace ( ':definitionId' , opts . presentationDefinitionId )
332
336
return fetch ( path , {
333
337
method : 'POST' ,
334
338
headers : {
335
339
'Content-Type' : 'application/json' ,
336
- }
337
- } )
338
- . then ( async ( response ) : Promise < string > => {
340
+ } ,
341
+ } ) . then ( async ( response ) : Promise < string > => {
339
342
if ( response . status >= 400 ) {
340
343
return Promise . reject ( Error ( await response . text ( ) ) )
341
344
} else {
342
- const responseData = await response . json ( ) ;
345
+ const responseData = await response . json ( )
343
346
344
347
if ( ! responseData . authRequestURI ) {
345
348
return Promise . reject ( Error ( 'Missing auth request uri in response body' ) )
@@ -348,26 +351,27 @@ export async function createAuthRequestUriCallback(opts: { path: string, present
348
351
return responseData . authRequestURI
349
352
}
350
353
} )
351
-
352
354
}
353
355
354
356
return authRequestUriCallback
355
357
}
356
358
357
- export async function createVerifyAuthResponseCallback ( opts : { path : string , presentationDefinitionId : string } ) : Promise < ( correlationId : string ) => Promise < boolean > > {
359
+ export async function createVerifyAuthResponseCallback ( opts : {
360
+ path : string
361
+ presentationDefinitionId : string
362
+ } ) : Promise < ( correlationId : string ) => Promise < boolean > > {
358
363
async function verifyAuthResponseCallback ( correlationId : string ) : Promise < boolean > {
359
364
return fetch ( opts . path , {
360
365
method : 'POST' ,
361
366
headers : {
362
367
'Content-Type' : 'application/json' ,
363
368
} ,
364
369
body : JSON . stringify ( { definitionId : opts . presentationDefinitionId , correlationId } ) ,
365
- } )
366
- . then ( async ( response ) : Promise < boolean > => {
370
+ } ) . then ( async ( response ) : Promise < boolean > => {
367
371
if ( response . status >= 400 ) {
368
372
return Promise . reject ( Error ( await response . text ( ) ) )
369
373
} else {
370
- const responseData = await response . json ( ) ;
374
+ const responseData = await response . json ( )
371
375
372
376
if ( ! responseData . status ) {
373
377
return Promise . reject ( Error ( 'Missing status in response body' ) )
0 commit comments