@rebasepro/server 0.23.0 → 0.24.1-canary.g56af4a4
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/README.md +1 -1
- package/bin/rebase-server.js +4 -2
- package/dist/GCSStorageController-DivE9bAx.js +402 -0
- package/dist/GCSStorageController-DivE9bAx.js.map +1 -0
- package/dist/S3StorageController-D_vKs4kP.js +480 -0
- package/dist/S3StorageController-D_vKs4kP.js.map +1 -0
- package/dist/api/ast-schema-editor.d.ts +92 -1
- package/dist/api/errors.d.ts +9 -0
- package/dist/api/live-schema-routes.d.ts +38 -8
- package/dist/api/logs-routes.d.ts +39 -1
- package/dist/api/openapi-generator.d.ts +17 -0
- package/dist/api/rest/api-generator.d.ts +97 -11
- package/dist/api/rest/auth-collection-writes.d.ts +28 -21
- package/dist/api/rest/field-access-query.d.ts +28 -8
- package/dist/api/rest/field-ops.d.ts +19 -7
- package/dist/api/rest/query-body.d.ts +10 -0
- package/dist/api/rest/write-validation.d.ts +9 -7
- package/dist/api/schema-editor-routes.d.ts +10 -1
- package/dist/api/sql-export-routes.d.ts +8 -0
- package/dist/api/types.d.ts +28 -1
- package/dist/{ast-schema-editor-Mvr50v_S.js → ast-schema-editor-CSdL0iCk.js} +310 -12
- package/dist/ast-schema-editor-CSdL0iCk.js.map +1 -0
- package/dist/auth/access.d.ts +121 -0
- package/dist/auth/adapter-middleware.d.ts +2 -1
- package/dist/auth/address-ownership.d.ts +16 -1
- package/dist/auth/admin-roles-route.d.ts +4 -2
- package/dist/auth/admin-roles.d.ts +17 -20
- package/dist/auth/admin-user-ops.d.ts +24 -2
- package/dist/auth/admin-users-route.d.ts +2 -0
- package/dist/auth/api-keys/api-key-middleware.d.ts +56 -55
- package/dist/auth/api-keys/api-key-routes.d.ts +41 -11
- package/dist/auth/api-keys/api-key-store.d.ts +31 -8
- package/dist/auth/api-keys/api-key-types.d.ts +14 -16
- package/dist/auth/api-keys/http-operation.d.ts +19 -0
- package/dist/auth/api-keys/index.d.ts +11 -11
- package/dist/auth/api-keys/key-grant.d.ts +41 -0
- package/dist/auth/api-keys/legacy-permissions.d.ts +33 -0
- package/dist/auth/auth-hooks.d.ts +46 -7
- package/dist/auth/builtin-auth-adapter.d.ts +8 -0
- package/dist/auth/cookie-utils.d.ts +7 -0
- package/dist/auth/deliverable-address.d.ts +6 -0
- package/dist/auth/email-change-routes.d.ts +41 -0
- package/dist/auth/expired-token-sweep.d.ts +71 -0
- package/dist/auth/impersonation.d.ts +110 -0
- package/dist/auth/index.d.ts +4 -2
- package/dist/auth/interfaces.d.ts +120 -59
- package/dist/auth/jwt-crypto.d.ts +7 -0
- package/dist/auth/jwt-keys.d.ts +4 -0
- package/dist/auth/jwt.d.ts +54 -3
- package/dist/auth/magic-link-routes.d.ts +2 -6
- package/dist/auth/mfa-routes.d.ts +2 -9
- package/dist/auth/middleware.d.ts +17 -5
- package/dist/auth/otp-routes.d.ts +2 -6
- package/dist/auth/passwordless-signup.d.ts +27 -0
- package/dist/auth/platform-token.d.ts +122 -0
- package/dist/auth/rate-limiter.d.ts +54 -1
- package/dist/auth/registration-policy.d.ts +17 -0
- package/dist/auth/routes.d.ts +45 -0
- package/dist/auth/scope-routes.d.ts +22 -0
- package/dist/auth/session-routes.d.ts +11 -6
- package/dist/auth/token-revocation.d.ts +50 -1
- package/dist/auth/user-picking.d.ts +35 -0
- package/dist/auth/verify-credential.d.ts +28 -0
- package/dist/{auth-B-GIMpDG.js → auth-OPq_FeMs.js} +3115 -638
- package/dist/auth-OPq_FeMs.js.map +1 -0
- package/dist/auth_adapter-CIItCTc8.js +21 -0
- package/dist/auth_adapter-CIItCTc8.js.map +1 -0
- package/dist/backend-DTAOsLQc.js.map +1 -1
- package/dist/backup/backup-common.d.ts +24 -3
- package/dist/backup/backup-routes.d.ts +46 -5
- package/dist/backup/backup-schedule.d.ts +33 -0
- package/dist/backup/backup-storage.d.ts +16 -0
- package/dist/backup/index.d.ts +5 -1
- package/dist/backup-5d7XhLX3.js +581 -0
- package/dist/backup-5d7XhLX3.js.map +1 -0
- package/dist/boot/bundle.d.ts +19 -0
- package/dist/boot/driver.d.ts +3 -0
- package/dist/boot/env.d.ts +56 -4
- package/dist/boot/http-server.d.ts +22 -0
- package/dist/boot/options.d.ts +16 -1
- package/dist/boot/runtime-cors.d.ts +17 -0
- package/dist/boot/security-headers.d.ts +26 -0
- package/dist/boot/static-routing.d.ts +65 -0
- package/dist/collection_patch-BRu-BvDv.js +472 -0
- package/dist/collection_patch-BRu-BvDv.js.map +1 -0
- package/dist/{contract-routes-CbFjuBwa.js → contract-routes-02lASyJI.js} +5 -8
- package/dist/contract-routes-02lASyJI.js.map +1 -0
- package/dist/cron/cron-routes.d.ts +1 -1
- package/dist/cron/cron-scheduler.d.ts +94 -23
- package/dist/cron/cron-store.d.ts +31 -4
- package/dist/cron/define-cron.d.ts +6 -2
- package/dist/cron/index.d.ts +1 -1
- package/dist/{cron-loader-DfTj2Hbi.js → cron-loader-D7OmleAb.js} +11 -7
- package/dist/cron-loader-D7OmleAb.js.map +1 -0
- package/dist/{cron-routes-eE8nif_b.js → cron-routes-CBfiaqEL.js} +34 -8
- package/dist/cron-routes-CBfiaqEL.js.map +1 -0
- package/dist/{cron-scheduler-B0pLfAix.js → cron-scheduler-C2vbETMo.js} +349 -65
- package/dist/cron-scheduler-C2vbETMo.js.map +1 -0
- package/dist/cron-store-B2Ih0gCN.js +540 -0
- package/dist/cron-store-B2Ih0gCN.js.map +1 -0
- package/dist/{ddl-bootstrap-C6mo0Kmz.js → ddl-bootstrap-BaqMSa4Y.js} +2 -2
- package/dist/{ddl-bootstrap-C6mo0Kmz.js.map → ddl-bootstrap-BaqMSa4Y.js.map} +1 -1
- package/dist/email/index.d.ts +2 -2
- package/dist/email/smtp-email-service.d.ts +23 -0
- package/dist/email/templates.d.ts +22 -0
- package/dist/email/types.d.ts +44 -0
- package/dist/env.d.ts +1 -39
- package/dist/{errors-DWsX4yTd.js → errors-D6_y86c5.js} +102 -8
- package/dist/errors-D6_y86c5.js.map +1 -0
- package/dist/filter-dialect-REl-TjZr.js +1628 -0
- package/dist/filter-dialect-REl-TjZr.js.map +1 -0
- package/dist/{function-loader-xnbDAPfa.js → function-loader-BDKKiBmy.js} +5 -4
- package/dist/function-loader-BDKKiBmy.js.map +1 -0
- package/dist/{function-routes-Chet4-lB.js → function-routes-DWB7BBsi.js} +25 -13
- package/dist/function-routes-DWB7BBsi.js.map +1 -0
- package/dist/functions/context.d.ts +26 -6
- package/dist/functions/define-function.d.ts +7 -4
- package/dist/functions/guards.d.ts +22 -5
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js +114 -37
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/request-timeout.d.ts +7 -5
- package/dist/history/history-routes.d.ts +9 -0
- package/dist/history/retention-sweep.d.ts +81 -0
- package/dist/{history-recorder-B4MpJfJK.js → history-recorder-DHenr3lm.js} +4 -4
- package/dist/{history-recorder-B4MpJfJK.js.map → history-recorder-DHenr3lm.js.map} +1 -1
- package/dist/{history-store-BhxWOuz9.js → history-store-DPofGVDp.js} +2 -2
- package/dist/{history-store-BhxWOuz9.js.map → history-store-DPofGVDp.js.map} +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.es.js +23363 -17552
- package/dist/index.es.js.map +1 -1
- package/dist/init/health.d.ts +17 -2
- package/dist/init/shutdown.d.ts +20 -0
- package/dist/init.d.ts +70 -6
- package/dist/internal-tables-L2t39RdT.js +136 -0
- package/dist/internal-tables-L2t39RdT.js.map +1 -0
- package/dist/jobs/job-queue.d.ts +8 -0
- package/dist/jobs/job-store.d.ts +24 -0
- package/dist/jobs/types.d.ts +25 -4
- package/dist/{jobs-CazMYhyy.js → jobs-BpD4Q0qR.js} +235 -25
- package/dist/jobs-BpD4Q0qR.js.map +1 -0
- package/dist/{jwt-DnQHNFCl.js → jwt-Bqcu7cGt.js} +207 -77
- package/dist/jwt-Bqcu7cGt.js.map +1 -0
- package/dist/{keys-CogCQpxG.js → keys-GAVZqbqx.js} +3 -17
- package/dist/{keys-CogCQpxG.js.map → keys-GAVZqbqx.js.map} +1 -1
- package/dist/load-failure-UvzZgGXT.js +48 -0
- package/dist/load-failure-UvzZgGXT.js.map +1 -0
- package/dist/{logger-DO2PZc4i.js → logger-D-S-hO5e.js} +26 -3
- package/dist/logger-D-S-hO5e.js.map +1 -0
- package/dist/{logs-routes-Bj4TYYUl.js → logs-routes-DAdv37GI.js} +48 -8
- package/dist/logs-routes-DAdv37GI.js.map +1 -0
- package/dist/mcp/consent-page.d.ts +1 -1
- package/dist/mcp/mcp-routes.d.ts +7 -0
- package/dist/mcp/mcp-tools.d.ts +23 -9
- package/dist/mcp/oauth-metadata.d.ts +21 -16
- package/dist/mcp/oauth-routes.d.ts +7 -1
- package/dist/metrics/index.d.ts +18 -0
- package/dist/metrics/pool-wait.d.ts +50 -0
- package/dist/offline-8Ks3yp9n-CadBKm2D.js +3305 -0
- package/dist/offline-8Ks3yp9n-CadBKm2D.js.map +1 -0
- package/dist/offline-store-D9ytNNaa-BCr2vsFB.js +1903 -0
- package/dist/offline-store-D9ytNNaa-BCr2vsFB.js.map +1 -0
- package/dist/{openapi-generator-O_O24MAT.js → openapi-generator-BqoUh4Ij.js} +455 -80
- package/dist/openapi-generator-BqoUh4Ij.js.map +1 -0
- package/dist/policy-PdzX-Opd.js +121 -0
- package/dist/policy-PdzX-Opd.js.map +1 -0
- package/dist/project_manifest-R6y_KHms.js +59 -0
- package/dist/project_manifest-R6y_KHms.js.map +1 -0
- package/dist/{proxy-Czngl3p9.js → proxy-qRlqeUmO.js} +2 -2
- package/dist/{proxy-Czngl3p9.js.map → proxy-qRlqeUmO.js.map} +1 -1
- package/dist/{query-parser-DGRVFNM3.js → query-parser-DK9eMkb9.js} +497 -52
- package/dist/query-parser-DK9eMkb9.js.map +1 -0
- package/dist/{request-timeout-C_4C2BeR.js → request-timeout-Dnl2_OBc.js} +17 -10
- package/dist/request-timeout-Dnl2_OBc.js.map +1 -0
- package/dist/resumable-upload-threshold-CKv-Ry0l.js +24 -0
- package/dist/resumable-upload-threshold-CKv-Ry0l.js.map +1 -0
- package/dist/schema-edit/apply-schema-change.d.ts +73 -3
- package/dist/schema-edit/local-source.d.ts +29 -0
- package/dist/schema-edit/project-root.d.ts +3 -2
- package/dist/schema-edit/remote-source.d.ts +20 -5
- package/dist/schema-edit/source-editor.d.ts +28 -0
- package/dist/schema-editor-routes-BFf3i8jm.js +136 -0
- package/dist/schema-editor-routes-BFf3i8jm.js.map +1 -0
- package/dist/serve-spa.d.ts +58 -0
- package/dist/services/outbound-post.d.ts +50 -0
- package/dist/services/outbound-url-guard.d.ts +34 -5
- package/dist/services/routed-realtime-service.d.ts +16 -0
- package/dist/services/webhook-service.d.ts +66 -14
- package/dist/soft-delete-params-47yBGs3_.js +668 -0
- package/dist/soft-delete-params-47yBGs3_.js.map +1 -0
- package/dist/sql-export-routes-BNNuGGLP.js +240 -0
- package/dist/sql-export-routes-BNNuGGLP.js.map +1 -0
- package/dist/{src-vkcwKXbT.js → src-CatHFUym.js} +439 -20
- package/dist/src-CatHFUym.js.map +1 -0
- package/dist/storage/GCSStorageController.d.ts +48 -2
- package/dist/storage/LocalStorageController.d.ts +69 -2
- package/dist/storage/S3StorageController.d.ts +39 -3
- package/dist/storage/image-transform.d.ts +5 -0
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/maintenance-routes.d.ts +23 -0
- package/dist/storage/maintenance.d.ts +126 -0
- package/dist/storage/property-limits.d.ts +41 -6
- package/dist/storage/rendition-cache.d.ts +9 -11
- package/dist/storage/request-keys.d.ts +15 -0
- package/dist/storage/request-principals.d.ts +30 -0
- package/dist/storage/requested-object.d.ts +74 -0
- package/dist/storage/routes.d.ts +52 -14
- package/dist/storage/source-variables.d.ts +10 -0
- package/dist/storage/streams.d.ts +42 -0
- package/dist/storage/tus-handler.d.ts +76 -7
- package/dist/storage/types.d.ts +101 -7
- package/dist/storage/upload-validation.d.ts +13 -0
- package/dist/storage-resumable-VO-cMpse-C_YX71pO.js +125 -0
- package/dist/storage-resumable-VO-cMpse-C_YX71pO.js.map +1 -0
- package/dist/strings.es-BeZWAodn.js +256 -0
- package/dist/strings.es-BeZWAodn.js.map +1 -0
- package/dist/upload-validation-Dd-fnsbA.js +172 -0
- package/dist/upload-validation-Dd-fnsbA.js.map +1 -0
- package/dist/utils/byte-size.d.ts +10 -0
- package/dist/utils/compression.d.ts +6 -0
- package/dist/utils/load-failure.d.ts +14 -0
- package/dist/utils/logger.d.ts +12 -0
- package/package.json +5 -5
- package/dist/GCSStorageController-CjrA4PMo.js +0 -242
- package/dist/GCSStorageController-CjrA4PMo.js.map +0 -1
- package/dist/S3StorageController-B6pKDNVj.js +0 -264
- package/dist/S3StorageController-B6pKDNVj.js.map +0 -1
- package/dist/admin-roles-vYdp_Pil.js +0 -36
- package/dist/admin-roles-vYdp_Pil.js.map +0 -1
- package/dist/admin_block-DxKLmdiv.js +0 -206
- package/dist/admin_block-DxKLmdiv.js.map +0 -1
- package/dist/ast-schema-editor-Mvr50v_S.js.map +0 -1
- package/dist/auth/api-keys/api-key-permission-guard.d.ts +0 -65
- package/dist/auth-B-GIMpDG.js.map +0 -1
- package/dist/backup-D7YR94N3.js +0 -253
- package/dist/backup-D7YR94N3.js.map +0 -1
- package/dist/contract-routes-CbFjuBwa.js.map +0 -1
- package/dist/cron-loader-DfTj2Hbi.js.map +0 -1
- package/dist/cron-routes-eE8nif_b.js.map +0 -1
- package/dist/cron-scheduler-B0pLfAix.js.map +0 -1
- package/dist/cron-store-TcoGz-xS.js +0 -305
- package/dist/cron-store-TcoGz-xS.js.map +0 -1
- package/dist/dynamic-import-X40pTZUQ.js +0 -23
- package/dist/dynamic-import-X40pTZUQ.js.map +0 -1
- package/dist/errors-DWsX4yTd.js.map +0 -1
- package/dist/function-loader-xnbDAPfa.js.map +0 -1
- package/dist/function-routes-Chet4-lB.js.map +0 -1
- package/dist/jobs-CazMYhyy.js.map +0 -1
- package/dist/jwt-DnQHNFCl.js.map +0 -1
- package/dist/logger-DO2PZc4i.js.map +0 -1
- package/dist/logs-routes-Bj4TYYUl.js.map +0 -1
- package/dist/openapi-generator-O_O24MAT.js.map +0 -1
- package/dist/query-parser-DGRVFNM3.js.map +0 -1
- package/dist/request-timeout-C_4C2BeR.js.map +0 -1
- package/dist/schema-editor-routes-C5-lh_jO.js +0 -87
- package/dist/schema-editor-routes-C5-lh_jO.js.map +0 -1
- package/dist/src-pmvW7BFx.js +0 -6688
- package/dist/src-pmvW7BFx.js.map +0 -1
- package/dist/src-vkcwKXbT.js.map +0 -1
- package/dist/types-BfKcm9do.js +0 -39
- package/dist/types-BfKcm9do.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* API keys module.
|
|
3
3
|
*
|
|
4
|
-
* Re-exports types, store, middleware
|
|
5
|
-
* for the API key authentication system.
|
|
4
|
+
* Re-exports types, store, middleware and routes for API key authentication.
|
|
6
5
|
*
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
9
|
-
export type { ApiKey,
|
|
8
|
+
export type { ApiKey, ApiKeyKind, ApiKeyMasked, ApiKeyWithSecret, CreateApiKeyRequest, CreatePersonalKeyRequest, UpdateApiKeyRequest } from "./api-key-types.js";
|
|
10
9
|
export { createApiKeyStore } from "./api-key-store.js";
|
|
11
|
-
export type { ApiKeyStore } from "./api-key-store.js";
|
|
12
|
-
export { isApiKeyToken, validateApiKey, createApiKeyPreAuth,
|
|
13
|
-
export type { ApiKeyAuthOptions } from "./api-key-middleware.js";
|
|
14
|
-
export { httpMethodToOperation
|
|
15
|
-
export type {
|
|
16
|
-
export { createApiKeyRoutes } from "./api-key-routes.js";
|
|
17
|
-
export type { ApiKeyRouteOptions } from "./api-key-routes.js";
|
|
10
|
+
export type { ApiKeyStore, ApiKeyFilter, NewApiKey } from "./api-key-store.js";
|
|
11
|
+
export { isApiKeyToken, resolveApiKey, validateApiKey, createApiKeyPreAuth, createFunctionScopeGuard, createTusScopeGuard } from "./api-key-middleware.js";
|
|
12
|
+
export type { ApiKeyAuthOptions, ApiKeyIdentity, ApiKeyRefusal } from "./api-key-middleware.js";
|
|
13
|
+
export { httpMethodToOperation } from "./http-operation.js";
|
|
14
|
+
export type { DataOperation } from "./http-operation.js";
|
|
15
|
+
export { createApiKeyRoutes, createPersonalKeyRoutes } from "./api-key-routes.js";
|
|
16
|
+
export type { ApiKeyRouteOptions, PersonalKeyRouteOptions } from "./api-key-routes.js";
|
|
17
|
+
export type { KeyTargets } from "./key-grant.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a new or changed key may hold, decided against whoever asked for it.
|
|
3
|
+
*
|
|
4
|
+
* One rule for every door that mints a credential: **nothing is minted with
|
|
5
|
+
* more than its minter holds.** A key's scopes must be within the creator's
|
|
6
|
+
* own; a service key's RLS roles must be roles the creator holds, unless the
|
|
7
|
+
* creator is an admin; and `keys:*` never goes on a key at all.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type AccessModel } from "@rebasepro/types";
|
|
12
|
+
/**
|
|
13
|
+
* The targets this backend serves, for refusing a key narrowed to something
|
|
14
|
+
* that does not exist — a typo there is a key that silently reaches nothing.
|
|
15
|
+
* Each list is read when a key is minted, so it reflects what is loaded then.
|
|
16
|
+
*/
|
|
17
|
+
export interface KeyTargets {
|
|
18
|
+
collections(): readonly string[];
|
|
19
|
+
functions(): readonly string[];
|
|
20
|
+
buckets(): readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** Read a `scopes` body field: a non-empty array of strings, deduplicated. */
|
|
23
|
+
export declare function readScopesField(value: unknown): string[];
|
|
24
|
+
/** Read a `roles` body field: an array of non-empty strings, deduplicated, without `service`. */
|
|
25
|
+
export declare function readRolesField(value: unknown): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Refuse scopes that are malformed, unknown, aimed at a target that does not
|
|
28
|
+
* exist, for key management, or beyond what `minterScopes` covers.
|
|
29
|
+
*/
|
|
30
|
+
export declare function assertScopesGrantable(requested: readonly string[], minterScopes: readonly string[], model: AccessModel, targets?: KeyTargets): void;
|
|
31
|
+
/**
|
|
32
|
+
* Refuse RLS roles the minter does not hold. An admin may give any role — they
|
|
33
|
+
* already read every row — and anyone else only their own.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertRolesGrantable(requested: readonly string[], minterRoles: readonly string[]): void;
|
|
36
|
+
/** Read an optional `expires_at`: absent, null, or a future ISO-8601 instant. */
|
|
37
|
+
export declare function readExpiresAt(value: unknown, requireFuture: boolean): string | null | undefined;
|
|
38
|
+
/** Read an optional `rate_limit`: absent, null, or a positive integer. */
|
|
39
|
+
export declare function readRateLimit(value: unknown): number | null | undefined;
|
|
40
|
+
/** Read a key name: a non-empty string, trimmed. */
|
|
41
|
+
export declare function readName(value: unknown): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scopes a key stored before scopes existed is read as.
|
|
3
|
+
*
|
|
4
|
+
* Such a row carries `permissions` — `[{ collection, operations }]`, with
|
|
5
|
+
* `"*"`, `"storage"`, `"functions"` and `"functions/<name>"` overloading the
|
|
6
|
+
* collection field — and an `admin` flag. This turns it into the scopes and
|
|
7
|
+
* RLS roles it now holds, once, when the store backfills the row.
|
|
8
|
+
*
|
|
9
|
+
* The rule is that nothing widens. Where a stored grant has no exact
|
|
10
|
+
* equivalent, it narrows:
|
|
11
|
+
*
|
|
12
|
+
* - A function grant without `write` becomes nothing. Functions were checked
|
|
13
|
+
* by HTTP method, so a read-only grant let a key call GET functions; a
|
|
14
|
+
* function is code, and `functions:invoke` is not a read.
|
|
15
|
+
* - `admin: true` becomes the `admin` RLS role and the admin surfaces such a
|
|
16
|
+
* key could reach (users, schema, backups, cron, logs) — not `database:*`,
|
|
17
|
+
* which lived on the realtime socket where no key could authenticate, and
|
|
18
|
+
* not `keys:*`, which no key may hold.
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
/** One stored permission entry, as the old column held it. */
|
|
23
|
+
export interface StoredPermission {
|
|
24
|
+
collection: string;
|
|
25
|
+
operations: string[];
|
|
26
|
+
}
|
|
27
|
+
/** Read a stored `permissions` value — JSON text or already-parsed — into entries. */
|
|
28
|
+
export declare function parseStoredPermissions(value: unknown): StoredPermission[];
|
|
29
|
+
/** The scopes and RLS roles a stored key now holds. Never more than it did. */
|
|
30
|
+
export declare function scopesFromStoredPermissions(permissions: readonly StoredPermission[], admin: boolean): {
|
|
31
|
+
scopes: string[];
|
|
32
|
+
roles: string[];
|
|
33
|
+
};
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
import type { PasswordValidationResult } from "./password.js";
|
|
40
|
+
import { ApiError } from "../api/errors.js";
|
|
40
41
|
import type { AuthRepository, UserData, CreateUserData } from "./interfaces.js";
|
|
41
42
|
import type { EmailService, EmailConfig } from "../email/index.js";
|
|
42
43
|
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
@@ -93,8 +94,12 @@ export interface AuthHooks {
|
|
|
93
94
|
*/
|
|
94
95
|
verifyCredentials?(email: string, password: string, repo: AuthRepository): Promise<UserData | null>;
|
|
95
96
|
/**
|
|
96
|
-
* Called after any successful authentication event
|
|
97
|
-
*
|
|
97
|
+
* Called after any successful authentication event: password login
|
|
98
|
+
* (`login`), registration (`register`), an OAuth sign-in (`oauth`), a
|
|
99
|
+
* token refresh (`refresh`), a password reset (`password-reset`), a
|
|
100
|
+
* guest session (`anonymous`), a magic link (`magic-link`), an email code
|
|
101
|
+
* (`otp`) and a second factor (`mfa`). Every value of {@link AuthMethod}
|
|
102
|
+
* is passed by some route.
|
|
98
103
|
*
|
|
99
104
|
* Use for audit logging, syncing external state, updating
|
|
100
105
|
* last-login timestamps, etc.
|
|
@@ -103,7 +108,11 @@ export interface AuthHooks {
|
|
|
103
108
|
*/
|
|
104
109
|
onAuthenticated?(user: UserData, method: AuthMethod): Promise<void>;
|
|
105
110
|
/**
|
|
106
|
-
* Called before a new user is created
|
|
111
|
+
* Called before a new user is created: registration, an OAuth sign-in
|
|
112
|
+
* that creates the account, a guest, and admin creation.
|
|
113
|
+
*
|
|
114
|
+
* Throw to refuse: the caller gets 400 `HOOK_REJECTED` with your message,
|
|
115
|
+
* or the status your error carries (`ApiError`, or a 4xx `status`).
|
|
107
116
|
*
|
|
108
117
|
* Also called when a guest becomes an account through
|
|
109
118
|
* `POST /auth/anonymous/link`, with the email and password hash it is
|
|
@@ -125,10 +134,14 @@ export interface AuthHooks {
|
|
|
125
134
|
*/
|
|
126
135
|
afterUserCreate?(user: UserData): Promise<void>;
|
|
127
136
|
/**
|
|
128
|
-
* Pre-login validation. Called before credential verification
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
137
|
+
* Pre-login validation. Called before credential verification on every
|
|
138
|
+
* sign-in: password (`login`), OAuth (`oauth`, with the provider's
|
|
139
|
+
* address), and the requests for a magic link (`magic-link`) or an email
|
|
140
|
+
* code (`otp`). Not on a token refresh, which is not a sign-in: to stop a
|
|
141
|
+
* signed-in account, disable it (`PUT /admin/users/:uid { disabled: true }`).
|
|
142
|
+
*
|
|
143
|
+
* Throw to refuse: 400 `HOOK_REJECTED` with your message, or the status
|
|
144
|
+
* your error carries.
|
|
132
145
|
*/
|
|
133
146
|
beforeLogin?(email: string, method: AuthMethod): Promise<void>;
|
|
134
147
|
/**
|
|
@@ -209,6 +222,19 @@ export interface AuthHooks {
|
|
|
209
222
|
* This is fire-and-forget — errors are logged but do not fail the request.
|
|
210
223
|
*/
|
|
211
224
|
afterUserDelete?(uid: string): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Called when a signed-in user asks to move their account to `newEmail`
|
|
227
|
+
* (`POST /auth/change-email`), before anything is mailed. The address is
|
|
228
|
+
* normalized, free and deliverable by then.
|
|
229
|
+
*
|
|
230
|
+
* The address rule `beforeUserCreate` enforces at sign-up — only your own
|
|
231
|
+
* domain, say — belongs here too, or a member can sign up with an allowed
|
|
232
|
+
* address and then move to any other.
|
|
233
|
+
*
|
|
234
|
+
* Throw to refuse: 400 `HOOK_REJECTED` with your message, or the status
|
|
235
|
+
* your error carries.
|
|
236
|
+
*/
|
|
237
|
+
beforeEmailChange?(user: UserData, newEmail: string): Promise<void>;
|
|
212
238
|
/**
|
|
213
239
|
* Optional hook to customize or override the default user creation flow via the admin panel/REST API.
|
|
214
240
|
* When provided, this replaces the built-in password generation, hashing, and invitation email logic.
|
|
@@ -258,4 +284,17 @@ export type ResolvedAuthHooks = Required<Pick<AuthHooks, "hashPassword" | "verif
|
|
|
258
284
|
* This is the single point where defaults are applied — all consumers
|
|
259
285
|
* call this once and use the resolved hooks throughout.
|
|
260
286
|
*/
|
|
287
|
+
/**
|
|
288
|
+
* What a hook's thrown error answers.
|
|
289
|
+
*
|
|
290
|
+
* The hooks that refuse (`beforeUserCreate`, `beforeLogin`,
|
|
291
|
+
* `beforeUserDelete`, `beforeEmailChange`) are documented as "throw to reject", and a plain
|
|
292
|
+
* `Error` is what people throw. It reached the error handler as a 500
|
|
293
|
+
* "Internal Server Error", so a deployment that limits sign-ups to its own
|
|
294
|
+
* domain answered an outsider with a server fault. A refusal is the caller's
|
|
295
|
+
* answer: 400 `HOOK_REJECTED` with the hook's message — or the status an
|
|
296
|
+
* error carries, when the hook chose one (`ApiError`, or any error with a 4xx
|
|
297
|
+
* `status`/`statusCode`).
|
|
298
|
+
*/
|
|
299
|
+
export declare function hookRefusal(error: unknown, hook: string): ApiError;
|
|
261
300
|
export declare function resolveAuthHooks(hooks?: AuthHooks): ResolvedAuthHooks;
|
|
@@ -70,6 +70,14 @@ export interface BuiltinAuthAdapterConfig {
|
|
|
70
70
|
enableEmailOtp?: boolean;
|
|
71
71
|
/** Opt-in httpOnly cookie mode for refresh tokens. */
|
|
72
72
|
cookieAuth?: import("./routes.js").CookieAuthConfig;
|
|
73
|
+
/** Refuse password sign-in until the address is verified; confirm-first registration. */
|
|
74
|
+
requireEmailVerification?: boolean;
|
|
75
|
+
/** Seconds a rotated-away refresh token still mints a sibling. Default 10. */
|
|
76
|
+
refreshTokenReuseIntervalSeconds?: number;
|
|
77
|
+
/** What a refresh token replayed after that window does to its session. Default `"reject"`. */
|
|
78
|
+
refreshTokenReuse?: import("./routes.js").RefreshTokenReusePolicy;
|
|
79
|
+
/** A magic-link or email-code request for an unknown address creates its account, while registration is open. */
|
|
80
|
+
magicLinkCreatesUsers?: boolean;
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
83
|
* Create the built-in Rebase auth adapter.
|
|
@@ -22,6 +22,13 @@ export declare function setRefreshCookie(c: Context<HonoEnv>, refreshToken: stri
|
|
|
22
22
|
export declare function clearRefreshCookie(c: Context<HonoEnv>, config: CookieAuthConfig | undefined): void;
|
|
23
23
|
/**
|
|
24
24
|
* Read the refresh token from the request — cookie first, then body fallback.
|
|
25
|
+
*
|
|
26
|
+
* An empty string is no token, wherever it comes from. In cookie mode every
|
|
27
|
+
* response this server sends carries `refreshToken: ""` (see
|
|
28
|
+
* `redactRefreshToken`), and a client that echoes it back — `@rebasepro/client`
|
|
29
|
+
* did, on every refresh from a live tab — is presenting nothing. Taking the
|
|
30
|
+
* body's `""` as the token, or refusing it at the schema, kept the cookie
|
|
31
|
+
* beside it from ever being read.
|
|
25
32
|
*/
|
|
26
33
|
export declare function readRefreshToken(c: Context<HonoEnv>, body: {
|
|
27
34
|
refreshToken?: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Addresses no mail can reach: the synthetic ones a guest and an X (Twitter)
|
|
3
|
+
* account are given, because `email` is NOT NULL. Nothing is mailed to them,
|
|
4
|
+
* and no account may move onto one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isDeliverableAddress(email: string): boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A signed-in user changes their own email address.
|
|
3
|
+
*
|
|
4
|
+
* `POST /auth/change-email { newEmail }` records the change and mails a link to
|
|
5
|
+
* the new address, and a notice without a link to the old one.
|
|
6
|
+
* `POST /auth/confirm-email-change { token }` — the link's landing screen calls
|
|
7
|
+
* it — moves the account onto the new address.
|
|
8
|
+
*
|
|
9
|
+
* The address moves only when its inbox answers, so the account is never
|
|
10
|
+
* pointed at an address nobody proved, and nothing is reserved meanwhile: a
|
|
11
|
+
* pending change that held the address would let any account keep a stranger
|
|
12
|
+
* from signing up with their own address. Whoever has the address when the link
|
|
13
|
+
* is followed keeps it, and the link answers 409.
|
|
14
|
+
*
|
|
15
|
+
* On confirmation the address is the account's, verified. The identities whose
|
|
16
|
+
* provider vouched for the old address are detached: the old address may be
|
|
17
|
+
* the reason for the change — a job left, an inbox lost — and whoever controls
|
|
18
|
+
* it now would otherwise sign in through that provider. The sessions stay: the
|
|
19
|
+
* change was asked for from one, and the link proves the new inbox, not
|
|
20
|
+
* anything about the others.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { Hono } from "hono";
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
import type { HonoEnv } from "../api/types.js";
|
|
27
|
+
import type { MiddlewareHandler } from "hono";
|
|
28
|
+
import type { resolveAuthHooks } from "./auth-hooks.js";
|
|
29
|
+
import type { AuthModuleConfig } from "./routes.js";
|
|
30
|
+
/** How long an address-change link stays usable. */
|
|
31
|
+
export declare const EMAIL_CHANGE_TTL_MS: number;
|
|
32
|
+
interface EmailChangeRoutesConfig {
|
|
33
|
+
router: Hono<HonoEnv>;
|
|
34
|
+
config: AuthModuleConfig;
|
|
35
|
+
ops: ReturnType<typeof resolveAuthHooks>;
|
|
36
|
+
parseBody: <T>(schema: z.ZodSchema<T>, body: unknown) => T;
|
|
37
|
+
/** A signed-in user, with the revocation watermark consulted. */
|
|
38
|
+
requireLiveSession: MiddlewareHandler<HonoEnv>;
|
|
39
|
+
}
|
|
40
|
+
export declare function mountEmailChangeRoutes(opts: EmailChangeRoutesConfig): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deleting the auth tokens nobody can use any more, on a schedule.
|
|
3
|
+
*
|
|
4
|
+
* `TokenRepository.deleteExpiredTokens` was declared, implemented and never
|
|
5
|
+
* called. Every expired reset link, magic link, email code, abandoned refresh
|
|
6
|
+
* token and stale MFA challenge stayed in the database for good: the tables
|
|
7
|
+
* grew by a row per sign-in attempt and nothing took one away.
|
|
8
|
+
*
|
|
9
|
+
* Runs on the process that owns the timers (`ownership.cronScheduler`), once
|
|
10
|
+
* an hour, and across instances once per hour in all: each tick claims its
|
|
11
|
+
* hour's slot in `rebase.cron_claims` — the claim the cron scheduler takes for
|
|
12
|
+
* a job's run — and only the instance that wins it sweeps. A store that cannot
|
|
13
|
+
* answer the claim means no sweep this hour rather than every instance at
|
|
14
|
+
* once; the tokens are already refused when presented, so a late sweep costs
|
|
15
|
+
* space, not safety.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type { DataDriver } from "@rebasepro/types";
|
|
20
|
+
import type { TokenRepository } from "./interfaces.js";
|
|
21
|
+
/** The slot key in `rebase.cron_claims`. Namespaced so no job file can take it. */
|
|
22
|
+
export declare const EXPIRED_TOKEN_SWEEP_JOB_ID = "rebase:auth:expired-tokens";
|
|
23
|
+
/** One sweep an hour, fleet-wide. */
|
|
24
|
+
export declare const EXPIRED_TOKEN_SWEEP_INTERVAL_MS: number;
|
|
25
|
+
export interface ExpiredTokenSweepOptions {
|
|
26
|
+
authRepo: Pick<TokenRepository, "deleteExpiredTokens">;
|
|
27
|
+
/**
|
|
28
|
+
* Claim `slot` for `jobId` across every instance: `true` for the one that
|
|
29
|
+
* wins it. Throws when the store cannot tell. Without it — a driver with
|
|
30
|
+
* no SQL, cron persistence switched off — every instance sweeps, which is
|
|
31
|
+
* wasted work but harmless: deleting what has expired is idempotent.
|
|
32
|
+
*/
|
|
33
|
+
claimSlot?: (jobId: string, slot: string) => Promise<boolean>;
|
|
34
|
+
intervalMs?: number;
|
|
35
|
+
/** Clock, for tests. */
|
|
36
|
+
now?: () => number;
|
|
37
|
+
}
|
|
38
|
+
/** What one tick did. */
|
|
39
|
+
export type ExpiredTokenSweepOutcome = "swept" | "claimed-elsewhere" | "unclaimed" | "failed";
|
|
40
|
+
export interface ExpiredTokenSweep {
|
|
41
|
+
/** Sweep now, then once per interval. */
|
|
42
|
+
start(): void;
|
|
43
|
+
/**
|
|
44
|
+
* No more ticks. Resolves once a tick already running has finished, so a
|
|
45
|
+
* caller about to close the pool can wait for the tick still using it.
|
|
46
|
+
*/
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
/** One tick: claim this interval's slot and, if it is ours, sweep. */
|
|
49
|
+
runSlot(): Promise<ExpiredTokenSweepOutcome>;
|
|
50
|
+
}
|
|
51
|
+
export declare function createExpiredTokenSweep(options: ExpiredTokenSweepOptions): ExpiredTokenSweep;
|
|
52
|
+
/** What {@link startExpiredTokenSweep} is given by the boot. */
|
|
53
|
+
export interface ExpiredTokenSweepWiring {
|
|
54
|
+
/** The auth repository, when the backend has one. */
|
|
55
|
+
authRepo?: Partial<Pick<TokenRepository, "deleteExpiredTokens">>;
|
|
56
|
+
/** The default data driver: its SQL admin backs the slot claim. */
|
|
57
|
+
driver: DataDriver;
|
|
58
|
+
/** Whether this process owns the timers (`ownership.cronScheduler`). */
|
|
59
|
+
ownsTimers: boolean;
|
|
60
|
+
/** `cronPersistence: false` keeps the claims table out of the database, here too. */
|
|
61
|
+
persistClaims?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start the sweep where it belongs, or answer `undefined` where it does not:
|
|
65
|
+
* a process that does not own the timers, or a backend whose auth repository
|
|
66
|
+
* cannot delete expired tokens.
|
|
67
|
+
*
|
|
68
|
+
* The claim is the cron store's, made on the first tick rather than at boot so
|
|
69
|
+
* the boot does not wait on its tables.
|
|
70
|
+
*/
|
|
71
|
+
export declare function startExpiredTokenSweep(wiring: ExpiredTokenSweepWiring): ExpiredTokenSweep | undefined;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running a request as another user: the `x-rebase-impersonate` header, and
|
|
3
|
+
* the `impersonate` field of the realtime socket's `AUTHENTICATE`.
|
|
4
|
+
*
|
|
5
|
+
* It exists for an administrator checking what one user can see and do — "can
|
|
6
|
+
* B read A's rows, can B write them?" — against the real policies, from
|
|
7
|
+
* Studio's API explorer and JS editor. A granted request runs as one of B's
|
|
8
|
+
* own would: B's uid, B's roles as they are now, B's guest flag and the claims
|
|
9
|
+
* a token minted for B now would carry reach `withAuth`, so the statement runs
|
|
10
|
+
* as `rebase_user` with B's identity and every policy is evaluated for B.
|
|
11
|
+
*
|
|
12
|
+
* Who may: a signed-in administrator, on their own session, judged on their
|
|
13
|
+
* roles as the database has them now rather than as their token claims. Never
|
|
14
|
+
* an API key — not a personal key whose owner is an administrator either — and
|
|
15
|
+
* never the service key. Impersonation is a person checking on another person,
|
|
16
|
+
* and the audit line has to name one.
|
|
17
|
+
*
|
|
18
|
+
* Where: the data API, custom functions and the realtime socket. Every other
|
|
19
|
+
* route refuses the header ({@link refuseUnhonouredImpersonation}).
|
|
20
|
+
*
|
|
21
|
+
* Fail closed: a request asking to act as someone either runs as the user it
|
|
22
|
+
* names or is refused. It never runs as its caller, because that is the
|
|
23
|
+
* failure this exists to end — a response showing the administrator's rows
|
|
24
|
+
* under a label saying they were B's.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import type { Context, MiddlewareHandler } from "hono";
|
|
29
|
+
import { type AuthenticatedUser, type DataDriver } from "@rebasepro/types";
|
|
30
|
+
import type { HonoEnv } from "../api/types.js";
|
|
31
|
+
import { ApiError } from "../api/errors.js";
|
|
32
|
+
/** How the caller authenticated, as far as impersonation is concerned. */
|
|
33
|
+
export type ImpersonationCredential = "session" | "api-key" | "service-key" | "none";
|
|
34
|
+
/** How the auth in use turns a uid into a request identity — `AuthAdapter.resolveUser`. */
|
|
35
|
+
export type ImpersonationUserResolver = (uid: string) => Promise<AuthenticatedUser | null>;
|
|
36
|
+
export interface ImpersonationRequest {
|
|
37
|
+
/** The uid the request asked to act as, as sent. */
|
|
38
|
+
requestedUid: string;
|
|
39
|
+
/** What the caller presented. Only a `session` may impersonate. */
|
|
40
|
+
credential: ImpersonationCredential;
|
|
41
|
+
/** The caller, as their credential verified. */
|
|
42
|
+
caller?: {
|
|
43
|
+
uid: string;
|
|
44
|
+
roles: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
/** Absent when the auth in use has no `resolveUser`: then nobody may. */
|
|
47
|
+
resolveUser?: ImpersonationUserResolver;
|
|
48
|
+
/**
|
|
49
|
+
* Where the request came in, for the security audit line — or absent to
|
|
50
|
+
* write none, for a decision that only re-confirms one already logged
|
|
51
|
+
* (the socket re-asks before every frame).
|
|
52
|
+
*/
|
|
53
|
+
audit?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/** The answer to a request to act as another user. */
|
|
56
|
+
export type ImpersonationDecision = {
|
|
57
|
+
granted: AuthenticatedUser;
|
|
58
|
+
impersonator: string;
|
|
59
|
+
} | {
|
|
60
|
+
refused: ApiError;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Decide whether this caller may act as the user they named, and who that
|
|
64
|
+
* user is now.
|
|
65
|
+
*
|
|
66
|
+
* The one decision both doors take — the HTTP data plane through
|
|
67
|
+
* {@link applyImpersonation}, the realtime socket at `AUTHENTICATE` and before
|
|
68
|
+
* every frame after it. The caller is judged before the named user is looked
|
|
69
|
+
* up, so the answer to a caller who may not impersonate says nothing about
|
|
70
|
+
* whether the uid exists.
|
|
71
|
+
*
|
|
72
|
+
* Throws when a lookup fails: that is not an answer about anyone, and each
|
|
73
|
+
* door refuses it its own way.
|
|
74
|
+
*/
|
|
75
|
+
export declare function decideImpersonation(request: ImpersonationRequest): Promise<ImpersonationDecision>;
|
|
76
|
+
export interface ImpersonationOptions {
|
|
77
|
+
/** What the caller presented. Only a `session` may impersonate. */
|
|
78
|
+
credential: ImpersonationCredential;
|
|
79
|
+
/** The unscoped delegate the request's driver was scoped from. */
|
|
80
|
+
driver: DataDriver;
|
|
81
|
+
/** The auth adapter's `resolveUser`. Absent: the header is refused for everyone. */
|
|
82
|
+
resolveUser?: ImpersonationUserResolver;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Honour or refuse this request's {@link IMPERSONATE_HEADER}.
|
|
86
|
+
*
|
|
87
|
+
* Called by the data-plane auth middlewares once the caller is on the context
|
|
88
|
+
* and its driver is scoped. When the header names a user the caller may act
|
|
89
|
+
* as, the context's `user` and `driver` are replaced with that user's and
|
|
90
|
+
* `impersonator` names the caller.
|
|
91
|
+
*
|
|
92
|
+
* @returns The refusal to send, or `undefined` to carry on — as the caller
|
|
93
|
+
* when the header is absent, as the named user when it was granted.
|
|
94
|
+
*/
|
|
95
|
+
export declare function applyImpersonation(c: Context<HonoEnv>, { credential, driver, resolveUser }: ImpersonationOptions): Promise<Response | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Refuse {@link IMPERSONATE_HEADER} on every route that does not honour it.
|
|
98
|
+
*
|
|
99
|
+
* Only the data API and custom functions run a request as another user; the
|
|
100
|
+
* rest — storage, auth, the admin surfaces — authenticate the caller and
|
|
101
|
+
* ignore the header. Ignored, a request asking to act as B would be answered
|
|
102
|
+
* as the administrator who sent it, which is the one outcome impersonation
|
|
103
|
+
* must never have. Mounted ahead of every route, so a surface added later is
|
|
104
|
+
* refused until it is listed here as honouring the header.
|
|
105
|
+
*
|
|
106
|
+
* @param honouredMounts - The mount points whose auth middleware applies the
|
|
107
|
+
* header (`/api/data`, `/api/functions`). A path is under one when it
|
|
108
|
+
* is the mount itself or continues it with a `/`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function refuseUnhonouredImpersonation(honouredMounts: readonly string[]): MiddlewareHandler<HonoEnv>;
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -49,8 +49,10 @@ export { createSqlRateLimitStore } from "./sql-rate-limit-store.js";
|
|
|
49
49
|
export type { SqlRateLimitStoreOptions } from "./sql-rate-limit-store.js";
|
|
50
50
|
export { resolveRateLimitStoreKind, RateLimitStoreConfigurationError } from "./resolve-rate-limit-store.js";
|
|
51
51
|
export type { RateLimitStoreKind, RateLimitStoreEnv } from "./resolve-rate-limit-store.js";
|
|
52
|
-
export { createApiKeyStore, createApiKeyRoutes, isApiKeyToken, validateApiKey, httpMethodToOperation
|
|
53
|
-
export type { ApiKey,
|
|
52
|
+
export { createApiKeyStore, createApiKeyRoutes, createPersonalKeyRoutes, isApiKeyToken, resolveApiKey, validateApiKey, httpMethodToOperation } from "./api-keys/index.js";
|
|
53
|
+
export type { ApiKey, ApiKeyKind, ApiKeyMasked, ApiKeyWithSecret, CreateApiKeyRequest, CreatePersonalKeyRequest, UpdateApiKeyRequest, ApiKeyStore, DataOperation, KeyTargets } from "./api-keys/index.js";
|
|
54
|
+
export { requireScope, requireScopeByMethod, hasScope, callerScopes, getAccessModel, configureAccess, accessModelFromCollections, AccessModelError } from "./access.js";
|
|
55
|
+
export type { KeyOwnerResolver } from "./access.js";
|
|
54
56
|
export { createBuiltinAuthAdapter } from "./builtin-auth-adapter.js";
|
|
55
57
|
export type { BuiltinAuthAdapterConfig } from "./builtin-auth-adapter.js";
|
|
56
58
|
export { createCustomAuthAdapter } from "./custom-auth-adapter.js";
|