@fuzdev/fuz_app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/actions/action_bridge.d.ts +65 -0
- package/dist/actions/action_bridge.d.ts.map +1 -0
- package/dist/actions/action_bridge.js +76 -0
- package/dist/actions/action_codegen.d.ts +97 -0
- package/dist/actions/action_codegen.d.ts.map +1 -0
- package/dist/actions/action_codegen.js +280 -0
- package/dist/actions/action_registry.d.ts +35 -0
- package/dist/actions/action_registry.d.ts.map +1 -0
- package/dist/actions/action_registry.js +83 -0
- package/dist/actions/action_spec.d.ts +169 -0
- package/dist/actions/action_spec.d.ts.map +1 -0
- package/dist/actions/action_spec.js +76 -0
- package/dist/auth/account_queries.d.ts +96 -0
- package/dist/auth/account_queries.d.ts.map +1 -0
- package/dist/auth/account_queries.js +172 -0
- package/dist/auth/account_routes.d.ts +86 -0
- package/dist/auth/account_routes.d.ts.map +1 -0
- package/dist/auth/account_routes.js +406 -0
- package/dist/auth/account_schema.d.ts +192 -0
- package/dist/auth/account_schema.d.ts.map +1 -0
- package/dist/auth/account_schema.js +105 -0
- package/dist/auth/admin_routes.d.ts +29 -0
- package/dist/auth/admin_routes.d.ts.map +1 -0
- package/dist/auth/admin_routes.js +193 -0
- package/dist/auth/api_token.d.ts +33 -0
- package/dist/auth/api_token.d.ts.map +1 -0
- package/dist/auth/api_token.js +36 -0
- package/dist/auth/api_token_queries.d.ts +80 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -0
- package/dist/auth/api_token_queries.js +116 -0
- package/dist/auth/app_settings_queries.d.ts +33 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -0
- package/dist/auth/app_settings_queries.js +51 -0
- package/dist/auth/app_settings_routes.d.ts +27 -0
- package/dist/auth/app_settings_routes.d.ts.map +1 -0
- package/dist/auth/app_settings_routes.js +66 -0
- package/dist/auth/app_settings_schema.d.ts +35 -0
- package/dist/auth/app_settings_schema.d.ts.map +1 -0
- package/dist/auth/app_settings_schema.js +22 -0
- package/dist/auth/audit_log_queries.d.ts +90 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -0
- package/dist/auth/audit_log_queries.js +205 -0
- package/dist/auth/audit_log_routes.d.ts +33 -0
- package/dist/auth/audit_log_routes.d.ts.map +1 -0
- package/dist/auth/audit_log_routes.js +106 -0
- package/dist/auth/audit_log_schema.d.ts +259 -0
- package/dist/auth/audit_log_schema.d.ts.map +1 -0
- package/dist/auth/audit_log_schema.js +123 -0
- package/dist/auth/bearer_auth.d.ts +32 -0
- package/dist/auth/bearer_auth.d.ts.map +1 -0
- package/dist/auth/bearer_auth.js +90 -0
- package/dist/auth/bootstrap_account.d.ts +82 -0
- package/dist/auth/bootstrap_account.d.ts.map +1 -0
- package/dist/auth/bootstrap_account.js +97 -0
- package/dist/auth/bootstrap_routes.d.ts +74 -0
- package/dist/auth/bootstrap_routes.d.ts.map +1 -0
- package/dist/auth/bootstrap_routes.js +154 -0
- package/dist/auth/daemon_token.d.ts +49 -0
- package/dist/auth/daemon_token.d.ts.map +1 -0
- package/dist/auth/daemon_token.js +49 -0
- package/dist/auth/daemon_token_middleware.d.ts +93 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -0
- package/dist/auth/daemon_token_middleware.js +167 -0
- package/dist/auth/ddl.d.ts +27 -0
- package/dist/auth/ddl.d.ts.map +1 -0
- package/dist/auth/ddl.js +111 -0
- package/dist/auth/deps.d.ts +52 -0
- package/dist/auth/deps.d.ts.map +1 -0
- package/dist/auth/deps.js +10 -0
- package/dist/auth/invite_queries.d.ts +68 -0
- package/dist/auth/invite_queries.d.ts.map +1 -0
- package/dist/auth/invite_queries.js +105 -0
- package/dist/auth/invite_routes.d.ts +18 -0
- package/dist/auth/invite_routes.d.ts.map +1 -0
- package/dist/auth/invite_routes.js +129 -0
- package/dist/auth/invite_schema.d.ts +51 -0
- package/dist/auth/invite_schema.d.ts.map +1 -0
- package/dist/auth/invite_schema.js +25 -0
- package/dist/auth/keyring.d.ts +87 -0
- package/dist/auth/keyring.d.ts.map +1 -0
- package/dist/auth/keyring.js +142 -0
- package/dist/auth/middleware.d.ts +40 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +64 -0
- package/dist/auth/migrations.d.ts +42 -0
- package/dist/auth/migrations.d.ts.map +1 -0
- package/dist/auth/migrations.js +79 -0
- package/dist/auth/password.d.ts +39 -0
- package/dist/auth/password.d.ts.map +1 -0
- package/dist/auth/password.js +25 -0
- package/dist/auth/password_argon2.d.ts +43 -0
- package/dist/auth/password_argon2.d.ts.map +1 -0
- package/dist/auth/password_argon2.js +76 -0
- package/dist/auth/permit_queries.d.ts +72 -0
- package/dist/auth/permit_queries.d.ts.map +1 -0
- package/dist/auth/permit_queries.js +116 -0
- package/dist/auth/request_context.d.ts +114 -0
- package/dist/auth/request_context.d.ts.map +1 -0
- package/dist/auth/request_context.js +176 -0
- package/dist/auth/require_keeper.d.ts +20 -0
- package/dist/auth/require_keeper.d.ts.map +1 -0
- package/dist/auth/require_keeper.js +35 -0
- package/dist/auth/role_schema.d.ts +69 -0
- package/dist/auth/role_schema.d.ts.map +1 -0
- package/dist/auth/role_schema.js +70 -0
- package/dist/auth/route_guards.d.ts +21 -0
- package/dist/auth/route_guards.d.ts.map +1 -0
- package/dist/auth/route_guards.js +32 -0
- package/dist/auth/session_cookie.d.ts +158 -0
- package/dist/auth/session_cookie.d.ts.map +1 -0
- package/dist/auth/session_cookie.js +135 -0
- package/dist/auth/session_lifecycle.d.ts +35 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -0
- package/dist/auth/session_lifecycle.js +27 -0
- package/dist/auth/session_middleware.d.ts +33 -0
- package/dist/auth/session_middleware.d.ts.map +1 -0
- package/dist/auth/session_middleware.js +62 -0
- package/dist/auth/session_queries.d.ts +135 -0
- package/dist/auth/session_queries.d.ts.map +1 -0
- package/dist/auth/session_queries.js +186 -0
- package/dist/auth/signup_routes.d.ts +32 -0
- package/dist/auth/signup_routes.d.ts.map +1 -0
- package/dist/auth/signup_routes.js +150 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +76 -0
- package/dist/cli/config.d.ts +48 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +77 -0
- package/dist/cli/daemon.d.ts +82 -0
- package/dist/cli/daemon.d.ts.map +1 -0
- package/dist/cli/daemon.js +149 -0
- package/dist/cli/help.d.ts +85 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +138 -0
- package/dist/cli/logger.d.ts +46 -0
- package/dist/cli/logger.d.ts.map +1 -0
- package/dist/cli/logger.js +48 -0
- package/dist/cli/util.d.ts +36 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +50 -0
- package/dist/crypto.d.ts +13 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +19 -0
- package/dist/db/assert_row.d.ts +18 -0
- package/dist/db/assert_row.d.ts.map +1 -0
- package/dist/db/assert_row.js +24 -0
- package/dist/db/create_db.d.ts +38 -0
- package/dist/db/create_db.d.ts.map +1 -0
- package/dist/db/create_db.js +57 -0
- package/dist/db/db.d.ts +97 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +76 -0
- package/dist/db/db_pg.d.ts +21 -0
- package/dist/db/db_pg.d.ts.map +1 -0
- package/dist/db/db_pg.js +45 -0
- package/dist/db/db_pglite.d.ts +21 -0
- package/dist/db/db_pglite.d.ts.map +1 -0
- package/dist/db/db_pglite.js +28 -0
- package/dist/db/migrate.d.ts +67 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +118 -0
- package/dist/db/pg_error.d.ts +16 -0
- package/dist/db/pg_error.d.ts.map +1 -0
- package/dist/db/pg_error.js +15 -0
- package/dist/db/query_deps.d.ts +14 -0
- package/dist/db/query_deps.d.ts.map +1 -0
- package/dist/db/query_deps.js +9 -0
- package/dist/db/sql_identifier.d.ts +27 -0
- package/dist/db/sql_identifier.d.ts.map +1 -0
- package/dist/db/sql_identifier.js +31 -0
- package/dist/db/status.d.ts +62 -0
- package/dist/db/status.d.ts.map +1 -0
- package/dist/db/status.js +116 -0
- package/dist/dev/setup.d.ts +159 -0
- package/dist/dev/setup.d.ts.map +1 -0
- package/dist/dev/setup.js +265 -0
- package/dist/env/dotenv.d.ts +25 -0
- package/dist/env/dotenv.d.ts.map +1 -0
- package/dist/env/dotenv.js +52 -0
- package/dist/env/load.d.ts +52 -0
- package/dist/env/load.d.ts.map +1 -0
- package/dist/env/load.js +79 -0
- package/dist/env/mask.d.ts +19 -0
- package/dist/env/mask.d.ts.map +1 -0
- package/dist/env/mask.js +26 -0
- package/dist/env/resolve.d.ts +126 -0
- package/dist/env/resolve.d.ts.map +1 -0
- package/dist/env/resolve.js +200 -0
- package/dist/hono_context.d.ts +48 -0
- package/dist/hono_context.d.ts.map +1 -0
- package/dist/hono_context.js +22 -0
- package/dist/http/common_routes.d.ts +52 -0
- package/dist/http/common_routes.d.ts.map +1 -0
- package/dist/http/common_routes.js +65 -0
- package/dist/http/db_routes.d.ts +57 -0
- package/dist/http/db_routes.d.ts.map +1 -0
- package/dist/http/db_routes.js +176 -0
- package/dist/http/error_schemas.d.ts +169 -0
- package/dist/http/error_schemas.d.ts.map +1 -0
- package/dist/http/error_schemas.js +178 -0
- package/dist/http/middleware_spec.d.ts +19 -0
- package/dist/http/middleware_spec.d.ts.map +1 -0
- package/dist/http/middleware_spec.js +9 -0
- package/dist/http/origin.d.ts +57 -0
- package/dist/http/origin.d.ts.map +1 -0
- package/dist/http/origin.js +207 -0
- package/dist/http/proxy.d.ts +112 -0
- package/dist/http/proxy.d.ts.map +1 -0
- package/dist/http/proxy.js +240 -0
- package/dist/http/route_spec.d.ts +197 -0
- package/dist/http/route_spec.d.ts.map +1 -0
- package/dist/http/route_spec.js +243 -0
- package/dist/http/schema_helpers.d.ts +64 -0
- package/dist/http/schema_helpers.d.ts.map +1 -0
- package/dist/http/schema_helpers.js +90 -0
- package/dist/http/surface.d.ts +132 -0
- package/dist/http/surface.d.ts.map +1 -0
- package/dist/http/surface.js +156 -0
- package/dist/http/surface_query.d.ts +77 -0
- package/dist/http/surface_query.d.ts.map +1 -0
- package/dist/http/surface_query.js +86 -0
- package/dist/rate_limiter.d.ts +94 -0
- package/dist/rate_limiter.d.ts.map +1 -0
- package/dist/rate_limiter.js +156 -0
- package/dist/realtime/sse.d.ts +80 -0
- package/dist/realtime/sse.d.ts.map +1 -0
- package/dist/realtime/sse.js +109 -0
- package/dist/realtime/sse_auth_guard.d.ts +93 -0
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -0
- package/dist/realtime/sse_auth_guard.js +111 -0
- package/dist/realtime/subscriber_registry.d.ts +85 -0
- package/dist/realtime/subscriber_registry.d.ts.map +1 -0
- package/dist/realtime/subscriber_registry.js +108 -0
- package/dist/runtime/deno.d.ts +21 -0
- package/dist/runtime/deno.d.ts.map +1 -0
- package/dist/runtime/deno.js +83 -0
- package/dist/runtime/deps.d.ts +113 -0
- package/dist/runtime/deps.d.ts.map +1 -0
- package/dist/runtime/deps.js +10 -0
- package/dist/runtime/fs.d.ts +15 -0
- package/dist/runtime/fs.d.ts.map +1 -0
- package/dist/runtime/fs.js +17 -0
- package/dist/runtime/mock.d.ts +81 -0
- package/dist/runtime/mock.d.ts.map +1 -0
- package/dist/runtime/mock.js +195 -0
- package/dist/runtime/node.d.ts +17 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +117 -0
- package/dist/schema_meta.d.ts +16 -0
- package/dist/schema_meta.d.ts.map +1 -0
- package/dist/schema_meta.js +9 -0
- package/dist/sensitivity.d.ts +15 -0
- package/dist/sensitivity.d.ts.map +1 -0
- package/dist/sensitivity.js +9 -0
- package/dist/server/app_backend.d.ts +74 -0
- package/dist/server/app_backend.d.ts.map +1 -0
- package/dist/server/app_backend.js +39 -0
- package/dist/server/app_server.d.ts +201 -0
- package/dist/server/app_server.d.ts.map +1 -0
- package/dist/server/app_server.js +266 -0
- package/dist/server/env.d.ts +68 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +95 -0
- package/dist/server/startup.d.ts +22 -0
- package/dist/server/startup.d.ts.map +1 -0
- package/dist/server/startup.js +48 -0
- package/dist/server/static.d.ts +39 -0
- package/dist/server/static.d.ts.map +1 -0
- package/dist/server/static.js +38 -0
- package/dist/server/validate_nginx.d.ts +34 -0
- package/dist/server/validate_nginx.d.ts.map +1 -0
- package/dist/server/validate_nginx.js +118 -0
- package/dist/testing/CLAUDE.md +3 -0
- package/dist/testing/admin_integration.d.ts +45 -0
- package/dist/testing/admin_integration.d.ts.map +1 -0
- package/dist/testing/admin_integration.js +840 -0
- package/dist/testing/adversarial_404.d.ts +15 -0
- package/dist/testing/adversarial_404.d.ts.map +1 -0
- package/dist/testing/adversarial_404.js +118 -0
- package/dist/testing/adversarial_headers.d.ts +36 -0
- package/dist/testing/adversarial_headers.d.ts.map +1 -0
- package/dist/testing/adversarial_headers.js +128 -0
- package/dist/testing/adversarial_input.d.ts +56 -0
- package/dist/testing/adversarial_input.d.ts.map +1 -0
- package/dist/testing/adversarial_input.js +494 -0
- package/dist/testing/app_server.d.ts +169 -0
- package/dist/testing/app_server.d.ts.map +1 -0
- package/dist/testing/app_server.js +240 -0
- package/dist/testing/assert_dev_env.d.ts +10 -0
- package/dist/testing/assert_dev_env.d.ts.map +1 -0
- package/dist/testing/assert_dev_env.js +13 -0
- package/dist/testing/assertions.d.ts +61 -0
- package/dist/testing/assertions.d.ts.map +1 -0
- package/dist/testing/assertions.js +96 -0
- package/dist/testing/attack_surface.d.ts +63 -0
- package/dist/testing/attack_surface.d.ts.map +1 -0
- package/dist/testing/attack_surface.js +224 -0
- package/dist/testing/audit_completeness.d.ts +29 -0
- package/dist/testing/audit_completeness.d.ts.map +1 -0
- package/dist/testing/audit_completeness.js +410 -0
- package/dist/testing/auth_apps.d.ts +55 -0
- package/dist/testing/auth_apps.d.ts.map +1 -0
- package/dist/testing/auth_apps.js +122 -0
- package/dist/testing/data_exposure.d.ts +62 -0
- package/dist/testing/data_exposure.d.ts.map +1 -0
- package/dist/testing/data_exposure.js +297 -0
- package/dist/testing/db.d.ts +111 -0
- package/dist/testing/db.d.ts.map +1 -0
- package/dist/testing/db.js +258 -0
- package/dist/testing/entities.d.ts +21 -0
- package/dist/testing/entities.d.ts.map +1 -0
- package/dist/testing/entities.js +42 -0
- package/dist/testing/error_coverage.d.ts +78 -0
- package/dist/testing/error_coverage.d.ts.map +1 -0
- package/dist/testing/error_coverage.js +135 -0
- package/dist/testing/integration.d.ts +37 -0
- package/dist/testing/integration.d.ts.map +1 -0
- package/dist/testing/integration.js +1139 -0
- package/dist/testing/integration_helpers.d.ts +107 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -0
- package/dist/testing/integration_helpers.js +246 -0
- package/dist/testing/middleware.d.ts +125 -0
- package/dist/testing/middleware.d.ts.map +1 -0
- package/dist/testing/middleware.js +210 -0
- package/dist/testing/rate_limiting.d.ts +43 -0
- package/dist/testing/rate_limiting.d.ts.map +1 -0
- package/dist/testing/rate_limiting.js +216 -0
- package/dist/testing/round_trip.d.ts +37 -0
- package/dist/testing/round_trip.d.ts.map +1 -0
- package/dist/testing/round_trip.js +128 -0
- package/dist/testing/schema_generators.d.ts +33 -0
- package/dist/testing/schema_generators.d.ts.map +1 -0
- package/dist/testing/schema_generators.js +137 -0
- package/dist/testing/standard.d.ts +49 -0
- package/dist/testing/standard.d.ts.map +1 -0
- package/dist/testing/standard.js +16 -0
- package/dist/testing/stubs.d.ts +96 -0
- package/dist/testing/stubs.d.ts.map +1 -0
- package/dist/testing/stubs.js +192 -0
- package/dist/testing/surface_invariants.d.ts +189 -0
- package/dist/testing/surface_invariants.d.ts.map +1 -0
- package/dist/testing/surface_invariants.js +450 -0
- package/dist/ui/AccountSessions.svelte +75 -0
- package/dist/ui/AccountSessions.svelte.d.ts +19 -0
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -0
- package/dist/ui/AdminAccounts.svelte +107 -0
- package/dist/ui/AdminAccounts.svelte.d.ts +19 -0
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -0
- package/dist/ui/AdminAuditLog.svelte +144 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts +4 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -0
- package/dist/ui/AdminInvites.svelte +142 -0
- package/dist/ui/AdminInvites.svelte.d.ts +4 -0
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -0
- package/dist/ui/AdminOverview.svelte +337 -0
- package/dist/ui/AdminOverview.svelte.d.ts +4 -0
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -0
- package/dist/ui/AdminPermitHistory.svelte +61 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts +19 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSessions.svelte +85 -0
- package/dist/ui/AdminSessions.svelte.d.ts +19 -0
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSettings.svelte +32 -0
- package/dist/ui/AdminSettings.svelte.d.ts +19 -0
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -0
- package/dist/ui/AdminSurface.svelte +42 -0
- package/dist/ui/AdminSurface.svelte.d.ts +4 -0
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -0
- package/dist/ui/AppShell.svelte +93 -0
- package/dist/ui/AppShell.svelte.d.ts +20 -0
- package/dist/ui/AppShell.svelte.d.ts.map +1 -0
- package/dist/ui/BootstrapForm.svelte +105 -0
- package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -0
- package/dist/ui/ColumnLayout.svelte +46 -0
- package/dist/ui/ColumnLayout.svelte.d.ts +11 -0
- package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -0
- package/dist/ui/ConfirmButton.svelte +125 -0
- package/dist/ui/ConfirmButton.svelte.d.ts +54 -0
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -0
- package/dist/ui/Datatable.svelte +185 -0
- package/dist/ui/Datatable.svelte.d.ts +35 -0
- package/dist/ui/Datatable.svelte.d.ts.map +1 -0
- package/dist/ui/LoginForm.svelte +82 -0
- package/dist/ui/LoginForm.svelte.d.ts +8 -0
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -0
- package/dist/ui/LogoutButton.svelte +36 -0
- package/dist/ui/LogoutButton.svelte.d.ts +10 -0
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -0
- package/dist/ui/MenuLink.svelte +35 -0
- package/dist/ui/MenuLink.svelte.d.ts +12 -0
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -0
- package/dist/ui/OpenSignupToggle.svelte +36 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts +19 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -0
- package/dist/ui/PopoverButton.svelte +136 -0
- package/dist/ui/PopoverButton.svelte.d.ts +63 -0
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -0
- package/dist/ui/SignupForm.svelte +117 -0
- package/dist/ui/SignupForm.svelte.d.ts +7 -0
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -0
- package/dist/ui/SurfaceExplorer.svelte +287 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts +8 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -0
- package/dist/ui/account_sessions_state.svelte.d.ts +15 -0
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -0
- package/dist/ui/account_sessions_state.svelte.js +45 -0
- package/dist/ui/admin_accounts_state.svelte.d.ts +19 -0
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_accounts_state.svelte.js +65 -0
- package/dist/ui/admin_invites_state.svelte.d.ts +19 -0
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_invites_state.svelte.js +71 -0
- package/dist/ui/admin_sessions_state.svelte.d.ts +18 -0
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -0
- package/dist/ui/admin_sessions_state.svelte.js +62 -0
- package/dist/ui/app_settings_state.svelte.d.ts +14 -0
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -0
- package/dist/ui/app_settings_state.svelte.js +44 -0
- package/dist/ui/audit_log_state.svelte.d.ts +40 -0
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -0
- package/dist/ui/audit_log_state.svelte.js +153 -0
- package/dist/ui/auth_state.svelte.d.ts +85 -0
- package/dist/ui/auth_state.svelte.d.ts.map +1 -0
- package/dist/ui/auth_state.svelte.js +238 -0
- package/dist/ui/datatable.d.ts +25 -0
- package/dist/ui/datatable.d.ts.map +1 -0
- package/dist/ui/datatable.js +9 -0
- package/dist/ui/enter_advance.d.ts +13 -0
- package/dist/ui/enter_advance.d.ts.map +1 -0
- package/dist/ui/enter_advance.js +30 -0
- package/dist/ui/loadable.svelte.d.ts +55 -0
- package/dist/ui/loadable.svelte.d.ts.map +1 -0
- package/dist/ui/loadable.svelte.js +75 -0
- package/dist/ui/popover.svelte.d.ts +137 -0
- package/dist/ui/popover.svelte.d.ts.map +1 -0
- package/dist/ui/popover.svelte.js +288 -0
- package/dist/ui/position_helpers.d.ts +27 -0
- package/dist/ui/position_helpers.d.ts.map +1 -0
- package/dist/ui/position_helpers.js +81 -0
- package/dist/ui/sidebar_state.svelte.d.ts +30 -0
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -0
- package/dist/ui/sidebar_state.svelte.js +39 -0
- package/dist/ui/table_state.svelte.d.ts +63 -0
- package/dist/ui/table_state.svelte.d.ts.map +1 -0
- package/dist/ui/table_state.svelte.js +117 -0
- package/dist/ui/ui_fetch.d.ts +29 -0
- package/dist/ui/ui_fetch.d.ts.map +1 -0
- package/dist/ui/ui_fetch.js +37 -0
- package/dist/ui/ui_format.d.ts +63 -0
- package/dist/ui/ui_format.d.ts.map +1 -0
- package/dist/ui/ui_format.js +196 -0
- package/package.json +121 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth entity types and client-safe schemas.
|
|
3
|
+
*
|
|
4
|
+
* Defines the runtime types for the fuz identity system:
|
|
5
|
+
* `Account`, `Actor`, `Permit`, `AuthSession`, and `ApiToken`.
|
|
6
|
+
*
|
|
7
|
+
* DDL lives in `ddl.ts`; role system in `role_schema.ts`.
|
|
8
|
+
* See docs/identity.md for design rationale.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
/** Minimum username length (must have start + middle + end characters). */
|
|
14
|
+
export declare const USERNAME_LENGTH_MIN = 3;
|
|
15
|
+
/** Maximum username length (matches GitHub's limit). */
|
|
16
|
+
export declare const USERNAME_LENGTH_MAX = 39;
|
|
17
|
+
/** Maximum length for username input on login/lookup — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
18
|
+
export declare const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
19
|
+
/** Username for account creation — starts with letter, alphanumeric/dash/underscore middle, ends with alphanumeric. No @ or . allowed. */
|
|
20
|
+
export declare const Username: z.ZodString;
|
|
21
|
+
export type Username = z.infer<typeof Username>;
|
|
22
|
+
/** Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change. */
|
|
23
|
+
export declare const UsernameProvided: z.ZodString;
|
|
24
|
+
export type UsernameProvided = z.infer<typeof UsernameProvided>;
|
|
25
|
+
/** Email validation. */
|
|
26
|
+
export declare const Email: z.ZodEmail;
|
|
27
|
+
export type Email = z.infer<typeof Email>;
|
|
28
|
+
/** Account — authentication identity. You log in as an account. */
|
|
29
|
+
export interface Account {
|
|
30
|
+
id: string;
|
|
31
|
+
username: Username;
|
|
32
|
+
email: Email | null;
|
|
33
|
+
email_verified: boolean;
|
|
34
|
+
password_hash: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
created_by: string | null;
|
|
37
|
+
updated_at: string;
|
|
38
|
+
updated_by: string | null;
|
|
39
|
+
}
|
|
40
|
+
/** Account without sensitive fields, scoped to the authenticated user's own session. */
|
|
41
|
+
export interface SessionAccount {
|
|
42
|
+
id: string;
|
|
43
|
+
username: Username;
|
|
44
|
+
email: Email | null;
|
|
45
|
+
email_verified: boolean;
|
|
46
|
+
created_at: string;
|
|
47
|
+
}
|
|
48
|
+
/** Actor — the entity that acts. Owns cells, holds permits, appears in audit trails. */
|
|
49
|
+
export interface Actor {
|
|
50
|
+
id: string;
|
|
51
|
+
account_id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
created_at: string;
|
|
54
|
+
updated_at: string | null;
|
|
55
|
+
updated_by: string | null;
|
|
56
|
+
}
|
|
57
|
+
/** Permit — time-bounded, revocable grant of a role to an actor. */
|
|
58
|
+
export interface Permit {
|
|
59
|
+
id: string;
|
|
60
|
+
actor_id: string;
|
|
61
|
+
role: string;
|
|
62
|
+
created_at: string;
|
|
63
|
+
expires_at: string | null;
|
|
64
|
+
revoked_at: string | null;
|
|
65
|
+
revoked_by: string | null;
|
|
66
|
+
granted_by: string | null;
|
|
67
|
+
}
|
|
68
|
+
export declare const is_permit_active: (p: Permit, now?: Date) => boolean;
|
|
69
|
+
/** Server-side auth session, keyed by blake3 hash of session token. */
|
|
70
|
+
export interface AuthSession {
|
|
71
|
+
id: string;
|
|
72
|
+
account_id: string;
|
|
73
|
+
created_at: string;
|
|
74
|
+
expires_at: string;
|
|
75
|
+
last_seen_at: string;
|
|
76
|
+
}
|
|
77
|
+
/** API token for CLI/programmatic access. */
|
|
78
|
+
export interface ApiToken {
|
|
79
|
+
id: string;
|
|
80
|
+
account_id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
token_hash: string;
|
|
83
|
+
expires_at: string | null;
|
|
84
|
+
last_used_at: string | null;
|
|
85
|
+
last_used_ip: string | null;
|
|
86
|
+
created_at: string;
|
|
87
|
+
}
|
|
88
|
+
/** Zod schema for `SessionAccount` — account without sensitive fields. */
|
|
89
|
+
export declare const SessionAccountJson: z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
username: z.ZodString;
|
|
92
|
+
email: z.ZodNullable<z.ZodEmail>;
|
|
93
|
+
email_verified: z.ZodBoolean;
|
|
94
|
+
created_at: z.ZodString;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export type SessionAccountJson = z.infer<typeof SessionAccountJson>;
|
|
97
|
+
/** Zod schema for `AuthSession` — id is the blake3 hash, safe for client. */
|
|
98
|
+
export declare const AuthSessionJson: z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
account_id: z.ZodString;
|
|
101
|
+
created_at: z.ZodString;
|
|
102
|
+
expires_at: z.ZodString;
|
|
103
|
+
last_seen_at: z.ZodString;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
export type AuthSessionJson = z.infer<typeof AuthSessionJson>;
|
|
106
|
+
/** Zod schema for client-safe API token listing (excludes `token_hash`). */
|
|
107
|
+
export declare const ClientApiTokenJson: z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
account_id: z.ZodString;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
112
|
+
last_used_at: z.ZodNullable<z.ZodString>;
|
|
113
|
+
last_used_ip: z.ZodNullable<z.ZodString>;
|
|
114
|
+
created_at: z.ZodString;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
export type ClientApiTokenJson = z.infer<typeof ClientApiTokenJson>;
|
|
117
|
+
/** Zod schema for the permit summary returned in admin account listings. */
|
|
118
|
+
export declare const PermitSummaryJson: z.ZodObject<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
role: z.ZodString;
|
|
121
|
+
created_at: z.ZodString;
|
|
122
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
123
|
+
granted_by: z.ZodNullable<z.ZodString>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
export type PermitSummaryJson = z.infer<typeof PermitSummaryJson>;
|
|
126
|
+
/** Zod schema for the actor summary returned in admin account listings. */
|
|
127
|
+
export declare const ActorSummaryJson: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
name: z.ZodString;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export type ActorSummaryJson = z.infer<typeof ActorSummaryJson>;
|
|
132
|
+
/** Zod schema for admin-facing account data — extends `SessionAccountJson` with audit fields. */
|
|
133
|
+
export declare const AdminAccountJson: z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
username: z.ZodString;
|
|
136
|
+
email: z.ZodNullable<z.ZodEmail>;
|
|
137
|
+
email_verified: z.ZodBoolean;
|
|
138
|
+
created_at: z.ZodString;
|
|
139
|
+
updated_at: z.ZodString;
|
|
140
|
+
updated_by: z.ZodNullable<z.ZodString>;
|
|
141
|
+
}, z.core.$strict>;
|
|
142
|
+
export type AdminAccountJson = z.infer<typeof AdminAccountJson>;
|
|
143
|
+
/** Zod schema for an admin account listing entry (account + actor + permits). */
|
|
144
|
+
export declare const AdminAccountEntryJson: z.ZodObject<{
|
|
145
|
+
account: z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
username: z.ZodString;
|
|
148
|
+
email: z.ZodNullable<z.ZodEmail>;
|
|
149
|
+
email_verified: z.ZodBoolean;
|
|
150
|
+
created_at: z.ZodString;
|
|
151
|
+
updated_at: z.ZodString;
|
|
152
|
+
updated_by: z.ZodNullable<z.ZodString>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
actor: z.ZodNullable<z.ZodObject<{
|
|
155
|
+
id: z.ZodString;
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
permits: z.ZodArray<z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
role: z.ZodString;
|
|
161
|
+
created_at: z.ZodString;
|
|
162
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
163
|
+
granted_by: z.ZodNullable<z.ZodString>;
|
|
164
|
+
}, z.core.$strict>>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
export type AdminAccountEntryJson = z.infer<typeof AdminAccountEntryJson>;
|
|
167
|
+
export interface CreateAccountInput {
|
|
168
|
+
username: Username;
|
|
169
|
+
password_hash: string;
|
|
170
|
+
email?: Email | null;
|
|
171
|
+
}
|
|
172
|
+
export interface GrantPermitInput {
|
|
173
|
+
actor_id: string;
|
|
174
|
+
role: string;
|
|
175
|
+
expires_at?: Date | null;
|
|
176
|
+
granted_by: string | null;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Convert an `Account` to a `SessionAccount` by stripping sensitive fields.
|
|
180
|
+
*
|
|
181
|
+
* @param account - the full account record
|
|
182
|
+
* @returns the client-safe account
|
|
183
|
+
*/
|
|
184
|
+
export declare const to_session_account: (account: Account) => SessionAccount;
|
|
185
|
+
/**
|
|
186
|
+
* Convert an `Account` to an `AdminAccountJson` for admin listings.
|
|
187
|
+
*
|
|
188
|
+
* @param account - the full account record
|
|
189
|
+
* @returns the admin-safe account with audit fields
|
|
190
|
+
*/
|
|
191
|
+
export declare const to_admin_account: (account: Account) => AdminAccountJson;
|
|
192
|
+
//# sourceMappingURL=account_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,wDAAwD;AACxD,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,gKAAgK;AAChK,eAAO,MAAM,4BAA4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 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth entity types and client-safe schemas.
|
|
3
|
+
*
|
|
4
|
+
* Defines the runtime types for the fuz identity system:
|
|
5
|
+
* `Account`, `Actor`, `Permit`, `AuthSession`, and `ApiToken`.
|
|
6
|
+
*
|
|
7
|
+
* DDL lives in `ddl.ts`; role system in `role_schema.ts`.
|
|
8
|
+
* See docs/identity.md for design rationale.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
// TODO consider `.brand()` on Username and Email for compile-time safety
|
|
14
|
+
/** Minimum username length (must have start + middle + end characters). */
|
|
15
|
+
export const USERNAME_LENGTH_MIN = 3;
|
|
16
|
+
/** Maximum username length (matches GitHub's limit). */
|
|
17
|
+
export const USERNAME_LENGTH_MAX = 39;
|
|
18
|
+
/** Maximum length for username input on login/lookup — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
19
|
+
export const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
20
|
+
/** Username for account creation — starts with letter, alphanumeric/dash/underscore middle, ends with alphanumeric. No @ or . allowed. */
|
|
21
|
+
export const Username = z
|
|
22
|
+
.string()
|
|
23
|
+
.min(USERNAME_LENGTH_MIN)
|
|
24
|
+
.max(USERNAME_LENGTH_MAX)
|
|
25
|
+
.regex(/^[a-zA-Z][0-9a-zA-Z_-]*[0-9a-zA-Z]$/);
|
|
26
|
+
/** Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change. */
|
|
27
|
+
export const UsernameProvided = z.string().min(1).max(USERNAME_PROVIDED_LENGTH_MAX);
|
|
28
|
+
/** Email validation. */
|
|
29
|
+
export const Email = z.email();
|
|
30
|
+
export const is_permit_active = (p, now = new Date()) => !p.revoked_at && (!p.expires_at || new Date(p.expires_at) > now);
|
|
31
|
+
// Client-safe Zod schemas — for route output validation and ActionSpec outputs.
|
|
32
|
+
/** Zod schema for `SessionAccount` — account without sensitive fields. */
|
|
33
|
+
export const SessionAccountJson = z.strictObject({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
username: Username,
|
|
36
|
+
email: Email.nullable(),
|
|
37
|
+
email_verified: z.boolean(),
|
|
38
|
+
created_at: z.string(),
|
|
39
|
+
});
|
|
40
|
+
/** Zod schema for `AuthSession` — id is the blake3 hash, safe for client. */
|
|
41
|
+
export const AuthSessionJson = z.strictObject({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
account_id: z.string(),
|
|
44
|
+
created_at: z.string(),
|
|
45
|
+
expires_at: z.string(),
|
|
46
|
+
last_seen_at: z.string(),
|
|
47
|
+
});
|
|
48
|
+
/** Zod schema for client-safe API token listing (excludes `token_hash`). */
|
|
49
|
+
export const ClientApiTokenJson = z.strictObject({
|
|
50
|
+
id: z.string(),
|
|
51
|
+
account_id: z.string(),
|
|
52
|
+
name: z.string(),
|
|
53
|
+
expires_at: z.string().nullable(),
|
|
54
|
+
last_used_at: z.string().nullable(),
|
|
55
|
+
last_used_ip: z.string().nullable(),
|
|
56
|
+
created_at: z.string(),
|
|
57
|
+
});
|
|
58
|
+
/** Zod schema for the permit summary returned in admin account listings. */
|
|
59
|
+
export const PermitSummaryJson = z.strictObject({
|
|
60
|
+
id: z.string(),
|
|
61
|
+
role: z.string(),
|
|
62
|
+
created_at: z.string(),
|
|
63
|
+
expires_at: z.string().nullable(),
|
|
64
|
+
granted_by: z.string().nullable(),
|
|
65
|
+
});
|
|
66
|
+
/** Zod schema for the actor summary returned in admin account listings. */
|
|
67
|
+
export const ActorSummaryJson = z.strictObject({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
});
|
|
71
|
+
/** Zod schema for admin-facing account data — extends `SessionAccountJson` with audit fields. */
|
|
72
|
+
export const AdminAccountJson = SessionAccountJson.extend({
|
|
73
|
+
updated_at: z.string(),
|
|
74
|
+
updated_by: z.string().nullable(),
|
|
75
|
+
});
|
|
76
|
+
/** Zod schema for an admin account listing entry (account + actor + permits). */
|
|
77
|
+
export const AdminAccountEntryJson = z.strictObject({
|
|
78
|
+
account: AdminAccountJson,
|
|
79
|
+
actor: ActorSummaryJson.nullable(),
|
|
80
|
+
permits: z.array(PermitSummaryJson),
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Convert an `Account` to a `SessionAccount` by stripping sensitive fields.
|
|
84
|
+
*
|
|
85
|
+
* @param account - the full account record
|
|
86
|
+
* @returns the client-safe account
|
|
87
|
+
*/
|
|
88
|
+
export const to_session_account = (account) => ({
|
|
89
|
+
id: account.id,
|
|
90
|
+
username: account.username,
|
|
91
|
+
email: account.email,
|
|
92
|
+
email_verified: account.email_verified,
|
|
93
|
+
created_at: account.created_at,
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Convert an `Account` to an `AdminAccountJson` for admin listings.
|
|
97
|
+
*
|
|
98
|
+
* @param account - the full account record
|
|
99
|
+
* @returns the admin-safe account with audit fields
|
|
100
|
+
*/
|
|
101
|
+
export const to_admin_account = (account) => ({
|
|
102
|
+
...to_session_account(account),
|
|
103
|
+
updated_at: account.updated_at,
|
|
104
|
+
updated_by: account.updated_by,
|
|
105
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic admin route specs — account listing, permit management, session and token revocation.
|
|
3
|
+
*
|
|
4
|
+
* All routes require the `admin` role.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { type RoleSchemaResult } from './role_schema.js';
|
|
9
|
+
import { type RouteSpec } from '../http/route_spec.js';
|
|
10
|
+
import type { RouteFactoryDeps } from './deps.js';
|
|
11
|
+
/** Options for admin route specs. */
|
|
12
|
+
export interface AdminRouteOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Role schema result from `create_role_schema()`. Defaults to builtin roles only.
|
|
15
|
+
* Pass the full result to enable extended app-defined roles in the admin UI.
|
|
16
|
+
* Both `Role` and `role_options` come from the same call — passing them together
|
|
17
|
+
* via this field ensures they stay in sync.
|
|
18
|
+
*/
|
|
19
|
+
roles?: RoleSchemaResult;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create admin route specs for account listing and permit management.
|
|
23
|
+
*
|
|
24
|
+
* @param deps - stateless capabilities (log)
|
|
25
|
+
* @param options - optional options with role schema for validation
|
|
26
|
+
* @returns route specs for admin account management
|
|
27
|
+
*/
|
|
28
|
+
export declare const create_admin_account_route_specs: (deps: Pick<RouteFactoryDeps, "log" | "on_audit_event">, options?: AdminRouteOptions) => Array<RouteSpec>;
|
|
29
|
+
//# sourceMappingURL=admin_routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_routes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAA8C,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGpG,OAAO,EAAoC,KAAK,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAUxF,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAShD,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,CAAC,EACtD,UAAU,iBAAiB,KACzB,KAAK,CAAC,SAAS,CAoMjB,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic admin route specs — account listing, permit management, session and token revocation.
|
|
3
|
+
*
|
|
4
|
+
* All routes require the `admin` role.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { BUILTIN_ROLE_OPTIONS, BuiltinRole, RoleName } from './role_schema.js';
|
|
10
|
+
import { AdminAccountEntryJson } from './account_schema.js';
|
|
11
|
+
import { require_request_context } from './request_context.js';
|
|
12
|
+
import { get_route_input, get_route_params } from '../http/route_spec.js';
|
|
13
|
+
import { query_account_by_id, query_actor_by_account, query_admin_account_list, } from './account_queries.js';
|
|
14
|
+
import { query_grant_permit, query_revoke_permit } from './permit_queries.js';
|
|
15
|
+
import { query_session_revoke_all_for_account } from './session_queries.js';
|
|
16
|
+
import { query_revoke_all_api_tokens_for_account } from './api_token_queries.js';
|
|
17
|
+
import { audit_log_fire_and_forget } from './audit_log_queries.js';
|
|
18
|
+
import { ERROR_ACCOUNT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE, ERROR_PERMIT_NOT_FOUND, ERROR_INSUFFICIENT_PERMISSIONS, } from '../http/error_schemas.js';
|
|
19
|
+
import { get_client_ip } from '../http/proxy.js';
|
|
20
|
+
/**
|
|
21
|
+
* Create admin route specs for account listing and permit management.
|
|
22
|
+
*
|
|
23
|
+
* @param deps - stateless capabilities (log)
|
|
24
|
+
* @param options - optional options with role schema for validation
|
|
25
|
+
* @returns route specs for admin account management
|
|
26
|
+
*/
|
|
27
|
+
export const create_admin_account_route_specs = (deps, options) => {
|
|
28
|
+
const role = 'admin';
|
|
29
|
+
const { on_audit_event } = deps;
|
|
30
|
+
const role_schema = options?.roles?.Role ?? BuiltinRole;
|
|
31
|
+
const role_options = options?.roles?.role_options ?? BUILTIN_ROLE_OPTIONS;
|
|
32
|
+
const grantable_roles = [];
|
|
33
|
+
for (const [name, rc] of role_options) {
|
|
34
|
+
if (rc.web_grantable)
|
|
35
|
+
grantable_roles.push(name);
|
|
36
|
+
}
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
method: 'GET',
|
|
40
|
+
path: '/accounts',
|
|
41
|
+
auth: { type: 'role', role },
|
|
42
|
+
description: 'List all accounts with their permits',
|
|
43
|
+
input: z.null(),
|
|
44
|
+
output: z.strictObject({
|
|
45
|
+
accounts: z.array(AdminAccountEntryJson),
|
|
46
|
+
grantable_roles: z.array(RoleName),
|
|
47
|
+
}),
|
|
48
|
+
handler: async (c, route) => {
|
|
49
|
+
const accounts = await query_admin_account_list(route);
|
|
50
|
+
return c.json({ accounts, grantable_roles });
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
method: 'POST',
|
|
55
|
+
path: '/accounts/:account_id/permits/grant',
|
|
56
|
+
auth: { type: 'role', role },
|
|
57
|
+
description: 'Grant a role permit to an account',
|
|
58
|
+
params: z.strictObject({ account_id: z.uuid() }),
|
|
59
|
+
input: z.strictObject({ role: role_schema }),
|
|
60
|
+
output: z.strictObject({
|
|
61
|
+
ok: z.literal(true),
|
|
62
|
+
permit: z.strictObject({ id: z.string(), role: z.string() }),
|
|
63
|
+
}),
|
|
64
|
+
errors: {
|
|
65
|
+
403: z.looseObject({
|
|
66
|
+
error: z.enum([ERROR_INSUFFICIENT_PERMISSIONS, ERROR_ROLE_NOT_WEB_GRANTABLE]),
|
|
67
|
+
}),
|
|
68
|
+
404: z.looseObject({ error: z.literal(ERROR_ACCOUNT_NOT_FOUND) }),
|
|
69
|
+
},
|
|
70
|
+
handler: async (c, route) => {
|
|
71
|
+
const { account_id } = get_route_params(c);
|
|
72
|
+
const { role: role_name } = get_route_input(c);
|
|
73
|
+
// Enforce web_grantable — direct API calls must respect the same
|
|
74
|
+
// restrictions as the UI. Keeper role can only be granted via daemon token.
|
|
75
|
+
const rc = role_options.get(role_name);
|
|
76
|
+
if (!rc?.web_grantable) {
|
|
77
|
+
return c.json({ error: ERROR_ROLE_NOT_WEB_GRANTABLE }, 403);
|
|
78
|
+
}
|
|
79
|
+
const actor = await query_actor_by_account(route, account_id);
|
|
80
|
+
if (!actor) {
|
|
81
|
+
return c.json({ error: ERROR_ACCOUNT_NOT_FOUND }, 404);
|
|
82
|
+
}
|
|
83
|
+
const ctx = require_request_context(c);
|
|
84
|
+
const permit = await query_grant_permit(route, {
|
|
85
|
+
actor_id: actor.id,
|
|
86
|
+
role: role_name,
|
|
87
|
+
granted_by: ctx.actor.id,
|
|
88
|
+
});
|
|
89
|
+
void audit_log_fire_and_forget(route, {
|
|
90
|
+
event_type: 'permit_grant',
|
|
91
|
+
actor_id: ctx.actor.id,
|
|
92
|
+
account_id: ctx.account.id,
|
|
93
|
+
target_account_id: account_id,
|
|
94
|
+
ip: get_client_ip(c),
|
|
95
|
+
metadata: { role: role_name, permit_id: permit.id },
|
|
96
|
+
}, deps.log, on_audit_event);
|
|
97
|
+
return c.json({ ok: true, permit: { id: permit.id, role: permit.role } });
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
method: 'POST',
|
|
102
|
+
path: '/accounts/:account_id/sessions/revoke-all',
|
|
103
|
+
auth: { type: 'role', role },
|
|
104
|
+
description: 'Revoke all sessions for an account',
|
|
105
|
+
params: z.strictObject({ account_id: z.uuid() }),
|
|
106
|
+
input: z.null(),
|
|
107
|
+
output: z.strictObject({ ok: z.literal(true), count: z.number() }),
|
|
108
|
+
errors: { 404: z.looseObject({ error: z.literal(ERROR_ACCOUNT_NOT_FOUND) }) },
|
|
109
|
+
handler: async (c, route) => {
|
|
110
|
+
const { account_id } = get_route_params(c);
|
|
111
|
+
const account = await query_account_by_id(route, account_id);
|
|
112
|
+
if (!account) {
|
|
113
|
+
return c.json({ error: ERROR_ACCOUNT_NOT_FOUND }, 404);
|
|
114
|
+
}
|
|
115
|
+
const ctx = require_request_context(c);
|
|
116
|
+
const count = await query_session_revoke_all_for_account(route, account_id);
|
|
117
|
+
void audit_log_fire_and_forget(route, {
|
|
118
|
+
event_type: 'session_revoke_all',
|
|
119
|
+
actor_id: ctx.actor.id,
|
|
120
|
+
account_id: ctx.account.id,
|
|
121
|
+
target_account_id: account_id,
|
|
122
|
+
ip: get_client_ip(c),
|
|
123
|
+
metadata: { count },
|
|
124
|
+
}, deps.log, on_audit_event);
|
|
125
|
+
return c.json({ ok: true, count });
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
method: 'POST',
|
|
130
|
+
path: '/accounts/:account_id/tokens/revoke-all',
|
|
131
|
+
auth: { type: 'role', role },
|
|
132
|
+
description: 'Revoke all API tokens for an account',
|
|
133
|
+
params: z.strictObject({ account_id: z.uuid() }),
|
|
134
|
+
input: z.null(),
|
|
135
|
+
output: z.strictObject({ ok: z.literal(true), count: z.number() }),
|
|
136
|
+
errors: { 404: z.looseObject({ error: z.literal(ERROR_ACCOUNT_NOT_FOUND) }) },
|
|
137
|
+
handler: async (c, route) => {
|
|
138
|
+
const { account_id } = get_route_params(c);
|
|
139
|
+
const account = await query_account_by_id(route, account_id);
|
|
140
|
+
if (!account) {
|
|
141
|
+
return c.json({ error: ERROR_ACCOUNT_NOT_FOUND }, 404);
|
|
142
|
+
}
|
|
143
|
+
const ctx = require_request_context(c);
|
|
144
|
+
const count = await query_revoke_all_api_tokens_for_account(route, account_id);
|
|
145
|
+
void audit_log_fire_and_forget(route, {
|
|
146
|
+
event_type: 'token_revoke_all',
|
|
147
|
+
actor_id: ctx.actor.id,
|
|
148
|
+
account_id: ctx.account.id,
|
|
149
|
+
target_account_id: account_id,
|
|
150
|
+
ip: get_client_ip(c),
|
|
151
|
+
metadata: { count },
|
|
152
|
+
}, deps.log, on_audit_event);
|
|
153
|
+
return c.json({ ok: true, count });
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: '/accounts/:account_id/permits/:permit_id/revoke',
|
|
159
|
+
auth: { type: 'role', role },
|
|
160
|
+
description: 'Revoke a permit',
|
|
161
|
+
params: z.strictObject({ account_id: z.uuid(), permit_id: z.uuid() }),
|
|
162
|
+
input: z.null(),
|
|
163
|
+
output: z.strictObject({ ok: z.literal(true), revoked: z.literal(true) }),
|
|
164
|
+
errors: {
|
|
165
|
+
404: z.looseObject({
|
|
166
|
+
error: z.enum([ERROR_ACCOUNT_NOT_FOUND, ERROR_PERMIT_NOT_FOUND]),
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
handler: async (c, route) => {
|
|
170
|
+
const { account_id, permit_id } = get_route_params(c);
|
|
171
|
+
const ctx = require_request_context(c);
|
|
172
|
+
// resolve the target actor from the URL account_id to prevent IDOR
|
|
173
|
+
const target_actor = await query_actor_by_account(route, account_id);
|
|
174
|
+
if (!target_actor) {
|
|
175
|
+
return c.json({ error: ERROR_ACCOUNT_NOT_FOUND }, 404);
|
|
176
|
+
}
|
|
177
|
+
const result = await query_revoke_permit(route, permit_id, target_actor.id, ctx.actor.id);
|
|
178
|
+
if (!result) {
|
|
179
|
+
return c.json({ error: ERROR_PERMIT_NOT_FOUND }, 404);
|
|
180
|
+
}
|
|
181
|
+
void audit_log_fire_and_forget(route, {
|
|
182
|
+
event_type: 'permit_revoke',
|
|
183
|
+
actor_id: ctx.actor.id,
|
|
184
|
+
account_id: ctx.account.id,
|
|
185
|
+
target_account_id: account_id,
|
|
186
|
+
ip: get_client_ip(c),
|
|
187
|
+
metadata: { role: result.role, permit_id },
|
|
188
|
+
}, deps.log, on_audit_event);
|
|
189
|
+
return c.json({ ok: true, revoked: true });
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API token generation and hashing utilities.
|
|
3
|
+
*
|
|
4
|
+
* Tokens use the format `secret_fuz_token_<base64url>` and are stored
|
|
5
|
+
* as blake3 hashes. These are pure cryptographic operations with no
|
|
6
|
+
* framework dependency — the bearer auth middleware that validates
|
|
7
|
+
* tokens lives in `bearer_auth.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/** Prefix for all fuz API tokens (enables secret scanning). */
|
|
12
|
+
export declare const API_TOKEN_PREFIX = "secret_fuz_token_";
|
|
13
|
+
/**
|
|
14
|
+
* Hash an API token for storage using blake3.
|
|
15
|
+
*
|
|
16
|
+
* @param token - the raw API token
|
|
17
|
+
* @returns hex-encoded blake3 hash
|
|
18
|
+
*/
|
|
19
|
+
export declare const hash_api_token: (token: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate a new API token with its hash and public id.
|
|
22
|
+
*
|
|
23
|
+
* The raw token is returned exactly once — callers must present it
|
|
24
|
+
* to the user immediately.
|
|
25
|
+
*
|
|
26
|
+
* @returns the raw token, a public id, and the blake3 hash for storage
|
|
27
|
+
*/
|
|
28
|
+
export declare const generate_api_token: () => {
|
|
29
|
+
token: string;
|
|
30
|
+
id: string;
|
|
31
|
+
token_hash: string;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=api_token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api_token.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/api_token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAA4B,CAAC;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAO;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAMnF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API token generation and hashing utilities.
|
|
3
|
+
*
|
|
4
|
+
* Tokens use the format `secret_fuz_token_<base64url>` and are stored
|
|
5
|
+
* as blake3 hashes. These are pure cryptographic operations with no
|
|
6
|
+
* framework dependency — the bearer auth middleware that validates
|
|
7
|
+
* tokens lives in `bearer_auth.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { hash_blake3 } from '@fuzdev/fuz_util/hash_blake3.js';
|
|
12
|
+
import { generate_random_base64url } from '../crypto.js';
|
|
13
|
+
/** Prefix for all fuz API tokens (enables secret scanning). */
|
|
14
|
+
export const API_TOKEN_PREFIX = 'secret_fuz_token_';
|
|
15
|
+
/**
|
|
16
|
+
* Hash an API token for storage using blake3.
|
|
17
|
+
*
|
|
18
|
+
* @param token - the raw API token
|
|
19
|
+
* @returns hex-encoded blake3 hash
|
|
20
|
+
*/
|
|
21
|
+
export const hash_api_token = (token) => hash_blake3(token);
|
|
22
|
+
/**
|
|
23
|
+
* Generate a new API token with its hash and public id.
|
|
24
|
+
*
|
|
25
|
+
* The raw token is returned exactly once — callers must present it
|
|
26
|
+
* to the user immediately.
|
|
27
|
+
*
|
|
28
|
+
* @returns the raw token, a public id, and the blake3 hash for storage
|
|
29
|
+
*/
|
|
30
|
+
export const generate_api_token = () => {
|
|
31
|
+
const raw = generate_random_base64url();
|
|
32
|
+
const token = `${API_TOKEN_PREFIX}${raw}`;
|
|
33
|
+
const token_hash = hash_api_token(token);
|
|
34
|
+
const id = `tok_${raw.slice(0, 12)}`;
|
|
35
|
+
return { token, id, token_hash };
|
|
36
|
+
};
|