# @adorsys/crypto-codecs

> [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Travis](https://img.shields.io/travis/adorsys/crypto-codecs.svg)](https://travis-ci.org/adorsys/crypto-codecs) [![Coveralls](h

Latest version **3.0.0** (published 2018-08-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @adorsys/crypto-codecs
pnpm add @adorsys/crypto-codecs
yarn add @adorsys/crypto-codecs
bun add @adorsys/crypto-codecs
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2018-08-28 |
| First published | 2018-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 2 |
| Unpacked size | 10.3 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gunnar Radzom |
| Maintainers | gra |

## Links

- npm: https://www.npmjs.com/package/@adorsys/crypto-codecs
- Repository: https://github.com/adorsys/crypto-codecs
- Homepage: https://github.com/adorsys/crypto-codecs#readme
- Issues: https://github.com/adorsys/crypto-codecs/issues
- npm.io page: https://npm.io/package/@adorsys/crypto-codecs

## Dependencies (2)

- [hydration](https://npm.io/package/hydration.md) 1.0.0
- [node-jose](https://npm.io/package/node-jose.md) 1.0.0

## Recent versions

- 3.0.0 (latest) — 2018-08-28
- 2.0.1 — 2018-07-29
- 2.0.0 — 2018-07-29
- 0.0.0-development — 2018-07-29

## README

# Crypto Codecs

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Travis](https://img.shields.io/travis/adorsys/crypto-codecs.svg)](https://travis-ci.org/adorsys/crypto-codecs)
[![Coveralls](https://img.shields.io/coveralls/adorsys/crypto-codecs.svg)](https://coveralls.io/github/adorsys/crypto-codecs)
[![Dev Dependencies](https://david-dm.org/adorsys/crypto-codecs/dev-status.svg)](https://david-dm.org/adorsys/crypto-codecs?type=dev)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://paypal.me/radzom)

A project for encrypting and decrypting anything

### Features

 - Support for JWE (Json Web Encryption)
 - Promise based interfaces
 - Encrypting and Decrypting everything (number, string, boolean, array, date, regex, buffer, object)


### Installation

```bash
npm install @adorsys/crypto-codecs
```

### Usage

```js
import { codecs, util } from 'crypto-codecs'
// ...or
const { codecs, util } = require('../src')

// Without providing a key
codecs.jwe()
  .then(codec => {
    codec.encrypt({test: 42})
      .then(cipher => codec.decrypt(cipher))
      .then(value => value) // {test: 42}
  })
  .catch(err => console.log(err))

// With providing a key
let Key
util.jwk.generate()
  .then(k => {
    // remember key for later use
    Key = k
    return codecs.jwe({Key})
  })
  .then(codec => codec.encrypt({test: 42}))
  .then(cipher => codecs.jwe({Key}).then(codec => codec.decrypt(cipher)))
  .then(value => value) // {test: 42}
  .catch(err => console.log(err))

``` 


### API

[@adorsys/crypto-codecs](https://adorsys.github.io/crypto-codecs/)

## Credits

Made with :heart: by [gradorsys](https://github.com/gradorsys) and all these wonderful contributors ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| <img src="https://avatars.githubusercontent.com/u/1225651?v=3" width="100px;"/><br /><sub><b>Francis Pouatcha</b></sub><br />🤔 | | | | | | |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!

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