Skip to content

encrypt-rsaProtect your data. Keep your code simple.

RSA encryption, authenticated JSON, and signed messages with one async API for Node.js and browsers.

encrypt-rsa

From install to encrypted JSON ​

bash
npm install encrypt-rsa
ts
import NodeRSA from 'encrypt-rsa';

const rsa = new NodeRSA();
const { publicKey, privateKey } = await rsa.createPrivateAndPublicKeys(2048);

const text = await rsa.encryptJSON({
  value: { message: 'Hello, العربية 😀' },
  publicKey,
});
const value = await rsa.decryptJSON({ text, privateKey });

JSON uses authenticated v1 hybrid encryption with RSA-OAEP/SHA-256. Keep private keys in trusted application storage and validate decrypted data before using it.

Follow the setup guide → · Read the complete API →

Released under the MIT License.