@fuzdev/fuz_app 0.161.0 → 0.163.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/dist/auth/CLAUDE.md +47 -36
- package/dist/auth/account_action_specs.d.ts +614 -150
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +56 -52
- package/dist/auth/account_route_schema.d.ts +401 -94
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +54 -39
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +531 -118
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +76 -58
- package/dist/auth/admin_action_specs.d.ts +1753 -240
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +28 -26
- package/dist/auth/admin_actions.d.ts +4 -4
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +3 -3
- package/dist/auth/all_cell_actions.d.ts +3 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token.d.ts +4 -4
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +3 -3
- package/dist/auth/audit_emitter.d.ts +8 -3
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +32 -9
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -3
- package/dist/auth/audit_log_schema.d.ts +798 -291
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +192 -201
- package/dist/auth/bootstrap_route_schema.d.ts +173 -50
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +35 -16
- package/dist/auth/cell_grant_action_specs.d.ts +1 -1
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_actions.d.ts +4 -4
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +1 -1
- package/dist/auth/credential_type_schema.d.ts +16 -29
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +14 -18
- package/dist/auth/grant_path_schema.d.ts +15 -29
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +13 -17
- package/dist/auth/invite_schema.d.ts +98 -26
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +21 -14
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +28 -1
- package/dist/auth/name_schema.d.ts +7 -6
- package/dist/auth/name_schema.d.ts.map +1 -1
- package/dist/auth/name_schema.js +8 -9
- package/dist/auth/password.d.ts +15 -7
- package/dist/auth/password.d.ts.map +1 -1
- package/dist/auth/password.js +16 -9
- package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
- package/dist/auth/role_grant_offer_action_specs.js +2 -2
- package/dist/auth/role_grant_offer_actions.d.ts +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +3 -3
- package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts +8 -8
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +10 -10
- package/dist/auth/role_schema.d.ts +47 -55
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +29 -35
- package/dist/auth/scope_kind_schema.d.ts +22 -26
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +19 -19
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +6 -6
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +7 -6
- package/dist/auth/signup_route_schema.d.ts +71 -21
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +18 -16
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.js +1 -1
- package/dist/auth/token_lifetime.d.ts +33 -9
- package/dist/auth/token_lifetime.d.ts.map +1 -1
- package/dist/auth/token_lifetime.js +8 -7
- package/dist/auth/token_scope.d.ts +99 -25
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +57 -35
- package/dist/dev/setup.d.ts +14 -7
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +11 -6
- package/dist/primitive_schemas.d.ts +2 -22
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +2 -24
- package/dist/primitive_schemas_fuz.d.ts +56 -2
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +54 -4
- package/dist/testing/CLAUDE.md +29 -8
- package/dist/testing/admin_integration.d.ts +3 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +1 -1
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +6 -2
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +12 -13
- package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +43 -8
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +4 -3
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +45 -42
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.d.ts +4 -4
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +34 -1
- package/dist/testing/db_entities.d.ts +3 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +4 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -3
- package/dist/testing/token_scope_fixtures.d.ts +24 -0
- package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
- package/dist/testing/token_scope_fixtures.js +49 -0
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +13 -12
- package/dist/ui/BootstrapForm.svelte +4 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +4 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/zod.d.ts +2 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +6 -2
- package/package.json +1 -1
- package/dist/auth/audit_log_schema_fuz.d.ts +0 -39
- package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
- package/dist/auth/audit_log_schema_fuz.js +0 -37
- package/dist/auth/role_schema_fuz.d.ts +0 -30
- package/dist/auth/role_schema_fuz.d.ts.map +0 -1
- package/dist/auth/role_schema_fuz.js +0 -30
- package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
- package/dist/auth/scope_kind_schema_fuz.js +0 -31
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
39
|
import { type RpcAction } from '../actions/action_types.js';
|
|
40
|
-
import { type
|
|
40
|
+
import { type RoleRegistry } from './role_schema.js';
|
|
41
41
|
import type { RevokingActionFactoryDeps } from './deps.js';
|
|
42
42
|
/**
|
|
43
43
|
* Validate a deployment's self-service eligible-role set at construction.
|
|
@@ -45,7 +45,7 @@ import type { RevokingActionFactoryDeps } from './deps.js';
|
|
|
45
45
|
* Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
|
|
46
46
|
* any account instance-wide authority, so no eligible set may name it — and a
|
|
47
47
|
* name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
|
|
48
|
-
* `
|
|
48
|
+
* `create_role_registry`, which refuses a builtin name where only app roles
|
|
49
49
|
* belong. Twin of the Rust `validate_self_service_eligible_roles`.
|
|
50
50
|
*
|
|
51
51
|
* @param roles - the eligible role names
|
|
@@ -57,7 +57,7 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
57
57
|
/**
|
|
58
58
|
* Optional override allowlist of role strings eligible for
|
|
59
59
|
* self-service. When omitted, eligibility is derived from
|
|
60
|
-
* `roles.role_specs` (or `
|
|
60
|
+
* `roles.role_specs` (or `builtin_role_specs` when `roles`
|
|
61
61
|
* is also omitted) by selecting every role whose
|
|
62
62
|
* `RoleSpec.grant_paths` includes `'self_service'`. Pass an empty
|
|
63
63
|
* array to lock the surface down (every call comes back as
|
|
@@ -68,11 +68,11 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
68
68
|
*/
|
|
69
69
|
eligible_roles?: ReadonlyArray<string>;
|
|
70
70
|
/**
|
|
71
|
-
* Optional role
|
|
71
|
+
* Optional role registry. Drives default eligibility derivation from
|
|
72
72
|
* `RoleSpec.grant_paths` and validates the `eligible_roles` override
|
|
73
73
|
* (when supplied) against the registered role set.
|
|
74
74
|
*/
|
|
75
|
-
roles?:
|
|
75
|
+
roles?: RoleRegistry;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Build the unified self-service role toggle RPC action.
|
|
@@ -81,7 +81,7 @@ export interface SelfServiceRoleActionsOptions {
|
|
|
81
81
|
* `connection_closer`); `audit.emit` writes a success row in the request
|
|
82
82
|
* transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
|
|
83
83
|
* through `connection_closer`.
|
|
84
|
-
* @param options - optional eligible-role override plus optional role
|
|
84
|
+
* @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
|
|
85
85
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
86
86
|
* @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
|
|
87
87
|
* @throws Error at factory time if the eligible set names a builtin role or an invalid role name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;
|
|
1
|
+
{"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGjG,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAW3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAG,IAW9E,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,yBAAyB,EAC/B,UAAS,6BAAkC,KACzC,KAAK,CAAC,SAAS,CA0JjB,CAAC"}
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
*
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
|
+
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
39
40
|
import { rpc_action } from '../actions/action_types.js';
|
|
40
41
|
import { queue_connection_close } from '../actions/connection_closer.js';
|
|
41
42
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
42
|
-
import {
|
|
43
|
+
import { builtin_role_specs, is_builtin_role, list_roles_with_grant_path, RoleName } from './role_schema.js';
|
|
43
44
|
import { GRANT_PATH_SELF_SERVICE } from './grant_path_schema.js';
|
|
44
45
|
import { query_create_role_grant, query_revoke_role_grant } from './role_grant_queries.js';
|
|
45
46
|
import { is_role_grant_active } from './account_schema.js';
|
|
@@ -51,7 +52,7 @@ import { ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE, self_service_role_set_action_spec
|
|
|
51
52
|
* Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
|
|
52
53
|
* any account instance-wide authority, so no eligible set may name it — and a
|
|
53
54
|
* name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
|
|
54
|
-
* `
|
|
55
|
+
* `create_role_registry`, which refuses a builtin name where only app roles
|
|
55
56
|
* belong. Twin of the Rust `validate_self_service_eligible_roles`.
|
|
56
57
|
*
|
|
57
58
|
* @param roles - the eligible role names
|
|
@@ -62,7 +63,7 @@ export const validate_self_service_eligible_roles = (roles) => {
|
|
|
62
63
|
if (is_builtin_role(role)) {
|
|
63
64
|
throw new Error(`self-service eligible role "${role}" is a builtin role — builtin roles are never self-service`);
|
|
64
65
|
}
|
|
65
|
-
if (!RoleName
|
|
66
|
+
if (!is(RoleName, role)) {
|
|
66
67
|
throw new Error(`self-service eligible role "${role}" is not a valid role name`);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -74,13 +75,13 @@ export const validate_self_service_eligible_roles = (roles) => {
|
|
|
74
75
|
* `connection_closer`); `audit.emit` writes a success row in the request
|
|
75
76
|
* transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
|
|
76
77
|
* through `connection_closer`.
|
|
77
|
-
* @param options - optional eligible-role override plus optional role
|
|
78
|
+
* @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
|
|
78
79
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
79
80
|
* @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
|
|
80
81
|
* @throws Error at factory time if the eligible set names a builtin role or an invalid role name
|
|
81
82
|
*/
|
|
82
83
|
export const create_self_service_role_actions = (deps, options = {}) => {
|
|
83
|
-
const role_specs = options.roles?.role_specs ??
|
|
84
|
+
const role_specs = options.roles?.role_specs ?? builtin_role_specs;
|
|
84
85
|
const eligible = options.eligible_roles
|
|
85
86
|
? new Set(options.eligible_roles)
|
|
86
87
|
: new Set(list_roles_with_grant_path(role_specs, GRANT_PATH_SELF_SERVICE));
|
|
@@ -88,7 +89,7 @@ export const create_self_service_role_actions = (deps, options = {}) => {
|
|
|
88
89
|
if (options.eligible_roles && options.roles) {
|
|
89
90
|
for (const r of eligible) {
|
|
90
91
|
if (!role_specs.has(r)) {
|
|
91
|
-
throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to
|
|
92
|
+
throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to create_role_registry`);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -11,33 +11,83 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
15
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
16
|
-
/** Input for `POST /signup`. `email` is optional (absent or `null` = no email) and must match any referenced invite. */
|
|
17
|
-
export declare const SignupInput: z.ZodObject<{
|
|
18
|
-
username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
19
|
-
password: z.ZodString;
|
|
20
|
-
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
|
-
export type SignupInput = z.infer<typeof SignupInput>;
|
|
23
16
|
/**
|
|
24
|
-
*
|
|
17
|
+
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
18
|
+
* (absent or `null` = no email) and must match any referenced invite.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SignupInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
email?: string | null | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
username: string;
|
|
26
|
+
password: string;
|
|
27
|
+
email?: string | null | undefined;
|
|
28
|
+
}, "object", {
|
|
29
|
+
username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
30
|
+
password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
31
|
+
email: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null | undefined, string | null | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type SignupInput = Infer<typeof SignupInput>;
|
|
34
|
+
/**
|
|
35
|
+
* Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
|
|
25
36
|
*
|
|
26
37
|
* Session cookie is the operative side effect. The returned `account` and
|
|
27
38
|
* `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
|
|
28
|
-
* the per-test identity straight off the signup response.
|
|
39
|
+
* the per-test identity straight off the signup response. Its `username` is
|
|
40
|
+
* the account row's, `UsernameCanonical`.
|
|
29
41
|
*/
|
|
30
|
-
export declare const SignupOutput:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
42
|
+
export declare const SignupOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
43
|
+
account: {
|
|
44
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
45
|
+
username: string;
|
|
46
|
+
};
|
|
47
|
+
actor: {
|
|
48
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
49
|
+
};
|
|
50
|
+
ok: true;
|
|
51
|
+
}, {
|
|
52
|
+
account: {
|
|
53
|
+
id: string;
|
|
54
|
+
username: string;
|
|
55
|
+
};
|
|
56
|
+
actor: {
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
ok: true;
|
|
60
|
+
}, "object", {
|
|
61
|
+
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
62
|
+
account: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
63
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
64
|
+
username: string;
|
|
65
|
+
}, {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string;
|
|
68
|
+
}, "object", {
|
|
69
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
|
|
70
|
+
readonly '~types'?: {
|
|
71
|
+
readonly input: string;
|
|
72
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
73
|
+
} | undefined;
|
|
74
|
+
};
|
|
75
|
+
username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
76
|
+
}>;
|
|
77
|
+
actor: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
78
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
79
|
+
}, {
|
|
80
|
+
id: string;
|
|
81
|
+
}, "object", {
|
|
82
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
|
|
83
|
+
readonly '~types'?: {
|
|
84
|
+
readonly input: string;
|
|
85
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
86
|
+
} | undefined;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
}>;
|
|
90
|
+
export type SignupOutput = Infer<typeof SignupOutput>;
|
|
41
91
|
/** Option inputs that shape the signup route metadata (not its handler). */
|
|
42
92
|
export interface SignupRouteShapeOptions {
|
|
43
93
|
/** Whether a per-account signup rate limiter is wired — toggles `rate_limit`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAON,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;EAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,IAAI,CAAC,SAAS,EAAE,SAAS,CAe1B,CAAC"}
|
|
@@ -11,27 +11,31 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { literal, loose_object, nullable, object, one_of, optional } from '@fuzdev/fuz_schema/schema.ts';
|
|
15
|
+
import { Email, Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
|
|
16
16
|
import { Password } from './password.js';
|
|
17
17
|
import { ERROR_NO_MATCHING_INVITE, ERROR_SIGNUP_CONFLICT, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY } from '../http/error_schemas.js';
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
|
|
20
|
+
* (absent or `null` = no email) and must match any referenced invite.
|
|
21
|
+
*/
|
|
22
|
+
export const SignupInput = object({
|
|
20
23
|
username: Username,
|
|
21
24
|
password: Password,
|
|
22
|
-
email: Email
|
|
25
|
+
email: optional(nullable(Email))
|
|
23
26
|
});
|
|
24
27
|
/**
|
|
25
|
-
* Output for `POST /signup
|
|
28
|
+
* Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
|
|
26
29
|
*
|
|
27
30
|
* Session cookie is the operative side effect. The returned `account` and
|
|
28
31
|
* `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
|
|
29
|
-
* the per-test identity straight off the signup response.
|
|
32
|
+
* the per-test identity straight off the signup response. Its `username` is
|
|
33
|
+
* the account row's, `UsernameCanonical`.
|
|
30
34
|
*/
|
|
31
|
-
export const SignupOutput =
|
|
32
|
-
ok:
|
|
33
|
-
account:
|
|
34
|
-
actor:
|
|
35
|
+
export const SignupOutput = object({
|
|
36
|
+
ok: literal(true),
|
|
37
|
+
account: object({ id: Uuid, username: UsernameCanonical }),
|
|
38
|
+
actor: object({ id: Uuid })
|
|
35
39
|
});
|
|
36
40
|
/**
|
|
37
41
|
* The `POST /signup` route shape minus its handler — pure hono-free data.
|
|
@@ -50,10 +54,8 @@ export const create_signup_route_shape = (options) => ({
|
|
|
50
54
|
output: SignupOutput,
|
|
51
55
|
rate_limit: options.signup_account_rate_limited ? 'both' : 'ip',
|
|
52
56
|
errors: {
|
|
53
|
-
400:
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
403: z.looseObject({ error: z.literal(ERROR_NO_MATCHING_INVITE) }),
|
|
57
|
-
409: z.looseObject({ error: z.literal(ERROR_SIGNUP_CONFLICT) })
|
|
57
|
+
400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
|
|
58
|
+
403: loose_object({ error: literal(ERROR_NO_MATCHING_INVITE) }),
|
|
59
|
+
409: loose_object({ error: literal(ERROR_SIGNUP_CONFLICT) })
|
|
58
60
|
}
|
|
59
61
|
});
|
|
@@ -56,7 +56,7 @@ export interface StandardRpcActionsDeps extends RevokingActionFactoryDeps {
|
|
|
56
56
|
* option flows to admin + role-grant-offer.
|
|
57
57
|
*
|
|
58
58
|
* @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
|
|
59
|
-
* @param options - role
|
|
59
|
+
* @param options - role registry, role-grant-offer config, account config
|
|
60
60
|
* @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
|
|
61
61
|
*/
|
|
62
62
|
export declare const create_standard_rpc_actions: (deps: StandardRpcActionsDeps, options?: StandardRpcActionsOptions) => Array<RpcAction>;
|
|
@@ -31,7 +31,7 @@ import { create_account_actions } from './account_actions.js';
|
|
|
31
31
|
* option flows to admin + role-grant-offer.
|
|
32
32
|
*
|
|
33
33
|
* @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
|
|
34
|
-
* @param options - role
|
|
34
|
+
* @param options - role registry, role-grant-offer config, account config
|
|
35
35
|
* @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
|
|
36
36
|
*/
|
|
37
37
|
export const create_standard_rpc_actions = (deps, options = {}) => [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
23
23
|
/**
|
|
24
24
|
* Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
|
|
25
25
|
* Shared with the Rust twin so out-of-range requests 400 identically on both
|
|
@@ -27,19 +27,43 @@ import { z } from 'zod';
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const TOKEN_TTL_DAYS_MAX = 36500;
|
|
29
29
|
/**
|
|
30
|
-
* Caller-provided lifetime for `account_token_create
|
|
30
|
+
* Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
|
|
31
|
+
* schema.
|
|
31
32
|
*
|
|
32
33
|
* `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
|
|
33
34
|
* to `days` from mint time. `eternal` is deliberately the first variant so
|
|
34
35
|
* schema-driven test generators produce it by default.
|
|
35
36
|
*/
|
|
36
|
-
export declare const TokenLifetimeInput:
|
|
37
|
-
kind:
|
|
38
|
-
}
|
|
39
|
-
kind:
|
|
40
|
-
days:
|
|
41
|
-
},
|
|
42
|
-
|
|
37
|
+
export declare const TokenLifetimeInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
38
|
+
kind: "eternal";
|
|
39
|
+
} | {
|
|
40
|
+
kind: "ttl";
|
|
41
|
+
days: number;
|
|
42
|
+
}, {
|
|
43
|
+
kind: "eternal";
|
|
44
|
+
} | {
|
|
45
|
+
kind: "ttl";
|
|
46
|
+
days: number;
|
|
47
|
+
}, "variant", {
|
|
48
|
+
readonly key: "kind";
|
|
49
|
+
readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
50
|
+
kind: "eternal";
|
|
51
|
+
}, {
|
|
52
|
+
kind: "eternal";
|
|
53
|
+
}, "object", {
|
|
54
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"eternal", "eternal", "literal", "eternal">;
|
|
55
|
+
}>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
56
|
+
kind: "ttl";
|
|
57
|
+
days: number;
|
|
58
|
+
}, {
|
|
59
|
+
kind: "ttl";
|
|
60
|
+
days: number;
|
|
61
|
+
}, "object", {
|
|
62
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"ttl", "ttl", "literal", "ttl">;
|
|
63
|
+
days: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>;
|
|
64
|
+
}>];
|
|
65
|
+
}>;
|
|
66
|
+
export type TokenLifetimeInput = Infer<typeof TokenLifetimeInput>;
|
|
43
67
|
/**
|
|
44
68
|
* Resolve a lifetime input to the `expires_at` value the mint query stores.
|
|
45
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAU,kBAAkB,EAC5B,MAAK,IAAiB,KACpB,IAAI,GAAG,IAGT,CAAC"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import { integer, literal, max_value, min_value, number, object, pipe, variant } from '@fuzdev/fuz_schema/schema.ts';
|
|
23
23
|
/**
|
|
24
24
|
* Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
|
|
25
25
|
* Shared with the Rust twin so out-of-range requests 400 identically on both
|
|
@@ -27,17 +27,18 @@ import { z } from 'zod';
|
|
|
27
27
|
*/
|
|
28
28
|
export const TOKEN_TTL_DAYS_MAX = 36_500;
|
|
29
29
|
/**
|
|
30
|
-
* Caller-provided lifetime for `account_token_create
|
|
30
|
+
* Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
|
|
31
|
+
* schema.
|
|
31
32
|
*
|
|
32
33
|
* `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
|
|
33
34
|
* to `days` from mint time. `eternal` is deliberately the first variant so
|
|
34
35
|
* schema-driven test generators produce it by default.
|
|
35
36
|
*/
|
|
36
|
-
export const TokenLifetimeInput =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
kind:
|
|
40
|
-
days:
|
|
37
|
+
export const TokenLifetimeInput = variant('kind', [
|
|
38
|
+
object({ kind: literal('eternal') }),
|
|
39
|
+
object({
|
|
40
|
+
kind: literal('ttl'),
|
|
41
|
+
days: pipe(number, integer, min_value(1), max_value(TOKEN_TTL_DAYS_MAX))
|
|
41
42
|
})
|
|
42
43
|
]);
|
|
43
44
|
/**
|
|
@@ -28,16 +28,19 @@
|
|
|
28
28
|
*
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
|
31
|
-
import {
|
|
31
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
32
32
|
/** Current `TokenScope` document version. Must match the Rust `TOKEN_SCOPE_VERSION`. */
|
|
33
33
|
export declare const TOKEN_SCOPE_VERSION = 1;
|
|
34
34
|
/**
|
|
35
|
-
* Serialized-document cap
|
|
35
|
+
* Serialized-document cap, in UTF-8 bytes of the document's compact JSON (no
|
|
36
|
+
* whitespace, what `JSON.stringify` writes) — never the text a driver or
|
|
37
|
+
* Postgres prints it as, which for `jsonb` adds a space after every `:` and
|
|
38
|
+
* `,`. Matches the Rust `MAX_TOKEN_SCOPE_BYTES`, which measures the same, and
|
|
36
39
|
* fuz_forge's `MAX_POLICY_BYTES`.
|
|
37
40
|
*/
|
|
38
41
|
export declare const MAX_TOKEN_SCOPE_BYTES: number;
|
|
39
42
|
/**
|
|
40
|
-
* The stored `api_token.scope` document.
|
|
43
|
+
* The stored `api_token.scope` document, a `@fuzdev/fuz_schema` schema.
|
|
41
44
|
*
|
|
42
45
|
* `grandfathered` is a fact about the *row* — the `api_token_scope` migration
|
|
43
46
|
* wrote it; no minter chose it — that only the token list cares about. The
|
|
@@ -49,33 +52,95 @@ export declare const MAX_TOKEN_SCOPE_BYTES: number;
|
|
|
49
52
|
* The discriminated union also refuses the contradiction
|
|
50
53
|
* `{kind: 'full', methods: [...]}`.
|
|
51
54
|
*/
|
|
52
|
-
export declare const TokenScope:
|
|
53
|
-
version:
|
|
54
|
-
kind:
|
|
55
|
-
grandfathered
|
|
56
|
-
}
|
|
57
|
-
version:
|
|
58
|
-
kind:
|
|
59
|
-
methods:
|
|
60
|
-
grandfathered
|
|
61
|
-
},
|
|
62
|
-
|
|
55
|
+
export declare const TokenScope: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
56
|
+
version: 1;
|
|
57
|
+
kind: "full";
|
|
58
|
+
grandfathered?: boolean | undefined;
|
|
59
|
+
} | {
|
|
60
|
+
version: 1;
|
|
61
|
+
kind: "methods";
|
|
62
|
+
methods: string[];
|
|
63
|
+
grandfathered?: boolean | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
version: 1;
|
|
66
|
+
kind: "full";
|
|
67
|
+
grandfathered?: boolean | undefined;
|
|
68
|
+
} | {
|
|
69
|
+
version: 1;
|
|
70
|
+
kind: "methods";
|
|
71
|
+
methods: string[];
|
|
72
|
+
grandfathered?: boolean | undefined;
|
|
73
|
+
}, "variant", {
|
|
74
|
+
readonly key: "kind";
|
|
75
|
+
readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
76
|
+
version: 1;
|
|
77
|
+
kind: "full";
|
|
78
|
+
grandfathered?: boolean | undefined;
|
|
79
|
+
}, {
|
|
80
|
+
version: 1;
|
|
81
|
+
kind: "full";
|
|
82
|
+
grandfathered?: boolean | undefined;
|
|
83
|
+
}, "object", {
|
|
84
|
+
version: import("@fuzdev/fuz_schema/schema.ts").Schema<1, 1, "literal", 1>;
|
|
85
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"full", "full", "literal", "full">;
|
|
86
|
+
grandfathered: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
|
|
87
|
+
}>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
88
|
+
version: 1;
|
|
89
|
+
kind: "methods";
|
|
90
|
+
methods: string[];
|
|
91
|
+
grandfathered?: boolean | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
version: 1;
|
|
94
|
+
kind: "methods";
|
|
95
|
+
methods: string[];
|
|
96
|
+
grandfathered?: boolean | undefined;
|
|
97
|
+
}, "object", {
|
|
98
|
+
version: import("@fuzdev/fuz_schema/schema.ts").Schema<1, 1, "literal", 1>;
|
|
99
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"methods", "methods", "literal", "methods">;
|
|
100
|
+
methods: import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
101
|
+
grandfathered: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean | undefined, boolean | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>>>;
|
|
102
|
+
}>];
|
|
103
|
+
}>;
|
|
104
|
+
export type TokenScope = Infer<typeof TokenScope>;
|
|
63
105
|
/**
|
|
64
106
|
* The `scope` input accepted by `account_token_create` — the stored shape minus
|
|
65
|
-
* the row-owned fields.
|
|
107
|
+
* the row-owned fields, a `@fuzdev/fuz_schema` schema.
|
|
66
108
|
*
|
|
67
109
|
* A minter cannot set `version` or `grandfathered`: the first is stamped by
|
|
68
110
|
* `token_scope_full` / `token_scope_methods`, and the second is the migration's
|
|
69
111
|
* mark for tokens that predate scoping. Letting a caller forge `grandfathered`
|
|
70
112
|
* would turn a tracked debt into a laundered one.
|
|
71
113
|
*/
|
|
72
|
-
export declare const TokenScopeInput:
|
|
73
|
-
kind:
|
|
74
|
-
}
|
|
75
|
-
kind:
|
|
76
|
-
methods:
|
|
77
|
-
},
|
|
78
|
-
|
|
114
|
+
export declare const TokenScopeInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
115
|
+
kind: "full";
|
|
116
|
+
} | {
|
|
117
|
+
kind: "methods";
|
|
118
|
+
methods: string[];
|
|
119
|
+
}, {
|
|
120
|
+
kind: "full";
|
|
121
|
+
} | {
|
|
122
|
+
kind: "methods";
|
|
123
|
+
methods: string[];
|
|
124
|
+
}, "variant", {
|
|
125
|
+
readonly key: "kind";
|
|
126
|
+
readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
127
|
+
kind: "full";
|
|
128
|
+
}, {
|
|
129
|
+
kind: "full";
|
|
130
|
+
}, "object", {
|
|
131
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"full", "full", "literal", "full">;
|
|
132
|
+
}>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
133
|
+
kind: "methods";
|
|
134
|
+
methods: string[];
|
|
135
|
+
}, {
|
|
136
|
+
kind: "methods";
|
|
137
|
+
methods: string[];
|
|
138
|
+
}, "object", {
|
|
139
|
+
kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"methods", "methods", "literal", "methods">;
|
|
140
|
+
methods: import("@fuzdev/fuz_schema/schema.ts").Schema<string[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
141
|
+
}>];
|
|
142
|
+
}>;
|
|
143
|
+
export type TokenScopeInput = Infer<typeof TokenScopeInput>;
|
|
79
144
|
/** A deliberately-minted full-authority scope. */
|
|
80
145
|
export declare const token_scope_full: () => TokenScope;
|
|
81
146
|
/** A narrowed scope over `methods`. */
|
|
@@ -197,7 +262,15 @@ export declare const token_scope_denied_body: (capability: string) => {
|
|
|
197
262
|
/** Stable label for the token list / UI. */
|
|
198
263
|
export declare const token_scope_label: (scope: TokenScope) => string;
|
|
199
264
|
/**
|
|
200
|
-
* Parse a stored document, enforcing the size cap and the schema.
|
|
265
|
+
* Parse a stored document, enforcing the size cap and the schema. The cap is
|
|
266
|
+
* measured on the document's compact serialization, not on `raw`, so the
|
|
267
|
+
* spaced text Postgres prints a `jsonb` as reads as the document it is.
|
|
268
|
+
*
|
|
269
|
+
* A `raw` past twice the cap is refused before it is parsed. Postgres prints a
|
|
270
|
+
* `jsonb` as its compact form plus one space after each `:` and `,` outside
|
|
271
|
+
* strings, each of which is a byte of that form beside its braces, so the
|
|
272
|
+
* printed text of a document either spine can write is under twice the cap and
|
|
273
|
+
* never refused here.
|
|
201
274
|
*
|
|
202
275
|
* **Fail-closed**: returns `null` on an unreadable document, and every caller on
|
|
203
276
|
* the enforcement path treats `null` as "refuse the credential" rather than
|
|
@@ -208,7 +281,7 @@ export declare const token_scope_label: (scope: TokenScope) => string;
|
|
|
208
281
|
*/
|
|
209
282
|
export declare const parse_token_scope: (raw: string) => TokenScope | null;
|
|
210
283
|
/**
|
|
211
|
-
* Serialize for storage, enforcing the size cap.
|
|
284
|
+
* Serialize for storage, enforcing the size cap in UTF-8 bytes.
|
|
212
285
|
*
|
|
213
286
|
* Throws on an over-cap document — the mint path maps that to a 400, matching
|
|
214
287
|
* the Rust side's `TokenScopeError::TooLarge`.
|
|
@@ -220,7 +293,8 @@ export declare const serialize_token_scope: (scope: TokenScope) => string;
|
|
|
220
293
|
*
|
|
221
294
|
* The DB driver may hand `scope` back already-parsed (JSONB → object) or as
|
|
222
295
|
* text depending on backend, so both are normalized here rather than at each
|
|
223
|
-
* call site
|
|
296
|
+
* call site, and either is held to the cap by its compact serialization, as
|
|
297
|
+
* the Rust spine holds the spaced `scope::text` it reads. Lives here rather than beside the queries so the pure scope module
|
|
224
298
|
* owns every parse — and so mocking the query module doesn't drag this along.
|
|
225
299
|
*/
|
|
226
300
|
export declare const parse_stored_token_scope: (value: unknown) => TokenScope | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_scope.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"token_scope.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,wFAAwF;AACxF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,QAAO,UAGlC,CAAC;AAEH,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,GAAI,SAAS,KAAK,CAAC,MAAM,CAAC,KAAG,UAI3D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,eAAe,KAAG,UAC8B,CAAC;AAE/F;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,UAAU,EAAE,QAAQ,MAAM,KAAG,OACtB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,UAAU,KAAG,OAAgC,CAAC;AAEhG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,mGAOjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,YACA,CAAC;AAQ3D;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,MAAM,KAAG,MAC3B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,OAEG,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,YAAY,MAAM,KAChB;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAGxD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,MAGrD,CAAC;AAoBF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,UAAU,GAAG,IAU5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,MASzD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,IACc,CAAC"}
|