fp/services/next/test-jwe-decrypt.js

19 lines
763 B
JavaScript
Raw Normal View History

2024-12-12 07:23:46 +00:00
// const { jwtDecrypt } = require('jose');
// const dotenv = require('dotenv')
// dotenv.config({
// path: '../../.env.development'
// })
// async function decryptJWE(jwe, secret) {
// const key = new TextEncoder().encode(secret); // Encode the secret to Uint8Array
// const { payload, protectedHeader } = await jwtDecrypt(jwe, key);
// console.log('Decrypted payload:', new TextDecoder().decode(payload));
// console.log('Header:', protectedHeader);
// }
// const jwe = '375hO4PPr4GCghunRf52r7tlG7HAFLanZ7D5blc0QDamW3nXp_terShYROf7bpPak8N1k29cF_e_hdDZNeI42ZaFQInhjCOBLrYDpcxbvjALNhkwFNPz_wj1IPqDehjMz1vowdN9LdrwJup9a8Q.HbClJBjeMIyzT3vrwRdM0Q';
// const secret = process.env.NEXTAUTH_SECRET;
// decryptJWE(jwe, secret).catch(console.error);