user-key-crypto
Version:
A simple and secure Node.js library to encrypt and decrypt data using user-defined secret keys. Perfect for privacy-focused applications.
65 lines (44 loc) โข 1.33 kB
Markdown
and secure Node.js library to encrypt and decrypt data using **user-defined secret keys**. Perfect for applications where **privacy and user-level encryption** is critical.
```bash
npm install user-key-crypto
```
```js
const { encrypt, decrypt } = require('user-key-crypto');
// Encrypt and decrypt
const encrypted = encrypt('Secret Info','mySecretKey##45');
console.log('Encrypted:', encrypted);
const decrypted = decrypt(encrypted,'mySecretKey##45');
console.log('Decrypted:', decrypted);
```
```js
const { encrypt } = require('user-key-crypto');
try {
const encrypted = encrypt('data',688); // Throws error if key is not string
} catch (err) {
console.error(err.message); // Secret must be a string
}
```
```bash
npm test
```
- AES-256-GCM encryption
- PBKDF2 key derivation
- Random salt, IV, and auth tag
- Stateless utility functions
- Fully error-handled
- End-to-end encrypted messaging
- User-level encryption in databases
- Secure configuration handling
- crypto (Native Node.js)
MIT
[ ](https://github.com/Abdul-Wahab-Abbasi) โข [LinkedIn](https://linkedin.com/in/web-crafter)
A simple