oslo
This package is highly experimental - use at your own risk
A collection of utilities for auth, including:
oslo/cookie
: Cookie parsing and serializationoslo/crypto
: Generate hashes and signaturesoslo/encoding
: Encode base64, base64url, base32, hexoslo/jwt
: Create and verify JWTsoslo/oauth2
: OAuth2 helpersoslo/otp
: HOTP, TOTPoslo/password
: Password hashingoslo/random
: Generate cryptographically strong random valuesoslo/request
: CSRF protectionoslo/session
: Session managementoslo/webauthn
: Verify Web Authentication API attestations and assertions
Aside from oslo/password
, every module works in any environment, including Node.js, Cloudflare Workers, Deno, and Bun.
Documentation: https://oslo.js.org
Installation
npm i oslo
pnpm add oslo
yarn add oslo
Node.js
For Node.js 16 & 18, you need to polyfill the Web Crypto API. This is not required in Node.js 20.
import { webcrypto } from "node:crypto";
globalThis.crypto = webcrypto;
Alternatively, add the --experimental-global-webcrypto
flag when running Node.
node --experimental-global-webcrypto index.js