auth/bootstrap_routes.ts view source
ZodObject<{ token: ZodString; username: ZodString; password: ZodString; }, $strict> Input for POST /bootstrap. token is the one-shot token file contents.
Bootstrap route spec for first-time account creation.
One-shot endpoint: exchanges a bootstrap token + credentials for an account with keeper privileges and a session cookie.
7 declarations
auth/bootstrap_routes.ts view source
ZodObject<{ token: ZodString; username: ZodString; password: ZodString; }, $strict> Input for POST /bootstrap. token is the one-shot token file contents.
auth/bootstrap_routes.ts view source
ZodObject<{ ok: ZodLiteral<true>; username: ZodString; }, $strict> Output for POST /bootstrap. Session cookie is the operative side effect.
auth/bootstrap_routes.ts view source
BootstrapRouteOptions Per-factory configuration for bootstrap route specs.
bootstrap_status is runtime state (a mutable ref), not a dep or options value —
it is passed through so the route handler can flip it on success.
session_optionsSessionOptions<string>bootstrap_statusShared mutable reference — flipped to false after successful bootstrap.
on_bootstrapCalled after successful bootstrap (account + session created). Use for app-specific post-bootstrap work like generating API tokens.
(result: BootstrapAccountSuccess, c: Context) => Promise<void>ip_rate_limiterRate limiter for bootstrap attempts (per-IP). Pass null to disable.
RateLimiter | nullauth/bootstrap_routes.ts view source
BootstrapStatus Bootstrap status — runtime state computed once at startup.
availablebooleantoken_pathstring | nullauth/bootstrap_routes.ts view source
(deps: CheckBootstrapStatusDeps, options: { token_path: string | null; }): Promise<BootstrapStatus> Check bootstrap availability at startup.
Bootstrap is available when:
1. A token path is configured
2. The token file exists on disk
3. The bootstrap_lock table shows bootstrapped = false
depsfilesystem and database access for the check
optionsstatic configuration including token_path
{ token_path: string | null; }Promise<BootstrapStatus> an object with available (boolean) and token_path (string | null)
auth/bootstrap_routes.ts view source
CheckBootstrapStatusDeps Dependencies for checking bootstrap status at startup.
stat(path: string) => Promise<StatResult | null>dblogLoggerauth/bootstrap_routes.ts view source
(deps: RouteFactoryDeps, options: BootstrapRouteOptions): RouteSpec[] Create bootstrap route specs for first-time account creation.
depsstateless capabilities including filesystem access
optionsper-factory configuration (session, token path, bootstrap status)
RouteSpec[] route specs (not yet applied to Hono)