Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/clubedaentrega/cipher

Encrypt/decrypt data using AES-128-GCM easily
https://github.com/clubedaentrega/cipher

Last synced: about 1 month ago
JSON representation

Encrypt/decrypt data using AES-128-GCM easily

Awesome Lists containing this project

README

        

# @clubedaentrega/cipher
Encrypt/decrypt data using [AES-128-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode) easily

## Install
`npm install @clubedaentrega/cipher --save`

## Usage
```js
// `key` is either a Buffer with 16 bytes or a hex-encoded-string
var key = ''
var cipher = require('@clubedaentrega/cipher')(key)

var cipherText = cipher.encrypt('some data')

var plainText = cipher.decrypt(cipherText) // 'some data'
var invalid = cipher.decrypt('invalid cipher text') // undefined
```

Create your encryption key with something like `crypto.randomBytes(16)`