crypter-url-safe
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Crypter - URL Safe

Description

Simple URL safe encryption and decryption. Uses AES-256-GCM with a random IV.

Use Cases

Encrypting and decrypting data in for a URL. Instead of having login?email=email you can have it be the encrypted version of the email. This is just a simple example but more secure than just having the email in the URL.

Warning ⚠️ Don't use for passwords

Use bcrypt for hashing passwords instead. Encrypting passwords is not the same as hashing them. This is not a password manager.

Secret Key

The secret key must be 32 bytes long. You can generate a random key with the following command.

openssl rand -hex 32

Usage

const Crypter = require('crypter-url-safe');
const crypter = new Crypter('db6a3d91aeaea2d91f69e91a6c033854b91d55e86393044bc9e7efb6e5bf5b2c');

const encrypted = crypter.encrypt('hello world'); // DB0Y5C38i32VVu9xk1nWY9qQ_YHo7V9UTF5hOecxHBDg57ibE7QvfGYk8p7EHo-jGv94_0iXyYEGDGPRDsrjv9z0iwHLWlT_t1PfcpC8SWGb6sXW64yblAiGOA
const decrypted = crypter.decrypt(encrypted);// hello world

Package Sidebar

Install

npm i crypter-url-safe

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

7.3 kB

Total Files

6

Last publish

Collaborators

  • kaitei