@ngriffin_uk/auth-crypto
v1.1.1
Published
Runtime-neutral authentication cryptography primitives
Readme
@ngriffin_uk/auth-crypto
Runtime-neutral Web Crypto helpers for AES-GCM keyrings, secure randomness, SHA-2, HMAC, constant-time comparison, RSA, and ECDSA.
pnpm add @ngriffin_uk/auth-cryptoimport {
constantTimeEqual,
randomBytes,
sha256,
} from "@ngriffin_uk/auth-crypto";
const token = randomBytes(32);
const digest = await sha256(token);
const matches = constantTimeEqual(digest, expectedDigest);The package requires globalThis.crypto and fails closed when secure
cryptography is unavailable. Prefer the higher-level auth packages unless you
are implementing a protocol.
