New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

simple-asym-crypto

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-asym-crypto

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

latest
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

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"

FAQs

Package last updated on 24 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts