@zudojs/auth 0.0.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 (87) hide show
  1. package/README.md +37 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/authErrors/authError.base.d.ts +77 -0
  4. package/dist/authErrors/authError.base.d.ts.map +1 -0
  5. package/dist/authErrors/authError.base.js +108 -0
  6. package/dist/authErrors/authError.base.js.map +1 -0
  7. package/dist/authErrors/index.d.ts +7 -0
  8. package/dist/authErrors/index.d.ts.map +1 -0
  9. package/dist/authErrors/index.js +7 -0
  10. package/dist/authErrors/index.js.map +1 -0
  11. package/dist/authPassword/authPassword.core.d.ts +39 -0
  12. package/dist/authPassword/authPassword.core.d.ts.map +1 -0
  13. package/dist/authPassword/authPassword.core.js +86 -0
  14. package/dist/authPassword/authPassword.core.js.map +1 -0
  15. package/dist/authPassword/index.d.ts +7 -0
  16. package/dist/authPassword/index.d.ts.map +1 -0
  17. package/dist/authPassword/index.js +7 -0
  18. package/dist/authPassword/index.js.map +1 -0
  19. package/dist/authProvider/authProvider.core.d.ts +62 -0
  20. package/dist/authProvider/authProvider.core.d.ts.map +1 -0
  21. package/dist/authProvider/authProvider.core.js +125 -0
  22. package/dist/authProvider/authProvider.core.js.map +1 -0
  23. package/dist/authProvider/index.d.ts +7 -0
  24. package/dist/authProvider/index.d.ts.map +1 -0
  25. package/dist/authProvider/index.js +7 -0
  26. package/dist/authProvider/index.js.map +1 -0
  27. package/dist/authSession/authSession.core.d.ts +16 -0
  28. package/dist/authSession/authSession.core.d.ts.map +1 -0
  29. package/dist/authSession/authSession.core.js +73 -0
  30. package/dist/authSession/authSession.core.js.map +1 -0
  31. package/dist/authSession/index.d.ts +7 -0
  32. package/dist/authSession/index.d.ts.map +1 -0
  33. package/dist/authSession/index.js +7 -0
  34. package/dist/authSession/index.js.map +1 -0
  35. package/dist/authToken/authToken.core.d.ts +31 -0
  36. package/dist/authToken/authToken.core.d.ts.map +1 -0
  37. package/dist/authToken/authToken.core.js +69 -0
  38. package/dist/authToken/authToken.core.js.map +1 -0
  39. package/dist/authToken/authToken.signing.d.ts +21 -0
  40. package/dist/authToken/authToken.signing.d.ts.map +1 -0
  41. package/dist/authToken/authToken.signing.js +87 -0
  42. package/dist/authToken/authToken.signing.js.map +1 -0
  43. package/dist/authToken/index.d.ts +7 -0
  44. package/dist/authToken/index.d.ts.map +1 -0
  45. package/dist/authToken/index.js +7 -0
  46. package/dist/authToken/index.js.map +1 -0
  47. package/dist/authToken/jwt.namespace.d.ts +18 -0
  48. package/dist/authToken/jwt.namespace.d.ts.map +1 -0
  49. package/dist/authToken/jwt.namespace.js +17 -0
  50. package/dist/authToken/jwt.namespace.js.map +1 -0
  51. package/dist/authTypes/authRbac.type.d.ts +45 -0
  52. package/dist/authTypes/authRbac.type.d.ts.map +1 -0
  53. package/dist/authTypes/authRbac.type.js +10 -0
  54. package/dist/authTypes/authRbac.type.js.map +1 -0
  55. package/dist/authTypes/authSession.type.d.ts +57 -0
  56. package/dist/authTypes/authSession.type.d.ts.map +1 -0
  57. package/dist/authTypes/authSession.type.js +7 -0
  58. package/dist/authTypes/authSession.type.js.map +1 -0
  59. package/dist/authTypes/authStrategy.type.d.ts +83 -0
  60. package/dist/authTypes/authStrategy.type.d.ts.map +1 -0
  61. package/dist/authTypes/authStrategy.type.js +7 -0
  62. package/dist/authTypes/authStrategy.type.js.map +1 -0
  63. package/dist/authTypes/authToken.type.d.ts +72 -0
  64. package/dist/authTypes/authToken.type.d.ts.map +1 -0
  65. package/dist/authTypes/authToken.type.js +7 -0
  66. package/dist/authTypes/authToken.type.js.map +1 -0
  67. package/dist/authTypes/authUser.type.d.ts +47 -0
  68. package/dist/authTypes/authUser.type.d.ts.map +1 -0
  69. package/dist/authTypes/authUser.type.js +7 -0
  70. package/dist/authTypes/authUser.type.js.map +1 -0
  71. package/dist/authTypes/index.d.ts +11 -0
  72. package/dist/authTypes/index.d.ts.map +1 -0
  73. package/dist/authTypes/index.js +11 -0
  74. package/dist/authTypes/index.js.map +1 -0
  75. package/dist/authUtils/authUtils.helper.d.ts +40 -0
  76. package/dist/authUtils/authUtils.helper.d.ts.map +1 -0
  77. package/dist/authUtils/authUtils.helper.js +84 -0
  78. package/dist/authUtils/authUtils.helper.js.map +1 -0
  79. package/dist/authUtils/index.d.ts +7 -0
  80. package/dist/authUtils/index.d.ts.map +1 -0
  81. package/dist/authUtils/index.js +7 -0
  82. package/dist/authUtils/index.js.map +1 -0
  83. package/dist/index.d.ts +19 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +19 -0
  86. package/dist/index.js.map +1 -0
  87. package/package.json +55 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Core user type used across the auth system.
