JWE Encypt support string type in plainText parameter #156
-
I need send a request with JWE using plainText as json, but actually the plainText parameter support only Uint8Array. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Did you open the docs? It shows how in each jwe example. Also, Buffer instances are Uint8Arrays in Node. All you have to do in node is pass The API intentionally only accepts and returns UInt8Array so that it does not have to deal with encoding. |
Beta Was this translation helpful? Give feedback.
-
It's work I read the docs, but I'm not an expert in binary data or buffers |
Beta Was this translation helpful? Give feedback.
Did you open the docs? It shows how in each jwe example. Also, Buffer instances are Uint8Arrays in Node.
All you have to do in node is pass
Buffer.from(yourString)
, alternatively, if your string uses encoding other than utf-8, passBuffer.from(yourString, encoding)
.The API intentionally only accepts and returns UInt8Array so that it does not have to deal with encoding.