# kripta-js

> A tiny asymmetric/symmetric encryption lib for humans.

Latest version **0.1.5** (published 2022-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install kripta-js
pnpm add kripta-js
yarn add kripta-js
bun add kripta-js
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2022-05-28 |
| First published | 2022-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | sanix-darker |
| Maintainers | sanix-darker |
| Keywords | AES, RSA, encryption, decryption |

## Links

- npm: https://www.npmjs.com/package/kripta-js
- Repository: https://github.com/Sanix-Darker/kripta-js
- Homepage: https://github.com/Sanix-Darker/kripta-js#readme
- Issues: https://github.com/Sanix-Darker/kripta-js/issues
- npm.io page: https://npm.io/package/kripta-js

## Dependencies (4)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [keypair](https://npm.io/package/keypair.md) ^1.0.4
- [node-forge](https://npm.io/package/node-forge.md) ^1.3.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

- 0.1.5 (latest) — 2022-05-28
- 0.1.4 — 2022-05-26
- 0.1.3 — 2022-05-26
- 0.1.2 — 2022-05-26
- 0.1.1 — 2022-05-26
- 0.1.0 — 2022-05-26

## README

# kripta-js

An simple implementation of a Symmetric(AES) and Asymmetric(RSA) encryption for humans.

## Features

- Generate RSA keys like
- Encrypt/Decrypt messages, files, binaries on symmetric or asymmetric

## How to use

- Install the lib
```bash
yarn add kripta-js
# or
npm install kripta-js
```

- To use the **symmetric encryption** (AES):
    - Schema :

        <img
            src="https://github.com/Sanix-Darker/kripta/raw/master/images/s.png"
            alt="drawing"
            width="400"
        />
    - Code :
        ```javascript
        import {KriptaAES} from "kripta-js";

        const message = "secret-message"
        const secret_key = "secret-code-password"

        const k = KriptaAES()
        // to encrypt
        const encrypted_msg = k.encrypt(message, secret_key)

        // to decrypt
        console.log(k.decrypt(encrypted_msg1, secret_key).decode())
        // secret-message 
        ```

    - Some methods and their Inputs/Outputs
        | function     	| params & types                                 | return type   |
        | -------	    | -------	                                     | -------	     |
        | encrypt       | message(Buffer|str), secret_key(str)           | str           |
        | decrypt       | encrypted_messsage(Buffer|str), secret_key(str)| str           |
        | encryptFile   | path_of_file(str),  password(str)              | str           |
        | decryptFile   | path_of_encrypted_file(str), password(str)     | str           |

- To use an **asymmetric encryption** (RSA):
    - Schema :

        <img
            src="https://github.com/Sanix-Darker/kripta/raw/master/images/as.gif"
            alt="drawing"
            width="400"
        />
    - Code example:
        ```javascript
        import {KriptaRSA} from "kripta-js";

        const message = "secret-message"
        const pub_key = `-----BEGIN PUBLIC KEY-----
        ....
        -----END PUBLIC KEY-----`

        const k = KriptaRSA()
        k.setPublicKey(pub_key)
        // To encrypt a message
        const encrypted_msg = k.encrypt(k.getPublicKey(), message.encode())

        const priv_key = `-----BEGIN RSA PRIVATE KEY-----
        .....
        -----END RSA PRIVATE KEY-----`

        k.setPrivateKey(priv_key)
        // To decrypt
        console.log(k.decrypt(encrypted_msg).decode())
        // secret-message 
        ```
    - Some methods and their Inputs/Outputs
        | function     	| params & types                  | return type   |
        | -------	    | -------	                      | -------	      |
        | encrypt       | publicKey(str), message(str)    | str           |
        | setPublicKey  | publicKey(str)                  | str           |
        | setPrivateKey | privateKey(str)                 | str           |
        | decrypt       | encrypted_messsage(Buffer|str)  | str           |

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