simple-asym-crypto

1.0.5 • Public • Published

Simple Asymmetric Crypto

Lazy convenience wrapper around browser crypto API for asymmetric encryption with 2048 RSA

Installation

npm install simple-asym-crypto
import {pair, encrypt, decrypt} from "simple-asym-crypto";

Use

Asymmetric cryptography is a hugely complex and well-discussed topic, this is simply a convenient wrapper around the browser's native crypto API with some opinionated configuration.

SAC (simple-asym-crypto) uses RSA 2048 to generate a public/private key pair with pair()

let keys = await pair();
console.log(keys) // {pub: <superlong string>, priv: <even longer string>}

let encryptedText = await encrypt("This is a secret", keys.pub);
console.log(encryptedText) // gibberish stringified encrypted array

let decryptedText = await decrypt(encryptedText, keys.priv);
console.log(decryptedText) // "This is a secret"

Readme

Keywords

none

Package Sidebar

Install

npm i simple-asym-crypto

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

6.19 kB

Total Files

3

Last publish

Collaborators

  • danknotdank