npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@athsra/crypto

v0.1.0

Published

athsra core crypto — Argon2id KDF + AES-256-GCM (WebCrypto). Worker + CLI 공유. MIT.

Readme

@athsra/crypto

athsra core crypto primitives — Argon2id KDF + AES-256-GCM authenticated encryption. Worker + CLI 양쪽에서 동일 결과 보장 (WebCrypto + @noble/hashes).

E2EE secret manager athsra 의 cryptographic 기반.

설치

bun add @athsra/crypto

사용

import {
  deriveKey,
  encrypt,
  decrypt,
  randomSalt,
  randomNonce,
  toBase64,
  fromBase64,
  DEFAULT_KDF,
  type SecretEnvelope,
} from '@athsra/crypto';

// 1. Argon2id KDF (m=64MB, t=3, p=1, OWASP 2024+ 권고)
const password = 'master-password';
const salt = randomSalt();              // 16 bytes random
const key = deriveKey(password, salt);  // 32 bytes (AES-256 key)

// 2. AES-256-GCM encrypt
const blob = await encrypt(key, 'plaintext');
// blob = { ciphertext: Uint8Array, nonce: Uint8Array }

// 3. SecretEnvelope wire format (Worker R2 + CLI 호환)
const envelope: SecretEnvelope = {
  version: 1,
  alg: 'aes-256-gcm',
  kdf: 'argon2id',
  kdf_params: DEFAULT_KDF,
  salt: toBase64(salt),
  nonce: toBase64(blob.nonce),
  ciphertext: toBase64(blob.ciphertext),
  version_id: `v${Date.now()}`,
  updated_at: new Date().toISOString(),
};

// 4. Decrypt (다른 머신 / 시점)
const sameKey = deriveKey(password, fromBase64(envelope.salt));
const plain = await decrypt(sameKey, {
  ciphertext: fromBase64(envelope.ciphertext),
  nonce: fromBase64(envelope.nonce),
});
// plain === 'plaintext'

API

| Export | 설명 | |---|---| | deriveKey(password, salt) | Argon2id (m=64MB, t=3, p=1) → 32 bytes | | encrypt(key, plaintext) | AES-256-GCM → { ciphertext, nonce } (auth tag 포함) | | decrypt(key, blob) | auth tag 검증 후 plaintext. 실패 시 throw | | randomSalt() / randomNonce() | crypto.getRandomValues 16 / 12 bytes | | toBase64(uint8) / fromBase64(str) | wire encoding | | DEFAULT_KDF | { m: 65536, t: 3, p: 1 } | | SecretEnvelope (type) | wire format spec |

의존성

  • @noble/hashes — Argon2id (paulmillr audited, 0 deps, Cure53 부분 audit)
  • WebCrypto SubtleCrypto — AES-256-GCM (native, NIST SP 800-38D / FIPS 140-2 approved)

호환성

Worker (Cloudflare Workers / V8 isolate) + Bun + Node.js 18+ 모두 동일 결과. 같은 (password, salt) → 같은 key (deterministic).

License

MIT — see LICENSE-MIT.