3
+ *
4
+ * @module authTypes/authUser
5
+ */
6
+ import type { UserId } from "@zudojs/constants";
7
+ export type { UserId } from "@zudojs/constants";
8
+ /**
9
+ * Authenticated user representation.
10
+ */
11
+ export interface AuthUser {
12
+ /** Unique identifier */
13
+ readonly id: UserId;
14
+ /** Email address */
15
+ readonly email: string;
16
+ /** Display name */
17
+ readonly name?: string;
18
+ /** Assigned roles */
19
+ readonly roles: readonly string[];
20
+ /** Custom claims */
21
+ readonly claims?: Record<string, unknown>;
22
+ /** Whether the user is active */
23
+ readonly active: boolean;
24
+ /** When the user was created */
25
+ readonly createdAt: Date;
26
+ /** When the user last logged in */
27
+ readonly lastLoginAt?: Date;
28
+ }
29
+ /**
30
+ * User credentials for login.
31
+ */
32
+ export interface UserCredentials {
33
+ /** User email or username */
34
+ readonly identifier: string;
35
+ /** Plain-text password (will be hashed for comparison) */
36
+ readonly password: string;
37
+ }
38
+ /**
39
+ * User registration input.
40
+ */
41
+ export interface UserRegistration {
42
+ readonly email: string;
43
+ readonly password: string;
44
+ readonly name?: string;
45
+ readonly roles?: readonly string[];
46
+ }
47
+ //# sourceMappingURL=authUser.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUser.type.d.ts","sourceRoot":"","sources":["../../src/authTypes/authUser.type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mBAAmB;IACnB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,oBAAoB;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Core user type used across the auth system.
3
+ *
4
+ * @module authTypes/authUser
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=authUser.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUser.type.js","sourceRoot":"","sources":["../../src/authTypes/authUser.type.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Core auth types: users, tokens, sessions, strategies, and RBAC.
3
+ *
4
+ * @module authTypes
5
+ */
6
+ export { type UserId, type AuthUser, type UserCredentials, type UserRegistration, } from "./authUser.type.js";
7
+ export { type JwtToken, type TokenId, type TokenPayload, type TokenPair, type TokenConfig, type TokenVerificationResult, } from "./authToken.type.js";
8
+ export { type SessionId, type AuthSession, type CreateSessionOptions, type SessionStore, } from "./authSession.type.js";
9
+ export { type OAuthProvider, type OAuthConfig, type OAuthUserInfo, type OAuthResult, type AuthStrategy, type PasswordCredentials, type ApiKeyCredentials, } from "./authStrategy.type.js";
10
+ export { type Permission, type Role, type GuardResult, type GuardContext, } from "./authRbac.type.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authTypes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,YAAY,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Core auth types: users, tokens, sessions, strategies, and RBAC.
3
+ *
4
+ * @module authTypes
5
+ */
6
+ export {} from "./authUser.type.js";
7
+ export {} from "./authToken.type.js";
8
+ export {} from "./authSession.type.js";
9
+ export {} from "./authStrategy.type.js";
10
+ export {} from "./authRbac.type.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authTypes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAON,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAKN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAQN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAKN,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Auth utility helpers.
3
+ *
4
+ * @module authUtils
5
+ */
6
+ /**
7
+ * Parse a Bearer token from an Authorization header.
8
+ *
9
+ * @param authorization - Raw Authorization header value
10
+ * @returns The token string, or null if not a Bearer token
11
+ */
12
+ export declare function parseBearerToken(authorization: string | undefined): string | null;
13
+ /**
14
+ * Parse cookie string into a key-value map.
15
+ *
16
+ * @param cookie - Raw Cookie header value
17
+ * @returns Parsed cookies
18
+ */
19
+ export declare function parseCookies(cookie: string | undefined): Record<string, string>;
20
+ /**
21
+ * Check if a token is expired without verifying the signature.
22
+ *
23
+ * @param token - JWT token string
24
+ * @returns Whether the token appears expired
25
+ */
26
+ export declare function isTokenExpired(token: string): boolean;
27
+ /**
28
+ * Extract the user ID from a JWT payload without verifying.
29
+ *
30
+ * @param token - JWT token string
31
+ * @returns User ID or null
32
+ */
33
+ export declare function extractUserId(token: string): string | null;
34
+ /**
35
+ * Generate a CSRF token.
36
+ *
37
+ * @returns Random hex string for CSRF protection
38
+ */
39
+ export declare function generateCsrfToken(): string;
40
+ //# sourceMappingURL=authUtils.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUtils.helper.d.ts","sourceRoot":"","sources":["../../src/authUtils/authUtils.helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,MAAM,GAAG,IAAI,CAKf;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAerD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Auth utility helpers.
3
+ *
4
+ * @module authUtils
5
+ */
6
+ import { randomBytes } from "node:crypto";
7
+ /**
8
+ * Parse a Bearer token from an Authorization header.
9
+ *
10
+ * @param authorization - Raw Authorization header value
11
+ * @returns The token string, or null if not a Bearer token
12
+ */
13
+ export function parseBearerToken(authorization) {
14
+ if (!authorization)
15
+ return null;
16
+ const parts = authorization.split(" ");
17
+ if (parts.length !== 2 || parts[0] !== "Bearer")
18
+ return null;
19
+ return parts[1] ?? null;
20
+ }
21
+ /**
22
+ * Parse cookie string into a key-value map.
23
+ *
24
+ * @param cookie - Raw Cookie header value
25
+ * @returns Parsed cookies
26
+ */
27
+ export function parseCookies(cookie) {
28
+ const result = {};
29
+ if (!cookie)
30
+ return result;
31
+ for (const part of cookie.split(";")) {
32
+ const [key, ...rest] = part.trim().split("=");
33
+ if (key && rest.length > 0) {
34
+ result[key.trim()] = rest.join("=").trim();
35
+ }
36
+ }
37
+ return result;
38
+ }
39
+ /**
40
+ * Check if a token is expired without verifying the signature.
41
+ *
42
+ * @param token - JWT token string
43
+ * @returns Whether the token appears expired
44
+ */
45
+ export function isTokenExpired(token) {
46
+ try {
47
+ const parts = token.split(".");
48
+ if (parts.length !== 3)
49
+ return true;
50
+ const payload = JSON.parse(Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf-8"));
51
+ const now = Math.floor(Date.now() / 1000);
52
+ return payload.exp < now;
53
+ }
54
+ catch {
55
+ return true;
56
+ }
57
+ }
58
+ /**
59
+ * Extract the user ID from a JWT payload without verifying.
60
+ *
61
+ * @param token - JWT token string
62
+ * @returns User ID or null
63
+ */
64
+ export function extractUserId(token) {
65
+ try {
66
+ const parts = token.split(".");
67
+ if (parts.length !== 3)
68
+ return null;
69
+ const payload = JSON.parse(Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf-8"));
70
+ return payload.sub ?? null;
71
+ }
72
+ catch {
73
+ return null;
74
+ }
75
+ }
76
+ /**
77
+ * Generate a CSRF token.
78
+ *
79
+ * @returns Random hex string for CSRF protection
80
+ */
81
+ export function generateCsrfToken() {
82
+ return randomBytes(32).toString("hex");
83
+ }
84
+ //# sourceMappingURL=authUtils.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authUtils.helper.js","sourceRoot":"","sources":["../../src/authUtils/authUtils.helper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,aAAiC;IAEjC,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7D,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,MAAM,CAAC,IAAI,CACT,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAC/C,QAAQ,CACT,CAAC,QAAQ,CAAC,OAAO,CAAC,CACpB,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,MAAM,CAAC,IAAI,CACT,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAC/C,QAAQ,CACT,CAAC,QAAQ,CAAC,OAAO,CAAC,CACpB,CAAC;QACF,OAAO,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Auth utility helpers: token parsing, cookie parsing, CSRF.
3
+ *
4
+ * @module authUtils
5
+ */
6
+ export { parseBearerToken, parseCookies, isTokenExpired, extractUserId, generateCsrfToken, } from "./authUtils.helper.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authUtils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Auth utility helpers: token parsing, cookie parsing, CSRF.
3
+ *
4
+ * @module authUtils
5
+ */
6
+ export { parseBearerToken, parseCookies, isTokenExpired, extractUserId, generateCsrfToken, } from "./authUtils.helper.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authUtils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @zudojs/auth
3
+ *
4
+ * Authentication and authorization services for the Zudojs framework.
5
+ *
6
+ * Provides JWT token management (access + refresh), password hashing (scrypt),
7
+ * session management, RBAC (role-based access control), and auth utilities.
8
+ *
9
+ * @module @zudojs/auth
10
+ */
11
+ export * from "./authTypes/index.js";
12
+ export * from "./authErrors/index.js";
13
+ export * from "./authPassword/index.js";
14
+ export * from "./authToken/index.js";
15
+ export { jwt } from "./authToken/jwt.namespace.js";
16
+ export * from "./authSession/index.js";
17
+ export * from "./authProvider/index.js";
18
+ export * from "./authUtils/index.js";
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @zudojs/auth
3
+ *
4
+ * Authentication and authorization services for the Zudojs framework.
5
+ *
6
+ * Provides JWT token management (access + refresh), password hashing (scrypt),
7
+ * session management, RBAC (role-based access control), and auth utilities.
8
+ *
9
+ * @module @zudojs/auth
10
+ */
11
+ export * from "./authTypes/index.js";
12
+ export * from "./authErrors/index.js";
13
+ export * from "./authPassword/index.js";
14
+ export * from "./authToken/index.js";
15
+ export { jwt } from "./authToken/jwt.namespace.js";
16
+ export * from "./authSession/index.js";
17
+ export * from "./authProvider/index.js";
18
+ export * from "./authUtils/index.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@zudojs/auth",
3
+ "version": "0.0.1",
4
+ "description": "Authentication and authorization services for the Zudojs framework — JWT, sessions, RBAC, OAuth2, and password management.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "clean": "rm -rf dist",
24
+ "test": "vitest run",
25
+ "test:watch": "vitest"
26
+ },
27
+ "dependencies": {
28
+ "@zudojs/errors": "workspace:*",
29
+ "@zudojs/constants": "workspace:*",
30
+ "@zudojs/permissions": "workspace:*"
31
+ },
32
+ "engines": {
33
+ "node": ">=24.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "^7.0.2",
37
+ "vitest": "^4.1.11"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "keywords": [
43
+ "zudojs",
44
+ "authentication",
45
+ "authorization",
46
+ "jwt",
47
+ "sessions",
48
+ "rbac"
49
+ ],
50
+ "homepage": "https://github.com/oyinlola-tech/zudo#readme",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/oyinlola-tech/zudo"
54
+ }
55
+ }