Overview
Encrypt and decrypt sensitive data. Use for storing secrets, tokens, or PII.
Features
- AES-256-GCM encryption
- Automatic IV generation
- Authentication tag verification
- Base64 output format
Installation
npx hanma add crypto
Code
// Source code not available
Usage
import { encrypt, decrypt } from './utils/crypto';
const encrypted = encrypt('secret data');
const decrypted = decrypt(encrypted);
Dependencies
No external dependencies required.
Frequently Asked Questions
How do I install Encryption Utilities?
Run the following command:
npx hanma add cryptoHow do I use this snippet?
Copy the code and paste it into your project. The snippet will be saved to
utils/crypto.ts.Can I customize this snippet?
Yes! All snippets are copy-paste code that you own. Feel free to modify them to fit your needs.
Does this work with other frameworks?
This snippet is designed for the specific framework. Check the other framework pages for equivalent implementations.