New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@libn/aead

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libn/aead

XChaCha20-Poly1305 authenticated encryption and XChaCha20 stream cipher.

latest
Source
npmnpm
Version
0.4.2
Version published
Maintainers
1
Created
Source

@libn/aead

XChaCha20-Poly1305 authenticated encryption and XChaCha20 stream cipher.

default

ChaCha20-Poly1305 AEAD scheme with extended nonces.

import { cipher, decrypt, encrypt } from "@libn/aead";
import { assert, assertEquals, assertNotEquals } from "@std/assert";

const key = crypto.getRandomValues(new Uint8Array(32));
const plaintext = crypto.getRandomValues(new Uint8Array(100));
const data = crypto.getRandomValues(new Uint8Array(100));

const secret = encrypt(key, plaintext, data);
assert(secret);
assertEquals(decrypt(key, secret, data), plaintext);
assertEquals(decrypt(key, secret), null);

// Or stream directly
const ciphertext = new Uint8Array(plaintext);
const iv = crypto.getRandomValues(new Uint8Array(24));
cipher(key, iv, ciphertext);
assertNotEquals(ciphertext, plaintext);
cipher(key, iv, ciphertext);
assertEquals(ciphertext, plaintext);

FAQs

Package last updated on 15 Nov 2025

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