@cichol/cryptography
v6.1.4
Published
A cryptography library providing various IES presets based on Web Crypto API for personal projects.
Downloads
986
Readme
@cichol/cryptography
A cryptography library providing various IES presets based on Web Crypto API for personal projects.
Table of Contents
Installation
$ npm install --save @cichol/cryptographyUsage
// For using default preset.
import { generateKeys, encrypt, decrypt } from '@cichol/cryptography/default'
// For using lightweight preset.
import { generateKeys, encrypt, decrypt } from '@cichol/cryptography/lightweight'
// For using post quantum preset.
import { generateKeys, encrypt, decrypt } from '@cichol/cryptography/post-quantum'
const [ publicKey, privateKey ] = await generateKeys()
const encryptedData = await encrypt('Hello, world!', publicKey)
await decrypt(encryptedData, privateKey) // 'Hello, world!'IES Presets
| Name | Key Agreement | Key Derivation | Symmetric Encryption |
|------|---------------|----------------|----------------------|
| default | ECDH (P-521) | HKDF (SHA-512) | AES-GCM (256bit) |
| lightweight | X25519 | HKDF (SHA-512) | ChaCha20-Poly1305 (256bit) |
| post-quantum | ML-KEM-1024 | HKDF (SHA-512) | ChaCha20-Poly1305 (256bit) |
