1.7.0 • Published 8 months ago

@melkir/crypto v1.7.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Crypto

Simple aes-256-gcm encryption and decryption module for NodeJS.

Install

npm install @melkir/crypto

Usage

import { randomBytes } from "node:crypto";
import { decrypt, encrypt } from "@melkir/crypto";

// The key must contain exactly 32 characters.
// The following instruction generates one randomly which you can then save in your environment variables.
const key = randomBytes(16).toString("hex");

const message = "Shh its a seekrit";
const encrypted = encrypt(message, key);
// You can now send your encrypted message to anyone without worrying about it being intercepted.
// The person who receives your message will then be able to decipher the content in the following way.
const decrypted = decrypt(encrypted, key);

Credits

Thanks @vlucas for the gist.

1.7.0

8 months ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago