testing/auth_apps.ts view source
AuthTestApps Pre-built Hono apps for each auth level, shared across adversarial test suites.
public
Honoauthed
Honokeeper
Honoby_role
Map<string, Hono>Auth test app factories for adversarial testing.
Creates Hono test apps at each auth level (public, authenticated, keeper, per-role) for use in adversarial auth enforcement and input validation tests.
6 declarations
testing/auth_apps.ts view source
AuthTestApps Pre-built Hono apps for each auth level, shared across adversarial test suites.
publicHonoauthedHonokeeperHonoby_roleMap<string, Hono>testing/auth_apps.ts view source
(route_specs: RouteSpec[], roles: string[]): AuthTestApps Create one Hono test app per auth level.
route_specsthe route specs to register
RouteSpec[]rolesall roles in the app
string[]AuthTestApps apps keyed by auth level
testing/auth_apps.ts view source
(route_specs: RouteSpec[], auth_ctx?: RequestContext | undefined, credential_type?: "session" | "api_token" | "daemon_token" | undefined): Hono<BlankEnv, BlankSchema, "/"> Create a Hono test app from route specs with optional auth context.
route_specsthe route specs to register
RouteSpec[]auth_ctx?optional request context to inject via middleware
RequestContext | undefinedcredential_type?optional credential type (default: 'session' when auth_ctx provided)
"session" | "api_token" | "daemon_token" | undefinedHono<BlankEnv, BlankSchema, "/"> a configured Hono app
testing/auth_apps.ts view source
(role?: string | undefined): RequestContext Create a mock request context with optional role permit.
role?optional role to grant
string | undefinedRequestContext a valid RequestContext
testing/auth_apps.ts view source
(path: string): string Replace Hono route params (:foo) with dummy values for HTTP testing.
pathstringstring testing/auth_apps.ts view source
(apps: AuthTestApps, auth: RouteAuth): Hono<BlankEnv, BlankSchema, "/"> Select the Hono test app with correct auth for a route.
appsthe pre-built auth test apps
auththe route's auth options
Hono<BlankEnv, BlankSchema, "/"> the correctly-authenticated Hono app