alepha@docs:~/framework/docs/packages/alepha$
cat security.md | pretty2 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
AuthenticatorDataParser- Parses authenticator data: RP ID hash (32 bytes), flags (1), sign counterBase64Url- Base64url (RFC 4648 section 5, no padding) to bytes and back, withatobCborDecoder- Decodes the CBOR subset WebAuthn uses (RFC 8949): unsigned and negativeCoseKey- COSE public keys (RFC 9052, 9053) to JWK, and signature checks with thatEffectivePermissionsProvider- The caller's effective permission set, computed once, server-side.JwtProvider- Provides utilities for working with JSON Web Tokens (JWT).OwnedResourceProvider- Reads the resource resolved by$ownsfor the current request.PermissionRegistryProvider- Answers "does the caller hold this permission?" from the set the server sentResourceGateMemoProvider- Request-scoped memo for the reads$ownsperforms to make its decision.ResourceGrantsProvider- The seam between$ownsand whatever decides what a member may doWebAuthnVerifier- Verifies WebAuthn registrations and assertions withcrypto.subtleandWebhookSigner- Signs webhook requests the Standard Webhooks wayWebhookVerifier- Verifies a Standard Webhooks request (https://www.standardwebhooks.com),