1.0.5 • Published 5 years ago

simple-asym-crypto v1.0.5

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

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"
1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago