auth-engine
Enforces standard implementation patterns for QAuth credential providers and token claims.
Install
mkdir -p .claude/skills/auth-engine && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11982" && unzip -o skill.zip -d .claude/skills/auth-engine && rm skill.zipInstalls to .claude/skills/auth-engine
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Auth engine rules for QAuth. Use when working with CredentialProvider implementations, token claim generation, the provider registry, or the federation layer. Enforces the pluggable provider pattern and correct token claim behaviour.Key capabilities
- →Verify credential provider input
- →Extract user attributes from verified identity
- →Issue tokens with user ID as subject
- →Manage token claims (sub, email, acr)
- →Resolve claims based on source trust level
- →Handle password hashing with Argon2id
How it works
The auth engine looks up credentials, passes data to `provider.verify()`, receives `VerifiedIdentity`, upserts `user_attributes` from `provider.extractAttributes()`, and issues tokens with `sub = users.id`.
Inputs & outputs
When to use auth-engine
- →Implementing a new CredentialProvider
- →Verifying token claim logic
- →Registering authentication providers
- →Debugging federation layer issues
About this skill
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:
- Looks up the credential from
user_credentialsby(realm_id, provider_type, external_sub) - Passes credential data to
provider.verify() - Receives
VerifiedIdentity - Upserts
user_attributesfromprovider.extractAttributes() - 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 externalSubis the normalized email addressassuranceLevel: 'low'— noacrclaim in tokens
- Located at
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
- Skeleton shipped (#232):
Token Claims
sub: alwaysusers.id(UUID) — never email, neverexternal_subemail: fromuser_attributes WHERE attr_key='email' AND verified=true, highest-trust source OMIT entirely if no verified email — do not set nullacr: eIDAS assurance level fromVerifiedIdentity.assuranceLevelOmit for password credentials (assuranceLevel: 'low'→ noacrclaim)- 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
Crypto
All signing, hashing, and key operations go through libs/server/jwt/ and libs/server/password/.
Never implement crypto directly in TypeScript service code.
The libs/server/password/ library wraps Argon2id for password hashing — use it via
the passwordHasher Fastify decorator. Do not call Argon2 directly.
Phase Status
- Phase 1 (email/password + OAuth 2.1 / OIDC): COMPLETE after identifier-abstraction refactor
- Phase 2 (Developer Portal): IN PROGRESS — no new providers
- T4 (WalletProvider + OID4VP 1.0): ACTIVE (Epic #231; skeleton shipped in
#232, transport layer #233 first). The mechanism is
OID4VP 1.0, not SIOPv2 — HAIP 1.0 §5 mandates
response_type=vp_token, which excludes the Self-Issued ID Token. Do not implement SIOPv2. See ADR-004 § Spec status (2026-07-20); profile order is decided (#296 locked):oid4vp-1.0-basefirst,haip-1.0second. - The
PasswordProvideris permanent infrastructure, not a legacy path to be deprecated
When not to use it
- →When implementing provider-specific logic outside the provider registry
- →When implementing crypto directly in TypeScript service code
- →When calling Argon2 directly instead of using passwordHasher
Limitations
- →Does not contain provider-specific logic
- →Does not implement crypto directly in TypeScript service code
- →Does not allow direct calls to Argon2
How it compares
This skill enforces a pluggable `CredentialProvider` pattern and specific token claim behaviors, centralizing authentication logic and preventing provider-specific logic from scattering across service routes.
Compared to similar skills
auth-engine side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| auth-engine (this skill) | 0 | 4mo | No flags | Advanced |
| supabase-developer | 95 | 7mo | Review | Intermediate |
| supabase-mcp-integration | 13 | 8mo | Review | Advanced |
| better-auth-best-practices | 18 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
supabase-developer
daffy0208
Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.
supabase-mcp-integration
manutej
Comprehensive Supabase integration covering authentication, database operations, realtime subscriptions, storage, and MCP server patterns for building production-ready backends with PostgreSQL, Auth, and real-time capabilities
better-auth-best-practices
novuhq
Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.
nextjs-supabase-auth
davila7
Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.
better-auth
mrgoonie
Implement authentication and authorization with Better Auth - a framework-agnostic TypeScript authentication framework. Features include email/password authentication with verification, OAuth providers (Google, GitHub, Discord, etc.), two-factor authentication (TOTP, SMS), passkeys/WebAuthn support, session management, role-based access control (RBAC), rate limiting, and database adapters. Use when adding authentication to applications, implementing OAuth flows, setting up 2FA/MFA, managing user sessions, configuring authorization rules, or building secure authentication systems for web applications.
auth-patterns
davepoon
This skill should be used when the user asks about "authentication in Next.js", "NextAuth", "Auth.js", "middleware auth", "protected routes", "session management", "JWT", "login flow", or needs guidance on implementing authentication and authorization in Next.js applications.