@linchkit/cap-auth
v1.0.0
Published
Authentication capability for LinchKit — provides the auth contract layer including schemas, actions (login, register, logout, refresh, API keys), middleware, and the `AuthProvider` interface. Concrete implementations are supplied by provider packages lik
Readme
@linchkit/cap-auth
Authentication capability for LinchKit — provides the auth contract layer including schemas, actions (login, register, logout, refresh, API keys), middleware, and the AuthProvider interface. Concrete implementations are supplied by provider packages like @linchkit/cap-auth-better-auth.
Installation
bun add @linchkit/cap-authPeer Dependencies
@linchkit/core^0.1.0
Usage
import { createCapAuth } from "@linchkit/cap-auth";
import { createBetterAuthProvider } from "@linchkit/cap-auth-better-auth";
const capAuth = createCapAuth({
provider: createBetterAuthProvider({ database: db }),
});Auth Middleware
import { createAuthMiddleware } from "@linchkit/cap-auth";
const middleware = createAuthMiddleware({
// options
});Schemas
import { userSchema, sessionSchema, tokenSchema, apiKeySchema } from "@linchkit/cap-auth";