# rsa-light

> RSA library that works on browser and node without any dependencies.

Latest version **1.0.0** (published 2021-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install rsa-light
pnpm add rsa-light
yarn add rsa-light
bun add rsa-light
```

## 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.0.0 |
| Published | 2021-03-26 |
| First published | 2021-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 510.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wonism |
| Maintainers | wonism |
| Keywords | crypt, encrypt, decrypt, rsa, RSA, ursa, forge, certificate, csr, tls, ssl, windows, mac, linux, key, jwk, node-rsa, zero-dependencies |

## Links

- npm: https://www.npmjs.com/package/rsa-light
- npm.io page: https://npm.io/package/rsa-light

## 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) — 2021-03-26

## README

# RSA Light

![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/wonism/rsa-light/test-release/main)
![npm](https://img.shields.io/npm/v/rsa-light)
![npm bundle size](https://img.shields.io/bundlephobia/min/rsa-light)

RSA library that works on browser and node without any dependencies.

## Installation

```sh
# npm
$ npm i -S rsa-light
# yarn
$ yarn add rsa-light
```
## Usage

```ts
// without signature
import RSA from 'rsa-light';

const rsaKey = RSA.generateRSAKey(512);
const publicKeyString = RSA.publicKeyString(rsaKey);

const encryptionResult = RSA.encrypt('Some Plain Text', publicKeyString);
const decryptionResult = RSA.decrypt(encryptionResult, rsaKey);

console.log(decryptionResult.plainText);
console.log(decryptionResult.signature);
```

```ts
// with signature
import RSA from 'rsa-light';

const rsaKey = RSA.generateRSAKey(512);
const publicKeyString = RSA.publicKeyString(rsaKey);

const signature = RSA.generateRSAKey(512);

const encryptionResult = RSA.encrypt('Some Plain Text', publicKeyString, signature);
const publicKeyId = RSA.publicKeyId(RSA.publicKeyString(signature));
const decryptionResult = RSA.decrypt(encryptionResult, rsaKey);

console.log(publicKeyId);
console.log(decryptionResult.plainText);
console.log(decryptionResult.signature);
console.log(decryptionResult.publicKey);
console.log(RSA.publicKeyString(signature));
console.log(RSA.publicKeyId(decryptionResult.publicKey));
```

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