@schemavaults/auth-common 0.13.2 → 0.16.1

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.
Files changed (42) hide show
  1. package/dist/audience-schema.d.ts +4 -3
  2. package/dist/audience-schema.js +25 -8
  3. package/dist/audience-schema.js.map +1 -1
  4. package/dist/auth-error-message-catalog.js +2 -2
  5. package/dist/auth-error-message-catalog.js.map +1 -1
  6. package/dist/auth_acquire_tokens_grant_types.d.ts +17 -59
  7. package/dist/auth_acquire_tokens_grant_types.js +50 -50
  8. package/dist/auth_acquire_tokens_grant_types.js.map +1 -1
  9. package/dist/authorize-client-application-form-type.d.ts +2 -6
  10. package/dist/authorize-client-application-form-type.js +2 -10
  11. package/dist/authorize-client-application-form-type.js.map +1 -1
  12. package/dist/cors/index.d.ts +1 -0
  13. package/dist/cors/index.js +2 -0
  14. package/dist/cors/index.js.map +1 -0
  15. package/dist/cors/is-origin-in-allowed-list.d.ts +9 -0
  16. package/dist/cors/is-origin-in-allowed-list.js +22 -0
  17. package/dist/cors/is-origin-in-allowed-list.js.map +1 -0
  18. package/dist/determineRefreshTokenCookieSameSiteValue.js +2 -2
  19. package/dist/determineRefreshTokenCookieSameSiteValue.js.map +1 -1
  20. package/dist/index.d.ts +6 -4
  21. package/dist/index.js +6 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/mfa/mfa-verify-body.d.ts +1 -1
  24. package/dist/organizations/hardcoded_orgs.d.ts +9 -2
  25. package/dist/organizations/hardcoded_orgs.js +18 -9
  26. package/dist/organizations/hardcoded_orgs.js.map +1 -1
  27. package/dist/organizations/index.d.ts +2 -2
  28. package/dist/organizations/index.js +2 -2
  29. package/dist/organizations/index.js.map +1 -1
  30. package/dist/organizations/organization_constants.d.ts +1 -2
  31. package/dist/organizations/organization_constants.js +3 -2
  32. package/dist/organizations/organization_constants.js.map +1 -1
  33. package/dist/organizations/organization_id.d.ts +2 -5
  34. package/dist/organizations/organization_id.js +4 -23
  35. package/dist/organizations/organization_id.js.map +1 -1
  36. package/dist/request_tokens_result.d.ts +74 -73
  37. package/dist/request_tokens_result.js +74 -67
  38. package/dist/request_tokens_result.js.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/organizations/schemavaults_org_id.d.ts +0 -2
  41. package/dist/organizations/schemavaults_org_id.js +0 -3
  42. package/dist/organizations/schemavaults_org_id.js.map +0 -1
