A
Private email discovery
Rejected addresses receive the same success-shaped response without code delivery or user creation.
A focused email-code and passkey foundation for Santiago-owned Cloudflare applications. Better Auth handles the protocol; each product decides who may sign in and keeps its own users, sessions, secrets, cookies, and recovery path.
Available on npm as experimental 0.x. Pin the version and keep the existing login and recovery path while verifying a consumer on its real origin.npm package page
Architecture
The reusable layer stays deliberately narrow. Product authorization and operational recovery remain local.
Reject unexpected origins and identities before protocol handlers touch state.
Better Auth manages hashed email codes, sessions, and WebAuthn verification.
Cloudflare D1 stores rate limits and authentication records for one application only.
The consuming product resolves the session and applies its own domain permissions.
Security posture
Controls are explicit in code and tests so a consumer can review the boundary before adopting it.
A
Rejected addresses receive the same success-shaped response without code delivery or user creation.
B
Discoverable credentials and user verification are required for the exact application hostname.
C
Limits are persisted in D1 instead of disappearing whenever a Worker isolate is recycled.
D
Non-local origins require HTTPS and secure cookies. Unsafe requests require an exact Origin match.
Integration
The package is public for controlled evaluation. Copy the canonical D1 schema into an app-owned additive migration, configure exact browser and auth server origins, then validate email delivery and passkeys before cutting over.
Read the multi-user integration guideCheck npm publication statuspnpm add @santi020k/auth-cloudflare hononpm install @santi020k/auth-cloudflare honoimport { createOwnerAuth } from
"@santi020k/auth-cloudflare";
app.all("/api/auth/*", (context) => {
const ownerAuth = createOwnerAuth({
appName: "Example owner workspace",
applicationOrigin: context.env.APPLICATION_ORIGIN,
authServerURL: context.env.AUTH_SERVER_URL,
cookiePrefix: "example-owner",
database: context.env.AUTH_DB,
ownerEmail: context.env.OWNER_EMAIL,
secret: context.env.AUTH_SECRET,
sendVerificationOTP: ({ email, otp }) =>
sendLoginCode(context.env, email, otp),
waitUntil: (task) => {
context.executionCtx.waitUntil(task);
},
});
return ownerAuth.handler(context.req.raw);
});import { createOwnerAuthClient } from
"@santi020k/auth-cloudflare/client";
const authClient = createOwnerAuthClient({
authServerURL: env.PUBLIC_AUTH_SERVER_URL,
});import { createOwnerAuthMiddleware } from
"@santi020k/auth-cloudflare/hono";
app.use("/account/*",
createOwnerAuthMiddleware((context) =>
createOwnerAuthForContext(context),
),
);Release discipline
The repository can prove package behavior and publish an experimental release. Consumer-origin evidence is still required before calling an integration production-ready or the package stable.
Designed for controlled adoption