auth-engine

A set of rules for the core authentication engine, the part of a system that verifies login credentials and creates identity tokens. It defines how different credential providers plug in and how verified users and their attributes are handled.

In plain words
What is it for?
Use it when adding credential providers, changing token claims, updating the provider registry, or working on authentication federation.
Why use it?
It keeps provider-specific login logic out of shared services and ensures tokens identify the correct user consistently.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/qauth-labs/qauth/auth-engine
Any agent
npx skills add qauth-labs/qauth --skill auth-engine
Clone the repo
git clone --depth 1 https://github.com/qauth-labs/qauth

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 872 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.00872
Opus 5 $0.00023 $0.00436
Sonnet 5 $0.00009 $0.00174
Haiku 4.5 $0.00005 $0.00087

Measured 2d ago against content hash b213ef930f0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

auth-engine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/auth-engine/SKILL.md · 83 lines

How it starts

The opening of the file, as written. The whole thing — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Auth Engine Rules

You are working in the QAuth authentication core.

CredentialProvider Pattern

Every authentication method implements the CredentialProvider interface:

// libs/server/federation/src/providers/credential-provider.interface.ts
export interface CredentialProvider {
  readonly type: string;
  verify(input: unknown): Promise<VerifiedIdentity>;
  extractAttributes(result: VerifiedIdentity): UserAttribute[];
}

The auth engine:

  1. Looks up the credential from user_credentials by (realm_id, provider_type, external_sub)
  2. Passes credential data to provider.verify()
  3. Receives VerifiedIdentity
  4. Upserts user_attributes from provider.extractAttributes()
  5. Issues tokens with sub = users.id

The engine does not contain provider-specific logic. Switch/case on provider_type belongs only in the provider registry, not in service routes.

Current Providers

  • PasswordProvider (provider_type: 'password') — Phase 1, COMPLETE
    • Located at libs/server/federation/src/providers/password.provider.ts
    • externalSub is the normalized email address
    • assuranceLevel: 'low' — no acr claim in tokens
  • WalletProvider (provider_type: 'wallet') — T4, IN PROGRESS (Epic #231)
    • Skeleton shipped (#232): libs/server/federation/src/providers/wallet.provider.ts
    • verify() throws by design until a validated OID4VP presentation exists — proving key possession is not authentication (see #233); do not wire it into a login path yet

Token Claims

  • sub: always users.id (UUID) — never email, never external_sub
  • email: from user_attributes WHERE attr_key='email' AND verified=true, highest-trust source OMIT entirely if no verified email — do not set null
  • acr: eIDAS assurance level from VerifiedIdentity.assuranceLevel Omit for password credentials (assuranceLevel: 'low' → no acr claim)
  • All other claims: from user_attributes, same trust-ordered resolution

Claim Resolution

// Claim resolution order by source trust level
// wallet > oidc_* > self_reported
const emailAttr = await fastify.repositories.userAttributes.findVerifiedByUserIdAndKey(
  userId,
  'email'
);
// Returns undefined if no verified email → omit claim from token

Read the full file on GitHub · 83 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 83 lines · 45 tokens per session scan A b213ef930f0a

Subscribe to this mod's changes

auth-engine is a skill published in the GitHub repository qauth-labs/qauth (24 stars, last pushed 7d ago), licensed Apache-2.0. It adds 45 tokens to every session and 872 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.