@schemavaults/auth-common 0.9.0 → 0.9.2

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.
@@ -0,0 +1,13 @@
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-auth" | "schemavaults-mail" | "schemavaults-web" | "schemavaults-cli", string>]>;
4
+ }, "strict", z.ZodTypeAny, {
5
+ app_id: string;
6
+ }, {
7
+ app_id: string;
8
+ }>, {
9
+ app_id: string;
10
+ }, {
11
+ app_id: string;
12
+ }>;
13
+ export default authorizeClientApplicationFormType;
@@ -0,0 +1,20 @@
1
+ import { appIdSchema, isHardcodedAppId } from "@schemavaults/app-definitions";
2
+ import { z } from "zod";
3
+ export const authorizeClientApplicationFormType = z
4
+ .object({
5
+ app_id: appIdSchema,
6
+ })
7
+ .required({
8
+ app_id: true,
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!");
19
+ export default authorizeClientApplicationFormType;
20
+ //# sourceMappingURL=authorize-client-application-form-type.js.map
@@ -0,0 +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"}
package/dist/index.d.ts CHANGED
@@ -23,3 +23,4 @@ export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
23
23
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
24
24
  export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
25
25
  export { determineRefreshTokenCookieSameSiteValue } from "./determineRefreshTokenCookieSameSiteValue";
26
+ export { authorizeClientApplicationFormType } from "./authorize-client-application-form-type";
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ export { MaximumBrowserCookieSize } from "./MaximumBrowserCookieSize";
16
16
  export { RefreshTokenCookieName, RefreshTokenExpiryCookieName, } from "./RefreshTokenCookieNames";
17
17
  export { AccessTokenCookieName, AccessTokenExpiryCookieName, } from "./AccessTokenCookieNames";
18
18
  export { determineRefreshTokenCookieSameSiteValue } from "./determineRefreshTokenCookieSameSiteValue";
19
+ export { authorizeClientApplicationFormType } from "./authorize-client-application-form-type";
19
20
  //# 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,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAE5D,cAAc,eAAe,CAAC;AAG9B,mBAAmB;AACnB,cAAc,cAAc,CAAC;AAM7B,cAAc,cAAc,CAAC;AAG7B,cAAc,QAAQ,CAAC;AAGvB,OAAO,EACL,wBAAwB,GAEzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EAEzB,uCAAuC,GAExC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+BAA+B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,aAAa,EACb,4BAA4B,EAC5B,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC;AAazB,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"}
@@ -1,16 +1,15 @@
1
1
  import { z } from "zod";
2
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-auth" | "schemavaults-mail" | "schemavaults-registry", string>]>, z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
4
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
3
+ access: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-auth" | "schemavaults-mail" | "schemavaults-registry", string>]>, z.ZodUnion<[z.ZodObject<{
5
4
  uid: z.ZodString;
6
5
  iat: z.ZodNumber;
7
6
  exp: z.ZodNumber;
8
7
  token: z.ZodString;
9
8
  aud: z.ZodString;
10
9
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
11
- }, {
10
+ } & {
12
11
  type: z.ZodLiteral<"access">;
13
- }>, "strict", z.ZodTypeAny, {
12
+ }, "strict", z.ZodTypeAny, {
14
13
  type: "access";
15
14
  uid: string;
16
15
  iat: number;
@@ -27,17 +26,16 @@ export declare const successfullyGeneratedTokensRecordSchema: z.ZodEffects<z.Zod
27
26
  aud: string;
28
27
  orgs?: string[] | undefined;
29
28
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
30
- refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
31
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
29
+ refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
32
30
  uid: z.ZodString;
33
31
  iat: z.ZodNumber;
34
32
  exp: z.ZodNumber;
35
33
  token: z.ZodString;
36
34
  aud: z.ZodString;
37
35
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
38
- }, {
36
+ } & {
39
37
  type: z.ZodLiteral<"refresh">;
40
- }>, "strict", z.ZodTypeAny, {
38
+ }, "strict", z.ZodTypeAny, {
41
39
  type: "refresh";
42
40
  uid: string;
43
41
  iat: number;
@@ -195,17 +193,16 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
195
193
  success: z.ZodLiteral<true>;
196
194
  error: z.ZodLiteral<false>;
197
195
  tokens: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
198
- access: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-auth" | "schemavaults-mail" | "schemavaults-registry", string>]>, z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
199
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
196
+ access: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, "schemavaults-auth" | "schemavaults-mail" | "schemavaults-registry", string>]>, z.ZodUnion<[z.ZodObject<{
200
197
  uid: z.ZodString;
201
198
  iat: z.ZodNumber;
202
199
  exp: z.ZodNumber;
203
200
  token: z.ZodString;
204
201
  aud: z.ZodString;
205
202
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
206
- }, {
203
+ } & {
207
204
  type: z.ZodLiteral<"access">;
208
- }>, "strict", z.ZodTypeAny, {
205
+ }, "strict", z.ZodTypeAny, {
209
206
  type: "access";
210
207
  uid: string;
211
208
  iat: number;
@@ -222,17 +219,16 @@ export declare const requestTokensResultSchema: z.ZodUnion<[z.ZodObject<{
222
219
  aud: string;
223
220
  orgs?: string[] | undefined;
224
221
  }>, z.ZodLiteral<"AS_HTTP_ONLY_COOKIE">]>>>;
225
- refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
226
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
222
+ refresh: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
227
223
  uid: z.ZodString;
228
224
  iat: z.ZodNumber;
229
225
  exp: z.ZodNumber;
230
226
  token: z.ZodString;
231
227
  aud: z.ZodString;
232
228
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
233
- }, {
229
+ } & {
234
230
  type: z.ZodLiteral<"refresh">;
235
- }>, "strict", z.ZodTypeAny, {
231
+ }, "strict", z.ZodTypeAny, {
236
232
  type: "refresh";
237
233
  uid: string;
238
234
  iat: number;
@@ -33,17 +33,16 @@ export declare const tokenDataSchema: z.ZodObject<{
33
33
  * @see AccessToken
34
34
  */
35
35
  export type AuthToken = z.infer<typeof tokenDataSchema>;
36
- export declare const refreshTokenDataSchema: z.ZodObject<z.objectUtil.extendShape<{
37
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
36
+ export declare const refreshTokenDataSchema: z.ZodObject<{
38
37
  uid: z.ZodString;
39
38
  iat: z.ZodNumber;
40
39
  exp: z.ZodNumber;
41
40
  token: z.ZodString;
42
41
  aud: z.ZodString;
43
42
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
44
- }, {
43
+ } & {
45
44
  type: z.ZodLiteral<"refresh">;
46
- }>, "strict", z.ZodTypeAny, {
45
+ }, "strict", z.ZodTypeAny, {
47
46
  type: "refresh";
48
47
  uid: string;
49
48
  iat: number;
@@ -60,17 +59,16 @@ export declare const refreshTokenDataSchema: z.ZodObject<z.objectUtil.extendShap
60
59
  aud: string;
61
60
  orgs?: string[] | undefined;
62
61
  }>;
63
- export declare const accessTokenDataSchema: z.ZodObject<z.objectUtil.extendShape<{
64
- type: z.ZodUnion<[z.ZodLiteral<"refresh">, z.ZodLiteral<"access">]>;
62
+ export declare const accessTokenDataSchema: z.ZodObject<{
65
63
  uid: z.ZodString;
66
64
  iat: z.ZodNumber;
67
65
  exp: z.ZodNumber;
68
66
  token: z.ZodString;
69
67
  aud: z.ZodString;
70
68
  orgs: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
71
- }, {
69
+ } & {
72
70
  type: z.ZodLiteral<"access">;
73
- }>, "strict", z.ZodTypeAny, {
71
+ }, "strict", z.ZodTypeAny, {
74
72
  type: "access";
75
73
  uid: string;
76
74
  iat: number;
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.9.0",
4
+ "version": "0.9.2",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {
@@ -13,8 +13,8 @@
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "dependencies": {
16
- "zod": "3.23.8",
17
- "@schemavaults/app-definitions": "0.6.17",
16
+ "zod": "3.25.8",
17
+ "@schemavaults/app-definitions": "0.6.18",
18
18
  "crypto-js": "4.2.0"
19
19
  },
20
20
  "scripts": {