@@ -47,8 +47,8 @@ export const createProofOfPossession = async <DIDDoc>(
4747 throw new Error ( BAD_PARAMS ) ;
4848 }
4949
50- const signerArgs = createJWT ( popMode , jwtProps , existingJwt ) ;
51- const jwt = await callbacks . signCallback ( signerArgs , signerArgs . header . kid ) ;
50+ const jwtPayload = createJWT ( popMode , jwtProps , existingJwt ) ;
51+ const jwt = await callbacks . signCallback ( jwtPayload , jwtPayload . header . kid ) ;
5252 const proof = {
5353 proof_type : 'JWT' ,
5454 jwt,
@@ -58,7 +58,7 @@ export const createProofOfPossession = async <DIDDoc>(
5858 partiallyValidateJWS ( jwt ) ;
5959 if ( callbacks . verifyCallback ) {
6060 debug ( `Calling supplied verify callback....` ) ;
61- await callbacks . verifyCallback ( { jwt, kid : signerArgs . header . kid } ) ;
61+ await callbacks . verifyCallback ( { jwt, kid : jwtPayload . header . kid } ) ;
6262 debug ( `Supplied verify callback return success result` ) ;
6363 }
6464 } catch {
@@ -130,9 +130,9 @@ const createJWT = (mode: PoPMode, jwtProps?: JwtProps, existingJwt?: Jwt): Jwt =
130130 ? getJwtProperty < string | string [ ] > ( 'aud' , true , jwtProps ?. issuer , existingJwt ?. payload ?. aud )
131131 : getJwtProperty < string | string [ ] > ( 'aud' , false , jwtProps ?. aud , existingJwt ?. payload ?. aud ) ;
132132 const iss =
133- // mode === 'pop'
134- getJwtProperty < string > ( 'iss' , false , jwtProps ?. clientId , existingJwt ?. payload ?. iss ) ;
135- // : getJwtProperty<string>('iss', false, jwtProps?.issuer, existingJwt?.payload?.iss);
133+ mode === 'pop'
134+ ? getJwtProperty < string > ( 'iss' , false , jwtProps ?. clientId , existingJwt ?. payload ?. iss )
135+ : getJwtProperty < string > ( 'iss' , false , jwtProps ?. issuer , existingJwt ?. payload ?. iss ) ;
136136 const client_id = mode === 'JWT' ? getJwtProperty < string > ( 'client_id' , false , jwtProps ?. clientId , existingJwt ?. payload ?. client_id ) : undefined ;
137137 const jti = getJwtProperty < string > ( 'jti' , false , jwtProps ?. jti , existingJwt ?. payload ?. jti ) ;
138138 const typ = getJwtProperty < string > ( 'typ' , true , jwtProps ?. typ , existingJwt ?. header ?. typ , 'openid4vci-proof+jwt' ) ;
@@ -142,7 +142,7 @@ const createJWT = (mode: PoPMode, jwtProps?: JwtProps, existingJwt?: Jwt): Jwt =
142142 const kid = getJwtProperty < string > ( 'kid' , false , jwtProps ?. kid , existingJwt ?. header ?. kid ) ;
143143 const jwk = getJwtProperty < BaseJWK > ( 'jwk' , false , jwtProps ?. jwk , existingJwt ?. header ?. jwk ) ;
144144 const x5c = getJwtProperty < string [ ] > ( 'x5c' , false , jwtProps ?. x5c , existingJwt ?. header . x5c ) ;
145- const jwt : Partial < Jwt > = existingJwt ? existingJwt : { } ;
145+ const jwt : Partial < Jwt > = { ... existingJwt } ;
146146 const now = + new Date ( ) ;
147147 const jwtPayload : Partial < JWTPayload > = {
148148 ...( aud && { aud } ) ,
0 commit comments