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 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, "/"> testing/auth_apps.ts view source
(role?: string | undefined): RequestContext Create a mock RequestContext with optional role role_grant.
role?string | undefinedRequestContext 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: { account: "none" | "optional" | "required"; actor: "none" | "optional" | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; }): Hono<...> Select the Hono test app with correct auth for a route.
appsauth{ account: "none" | "optional" | "required"; actor: "none" | "optional" | "required"; roles?: readonly string[] | undefined; credential_types?: readonly string[] | undefined; }Hono<BlankEnv, BlankSchema, "/"> Error - if `auth.roles` names a role not present in `apps.by_role` —