Skip to content

Commit

Permalink
fix: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
auer-martin committed Oct 3, 2024
1 parent 2c1a354 commit b119275
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/jarm/__tests__/jarm.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('jarm', () => {
it('should create some tests', () => {
expect(true).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const jarmAuthResponseSend = async (input: JarmAuthResponseSendInput): Pr
case 'fragment.jwt':
return handleFragmentJwt(responseEndpoint, authResponse);
case 'form_post.jwt':
throw new Error('Not implemented');
throw new Error('Not implemented. form_post.jwt is not yet supported.');
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const vJarmAuthResponseParams = v.looseObject({
iss: v.string(),

/**
* The client_id of the client the response is intended for
* Expiration of the JWT
*/
exp: v.number(),

/**
* Expiration of the JWT
* The client_id of the client the response is intended for
*/
aud: v.string(),
});
Expand All @@ -50,7 +50,7 @@ export const validateJarmAuthResponseParams = (input: {
}

// 4. The client obtains the aud element from the JWT and checks whether it matches the client id the client used to identify itself in the corresponding authorization request. If the check fails, the client MUST abort processing and refuse the response.
if (authRequestParams.client_id !== authResponseParams.client_id) {
if (authRequestParams.client_id !== authResponseParams.aud) {
throw new Error(`Invalid audience in jarm-auth-response. Expected '${authRequestParams.client_id}' received '${authResponseParams.aud}'.`);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/siop-oid4vp/lib/op/OP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export class OP {
}

public static async extractEncJwksFromClientMetadata(clientMetadata: JwksMetadataParams) {
// The client metadata will be parsed in the joseExtractJWKS function
// TODO: Currently no mechanisms are in place to deal with multiple 'enc' keys in the client metadata.
// TODO: Maybe we should return all 'enc' keys in the client metadata. In addition the JWKS from the jwks_uri are not fetched if jwks are present.
// TODO: Is that the expected behavior?
const jwks = await extractJwksFromJwksMetadata(clientMetadata)
const encryptionJwk = jwks?.keys.find((key) => key.use === 'enc')
if (!encryptionJwk) {
Expand Down

0 comments on commit b119275

Please sign in to comment.