alepha@docs:~/framework/docs/packages/alepha$
cat security.md | pretty
2 min read
Last commit: Nov 21, 2026

#Alepha - Security

#Installation

Part of the alepha package. Import from alepha/security.

npm install alepha

#Overview

Complete authentication and authorization system with JWT, RBAC, and multi-issuer support.

Features:

  • JWT token issuer with role definitions, access and refresh tokens
  • Multi-issuer support, JWKS and OIDC discovery for external issuers
  • $secure: issuers, roles, permissions and guards on any handler
  • $owns: resource-scoped authorization (owner, membership, grants)
  • Roles and permissions as primitives, wildcards, ownership and excludes
  • Permission scopes narrowing what a machine credential may do
  • HTTP Basic Authentication
  • Service-to-service authentication
  • Webhook signing and verification
  • WebAuthn (passkey) verification
  • User profile extraction from JWT

#API Reference

#Primitives

  • $basicAuth - Middleware that enforces HTTP Basic Authentication on the request.
  • $issuer - Create a new issuer.
  • $owns - Resource-scoped authorization gate.
  • $permission - Create a new permission.
  • $role - Create a new role.
  • $secure - Middleware that enforces authentication and authorization.
  • $serviceAccount - Allow to get an access token for a service account.

#Providers