JSPM

@hazae41/chacha20

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 239
  • Score
    100M100P100Q51832F

ChaCha20 adapter for WebAssembly and JS implementations

Package Exports

  • @hazae41/chacha20

Readme

ChaCha20

ChaCha20 for the web

npm install @hazae41/chacha20

📦 NPM

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Usage

const key = crypto.getRandomValues(new Uint8Array(32))
const nonce = crypto.getRandomValues(new Uint8Array(12))

const encryptor = chacha20.Cipher.import(key, nonce)
const decryptor = chacha20.Cipher.import(key, nonce)

const message = new TextEncoder().encode("Hello world")

const encrypted = encryptor.feed(message)
const decrypted = decryptor.feed(encrypted)