Skip to content

Commit

Permalink
Ajoute la possibilité de générer un jeton signé dans l'adaptateurChif…
Browse files Browse the repository at this point in the history
…frement
  • Loading branch information
Fabinout committed Dec 3, 2024
1 parent 0f56b9f commit 9239d33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/adaptateurs/adaptateurChiffrement.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,19 @@ const verifieSignatureJWTDepuisJWKS = (jwt, urlJWKS) => {
return verifieJeton(jwt, jwks);
};

const genereJWT = (infos, cle) => {
const headerJWT = {
alg: 'RS256',
};

return jose.importJWK(cle).then((clePrivee) => new jose.SignJWT(infos)
.setProtectedHeader(headerJWT)
.sign(clePrivee));
};

module.exports = {
cleHachage,
dechiffreJWE,
genereJWT,
verifieSignatureJWTDepuisJWKS,
};

0 comments on commit 9239d33

Please sign in to comment.