lazyxchacha
v1.0.1
Published
Lazy XChaCha20-Poly1305 in JS
Downloads
19
Readme
lazyxchacha
Lazy XChaCha20-Poly1305 in JS base on stablelib: XChaCha20Poly1305.
Algorithm details
- Key exchange: X25519
- Encryption: XChaCha20
- Authentication: Poly1305
import * as xChaCha from 'lazyxchacha'
const clientKp = xChaCha.generateKeyPair();
const serverKp = xChaCha.generateKeyPair();
const clientSharedKey = xChaCha.sharedKey(clientKp.sk, serverKp.pk);
const serverSharedKey = xChaCha.sharedKey(serverKp.sk, clientKp.pk);
const message = 'Hello';
const ciphertext = xChaCha.encrypt(message, clientSharedKey);
const plaintext = xChaCha.decrypt(ciphertext, serverSharedKey);