0.0.2 • Published 6 years ago

dual-crypto v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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