@@ -1,3 +1,4 @@
1
- import { z } from "zod";
2
- export declare const audienceRefSchema: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>;
3
- export declare const audienceSchema: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
1
+ import { type SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
2
+ import type { z as zod } from "zod";
3
+ export declare function createAudienceSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>;
4
+ export declare function createAudienceListSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodArray<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, "many">;
@@ -1,12 +1,29 @@
1
- import { apiServerIdSchema } from "@schemavaults/app-definitions";
2
- import { z } from "zod";
3
- export const audienceRefSchema = apiServerIdSchema;
1
+ import { apiServerIdSchema, getAppEnvironment, getAuthServerAppId, getAuthServerUrl, } from "@schemavaults/app-definitions";
2
+ // NOTE: Do not add module-scope `createAudienceSchema(...)` results here. The
3
+ // factories below read SCHEMAVAULTS_APP_ENVIRONMENT (via getAppEnvironment()),
4
+ // the auth-server URL, and the auth server's own app id, which are runtime
5
+ // concerns; eager module-scope initialization breaks `next build` in Docker
6
+ // where those env vars are unset.
7
+ export function createAudienceSchema(z, environment = getAppEnvironment()) {
8
+ const auth_server_url = getAuthServerUrl(environment);
9
+ const auth_server_app_id = getAuthServerAppId();
10
+ const authServerUrlSchema = z
11
+ .string()
12
+ .url()
13
+ .refine((url) => url === auth_server_url)
14
+ .describe("Allow the auth-server URL configured for the current server!");
15
+ const apiServerIdWithoutAuthServerIdSchema = apiServerIdSchema
16
+ .refine((id) => {
17
+ return id !== auth_server_app_id;
18
+ }, `Auth app ID ('${auth_server_app_id}') is not allowed as an audience; use the auth-server URL for tokens with the auth-server audience!`)
19
+ .describe(`An API server ID, but the auth app's ID (${auth_server_app_id}) is forbidden.`);
20
+ return z.union([authServerUrlSchema, apiServerIdWithoutAuthServerIdSchema]);
21
+ }
4
22
  const MAX_APPS_IN_AUDIENCE_LIST = 10;
5
- export const audienceSchema = z.union([
6
- audienceRefSchema,
7
- audienceRefSchema
23
+ export function createAudienceListSchema(z, environment = getAppEnvironment()) {
24
+ return createAudienceSchema(z, environment)
8
25
  .array()
9
26
  .min(1, "Audience list may not be empty")
10
- .max(MAX_APPS_IN_AUDIENCE_LIST, `Audience list may not contain more than ${MAX_APPS_IN_AUDIENCE_LIST} audience references.`),
11
- ]);
27
+ .max(MAX_APPS_IN_AUDIENCE_LIST, `Audience list may not contain more than ${MAX_APPS_IN_AUDIENCE_LIST} audience references.`);
28
+ }
12
29
  //# sourceMappingURL=audience-schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audience-schema.js","sourceRoot":"","sources":["../src/audience-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,iB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AAyB,GAAG,EAA4B,CAAC;AAE/D,MAAM,UAAU,wBAAwB,CACtC,CAAa,EACb,cAA0C,iBAAiB,EAAE;IAE7D,OAAO,oBAAoB,CAAC,CAAC,EAAE,WAAW,CAAC;SACxC,KAAK,EAAE;SACP,GAAG,CAAC,CAAC,EAAE,gCAAgC,CAAC;SACxC,GAAG,CACF,yBAAyB,EACzB,2CAA2C,yBAAyB,uBAAuB,CAC5F,CAAC;AACN,CAAC"}
@@ -22,8 +22,8 @@ export const ERROR_MESSAGE_CATALOG = {
22
22
  unauthenticated: "Failed to authenticate to figure out who you are! Try logging in again or contacting support...",
23
23
  forbidden: "Oops! You don't have permission to do that action! Get in touch with support if you believe this is a mistake!",
24
24
  account_disabled: "Your account has been disabled!",
25
- load_user_data_failure: "There was an error loading data associated with your SchemaVaults account!",
26
- internal_server_error: "There was a problem in the SchemaVaults backend logic and something caused a crash!",
25
+ load_user_data_failure: "There was an error loading data associated with your account!",
26
+ internal_server_error: "There was a problem in the backend logic and something caused a crash!",
27
27
  load_server_config_failure: "There was a problem loading server configuration settings.",
28
28
  server_misconfiguration: "The server does not appear to be configured properly. If you are the site admin, please see the logs for more details.",
29
29
  account_not_in_organization: "Your account is not a member of the organization required for the attempted action.",
@@ -1 +1 @@
1
- {"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;CACc,CAAC;AAIvC,MAAM,CAAC,MAAM,qBAAqB,GAA4C;IAC5E,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,wCAAwC;IACrD,gBAAgB,EAAE,kCAAkC;IACpD,uBAAuB,EAAE,wCAAwC;IACjE,eAAe,EACb,iGAAiG;IACnG,SAAS,EACP,gHAAgH;IAClH,gBAAgB,EAAE,iCAAiC;IACnD,sBAAsB,EACpB,4EAA4E;IAC9E,qBAAqB,EACnB,qFAAqF;IACvF,0BAA0B,EACxB,4DAA4D;IAC9D,uBAAuB,EACrB,wHAAwH;IAC1H,2BAA2B,EACzB,qFAAqF;IACvF,sBAAsB,EACpB,oGAAoG;IACtG,oBAAoB,EAClB,6HAA6H;CAChI,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,EAA8C,CAAC,CAAC;AAC5E,CAAC"}
1
+ {"version":3,"file":"auth-error-message-catalog.js","sourceRoot":"","sources":["../src/auth-error-message-catalog.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG;IAChB,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,yBAAyB;IACzB,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,wBAAwB;IACxB,uBAAuB;IACvB,4BAA4B;IAC5B,yBAAyB;IACzB,6BAA6B;IAC7B,wBAAwB;IACxB,sBAAsB;CACc,CAAC;AAIvC,MAAM,CAAC,MAAM,qBAAqB,GAA4C;IAC5E,OAAO,EAAE,2BAA2B;IACpC,WAAW,EAAE,wCAAwC;IACrD,gBAAgB,EAAE,kCAAkC;IACpD,uBAAuB,EAAE,wCAAwC;IACjE,eAAe,EACb,iGAAiG;IACnG,SAAS,EACP,gHAAgH;IAClH,gBAAgB,EAAE,iCAAiC;IACnD,sBAAsB,EACpB,+DAA+D;IACjE,qBAAqB,EACnB,wEAAwE;IAC1E,0BAA0B,EACxB,4DAA4D;IAC9D,uBAAuB,EACrB,wHAAwH;IAC1H,2BAA2B,EACzB,qFAAqF;IACvF,sBAAsB,EACpB,oGAAoG;IACtG,oBAAoB,EAClB,6HAA6H;CAChI,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC,EAA8C,CAAC,CAAC;AAC5E,CAAC"}
@@ -1,14 +1,15 @@
1
- import { z } from "zod";
1
+ import type { z as zod } from "zod";
2
+ import { SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
2
3
  export declare const grant_types: readonly ["authorization_code", "refresh_token"];
3
- export declare const authorizationCodePOSTbody: z.ZodObject<{
4
- code: z.ZodEffects<z.ZodString, string, string>;
5
- challenge_time: z.ZodNumber;
6
- code_verifier: z.ZodEffects<z.ZodString, string, string>;
7
- audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
8
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
9
- grant_type: z.ZodLiteral<"authorization_code">;
10
- redirect_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
- }, "strict", z.ZodTypeAny, {
4
+ export declare function createAuthorizationCodePOSTBodySchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodObject<{
5
+ code: zod.ZodString;
6
+ challenge_time: zod.ZodNumber;
7
+ code_verifier: zod.ZodEffects<zod.ZodString, string, string>;
8
+ audience: zod.ZodUnion<[zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, zod.ZodArray<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, "many">]>;
9
+ client_app_id: zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>;
10
+ grant_type: zod.ZodLiteral<"authorization_code">;
11
+ redirect_uri: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
12
+ }, "strict", zod.ZodTypeAny, {
12
13
  code: string;
13
14
  challenge_time: number;
14
15
  code_verifier: string;
@@ -25,12 +26,12 @@ export declare const authorizationCodePOSTbody: z.ZodObject<{
25
26
  grant_type: "authorization_code";
26
27
  redirect_uri?: string | null | undefined;
27
28
  }>;
28
- export declare const refreshTokenPOSTbody: z.ZodObject<{
29
- audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
30
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
31
- grant_type: z.ZodLiteral<"refresh_token">;
32
- replaceRefreshToo: z.ZodOptional<z.ZodBoolean>;
33
- }, "strict", z.ZodTypeAny, {
29
+ export declare function createRefreshTokenPOSTBodySchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodObject<{
30
+ audience: zod.ZodUnion<[zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, zod.ZodArray<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, "many">]>;
31
+ client_app_id: zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>;
32
+ grant_type: zod.ZodLiteral<"refresh_token">;
33
+ replaceRefreshToo: zod.ZodOptional<zod.ZodBoolean>;
34
+ }, "strict", zod.ZodTypeAny, {
34
35
  audience: string | string[];
35
36
  client_app_id: string;
36
37
  grant_type: "refresh_token";
@@ -41,46 +42,3 @@ export declare const refreshTokenPOSTbody: z.ZodObject<{
41
42
  grant_type: "refresh_token";
42
43
  replaceRefreshToo?: boolean | undefined;
43
44
  }>;
44
- export declare const grantTypePOSTbodySchemaMap: {
45
- readonly authorization_code: z.ZodObject<{
46
- code: z.ZodEffects<z.ZodString, string, string>;
47
- challenge_time: z.ZodNumber;
48
- code_verifier: z.ZodEffects<z.ZodString, string, string>;
49
- audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
50
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
51
- grant_type: z.ZodLiteral<"authorization_code">;
52
- redirect_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
- }, "strict", z.ZodTypeAny, {
54
- code: string;
55
- challenge_time: number;
56
- code_verifier: string;
57
- audience: string | string[];
58
- client_app_id: string;
59
- grant_type: "authorization_code";
60
- redirect_uri?: string | null | undefined;
61
- }, {
62
- code: string;
63
- challenge_time: number;
64
- code_verifier: string;
65
- audience: string | string[];
66
- client_app_id: string;
67
- grant_type: "authorization_code";
68
- redirect_uri?: string | null | undefined;
69
- }>;
70
- readonly refresh_token: z.ZodObject<{
71
- audience: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, "many">]>;
72
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
73
- grant_type: z.ZodLiteral<"refresh_token">;
74
- replaceRefreshToo: z.ZodOptional<z.ZodBoolean>;
75
- }, "strict", z.ZodTypeAny, {
76
- audience: string | string[];
77
- client_app_id: string;
78
- grant_type: "refresh_token";
79
- replaceRefreshToo?: boolean | undefined;
80
- }, {
81
- audience: string | string[];
82
- client_app_id: string;
83
- grant_type: "refresh_token";
84
- replaceRefreshToo?: boolean | undefined;
85
- }>;
86
- };
@@ -1,56 +1,56 @@
1
1
  import { PKCE_ProofKeyManager } from "./pkce";
2
- import { z } from "zod";
3
- import { audienceSchema } from "./audience-schema";
4
- import { appIdSchema } from "@schemavaults/app-definitions";
2
+ import { createAudienceListSchema, createAudienceSchema, } from "./audience-schema";
3
+ import { appIdSchema, getAppEnvironment, } from "@schemavaults/app-definitions";
5
4
  export const grant_types = [
6
5
  "authorization_code",
7
6
  "refresh_token",
8
7
  ];
9
- const _createTokenEndpointBaseSchema = z.object({
10
- audience: audienceSchema,
11
- client_app_id: appIdSchema,
12
- });
13
- export const authorizationCodePOSTbody = _createTokenEndpointBaseSchema
14
- .extend({
15
- grant_type: z.literal("authorization_code"),
16
- code: z
17
- .string()
18
- .min(64)
19
- .max(1024)
20
- .refine((value) => /^[A-Za-z0-9_-]+$/.test(value)),
21
- code_verifier: PKCE_ProofKeyManager.codeChallengeSchema,
22
- challenge_time: z.number().nonnegative(),
23
- // OAuth2 `redirect_uri` (RFC 6749 §4.1.3) bound to the issued
24
- // authorization code. The token endpoint verifies this matches the
25
- // value persisted on the authorization_codes row by exact string
26
- // equality, so a code minted for URI A cannot be redeemed by
27
- // presenting URI B even when both share an allowlisted origin.
28
- // Null/absent is reserved for the auth server's own account flow,
29
- // which has no third-party callback.
30
- redirect_uri: z.string().url().nullable().optional(),
31
- })
32
- .required({
33
- grant_type: true,
34
- audience: true,
35
- client_app_id: true,
36
- code: true,
37
- code_verifier: true,
38
- challenge_time: true,
39
- })
40
- .strict();
41
- export const refreshTokenPOSTbody = _createTokenEndpointBaseSchema
42
- .extend({
43
- grant_type: z.literal("refresh_token"),
44
- replaceRefreshToo: z.boolean().optional(),
45
- })
46
- .required({
47
- grant_type: true,
48
- audience: true,
49
- client_app_id: true,
50
- })
51
- .strict();
52
- export const grantTypePOSTbodySchemaMap = {
53
- authorization_code: authorizationCodePOSTbody,
54
- refresh_token: refreshTokenPOSTbody,
55
- };
8
+ function createTokenEndpointBaseSchema(z, environment = getAppEnvironment()) {
9
+ return z.object({
10
+ audience: z.union([
11
+ createAudienceSchema(z, environment),
12
+ createAudienceListSchema(z, environment),
13
+ ]),
14
+ client_app_id: appIdSchema,
15
+ });
16
+ }
17
+ export function createAuthorizationCodePOSTBodySchema(z, environment = getAppEnvironment()) {
18
+ return createTokenEndpointBaseSchema(z, environment)
19
+ .extend({
20
+ grant_type: z.literal("authorization_code"),
21
+ code: z.string().min(64).max(1024).base64url(),
22
+ code_verifier: PKCE_ProofKeyManager.codeChallengeSchema,
23
+ challenge_time: z.number().nonnegative(),
24
+ // OAuth2 `redirect_uri` (RFC 6749 §4.1.3) bound to the issued
25
+ // authorization code. The token endpoint verifies this matches the
26
+ // value persisted on the authorization_codes row by exact string
27
+ // equality, so a code minted for URI A cannot be redeemed by
28
+ // presenting URI B even when both share an allowlisted origin.
29
+ // Null/absent is reserved for the auth server's own account flow,
30
+ // which has no third-party callback.
31
+ redirect_uri: z.string().url().nullable().optional(),
32
+ })
33
+ .required({
34
+ grant_type: true,
35
+ audience: true,
36
+ client_app_id: true,
37
+ code: true,
38
+ code_verifier: true,
39
+ challenge_time: true,
40
+ })
41
+ .strict();
42
+ }
43
+ export function createRefreshTokenPOSTBodySchema(z, environment = getAppEnvironment()) {
44
+ return createTokenEndpointBaseSchema(z, environment)
45
+ .extend({
46
+ grant_type: z.literal("refresh_token"),
47
+ replaceRefreshToo: z.boolean().optional(),
48
+ })
49
+ .required({
50
+ grant_type: true,
51
+ audience: true,
52
+ client_app_id: true,
53
+ })
54
+ .strict();
55
+ }
56
56
  //# sourceMappingURL=auth_acquire_tokens_grant_types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth_acquire_tokens_grant_types.js","sourceRoot":"","sources":["../src/auth_acquire_tokens_grant_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,oBAAoB;IACpB,eAAe;CACqB,CAAC;AAEvC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,cAAc;IACxB,aAAa,EAAE,WAAW;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,8BAA8B;KACpE,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC3C,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,EAAE,CAAC;SACP,GAAG,CAAC,IAAI,CAAC;SACT,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,aAAa,EAAE,oBAAoB,CAAC,mBAAmB;IACvD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;IACxC,8DAA8D;IAC9D,mEAAmE;IACnE,iEAAiE;IACjE,6DAA6D;IAC7D,+DAA+D;IAC/D,kEAAkE;IAClE,qCAAqC;IACrC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE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R,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,IAAI;KACpB,CAAC;SACD,MAAM,EAAE,CAAC;AACd,CAAC"}
@@ -1,13 +1,9 @@
1
1
  import { z } from "zod";
2
- export declare const authorizeClientApplicationFormType: z.ZodEffects<z.ZodObject<{
3
- app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
2
+ export declare const authorizeClientApplicationFormType: z.ZodObject<{
3
+ app_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
4
4
  }, "strict", z.ZodTypeAny, {
5
5
  app_id: string;
6
6
  }, {
7
7
  app_id: string;
8
- }>, {
9
- app_id: string;
10
- }, {
11
- app_id: string;
12
8
  }>;
13
9
  export default authorizeClientApplicationFormType;
@@ -1,4 +1,4 @@
1
- import { appIdSchema, isHardcodedAppId } from "@schemavaults/app-definitions";
1
+ import { appIdSchema } from "@schemavaults/app-definitions";
2
2
  import { z } from "zod";
3
3
  export const authorizeClientApplicationFormType = z
4
4
  .object({
@@ -7,14 +7,6 @@ export const authorizeClientApplicationFormType = z
7
7
  .required({
8
8
  app_id: true,
9
9
  })
10
- .strict()
11
- .refine((values) => {
12
- if (isHardcodedAppId(values.app_id)) {
13
- return false;
14
- }
15
- else {
16
- return true;
17
- }
18
- }, "Hardcoded client applications are automatically pre-authorized!");
10
+ .strict();
19
11
  export default authorizeClientApplicationFormType;
20
12
  //# sourceMappingURL=authorize-client-application-form-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorize-client-application-form-type.js","sourceRoot":"","sources":["../src/authorize-client-application-form-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAChD,MAAM,CAAC;IACN,MAAM,EAAE,WAAW;CACpB,CAAC;KACD,QAAQ,CAAC;IACR,MAAM,EAAE,IAAI;CACb,CAAC;KACD,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,MAAM,EAAW,EAAE;IAC1B,IAAI,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,EAAE,iEAAiE,CAAC,CAAC;AAExE,eAAe,kCAAkC,CAAC"}
1
+ {"version":3,"file":"authorize-client-application-form-type.js","sourceRoot":"","sources":["../src/authorize-client-application-form-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAChD,MAAM,CAAC;IACN,MAAM,EAAE,WAAW;CACpB,CAAC;KACD,QAAQ,CAAC;IACR,MAAM,EAAE,IAAI;CACb,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,eAAe,kCAAkC,CAAC"}
@@ -0,0 +1 @@
1
+ export { isOriginInAllowedList } from "./is-origin-in-allowed-list";
@@ -0,0 +1,2 @@
1
+ export { isOriginInAllowedList } from "./is-origin-in-allowed-list";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check if an origin is in a list of allowed origins.
3
+ *
4
+ * Matching is exact, but tolerant of a single trailing slash on either the
5
+ * request origin or the allowed origin (e.g. "https://app.example.com" and
6
+ * "https://app.example.com/" match each other).
7
+ */
8
+ export declare function isOriginInAllowedList(origin: string, allowedOrigins: readonly string[]): boolean;
9
+ export default isOriginInAllowedList;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Check if an origin is in a list of allowed origins.
3
+ *
4
+ * Matching is exact, but tolerant of a single trailing slash on either the
5
+ * request origin or the allowed origin (e.g. "https://app.example.com" and
6
+ * "https://app.example.com/" match each other).
7
+ */
8
+ export function isOriginInAllowedList(origin, allowedOrigins) {
9
+ return allowedOrigins.some((allowed) => {
10
+ // Direct match
11
+ if (origin === allowed)
12
+ return true;
13
+ // Origin may or may not have trailing slash
14
+ if (origin === allowed.replace(/\/$/, ""))
15
+ return true;
16
+ if (origin.replace(/\/$/, "") === allowed)
17
+ return true;
18
+ return false;
19
+ });
20
+ }
21
+ export default isOriginInAllowedList;
22
+ //# sourceMappingURL=is-origin-in-allowed-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-origin-in-allowed-list.js","sourceRoot":"","sources":["../../src/cors/is-origin-in-allowed-list.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAc,EACd,cAAiC;IAEjC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QACrC,eAAe;QACf,IAAI,MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACpC,4CAA4C;QAC5C,IAAI,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACvD,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,9 +1,9 @@
1
- import { SCHEMAVAULTS_AUTH_APP_ID, } from "@schemavaults/app-definitions";
1
+ import { getAuthServerAppId, } from "@schemavaults/app-definitions";
2
2
  // SameSite=none | send cookie in all contexts
3
3
  // SameSite=strict | send cookie in same-site contexts (navigations and other requests)
4
4
  // SameSite=lax | send cookie in same-site requests and when navigating
5
5
  export function determineRefreshTokenCookieSameSiteValue(client_app_id, secure) {
6
- const isAuthServer = SCHEMAVAULTS_AUTH_APP_ID === client_app_id;
6
+ const isAuthServer = getAuthServerAppId() === client_app_id;
7
7
  if (isAuthServer) {
8
8
  return secure ? "strict" : "lax";
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"determineRefreshTokenCookieSameSiteValue.js","sourceRoot":"","sources":["../src/determineRefreshTokenCookieSameSiteValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AAEvC,8CAA8C;AAC9C,uFAAuF;AACvF,uEAAuE;AACvE,MAAM,UAAU,wCAAwC,CACtD,aAAoB,EACpB,MAAe;IAEf,MAAM,YAAY,GAAY,wBAAwB,KAAK,aAAa,CAAC;IACzE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,eAAe,wCAAwC,CAAC"}
1
+ {"version":3,"file":"determineRefreshTokenCookieSameSiteValue.js","sourceRoot":"","sources":["../src/determineRefreshTokenCookieSameSiteValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,8CAA8C;AAC9C,uFAAuF;AACvF,uEAAuE;AACvE,MAAM,UAAU,wCAAwC,CACtD,aAAoB,EACpB,MAAe;IAEf,MAAM,YAAY,GAAY,kBAAkB,EAAE,KAAK,aAAa,CAAC;IACrE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,eAAe,wCAAwC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,15 +12,15 @@ export * from "./pkce";
12
12
  export type * from "./pkce";
13
13
  export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, type AuthenticateResult, type AuthenticatedAuthenticateResult, type MfaRequiredAuthenticateResult, type AuthenticateFailureResult, type ChallengeExpiredAuthenticateResult, type AvailableMfaFactor, } from "./authenticate_result";
14
14
  export * from "./mfa";
15
- export { requestTokensResultSchema, type RequestTokensResult, successfullyGeneratedTokensRecordSchema, type SuccessfullyGeneratedTokensRecord, } from "./request_tokens_result";
15
+ export { createRequestTokensResultSchema, type RequestTokensResult, createSuccessfullyGeneratedTokensRecordSchema, type SuccessfullyGeneratedTokensRecord, } from "./request_tokens_result";
16
16
  export * from "./auth_acquire_tokens_grant_types";
17
17
  export type * from "./auth_acquire_tokens_grant_types";
18
- export { PRODUCTION_AUTH_SERVER_URL } from "@schemavaults/app-definitions";
18
+ export { getAuthServerUrl } from "@schemavaults/app-definitions";
19
19
  export { appIdSchema } from "@schemavaults/app-definitions";
20
- export { audienceSchema, audienceRefSchema } from "./audience-schema";
20
+ export { createAudienceSchema, createAudienceListSchema, } from "./audience-schema";
21
21
  export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
22
22
  export type { InviteCode, InviteCodeDefinition } from "./invite-code";
23
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
23
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, getHardcodedOrgs, getAuthServerOwnerOrganizationId, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_ID, getAuthServerOwnerOrganizationName, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_NAME, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
24
24
  export type { OrganizationID, OrganizationDefinition, InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, OrganizationInvitationStatus, OrganizationInvitation, UserPendingInvitation, OrganizationInvitationWithUserData, OrganizationMembershipRoleType, OrganizationMembershipRoleDetails, } from "./organizations";
25
25
  export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
26
26
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
@@ -30,5 +30,7 @@ export { authorizeClientApplicationFormType } from "./authorize-client-applicati
30
30
  export { paginationOptionsSchema, DEFAULT_PAGINATION_PAGE_INDEX, DEFAULT_PAGINATION_PAGE_SIZE, isValidPaginationOptions, } from "./pagination";
31
31
  export type { PaginationOptions } from "./pagination";
32
32
  export { timingSafeStringEqual } from "./timing-safe-string-equal";
33
+ export { isOriginInAllowedList } from "./cors";
33
34
  export { oauth2StateSchema, OAUTH2_STATE_VSCHAR_REGEX, parseOAuth2State, OAuth2StateValidationError, } from "./oauth2-state-schema";
34
35
  export type { OAuth2State } from "./oauth2-state-schema";
36
+ export { createAuthorizationCodePOSTBodySchema, createRefreshTokenPOSTBodySchema, } from "./auth_acquire_tokens_grant_types";
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ export * from "./middleware";
7
7
  export * from "./pkce";
8
8
  export { authenticateResultSchema, authenticatedAuthenticateResultSchema, mfaRequiredAuthenticateResultSchema, authenticateFailureResultSchema, challengeExpiredAuthenticateResultSchema, availableMfaFactorSchema, collapseWebauthnFactors, } from "./authenticate_result";
9
9
  export * from "./mfa";
10
- export { requestTokensResultSchema, successfullyGeneratedTokensRecordSchema, } from "./request_tokens_result";
10
+ export { createRequestTokensResultSchema, createSuccessfullyGeneratedTokensRecordSchema, } from "./request_tokens_result";
11
11
  export * from "./auth_acquire_tokens_grant_types";
12
- export { PRODUCTION_AUTH_SERVER_URL } from "@schemavaults/app-definitions";
12
+ export { getAuthServerUrl } from "@schemavaults/app-definitions";
13
13
  export { appIdSchema } from "@schemavaults/app-definitions";
14
- export { audienceSchema, audienceRefSchema } from "./audience-schema";
14
+ export { createAudienceSchema, createAudienceListSchema, } from "./audience-schema";
15
15
  export { inviteCodeFormatSchema, inviteCodeDefinitionSchema, } from "./invite-code";
16
- export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, hardcodedOrgs, SCHEMAVAULTS_ORGANIZATION_ID, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
16
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, organizationDefinitionSchema, getHardcodedOrgs, getAuthServerOwnerOrganizationId, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_ID, getAuthServerOwnerOrganizationName, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_NAME, MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, inviteMemberInputModes, inviteMemberFormSchema, organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, organizationMembershipRoleTypes, organizationMembershipRoleTypeSchema, isValidOrganizationMembershipRoleType, organizationMembershipRoleDetailsSchema, isValidOrganizationMembershipRoleDetails, } from "./organizations";
17
17
  export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
18
18
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
19
19
  export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
@@ -21,5 +21,7 @@ export { determineRefreshTokenCookieSameSiteValue } from "./determineRefreshToke
21
21
  export { authorizeClientApplicationFormType } from "./authorize-client-application-form-type";
22
22
  export { paginationOptionsSchema, DEFAULT_PAGINATION_PAGE_INDEX, DEFAULT_PAGINATION_PAGE_SIZE, isValidPaginationOptions, } from "./pagination";
23
23
  export { timingSafeStringEqual } from "./timing-safe-string-equal";
24
+ export { isOriginInAllowedList } from "./cors";
24
25
  export { oauth2StateSchema, OAUTH2_STATE_VSCHAR_REGEX, parseOAuth2State, OAuth2StateValidationError, } from "./oauth2-state-schema";
26
+ export { createAuthorizationCodePOSTBodySchema, createRefreshTokenPOSTBodySchema, } from "./auth_acquire_tokens_grant_types";
25
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAA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0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,EAC5B,+BAA+B,EAC/B,oCAAoC,EACpC,qCAAqC,EACrC,uCAAuC,EACvC,wCAAwC,GACzC,MAAM,iBAAiB,CAAC;AAezB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AAEtG,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAE9F,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,mCAAmC,CAAC"}
@@ -81,7 +81,7 @@ export declare const mfaProofSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
81
81
  export type MfaProof = z.infer<typeof mfaProofSchema>;
82
82
  export declare const mfaVerifyBodySchema: z.ZodObject<{
83
83
  challenge_id: z.ZodString;
84
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
84
+ client_app_id: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
85
85
  proof: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
86
86
  type: z.ZodLiteral<"totp">;
87
87
  factor_id: z.ZodString;
@@ -1,3 +1,10 @@
1
1
  import { OrganizationDefinition } from "./organization_definition";
2
- export declare const hardcodedOrgs: readonly OrganizationDefinition[];
3
- export default hardcodedOrgs;
2
+ /**
3
+ * @description Builds the virtual "hardcoded" organizations fresh on each call
4
+ * so the owner organization's ID and display name are resolved from the
5
+ * SCHEMAVAULTS_AUTH_SERVER_OWNER_ORGANIZATION / _NAME environment variables at
6
+ * call time rather than module load. Server-side only — client code should
7
+ * receive the value via context/props (see useAuthUiOwnerOrganizationId).
8
+ */
9
+ export declare function getHardcodedOrgs(): readonly OrganizationDefinition[];
10
+ export default getHardcodedOrgs;
@@ -1,11 +1,20 @@
1
- import SCHEMAVAULTS_ORGANIZATION_ID from "./schemavaults_org_id";
1
+ import { getAuthServerOwnerOrganizationId, getAuthServerOwnerOrganizationName, } from "@schemavaults/app-definitions";
2
2
  const DefaultHardcodedOrgCreationTime = new Date("2024-01-01T00:00:00Z");
3
- export const hardcodedOrgs = [
4
- {
5
- name: "SchemaVaults",
6
- organization_id: SCHEMAVAULTS_ORGANIZATION_ID,
7
- created_at: DefaultHardcodedOrgCreationTime.getTime(),
8
- },
9
- ];
10
- export default hardcodedOrgs;
3
+ /**
4
+ * @description Builds the virtual "hardcoded" organizations fresh on each call
5
+ * so the owner organization's ID and display name are resolved from the
6
+ * SCHEMAVAULTS_AUTH_SERVER_OWNER_ORGANIZATION / _NAME environment variables at
7
+ * call time rather than module load. Server-side only — client code should
8
+ * receive the value via context/props (see useAuthUiOwnerOrganizationId).
9
+ */
10
+ export function getHardcodedOrgs() {
11
+ return [
12
+ {
13
+ name: getAuthServerOwnerOrganizationName(),
14
+ organization_id: getAuthServerOwnerOrganizationId(),
15
+ created_at: DefaultHardcodedOrgCreationTime.getTime(),
16
+ },
17
+ ];
18
+ }
19
+ export default getHardcodedOrgs;
11
20
  //# sourceMappingURL=hardcoded_orgs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hardcoded_orgs.js","sourceRoot":"","sources":["../../src/organizations/hardcoded_orgs.ts"],"names":[],"mappings":"AACA,OAAO,4BAA4B,MAAM,uBAAuB,CAAC;AAEjE,MAAM,+BAA+B,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D;QACE,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE,4BAA4B;QAC7C,UAAU,EAAE,+BAA+B,CAAC,OAAO,EAAE;KACtD;CACF,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"hardcoded_orgs.js","sourceRoot":"","sources":["../../src/organizations/hardcoded_orgs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,+BAA+B,CAAC;AAGvC,MAAM,+BAA+B,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL;YACE,IAAI,EAAE,kCAAkC,EAAE;YAC1C,eAAe,EAAE,gCAAgC,EAAE;YACnD,UAAU,EAAE,+BAA+B,CAAC,OAAO,EAAE;SACtD;KACF,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
@@ -4,8 +4,8 @@ export { organizationDefinitionSchema } from "./organization_definition";
4
4
  export type { OrganizationDefinition } from "./organization_definition";
5
5
  export { organizationNameSchema, isValidOrganizationName, } from "./organization_name";
6
6
  export type { OrganizationName } from "./organization_name";
7
- export { SCHEMAVAULTS_ORGANIZATION_ID } from "./schemavaults_org_id";
8
- export { hardcodedOrgs } from "./hardcoded_orgs";
7
+ export { getAuthServerOwnerOrganizationId, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_ID, getAuthServerOwnerOrganizationName, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_NAME, } from "@schemavaults/app-definitions";
8
+ export { getHardcodedOrgs } from "./hardcoded_orgs";
9
9
  export { MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
10
10
  export { inviteMemberInputModes, inviteMemberFormSchema, } from "./invite_member_form";
11
11
  export type { InviteMemberInputMode, InviteMemberFormValues, InviteMemberSubmitData, } from "./invite_member_form";
@@ -1,8 +1,8 @@
1
1
  export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "./organization_id";
2
2
  export { organizationDefinitionSchema } from "./organization_definition";
3
3
  export { organizationNameSchema, isValidOrganizationName, } from "./organization_name";
4
- export { SCHEMAVAULTS_ORGANIZATION_ID } from "./schemavaults_org_id";
5
- export { hardcodedOrgs } from "./hardcoded_orgs";
4
+ export { getAuthServerOwnerOrganizationId, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_ID, getAuthServerOwnerOrganizationName, DEFAULT_AUTH_SERVER_OWNER_ORGANIZATION_NAME, } from "@schemavaults/app-definitions";
5
+ export { getHardcodedOrgs } from "./hardcoded_orgs";
6
6
  export { MAXIMUM_USER_ORGANIZATIONS, MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
7
7
  export { inviteMemberInputModes, inviteMemberFormSchema, } from "./invite_member_form";
8
8
  export { organizationInvitationStatusTypes, organizationInvitationStatusSchema, organizationInvitationSchema, } from "./organization_invitation";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/organizations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAGzE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;A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AG7C,OAAO,EACL,uCAAuC,EACvC,wCAAwC,GACzC,MAAM,wCAAwC,CAAC"}
@@ -1,5 +1,4 @@
1
- export declare const MINIMUM_ORGANIZATION_ID_LENGTH: 4;
2
- export declare const MAXIMUM_ORGANIZATION_ID_LENGTH: 32;
1
+ export { MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "@schemavaults/app-definitions";
3
2
  export declare const MINIMUM_ORGANIZATION_NAME_LENGTH: 1;
4
3
  export declare const MAXIMUM_ORGANIZATION_NAME_LENGTH: 64;
5
4
  export declare const MAXIMUM_USER_ORGANIZATIONS: 10;
@@ -1,5 +1,6 @@
1
- export const MINIMUM_ORGANIZATION_ID_LENGTH = 4;
2
- export const MAXIMUM_ORGANIZATION_ID_LENGTH = 32;
1
+ // The ID length limits moved to @schemavaults/app-definitions alongside
2
+ // organizationIdSchema; re-exported here to keep this package's public API unchanged.
3
+ export { MINIMUM_ORGANIZATION_ID_LENGTH, MAXIMUM_ORGANIZATION_ID_LENGTH, } from "@schemavaults/app-definitions";
3
4
  export const MINIMUM_ORGANIZATION_NAME_LENGTH = 1;
4
5
  export const MAXIMUM_ORGANIZATION_NAME_LENGTH = 64;
5
6
  export const MAXIMUM_USER_ORGANIZATIONS = 10;
@@ -1 +1 @@
1
- {"version":3,"file":"organization_constants.js","sourceRoot":"","sources":["../../src/organizations/organization_constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAA2B,CAAC;AAC1E,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAA4B,CAAC;AAE3E,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAA2B,CAAC;AAC5E,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAA4B,CAAC;AAE7E,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAA4B,CAAC"}
1
+ {"version":3,"file":"organization_constants.js","sourceRoot":"","sources":["../../src/organizations/organization_constants.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,sFAAsF;AACtF,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAA2B,CAAC;AAC5E,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAA4B,CAAC;AAE7E,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAA4B,CAAC"}
@@ -1,5 +1,2 @@
1
- import { z } from "zod";
2
- export declare const RESERVED_ORGANIZATION_IDS: readonly ["new", "create", "delete", "update"];
3
- export declare const organizationIdSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
4
- export type OrganizationID = z.infer<typeof organizationIdSchema>;
5
- export declare function isValidOrganizationID(organization_id: string): organization_id is OrganizationID;
1
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "@schemavaults/app-definitions";
2
+ export type { OrganizationID } from "@schemavaults/app-definitions";
@@ -1,24 +1,5 @@
1
- import { z } from "zod";
2
- import { MAXIMUM_ORGANIZATION_ID_LENGTH, MINIMUM_ORGANIZATION_ID_LENGTH, } from "./organization_constants";
3
- export const RESERVED_ORGANIZATION_IDS = [
4
- "new",
5
- "create",
6
- "delete",
7
- "update",
8
- ];
9
- export const organizationIdSchema = z
10
- .string()
11
- .min(MINIMUM_ORGANIZATION_ID_LENGTH, `Organization ID must be at least ${MINIMUM_ORGANIZATION_ID_LENGTH} characters long.`)
12
- .max(MAXIMUM_ORGANIZATION_ID_LENGTH, `Organization ID may not be longer than ${MAXIMUM_ORGANIZATION_ID_LENGTH} characters long.`)
13
- .regex(/^[a-z][a-z0-9_-]+$/, "Organization ID must start with a letter, and may only contain lowercase alphanumeric characters, numbers, hyphens and underscores.")
14
- .refine((orgId) => {
15
- if (orgId.endsWith("_") || orgId.endsWith("-")) {
16
- return false;
17
- }
18
- return true;
19
- }, "Organization ID may not end with a hyphen or dash.")
20
- .refine((orgId) => !RESERVED_ORGANIZATION_IDS.includes(orgId), "This organization ID is reserved and cannot be used.");
21
- export function isValidOrganizationID(organization_id) {
22
- return organizationIdSchema.safeParse(organization_id).success;
23
- }
1
+ // Organization ID validation moved to @schemavaults/app-definitions so the
2
+ // env-driven owner-organization getter can validate without a circular
3
+ // dependency; re-exported here to keep this package's public API unchanged.
4
+ export { organizationIdSchema, isValidOrganizationID, RESERVED_ORGANIZATION_IDS, } from "@schemavaults/app-definitions";
24
5
  //# sourceMappingURL=organization_id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization_id.js","sourceRoot":"","sources":["../../src/organizations/organization_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,QAAQ;CAC4B,CAAC;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,EAAE;KACR,GAAG,CACF,8BAA8B,EAC9B,oCAAoC,8BAA8B,mBAAmB,CACtF;KACA,GAAG,CACF,8BAA8B,EAC9B,0CAA0C,8BAA8B,mBAAmB,CAC5F;KACA,KAAK,CACJ,oBAAoB,EACpB,qIAAqI,CACtI;KACA,MAAM,CAAC,CAAC,KAAa,EAAW,EAAE;IACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,EAAE,oDAAoD,CAAC;KACvD,MAAM,CACL,CAAC,KAAa,EAAW,EAAE,CACzB,CAAC,yBAAyB,CAAC,QAAQ,CAAC,KAAmD,CAAC,EAC1F,sDAAsD,CACvD,CAAC;AAIJ,MAAM,UAAU,qBAAqB,CACnC,eAAuB;IAEvB,OAAO,oBAAoB,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC"}
1
+ {"version":3,"file":"organization_id.js","sourceRoot":"","sources":["../../src/organizations/organization_id.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,uEAAuE;AACvE,4EAA4E;AAC5E,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC"}
@@ -1,15 +1,16 @@
1
- import { z } from "zod";
2
- export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
3
- access: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodUnion<[z.ZodObject<{
4
- uid: z.ZodString;
5
- iat: z.ZodNumber;
6
- exp: z.ZodNumber;
7
- token: z.ZodString;
8
- aud: z.ZodString;
9
- jti: z.ZodOptional<z.ZodString>;
1
+ import type { z as zod } from "zod";
2
+ import { type SchemaVaultsAppEnvironment } from "@schemavaults/app-definitions";
3
+ export declare function createSuccessfullyGeneratedTokensRecordSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodEffects<zod.ZodEffects<zod.ZodObject<{
4
+ access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, zod.ZodUnion<[zod.ZodObject<{
5
+ uid: zod.ZodString;
6
+ iat: zod.ZodNumber;
7
+ exp: zod.ZodNumber;
8
+ token: zod.ZodString;
9
+ aud: zod.ZodString;
10
+ jti: zod.ZodOptional<zod.ZodString>;
10
11
  } & {
11
- type: z.ZodLiteral<"access">;
12
- }, "strict", z.ZodTypeAny, {
12
+ type: zod.ZodLiteral<"access">;
13
+ }, "strict", zod.ZodTypeAny, {
13
14
  type: "access";
14
15
  uid: string;
15
16
  iat: number;
@@ -25,17 +26,17 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
25
26
  token: string;
26
27
  aud: string;
27
28
  jti?: string | undefined;
28
- }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
29
- refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
30
- uid: z.ZodString;
31
- iat: z.ZodNumber;
32
- exp: z.ZodNumber;
33
- token: z.ZodString;
34
- aud: z.ZodString;
35
- jti: z.ZodOptional<z.ZodString>;
29
+ }>, zod.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
30
+ refresh: zod.ZodOptional<zod.ZodUnion<[zod.ZodObject<{
31
+ uid: zod.ZodString;
32
+ iat: zod.ZodNumber;
33
+ exp: zod.ZodNumber;
34
+ token: zod.ZodString;
35
+ aud: zod.ZodString;
36
+ jti: zod.ZodOptional<zod.ZodString>;
36
37
  } & {
37
- type: z.ZodLiteral<"refresh">;
38
- }, "strict", z.ZodTypeAny, {
38
+ type: zod.ZodLiteral<"refresh">;
39
+ }, "strict", zod.ZodTypeAny, {
39
40
  type: "refresh";
40
41
  uid: string;
41
42
  iat: number;
@@ -51,9 +52,9 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
51
52
  token: string;
52
53
  aud: string;
53
54
  jti?: string | undefined;
54
- }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
55
- refresh_token_expiry: z.ZodOptional<z.ZodNumber>;
56
- }, "strict", z.ZodTypeAny, {
55
+ }>, zod.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
56
+ refresh_token_expiry: zod.ZodOptional<zod.ZodNumber>;
57
+ }, "strict", zod.ZodTypeAny, {
57
58
  refresh?: {
58
59
  type: "refresh";
59
60
  uid: string;
@@ -174,12 +175,12 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
174
175
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
175
176
  refresh_token_expiry?: number | undefined;
176
177
  }>;
177
- export type SuccessfullyGeneratedTokensRecord = z.infer<typeof successfullyGeneratedTokensRecordSchema>;
178
- export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
179
- message: z.ZodString;
180
- success: z.ZodLiteral<false>;
181
- error: z.ZodLiteral<true>;
182
- }, "strict", z.ZodTypeAny, {
178
+ export type SuccessfullyGeneratedTokensRecord = zod.infer<ReturnType<typeof createSuccessfullyGeneratedTokensRecordSchema>>;
179
+ export declare function createRequestTokensResultSchema(z: typeof zod, environment?: SchemaVaultsAppEnvironment): zod.ZodUnion<[zod.ZodObject<{
180
+ message: zod.ZodString;
181
+ success: zod.ZodLiteral<false>;
182
+ error: zod.ZodLiteral<true>;
183
+ }, "strict", zod.ZodTypeAny, {
183
184
  message: string;
184
185
  success: false;
185
186
  error: true;
@@ -187,22 +188,22 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
187
188
  message: string;
188
189
  success: false;
189
190
  error: true;
190
- }>, z.ZodObject<{
191
- message: z.ZodString;
192
- client_app_id: z.ZodUnion<readonly [z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
193
- success: z.ZodLiteral<true>;
194
- error: z.ZodLiteral<false>;
195
- tokens: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
196
- access: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-registry" | "schemavaults-auth" | "schemavaults-mail", string>]>, z.ZodUnion<[z.ZodObject<{
197
- uid: z.ZodString;
198
- iat: z.ZodNumber;
199
- exp: z.ZodNumber;
200
- token: z.ZodString;
201
- aud: z.ZodString;
202
- jti: z.ZodOptional<z.ZodString>;
191
+ }>, zod.ZodObject<{
192
+ message: zod.ZodString;
193
+ client_app_id: zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>;
194
+ success: zod.ZodLiteral<true>;
195
+ error: zod.ZodLiteral<false>;
196
+ tokens: zod.ZodOptional<zod.ZodEffects<zod.ZodEffects<zod.ZodObject<{
197
+ access: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, string, string>]>, zod.ZodUnion<[zod.ZodObject<{
198
+ uid: zod.ZodString;
199
+ iat: zod.ZodNumber;
200
+ exp: zod.ZodNumber;
201
+ token: zod.ZodString;
202
+ aud: zod.ZodString;
203
+ jti: zod.ZodOptional<zod.ZodString>;
203
204
  } & {
204
- type: z.ZodLiteral<"access">;
205
- }, "strict", z.ZodTypeAny, {
205
+ type: zod.ZodLiteral<"access">;
206
+ }, "strict", zod.ZodTypeAny, {
206
207
  type: "access";
207
208
  uid: string;
208
209
  iat: number;
@@ -218,17 +219,17 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
218
219
  token: string;
219
220
  aud: string;
220
221
  jti?: string | undefined;
221
- }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
222
- refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
223
- uid: z.ZodString;
224
- iat: z.ZodNumber;
225
- exp: z.ZodNumber;
226
- token: z.ZodString;
227
- aud: z.ZodString;
228
- jti: z.ZodOptional<z.ZodString>;
222
+ }>, zod.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
223
+ refresh: zod.ZodOptional<zod.ZodUnion<[zod.ZodObject<{
224
+ uid: zod.ZodString;
225
+ iat: zod.ZodNumber;
226
+ exp: zod.ZodNumber;
227
+ token: zod.ZodString;
228
+ aud: zod.ZodString;
229
+ jti: zod.ZodOptional<zod.ZodString>;
229
230
  } & {
230
- type: z.ZodLiteral<"refresh">;
231
- }, "strict", z.ZodTypeAny, {
231
+ type: zod.ZodLiteral<"refresh">;
232
+ }, "strict", zod.ZodTypeAny, {
232
233
  type: "refresh";
233
234
  uid: string;
234
235
  iat: number;
@@ -244,9 +245,9 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
244
245
  token: string;
245
246
  aud: string;
246
247
  jti?: string | undefined;
247
- }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
248
- refresh_token_expiry: z.ZodOptional<z.ZodNumber>;
249
- }, "strict", z.ZodTypeAny, {
248
+ }>, zod.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>;
249
+ refresh_token_expiry: zod.ZodOptional<zod.ZodNumber>;
250
+ }, "strict", zod.ZodTypeAny, {
250
251
  refresh?: {
251
252
  type: "refresh";
252
253
  uid: string;
@@ -367,18 +368,18 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
367
368
  } | "AS_HTTP_ONLY_COOKIE"> | undefined;
368
369
  refresh_token_expiry?: number | undefined;
369
370
  }>>;
370
- userData: z.ZodOptional<z.ZodEffects<z.ZodObject<{
371
- uid: z.ZodString;
372
- sub: z.ZodString;
373
- email: z.ZodString;
374
- email_verified: z.ZodOptional<z.ZodBoolean>;
375
- admin: z.ZodOptional<z.ZodBoolean>;
376
- phone_number: z.ZodOptional<z.ZodString>;
377
- phone_verified: z.ZodOptional<z.ZodBoolean>;
378
- disabled: z.ZodOptional<z.ZodBoolean>;
379
- created_at: z.ZodNumber;
380
- invite_code: z.ZodOptional<z.ZodString>;
381
- }, "strict", z.ZodTypeAny, {
371
+ userData: zod.ZodOptional<zod.ZodEffects<zod.ZodObject<{
372
+ uid: zod.ZodString;
373
+ sub: zod.ZodString;
374
+ email: zod.ZodString;
375
+ email_verified: zod.ZodOptional<zod.ZodBoolean>;
376
+ admin: zod.ZodOptional<zod.ZodBoolean>;
377
+ phone_number: zod.ZodOptional<zod.ZodString>;
378
+ phone_verified: zod.ZodOptional<zod.ZodBoolean>;
379
+ disabled: zod.ZodOptional<zod.ZodBoolean>;
380
+ created_at: zod.ZodNumber;
381
+ invite_code: zod.ZodOptional<zod.ZodString>;
382
+ }, "strict", zod.ZodTypeAny, {
382
383
  uid: string;
383
384
  sub: string;
384
385
  email: string;
@@ -423,8 +424,8 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
423
424
  disabled?: boolean | undefined;
424
425
  invite_code?: string | undefined;
425
426
  }>>;
426
- userOrgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, "many">>;
427
- }, "strict", z.ZodTypeAny, {
427
+ userOrgs: zod.ZodOptional<zod.ZodArray<zod.ZodEffects<zod.ZodEffects<zod.ZodString, string, string>, string, string>, "many">>;
428
+ }, "strict", zod.ZodTypeAny, {
428
429
  message: string;
429
430
  client_app_id: string;
430
431
  success: true;
@@ -503,4 +504,4 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
503
504
  } | undefined;
504
505
  userOrgs?: string[] | undefined;
505
506
  }>]>;
506
- export type RequestTokensResult = z.infer<typeof requestTokensResultSchema>;
507
+ export type RequestTokensResult = zod.infer<ReturnType<typeof createRequestTokensResultSchema>>;
@@ -1,73 +1,80 @@
1
- import { z } from "zod";
2
1
  import { userDataSchema } from "./user_data";
3
2
  import { accessTokenDataSchema, refreshTokenDataSchema } from "./token-data";
4
- import { audienceRefSchema } from "./audience-schema";
3
+ import { createAudienceSchema } from "./audience-schema";
5
4
  import { organizationIdSchema } from "./organizations";
6
- import { appIdSchema } from "@schemavaults/app-definitions";
7
- export const successfullyGeneratedTokensRecordSchema = z
8
- .object({
9
- access: z
10
- .record(
11
- // map of audience (app id, fs region, or auth server url) to token for that audience
12
- audienceRefSchema, z.union([accessTokenDataSchema, z.literal("AS_HTTP_ONLY_COOKIE")]))
13
- .optional(),
14
- refresh: z
15
- .union([refreshTokenDataSchema, z.literal("AS_HTTP_ONLY_COOKIE")])
16
- .optional(),
17
- refresh_token_expiry: z.number().optional(),
18
- })
19
- .strict()
20
- .refine((values) => {
21
- if (values.refresh === "AS_HTTP_ONLY_COOKIE") {
22
- if (typeof values.refresh_token_expiry === "number" &&
23
- !isNaN(values.refresh_token_expiry)) {
24
- return true;
5
+ import { appIdSchema, getAppEnvironment, } from "@schemavaults/app-definitions";
6
+ // NOTE: These schemas are exposed as factories (rather than module-scope
7
+ // constants) because the audience schema depends on the app environment and
8
+ // auth-server URL, which must be resolved at call time. Eager module-scope
9
+ // initialization breaks `next build` in Docker where those env vars are unset.
10
+ export function createSuccessfullyGeneratedTokensRecordSchema(z, environment = getAppEnvironment()) {
11
+ return z
12
+ .object({
13
+ access: z
14
+ .record(
15
+ // map of audience (app id, fs region, or auth server url) to token for that audience
16
+ createAudienceSchema(z, environment), z.union([accessTokenDataSchema, z.literal("AS_HTTP_ONLY_COOKIE")]))
17
+ .optional(),
18
+ refresh: z
19
+ .union([refreshTokenDataSchema, z.literal("AS_HTTP_ONLY_COOKIE")])
20
+ .optional(),
21
+ refresh_token_expiry: z.number().optional(),
22
+ })
23
+ .strict()
24
+ .refine((values) => {
25
+ if (values.refresh === "AS_HTTP_ONLY_COOKIE") {
26
+ if (typeof values.refresh_token_expiry === "number" &&
27
+ !isNaN(values.refresh_token_expiry)) {
28
+ return true;
29
+ }
30
+ else {
31
+ return false;
32
+ }
25
33
  }
26
- else {
27
- return false;
34
+ return true;
35
+ }, `A value must be supplied for 'refresh_token_expiry' if refresh token is passed 'AS_HTTP_ONLY_COOKIE'!`)
36
+ .refine((values) => {
37
+ if (values.refresh && typeof values.refresh === "object") {
38
+ if (typeof values.refresh_token_expiry === "number") {
39
+ return false;
40
+ }
28
41
  }
29
- }
30
- return true;
31
- }, `A value must be supplied for 'refresh_token_expiry' if refresh token is passed 'AS_HTTP_ONLY_COOKIE'!`)
32
- .refine((values) => {
33
- if (values.refresh && typeof values.refresh === "object") {
34
- if (typeof values.refresh_token_expiry === "number") {
35
- return false;
36
- }
37
- }
38
- return true;
39
- }, "Passing 'refresh_token_expiry' is redundant when refresh token is passed as an object!");
40
- const requestTokensSuccessfulResultSchema = z
41
- .object({
42
- success: z.literal(true),
43
- error: z.literal(false),
44
- message: z.string(),
45
- client_app_id: appIdSchema,
46
- tokens: successfullyGeneratedTokensRecordSchema.optional(),
47
- userData: userDataSchema.optional(),
48
- userOrgs: organizationIdSchema.array().optional(),
49
- })
50
- .required({
51
- success: true,
52
- message: true,
53
- error: true,
54
- client_app_id: true,
55
- })
56
- .strict();
57
- const requestTokensFailureResultSchema = z
58
- .object({
59
- success: z.literal(false),
60
- error: z.literal(true),
61
- message: z.string(),
62
- })
63
- .required({
64
- success: true,
65
- message: true,
66
- error: true,
67
- })
68
- .strict();
69
- export const requestTokensResultSchema = z.union([
70
- requestTokensFailureResultSchema,
71
- requestTokensSuccessfulResultSchema,
72
- ]);
42
+ return true;
43
+ }, "Passing 'refresh_token_expiry' is redundant when refresh token is passed as an object!");
44
+ }
45
+ export function createRequestTokensResultSchema(z, environment = getAppEnvironment()) {
46
+ const requestTokensSuccessfulResultSchema = z
47
+ .object({
48
+ success: z.literal(true),
49
+ error: z.literal(false),
50
+ message: z.string(),
51
+ client_app_id: appIdSchema,
52
+ tokens: createSuccessfullyGeneratedTokensRecordSchema(z, environment).optional(),
53
+ userData: userDataSchema.optional(),
54
+ userOrgs: organizationIdSchema.array().optional(),
55
+ })
56
+ .required({
57
+ success: true,
58
+ message: true,
59
+ error: true,
60
+ client_app_id: true,
61
+ })
62
+ .strict();
63
+ const requestTokensFailureResultSchema = z
64
+ .object({
65
+ success: z.literal(false),
66
+ error: z.literal(true),
67
+ message: z.string(),
68
+ })
69
+ .required({
70
+ success: true,
71
+ message: true,
72
+ error: true,
73
+ })
74
+ .strict();
75
+ return z.union([
76
+ requestTokensFailureResultSchema,
77
+ requestTokensSuccessfulResultSchema,
78
+ ]);
79
+ }
73
80
  //# sourceMappingURL=request_tokens_result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request_tokens_result.js","sourceRoot":"","sources":["../src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C,MAAM,EAAE;KACpB,CAAC;SACD,QAAQ,CAAC;QACR,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;KACZ,CAAC;SACD,MAAM,EAAE,CAAC;IAEZ,OAAO,CAAC,CAAC,KAAK,CAAC;QACb,gCAAgC;QAChC,mCAAmC;KACpC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schemavaults/auth-common",
3
3
  "description": "Types and utility functions for authentication and authorization",
4
- "version": "0.13.2",
4
+ "version": "0.16.1",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "types": "dist/index.d.ts",
15
15
  "dependencies": {
16
16
  "zod": "3.25.8",
17
- "@schemavaults/app-definitions": "0.7.1",
17
+ "@schemavaults/app-definitions": "0.10.0",
18
18
  "crypto-js": "4.2.0"
19
19
  },
20
20
  "scripts": {
@@ -1,2 +0,0 @@
1
- export declare const SCHEMAVAULTS_ORGANIZATION_ID: "schemavaults";
2
- export default SCHEMAVAULTS_ORGANIZATION_ID;
@@ -1,3 +0,0 @@
1
- export const SCHEMAVAULTS_ORGANIZATION_ID = "schemavaults";
2
- export default SCHEMAVAULTS_ORGANIZATION_ID;
3
- //# sourceMappingURL=schemavaults_org_id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemavaults_org_id.js","sourceRoot":"","sources":["../../src/organizations/schemavaults_org_id.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GACvC,cAAgD,CAAC;AAEnD,eAAe,4BAA4B,CAAC"}