Skip to content

Migrating JWE decrypt/verify from 2.0.5 to 4.5.0 #360

Discussion options

You must be logged in to vote

I resolved with the following code:

// the "token" var is a string that I receive as query string
const publicKey = await jose.importSPKI(PUBLIC_KEY, 'ES256');
const privateKey = await jose.importPKCS8(PRIVATE_KEY, 'ECDH-ES');
const decrypted = await jose.compactDecrypt(token, privateKey, { keyManagementAlgorithms: ['ECDH-ES'] });
return await jose.jwtVerify(decrypted.plaintext, publicKey, { algorithms: ['ES256'] });

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@panva
Comment options

@federico-moretti
Comment options

Answer selected by federico-moretti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants