Simon Axelsson admin
  • https://siax.io
  • Process optimisation, operational improvement and automation. Founder of SIAX Technology AB. Business workflows, data, BI and system integration.

  • Joined on 2026-07-02

@siax/auth-core (0.1.0)

Published 2026-11-11 16:14:30 +00:00 by admin

Installation

@siax:registry=https://git.siax.app/api/packages/admin/npm/
npm install @siax/[email protected]
"@siax/auth-core": "0.1.0"

About this package

Canonical Principal/AuthContext/NormalizedIdentity types + provider-neutral authorization primitives (hasRole/hasScope/hasCapability) for the SIAX estate (ADR-025). Zero Zitadel (or any other IdP) awareness -- provider-specific claim parsing lives in adapter packages like @siax/auth-zitadel, never here, so the IdP can change without touching this package or its consumers. No business authorization (isAdmin/canApproveInvoice-shaped helpers) belongs here either -- that is CL0UD/policy-engine territory. Node ESM (`.mjs`), Node >= 20 -- same convention as @siax/idempotency, @siax/outbox, @siax/workload-auth, @siax/schemas.

@siax/auth-core

Canonical Principal/AuthContext/NormalizedIdentity types and provider-neutral authorization primitives for the SIAX estate. See ADR-025 for the full decision record and rationale.

What this package is

  • The one frozen shape every @siax/auth-* package and consumer reads: AuthContext (principal, tenant, authorization, authentication, delegation).
  • NormalizedIdentity — the narrower shape a provider adapter (e.g. @siax/auth-zitadel) produces directly from verified claims, before any policy/capability resolution.
  • Three pure predicates: hasRole, hasScope, hasCapability — plain membership checks over ctx.authorization. Plus isDelegated / effectiveActor for the delegation chain (agents acting under a human's or workload's authority).

What this package deliberately is NOT

  • Not provider-aware. Zero Zitadel (or any other IdP) URNs, claim names, HTTP, or JWKS/introspection code. That is @siax/auth-zitadel's job — swapping or upgrading the IdP never touches this package.
  • Not a business-authorization layer. No isAdmin(), isBillingAdmin(), canApproveInvoice(). roles/scopes/capabilities are opaque string sets here; their vocabulary and meaning belong to CL0UD's policy engine or a product's own capability table.
  • Not a session/cookie/token-storage library. No cookies, no Next.js middleware, no CLI, no credential broker. Those are later, separate packages (@siax/auth-node, @siax/auth-next, @siax/auth-cli, the credential-broker daemon) — see ADR-025 §2.

Usage

import { hasRole, hasScope, hasCapability, effectiveActor } from '@siax/auth-core';

if (!hasCapability(ctx, 'b00k.invoice.create')) {
  throw forbidden();
}

// Audit trail: who is REALLY responsible, even through an agent delegation.
auditLog.record({ actor: effectiveActor(ctx), action: 'invoice.create' });

ctx here is an AuthContext your transport layer built from a NormalizedIdentity (e.g. @siax/auth-zitadel's normalizeZitadelClaims()) plus resolved capabilities — this package does not construct one for you.

Details
npm
2026-11-11 16:14:30 +00:00
558
UNLICENSED
latest
4.7 KiB
Assets (1)
Versions (1) View all
0.1.0 2026-11-11