oidc: add alg to the jwks keys

This commit is contained in:
Girish Ramakrishnan
2026-02-12 19:39:18 +01:00
parent 51e02da277
commit 88a44ee065
2 changed files with 23 additions and 2 deletions

View File

@@ -528,7 +528,7 @@ async function start() {
if (!keyEdDsa) {
debug('Generating new OIDC EdDSA key');
const { privateKey } = await jose.generateKeyPair('EdDSA', { extractable: true });
keyEdDsa = await jose.exportJWK(privateKey);
keyEdDsa = Object.assign(await jose.exportJWK(privateKey), { alg: 'EdDSA' }); // alg is optional, but wp requires it
await blobs.setString(blobs.OIDC_KEY_EDDSA, JSON.stringify(keyEdDsa));
jwksKeys.push(keyEdDsa);
} else {
@@ -540,7 +540,7 @@ async function start() {
if (!keyRs256) {
debug('Generating new OIDC RS256 key');
const { privateKey } = await jose.generateKeyPair('RS256', { extractable: true });
keyRs256 = await jose.exportJWK(privateKey);
keyRs256 = Object.assign(await jose.exportJWK(privateKey), { alg: 'RS256' }); // alg is optional, but wp requires it
await blobs.setString(blobs.OIDC_KEY_RS256, JSON.stringify(keyRs256));
jwksKeys.push(keyRs256);
} else {