Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/robbestad/security


https://github.com/robbestad/security

Last synced: 20 days ago
JSON representation

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
```