-
Hi, I would like to store sensitive information in the local storage of my client. My idea is:
Your library seems perfect for that. However, though I read your doc, I couldn't make it work. Here is what I got: app.get("/user", async (req, res) => {
const encoder = new TextEncoder()
const encryptedUser = await new CompactEncrypt(encoder.encode({name: "joe", age: 99, hobbies: ["swim", "eat"]}))
.setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' })
.encrypt("myPrivateKey")
res.status(200).json({
user: encryptedUser,
});
}); Node throws this error: How to fix this, and which library would you recommend to decipher the JOSE token in the client? Is Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 14 replies
-
First of all give #114 and the documentation for the encrypt method's key parameter type a read. See if it helps. If not, please come back. |
Beta Was this translation helpful? Give feedback.
-
Second of all, this library is a universal/isomorphic javascript library. This means it works both in Node and the browser. The only difference is the KeyLike type that i've asked you to give a read in my previous comment. The jsonwebtoken is not fit for neither JWE nor browser runtime. |
Beta Was this translation helpful? Give feedback.
First of all give #114 and the documentation for the encrypt method's key parameter type a read. See if it helps. If not, please come back.