# aes-256-gcm

> Simplifies encryption/decryption using the AES 256 GCM algorithm.

Latest version **1.0.3** (published 2018-07-14) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install aes-256-gcm
pnpm add aes-256-gcm
yarn add aes-256-gcm
bun add aes-256-gcm
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-07-14 |
| First published | 2018-02-26 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Anton Ivanov |
| Maintainers | anton-ivanov |
| Keywords | aes, aes-256-gcm, crypto, encryption, decryption, aes, aes-256 |

## Links

- npm: https://www.npmjs.com/package/aes-256-gcm
- Repository: https://github.com/catcher-in-the-try/aes-256-gcm
- Homepage: https://github.com/catcher-in-the-try/aes-256-gcm#readme
- Issues: https://github.com/catcher-in-the-try/aes-256-gcm/issues
- npm.io page: https://npm.io/package/aes-256-gcm

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-07-14
- 1.0.1 — 2018-07-12
- 1.0.0 — 2018-02-26

## README

# AES-256-GCM encryption/decryption shortcuts #

A static class that simplifies encryption/decryption using the AES 256 GCM algorithm.

Just use a one-liner to encrypt or decrypt - the IV and tag are handled
automatically.

## Example ##

```js
const Aes = require('aes-256-gcm');

// Must be 32 bytes.
const SHARED_SECRET = '12345678901234567890123456789012';

// Encrypt:
let { ciphertext, iv, tag } = Aes.encrypt('hi', SHARED_SECRET);

//   ciphertext: 'VOE='
//   iv: '0K6oPWsBAHLXYtLu5VAvsQ=='
//   tag: 'hCae3Lt5sAK3oNAnUh5emA==' 


// Decrypt:
let cleartext = Aes.decrypt(ciphertext, iv, tag, SHARED_SECRET;

// `cleartext` contains:
// 'hi'

```

## Methods ##

### static encrypt(text, secret) ###

Encrypts the `text` using the 256-bit shared key (`secret`) and returns an object
containing three base64-encoded strings:

```json
{ 
  "ciphertext": "(string)", 
  "iv": "(string)", 
  "tag": "(string)"
}
```

All of those strings must be passed to the end user to successfully decrypt the
text.

### static decrypt(ciphertext, iv, tag, secret) ###

Decrypts the `ciphertext` using the `iv` and authentication tag `tag` received
from the encryption function, and using the 256-bit shared key (`secret`).

Returns the decoded string.

---
_Source: https://npm.io/package/aes-256-gcm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
