Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

dual-crypto

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dual-crypto

[![Build Status](https://travis-ci.org/hotwallet/dual-crypto.svg?branch=master)](https://travis-ci.org/hotwallet/dual-crypto)

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

dual-crypto

Build Status

Simple symmetric and asymmetric cryptography for the browser

Install

npm i dual-crypto

Usage

import DualCrypto from 'dual-crypto'

async () => {
  const secret = 'correct horse battery staple'
  const salt = 'my custom salt' // (optional) if secret is not unique, use a custom salt
  const dc = await DualCrypto({ secret, salt })
  const message = 'I am Satoshi Nakamoto'

  // asymmetric functions
  const publicKey = dc.getPublicKey()
  const signature = await dc.sign(message)
  const isAuthentic = await DualCrypto.verify({ publicKey, message, signature })

  // symmetric functions
  const encryptedMessage = await dc.encrypt(message)
  const decryptedMessage = await dc.decrypt(encryptedMessage)
}

License

MIT

FAQs

Package last updated on 18 Oct 2018

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