# @flk/crypto

> Falak JS Encrypting and Decrypting data using crypto js.

Latest version **1.0.0** (published 2019-09-17) · 0 weekly downloads

## Install

```sh
npm install @flk/crypto
pnpm add @flk/crypto
yarn add @flk/crypto
bun add @flk/crypto
```

## 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.0 |
| Published | 2019-09-17 |
| First published | 2019-09-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Hasan Zohdy |
| Maintainers | hassanzohdy |
| Keywords | crypto, encryption, decryption, flk |

## Links

- npm: https://www.npmjs.com/package/@flk/crypto
- Repository: https://github.com/falakjs/@flk/crypto
- npm.io page: https://npm.io/package/@flk/crypto

## Dependencies (1)

- [crypto-js](https://npm.io/package/crypto-js.md) 3.1.9-1

## 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.0 (latest) — 2019-09-17

## README

# Crypto
A simple Encryption/Decryption handler.

> The current followed encryption algorithm is AES.

# Installation
`flk install flk-crypto`

OR 

`npm install flk-crypto`

Alias: `crypto`.

# Table of contents
- [Crypto](#crypto)
- [Installation](#installation)
- [Table of contents](#table-of-contents)
- [Usage](#usage)
- [Available methods](#available-methods)
  - [encrypt](#encrypt)
    - [Examples](#examples)
  - [Decrypt](#decrypt)
    - [Examples](#examples-1)
- [Configurations](#configurations)


# Usage

```javascript
  let crypto = DI.resolve('crypto');

  let encryptedValue = crypto.encrypt('hello world');
```

# Available methods
- [encrypt](#encrypt)
- [get](#get)
- [has](#has)
- [remove](#remove)
- [clear](#clear)

## encrypt

`encrypt(value: any): String`
Encrypt the given value.

This method accepts any type of values, it will be handled automatically, that means you can encrypt scalar values (`string|boolean|number`), arrays or objects.

### Examples

```javascript
  let crypto = DI.resolve('crypto');

  let encryptedValue = crypto.encrypt('hello world');

  // encrypt objects
  let user = {
    name: 'Hasan',
    age: 30,
  };

  let encryptedObject = crypto.encrypt(user);
```

## Decrypt

`decrypt(encodedValue: String): any|null`
Decrypt the given encoded value.

### Examples

```javascript
let user = crypto.decrypt('some-encoded-value');
```

# Configurations
Available configurations for `crypto` in [Application configurations](https://github.com/falakjs/config).

**Main Configuration key**: `crypto`

| key           | Type      |Description                                                                            |
| ------------- |  ------------- | -------------------------------------------------------------------------------------- |
| key | `String` | Set the encryption/decryption key, by default it is the current application name. |

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