# @distributed/aes

> Small encryption library used by Distributed services and applications

Latest version **1.1.5** (published 2024-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @distributed/aes
pnpm add @distributed/aes
yarn add @distributed/aes
bun add @distributed/aes
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2024-05-21 |
| First published | 2020-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gomah |
| Maintainers | gomah |

## Links

- npm: https://www.npmjs.com/package/@distributed/aes
- Repository: https://github.com/distributedvc/aes
- Homepage: https://github.com/distributedvc/aes#readme
- Issues: https://github.com/distributedvc/aes/issues
- npm.io page: https://npm.io/package/@distributed/aes

## Recent versions

- 1.1.5 (latest) — 2024-05-21
- 1.1.4 — 2024-03-02
- 1.1.1 — 2022-09-01
- 1.1.0 — 2022-08-26
- 1.0.6 — 2022-04-05
- 1.0.5 — 2021-07-14
- 1.0.4 — 2021-06-16
- 1.0.3 — 2020-10-25
- 1.0.2 — 2020-08-26
- 1.0.0 — 2020-06-22

## README

<h1 align="center">
  @distributed/aes
</h1>

<p align="center">
  <a href="https://prettier.io">
    <img src="https://img.shields.io/badge/code_style-prettier-0a0a0a.svg?style=flat-square" alt="Code Style" />
  </a>

  <a href="https://npmjs.com/package/@distributed/aes">
    <img src="https://img.shields.io/npm/v/@distributed/aes/latest.svg?style=flat-square" alt="npm version" />
  </a>

  <a href="https://opensource.org/licenses/MIT">
    <img src="https://img.shields.io/badge/License-MIT-black.svg?style=flat-square" alt="License MIT" />
  </a>

  <br />

  <a href="https://david-dm.org/distributed/aes">
    <img src="https://david-dm.org/distributed/aes/status.svg?style=flat-square" alt="dependencies" />
  </a>

  <a href="https://circleci.com/gh/distributedvc/aes">
    <img src="https://circleci.com/gh/distributedvc/aes.svg?style=shield" alt="Circle CI" />
  </a>

  <a href="https://npmjs.com/package/@distributed/aes">
    <img src="https://img.shields.io/npm/dt/@distributed/aes.svg?style=flat-square" alt="npm downloads" />
  </a>

  <a href="https://packagephobia.now.sh/result?p=@distributed/aes">
    <img src="https://flat.badgen.net/packagephobia/install/@distributed/aes" alt="Package Phobia" />
  </a>

  <a href="https://bundlephobia.com/result?p=@distributed/aes">
    <img src="https://flat.badgen.net/bundlephobia/minzip/@distributed/aes" alt="Bundle Phobia" />
  </a>

</p>

> Package to encrypt & decrypt strings using `aes-256-gcm`.

### Install

With yarn:

```bash
yarn add @distributed/aes
```

With npm:

```bash
npm install @distributed/aes
```

## Usage

Don't use this package to encrypt your passwords, use hashing algorithms like [argon2](https://github.com/ranisalt/node-argon2) or [bcrypt](https://github.com/kelektiv/node.bcrypt.js) instead.

```ts
import { encrypt, decrypt } from '@distributed/aes';

const key = 'secureKey';

const encrypted = encrypt(key, 'foo'); // 4lxXNMY0dxjTLtP2i8KV3Fe770+yaEj3KnGUPdKKHn0pgXo=
const decrypted = decrypt(key, encrypted); // foo
```

### Demo on the fly

```bash
# Encrypt
curl https://aes.distributed.sh/encrypt?key=secureKey&input=foo
# -> aWmlhjZpAn/vbhsN60zciuUMnNNyec8ow0mNNde/IbCgy0M=%

# Decrypt
curl -X https://aes.distributed.sh/decrypt?key=secureKey&input="aWmlhjZpAn/vbhsN60zciuUMnNNyec8ow0mNNde/IbCgy0M="
# -> foo
```

## Development

1. Install dependencies using `yarn install` or `npm install`
2. Start development server using `yarn watch`

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