Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robbestad/security
https://github.com/robbestad/security
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/robbestad/security
- Owner: robbestad
- Created: 2021-06-12T08:20:47.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-27T17:25:13.000Z (over 3 years ago)
- Last Synced: 2024-11-20T23:16:31.744Z (about 1 month ago)
- Language: JavaScript
- Size: 76.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @svenanders/security
Node.js package for handling hashing of passwords and encryption/decryption of data
* Encrypt and Decrypt
Provide `ENCRYPTION_KEY` through env.
```
import {Encrypt, Decrypt} from "@svenanders/security"
Encrypt(text_to_encrypt) // -> returns encrypted text
Verify(encryped_text) // -> returns original text
```* Hash and Verify
Uses `pbkdf2Sync` and `sha512`
```
import {Hash, Verify} from "@svenanders/security"
Hash(input_password) // -> {hash, salt} (to be stored in db)
Verify(hash, input_password, salt) // -> true if input_password can be verified
```* Email validation
```
import {ValidateEmail} from "@svenanders/security"
ValidateEmail(email) // -> true if email validates
```