@schemavaults/auth-common 0.9.1 → 0.9.3

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.
@@ -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;
@@ -1,5 +1,11 @@
1
1
  import type { AuthTokenTypes } from "../token-data";
2
+ /**
3
+ * @description How long refresh tokens are valid for (in seconds)
4
+ */
2
5
  export declare const refreshTokenExpiry: number;
6
+ /**
7
+ * @description How long access tokens are valid for (in seconds)
8
+ */
3
9
  export declare const accessTokenExpiry: number;
4
10
  /**
5
11
  *
@@ -3,9 +3,13 @@ const oneMinute = 60;
3
3
  const oneHour = oneMinute * 60;
4
4
  const oneDay = oneHour * 24;
5
5
  const oneWeek = oneDay * 7;
6
- // How long refresh tokens are valid for (in seconds)
6
+ /**
7
+ * @description How long refresh tokens are valid for (in seconds)
8
+ */
7
9
  export const refreshTokenExpiry = oneWeek * 2;
8
- // How long access tokens are valid for (in seconds)
10
+ /**
11
+ * @description How long access tokens are valid for (in seconds)
12
+ */
9
13
  export const accessTokenExpiry = oneHour * 1.5;
10
14
  /**
11
15
  * @param type Access or refresh token -- determines the expiry time
@@ -1 +1 @@
1
- {"version":3,"file":"token-expiry.js","sourceRoot":"","sources":["../../src/token-data/token-expiry.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,SAAS,GAAW,EAAW,CAAC;AACtC,MAAM,OAAO,GAAW,SAAS,GAAG,EAAE,CAAC;AACvC,MAAM,MAAM,GAAW,OAAO,GAAG,EAAE,CAAC;AACpC,MAAM,OAAO,GAAW,MAAM,GAAG,CAAC,CAAC;AAEnC,qDAAqD;AACrD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AAW,OAAO,GAAG,GAAG,CAAC;AAEvD;;;GAGG;AACH,SAAS,gBAAgB,CAAC,IAAoB;IAC5C,IAAI,kBAA0B,CAAC;IAC/B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,kBAAkB,GAAG,kBAAkB,CAAC;YACxC,MAAM;QACR,KAAK,QAAQ;YACX,kBAAkB,GAAG,iBAAiB,CAAC;YACvC,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,qHAAqH;AAErH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAoB,EAAE,GAAW;IAC7D,4DAA4D;IAC5D,MAAM,kBAAkB,GAAW,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC1D,+BAA+B;IAC/B,OAAO,GAAG,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAoB;IAC1D,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;AACtC,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.9.1",
4
+ "version": "0.9.3",
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": {