@warlock.js/auth 4.0.31 → 4.0.39

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 (169) hide show
  1. package/cjs/index.js +8 -1
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +8 -1
  4. package/esm/index.js.map +1 -1
  5. package/package.json +48 -34
  6. package/cjs/commands/auth-cleanup-command.d.ts +0 -10
  7. package/cjs/commands/auth-cleanup-command.d.ts.map +0 -1
  8. package/cjs/commands/auth-cleanup-command.js +0 -29
  9. package/cjs/commands/auth-cleanup-command.js.map +0 -1
  10. package/cjs/commands/jwt-secret-generator-command.d.ts +0 -2
  11. package/cjs/commands/jwt-secret-generator-command.d.ts.map +0 -1
  12. package/cjs/commands/jwt-secret-generator-command.js +0 -7
  13. package/cjs/commands/jwt-secret-generator-command.js.map +0 -1
  14. package/cjs/contracts/auth-contract.d.ts +0 -23
  15. package/cjs/contracts/auth-contract.d.ts.map +0 -1
  16. package/cjs/contracts/index.d.ts +0 -3
  17. package/cjs/contracts/index.d.ts.map +0 -1
  18. package/cjs/contracts/types.d.ts +0 -134
  19. package/cjs/contracts/types.d.ts.map +0 -1
  20. package/cjs/contracts/types.js +0 -20
  21. package/cjs/contracts/types.js.map +0 -1
  22. package/cjs/index.d.ts +0 -8
  23. package/cjs/index.d.ts.map +0 -1
  24. package/cjs/middleware/auth.middleware.d.ts +0 -2
  25. package/cjs/middleware/auth.middleware.d.ts.map +0 -1
  26. package/cjs/middleware/auth.middleware.js +0 -73
  27. package/cjs/middleware/auth.middleware.js.map +0 -1
  28. package/cjs/middleware/index.d.ts +0 -2
  29. package/cjs/middleware/index.d.ts.map +0 -1
  30. package/cjs/models/access-token/access-token.d.ts +0 -12
  31. package/cjs/models/access-token/access-token.d.ts.map +0 -1
  32. package/cjs/models/access-token/access-token.js +0 -16
  33. package/cjs/models/access-token/access-token.js.map +0 -1
  34. package/cjs/models/access-token/index.d.ts +0 -3
  35. package/cjs/models/access-token/index.d.ts.map +0 -1
  36. package/cjs/models/access-token/migration.d.ts +0 -3
  37. package/cjs/models/access-token/migration.d.ts.map +0 -1
  38. package/cjs/models/access-token/migration.js +0 -10
  39. package/cjs/models/access-token/migration.js.map +0 -1
  40. package/cjs/models/auth.d.ts +0 -47
  41. package/cjs/models/auth.d.ts.map +0 -1
  42. package/cjs/models/auth.js +0 -58
  43. package/cjs/models/auth.js.map +0 -1
  44. package/cjs/models/casts/cast-password.d.ts +0 -7
  45. package/cjs/models/casts/cast-password.d.ts.map +0 -1
  46. package/cjs/models/casts/cast-password.js +0 -9
  47. package/cjs/models/casts/cast-password.js.map +0 -1
  48. package/cjs/models/casts/index.d.ts +0 -2
  49. package/cjs/models/casts/index.d.ts.map +0 -1
  50. package/cjs/models/index.d.ts +0 -5
  51. package/cjs/models/index.d.ts.map +0 -1
  52. package/cjs/models/refresh-token/index.d.ts +0 -2
  53. package/cjs/models/refresh-token/index.d.ts.map +0 -1
  54. package/cjs/models/refresh-token/migration.d.ts +0 -3
  55. package/cjs/models/refresh-token/migration.d.ts.map +0 -1
  56. package/cjs/models/refresh-token/refresh-token.d.ts +0 -32
  57. package/cjs/models/refresh-token/refresh-token.d.ts.map +0 -1
  58. package/cjs/models/refresh-token/refresh-token.js +0 -52
  59. package/cjs/models/refresh-token/refresh-token.js.map +0 -1
  60. package/cjs/services/auth-events.d.ts +0 -84
  61. package/cjs/services/auth-events.d.ts.map +0 -1
  62. package/cjs/services/auth-events.js +0 -65
  63. package/cjs/services/auth-events.js.map +0 -1
  64. package/cjs/services/auth.service.d.ts +0 -78
  65. package/cjs/services/auth.service.d.ts.map +0 -1
  66. package/cjs/services/auth.service.js +0 -265
  67. package/cjs/services/auth.service.js.map +0 -1
  68. package/cjs/services/generate-jwt-secret.d.ts +0 -2
  69. package/cjs/services/generate-jwt-secret.d.ts.map +0 -1
  70. package/cjs/services/generate-jwt-secret.js +0 -26
  71. package/cjs/services/generate-jwt-secret.js.map +0 -1
  72. package/cjs/services/index.d.ts +0 -5
  73. package/cjs/services/index.d.ts.map +0 -1
  74. package/cjs/services/jwt.d.ts +0 -23
  75. package/cjs/services/jwt.d.ts.map +0 -1
  76. package/cjs/services/jwt.js +0 -39
  77. package/cjs/services/jwt.js.map +0 -1
  78. package/cjs/utils/auth-error-codes.d.ts +0 -18
  79. package/cjs/utils/auth-error-codes.d.ts.map +0 -1
  80. package/cjs/utils/auth-error-codes.js +0 -18
  81. package/cjs/utils/auth-error-codes.js.map +0 -1
  82. package/cjs/utils/duration.d.ts +0 -45
  83. package/cjs/utils/duration.d.ts.map +0 -1
  84. package/cjs/utils/duration.js +0 -93
  85. package/cjs/utils/duration.js.map +0 -1
  86. package/cjs/utils/index.d.ts +0 -3
  87. package/cjs/utils/index.d.ts.map +0 -1
  88. package/esm/commands/auth-cleanup-command.d.ts +0 -10
  89. package/esm/commands/auth-cleanup-command.d.ts.map +0 -1
  90. package/esm/commands/auth-cleanup-command.js +0 -29
  91. package/esm/commands/auth-cleanup-command.js.map +0 -1
  92. package/esm/commands/jwt-secret-generator-command.d.ts +0 -2
  93. package/esm/commands/jwt-secret-generator-command.d.ts.map +0 -1
  94. package/esm/commands/jwt-secret-generator-command.js +0 -7
  95. package/esm/commands/jwt-secret-generator-command.js.map +0 -1
  96. package/esm/contracts/auth-contract.d.ts +0 -23
  97. package/esm/contracts/auth-contract.d.ts.map +0 -1
  98. package/esm/contracts/index.d.ts +0 -3
  99. package/esm/contracts/index.d.ts.map +0 -1
  100. package/esm/contracts/types.d.ts +0 -134
  101. package/esm/contracts/types.d.ts.map +0 -1
  102. package/esm/contracts/types.js +0 -20
  103. package/esm/contracts/types.js.map +0 -1
  104. package/esm/index.d.ts +0 -8
  105. package/esm/index.d.ts.map +0 -1
  106. package/esm/middleware/auth.middleware.d.ts +0 -2
  107. package/esm/middleware/auth.middleware.d.ts.map +0 -1
  108. package/esm/middleware/auth.middleware.js +0 -73
  109. package/esm/middleware/auth.middleware.js.map +0 -1
  110. package/esm/middleware/index.d.ts +0 -2
  111. package/esm/middleware/index.d.ts.map +0 -1
  112. package/esm/models/access-token/access-token.d.ts +0 -12
  113. package/esm/models/access-token/access-token.d.ts.map +0 -1
  114. package/esm/models/access-token/access-token.js +0 -16
  115. package/esm/models/access-token/access-token.js.map +0 -1
  116. package/esm/models/access-token/index.d.ts +0 -3
  117. package/esm/models/access-token/index.d.ts.map +0 -1
  118. package/esm/models/access-token/migration.d.ts +0 -3
  119. package/esm/models/access-token/migration.d.ts.map +0 -1
  120. package/esm/models/access-token/migration.js +0 -10
  121. package/esm/models/access-token/migration.js.map +0 -1
  122. package/esm/models/auth.d.ts +0 -47
  123. package/esm/models/auth.d.ts.map +0 -1
  124. package/esm/models/auth.js +0 -58
  125. package/esm/models/auth.js.map +0 -1
  126. package/esm/models/casts/cast-password.d.ts +0 -7
  127. package/esm/models/casts/cast-password.d.ts.map +0 -1
  128. package/esm/models/casts/cast-password.js +0 -9
  129. package/esm/models/casts/cast-password.js.map +0 -1
  130. package/esm/models/casts/index.d.ts +0 -2
  131. package/esm/models/casts/index.d.ts.map +0 -1
  132. package/esm/models/index.d.ts +0 -5
  133. package/esm/models/index.d.ts.map +0 -1
  134. package/esm/models/refresh-token/index.d.ts +0 -2
  135. package/esm/models/refresh-token/index.d.ts.map +0 -1
  136. package/esm/models/refresh-token/migration.d.ts +0 -3
  137. package/esm/models/refresh-token/migration.d.ts.map +0 -1
  138. package/esm/models/refresh-token/refresh-token.d.ts +0 -32
  139. package/esm/models/refresh-token/refresh-token.d.ts.map +0 -1
  140. package/esm/models/refresh-token/refresh-token.js +0 -52
  141. package/esm/models/refresh-token/refresh-token.js.map +0 -1
  142. package/esm/services/auth-events.d.ts +0 -84
  143. package/esm/services/auth-events.d.ts.map +0 -1
  144. package/esm/services/auth-events.js +0 -65
  145. package/esm/services/auth-events.js.map +0 -1
  146. package/esm/services/auth.service.d.ts +0 -78
  147. package/esm/services/auth.service.d.ts.map +0 -1
  148. package/esm/services/auth.service.js +0 -265
  149. package/esm/services/auth.service.js.map +0 -1
  150. package/esm/services/generate-jwt-secret.d.ts +0 -2
  151. package/esm/services/generate-jwt-secret.d.ts.map +0 -1
  152. package/esm/services/generate-jwt-secret.js +0 -26
  153. package/esm/services/generate-jwt-secret.js.map +0 -1
  154. package/esm/services/index.d.ts +0 -5
  155. package/esm/services/index.d.ts.map +0 -1
  156. package/esm/services/jwt.d.ts +0 -23
  157. package/esm/services/jwt.d.ts.map +0 -1
  158. package/esm/services/jwt.js +0 -39
  159. package/esm/services/jwt.js.map +0 -1
  160. package/esm/utils/auth-error-codes.d.ts +0 -18
  161. package/esm/utils/auth-error-codes.d.ts.map +0 -1
  162. package/esm/utils/auth-error-codes.js +0 -18
  163. package/esm/utils/auth-error-codes.js.map +0 -1
  164. package/esm/utils/duration.d.ts +0 -45
  165. package/esm/utils/duration.d.ts.map +0 -1
  166. package/esm/utils/duration.js +0 -93
  167. package/esm/utils/duration.js.map +0 -1
  168. package/esm/utils/index.d.ts +0 -3
  169. package/esm/utils/index.d.ts.map +0 -1
@@ -1,18 +0,0 @@
1
- export declare enum AuthErrorCodes {
2
- /**
3
- * Missing Access Token Error Code EC001
4
- * EC001 = Missing Access Token
5
- */
6
- MissingAccessToken = "EC001",
7
- /**
8
- * Invalid Access Token Error Code EC002
9
- * EC002 = Invalid Access Token
10
- */
11
- InvalidAccessToken = "EC002",
12
- /**
13
- * Unauthorized Error Code EC003
14
- * EC003 = Unauthorized
15
- */
16
- Unauthorized = "EC003"
17
- }
18
- //# sourceMappingURL=auth-error-codes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-error-codes.d.ts","sourceRoot":"","sources":["../../src/utils/auth-error-codes.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB;;;OAGG;IACH,kBAAkB,UAAU;IAC5B;;;OAGG;IACH,kBAAkB,UAAU;IAC5B;;;OAGG;IACH,YAAY,UAAU;CACvB"}
@@ -1,18 +0,0 @@
1
- 'use strict';exports.AuthErrorCodes=void 0;
2
- (function (AuthErrorCodes) {
3
- /**
4
- * Missing Access Token Error Code EC001
5
- * EC001 = Missing Access Token
6
- */
7
- AuthErrorCodes["MissingAccessToken"] = "EC001";
8
- /**
9
- * Invalid Access Token Error Code EC002
10
- * EC002 = Invalid Access Token
11
- */
12
- AuthErrorCodes["InvalidAccessToken"] = "EC002";
13
- /**
14
- * Unauthorized Error Code EC003
15
- * EC003 = Unauthorized
16
- */
17
- AuthErrorCodes["Unauthorized"] = "EC003";
18
- })(exports.AuthErrorCodes || (exports.AuthErrorCodes = {}));//# sourceMappingURL=auth-error-codes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-error-codes.js","sources":["../../src/utils/auth-error-codes.ts"],"sourcesContent":[null],"names":["AuthErrorCodes"],"mappings":"aAAYA,8BAgBX;AAhBD,CAAA,UAAY,cAAc,EAAA;AACxB;;;AAGG;AACH,IAAA,cAAA,CAAA,oBAAA,CAAA,GAAA,OAA4B,CAAA;AAC5B;;;AAGG;AACH,IAAA,cAAA,CAAA,oBAAA,CAAA,GAAA,OAA4B,CAAA;AAC5B;;;AAGG;AACH,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,OAAsB,CAAA;AACxB,CAAC,EAhBWA,sBAAc,KAAdA,sBAAc,GAgBzB,EAAA,CAAA,CAAA"}
@@ -1,45 +0,0 @@
1
- import { NO_EXPIRATION } from "../contracts/types";
2
- /**
3
- * Duration object for specifying time periods
4
- * All units are additive (e.g., { days: 1, hours: 6 } = 30 hours)
5
- *
6
- * @example
7
- * ```typescript
8
- * { hours: 1 } // 1 hour
9
- * { days: 7, hours: 12 } // 7.5 days
10
- * { minutes: 30 } // 30 minutes
11
- * ```
12
- */
13
- export type Duration = {
14
- milliseconds?: number;
15
- seconds?: number;
16
- minutes?: number;
17
- hours?: number;
18
- days?: number;
19
- weeks?: number;
20
- };
21
- /**
22
- * Expiration value type - can be a Duration object, string format, or NO_EXPIRATION
23
- */
24
- export type ExpiresIn = Duration | typeof NO_EXPIRATION | string | number;
25
- /**
26
- * Parse duration to milliseconds
27
- * Supports Duration object, string format ("1d 2h 30m"), or number (raw ms)
28
- *
29
- * @example
30
- * ```typescript
31
- * parseExpirationToMs({ hours: 1 }) // 3600000
32
- * parseExpirationToMs({ days: 1 }) // 86400000
33
- * parseExpirationToMs("1h") // 3600000
34
- * parseExpirationToMs("1d 2h 30m") // 95400000
35
- * parseExpirationToMs(3600000) // 3600000
36
- * parseExpirationToMs(NO_EXPIRATION) // undefined
37
- * ```
38
- */
39
- export declare function parseExpirationToMs(expiration: ExpiresIn | undefined, defaultMs?: number): number | undefined;
40
- /**
41
- * Convert ExpiresIn to a value suitable for jwt.generate (string or number)
42
- * Returns undefined if NO_EXPIRATION
43
- */
44
- export declare function toJwtExpiresIn(expiration: ExpiresIn | undefined, defaultMs?: number): string | undefined;
45
- //# sourceMappingURL=duration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/utils/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,SAAS,GAAE,MAAgB,GAC1B,MAAM,GAAG,SAAS,CAmBpB;AAuDD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,GAAG,SAAS,EACjC,SAAS,GAAE,MAAgB,GAC1B,MAAM,GAAG,SAAS,CAMpB"}
@@ -1,93 +0,0 @@
1
- 'use strict';var types=require('../contracts/types.js');/**
2
- * Parse duration to milliseconds
3
- * Supports Duration object, string format ("1d 2h 30m"), or number (raw ms)
4
- *
5
- * @example
6
- * ```typescript
7
- * parseExpirationToMs({ hours: 1 }) // 3600000
8
- * parseExpirationToMs({ days: 1 }) // 86400000
9
- * parseExpirationToMs("1h") // 3600000
10
- * parseExpirationToMs("1d 2h 30m") // 95400000
11
- * parseExpirationToMs(3600000) // 3600000
12
- * parseExpirationToMs(NO_EXPIRATION) // undefined
13
- * ```
14
- */
15
- function parseExpirationToMs(expiration, defaultMs = 3600000) {
16
- if (expiration === undefined) {
17
- return defaultMs;
18
- }
19
- if (expiration === types.NO_EXPIRATION) {
20
- return undefined;
21
- }
22
- if (typeof expiration === "number") {
23
- return expiration;
24
- }
25
- if (typeof expiration === "string") {
26
- return parseStringDuration(expiration);
27
- }
28
- // It's a Duration object
29
- return parseDurationObject(expiration);
30
- }
31
- /**
32
- * Parse a Duration object to milliseconds
33
- */
34
- function parseDurationObject(duration) {
35
- let ms = 0;
36
- if (duration.milliseconds)
37
- ms += duration.milliseconds;
38
- if (duration.seconds)
39
- ms += duration.seconds * 1000;
40
- if (duration.minutes)
41
- ms += duration.minutes * 60 * 1000;
42
- if (duration.hours)
43
- ms += duration.hours * 60 * 60 * 1000;
44
- if (duration.days)
45
- ms += duration.days * 24 * 60 * 60 * 1000;
46
- if (duration.weeks)
47
- ms += duration.weeks * 7 * 24 * 60 * 60 * 1000;
48
- return ms;
49
- }
50
- /**
51
- * Parse a string duration to milliseconds
52
- * Supports formats: "1h", "7d", "30m", "90s", "1d 2h 30m"
53
- */
54
- function parseStringDuration(str) {
55
- let totalMs = 0;
56
- const parts = str.trim().split(/\s+/);
57
- for (const part of parts) {
58
- const match = part.match(/^(\d+(?:\.\d+)?)([smhdw])$/i);
59
- if (!match)
60
- continue;
61
- const value = parseFloat(match[1]);
62
- const unit = match[2].toLowerCase();
63
- switch (unit) {
64
- case "s":
65
- totalMs += value * 1000;
66
- break;
67
- case "m":
68
- totalMs += value * 60 * 1000;
69
- break;
70
- case "h":
71
- totalMs += value * 60 * 60 * 1000;
72
- break;
73
- case "d":
74
- totalMs += value * 24 * 60 * 60 * 1000;
75
- break;
76
- case "w":
77
- totalMs += value * 7 * 24 * 60 * 60 * 1000;
78
- break;
79
- }
80
- }
81
- return totalMs || 3600000; // Default to 1 hour if nothing parsed
82
- }
83
- /**
84
- * Convert ExpiresIn to a value suitable for jwt.generate (string or number)
85
- * Returns undefined if NO_EXPIRATION
86
- */
87
- function toJwtExpiresIn(expiration, defaultMs = 3600000) {
88
- const ms = parseExpirationToMs(expiration, defaultMs);
89
- if (ms === undefined)
90
- return undefined;
91
- // Convert ms to seconds for JWT (more common format)
92
- return Math.floor(ms / 1000) + "s";
93
- }exports.parseExpirationToMs=parseExpirationToMs;exports.toJwtExpiresIn=toJwtExpiresIn;//# sourceMappingURL=duration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duration.js","sources":["../../src/utils/duration.ts"],"sourcesContent":[null],"names":["NO_EXPIRATION"],"mappings":"wDA2BA;;;;;;;;;;;;;AAaG;SACa,mBAAmB,CACjC,UAAiC,EACjC,YAAoB,OAAO,EAAA;IAE3B,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IAED,IAAI,UAAU,KAAKA,mBAAa,EAAE;AAChC,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AAED,IAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;AAClC,QAAA,OAAO,UAAU,CAAC;AACnB,KAAA;AAED,IAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;AAClC,QAAA,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC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AK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEpC,QAAA,QAAQ,IAAI;AACV,YAAA,KAAK,GAAG;AACN,gBAAA,OAAO,IAAI,KAAK,GAAG,IAAI,CAAC;gBACxB,MAAM;AACR,YAAA,KAAK,GAAG;AACN,gBAAA,OAAO,IAAI,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC;gBAC7B,MAAM;AACR,YAAA,KAAK,GAAG;gBACN,OAAO,IAAI,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;gBAClC,MAAM;AACR,YAAA,KAAK,GAAG;gBACN,OAAO,IAAI,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;gBACvC,MAAM;AACR,YAAA,KAAK,GAAG;AACN,gBAAA,OAAO,IAAI,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;gBAC3C,MAAM;AACT,SAAA;AACF,KAAA;AAED,IAAA,OAAO,OAAO,IAAI,OAAO,CAAC;AAC5B,CAAC;AAED;;;AAGG;SACa,cAAc,CAC5B,UAAiC,EACjC,YAAoB,OAAO,EAAA;IAE3B,MAAM,EAAE,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACtD,IAAI,EAAE,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS,CAAC;;IAGvC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;AACrC"}
@@ -1,3 +0,0 @@
1
- export * from "./auth-error-codes";
2
- export * from "./duration";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Register the auth:cleanup CLI command
3
- *
4
- * @example
5
- * ```bash
6
- * warlock auth:cleanup
7
- * ```
8
- */
9
- export declare function registerAuthCleanupCommand(): any;
10
- //# sourceMappingURL=auth-cleanup-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-cleanup-command.d.ts","sourceRoot":"","sources":["../../src/commands/auth-cleanup-command.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,QAqBzC"}
@@ -1,29 +0,0 @@
1
- import {colors}from'@mongez/copper';import {command}from'@warlock.js/core';import {authService}from'../services/auth.service.js';/**
2
- * Register the auth:cleanup CLI command
3
- *
4
- * @example
5
- * ```bash
6
- * warlock auth:cleanup
7
- * ```
8
- */
9
- function registerAuthCleanupCommand() {
10
- return command({
11
- name: "auth.cleanup",
12
- description: "Remove expired refresh tokens from the database",
13
- preload: {
14
- env: true,
15
- config: ["auth", "database"],
16
- connectors: ["database"],
17
- },
18
- action: async () => {
19
- console.log(colors.cyan("🧹 Cleaning up expired tokens..."));
20
- const count = await authService.cleanupExpiredTokens();
21
- if (count === 0) {
22
- console.log(colors.green("✅ No expired tokens found."));
23
- }
24
- else {
25
- console.log(colors.green(`✅ Removed ${count} expired token(s).`));
26
- }
27
- },
28
- });
29
- }export{registerAuthCleanupCommand};//# sourceMappingURL=auth-cleanup-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-cleanup-command.js","sources":["../../src/commands/auth-cleanup-command.ts"],"sourcesContent":[null],"names":[],"mappings":"iIAIA;;;;;;;AAOG;SACa,0BAA0B,GAAA;AACxC,IAAA,OAAO,OAAO,CAAC;AACb,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,WAAW,EAAE,iDAAiD;AAC9D,QAAA,OAAO,EAAE;AACP,YAAA,GAAG,EAAE,IAAI;AACT,YAAA,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;YAC5B,UAAU,EAAE,CAAC,UAAU,CAAC;AACzB,SAAA;QACD,MAAM,EAAE,YAAW;YACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,CAAC;AAE7D,YAAA,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,oBAAoB,EAAE,CAAC;YAEvD,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;AACzD,aAAA;AAAM,iBAAA;AACL,gBAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,UAAA,EAAa,KAAK,CAAA,kBAAA,CAAoB,CAAC,CAAC,CAAC;AACnE,aAAA;SACF;AACF,KAAA,CAAC,CAAC;AACL"}
@@ -1,2 +0,0 @@
1
- export declare function registerJWTSecretGeneratorCommand(): any;
2
- //# sourceMappingURL=jwt-secret-generator-command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-secret-generator-command.d.ts","sourceRoot":"","sources":["../../src/commands/jwt-secret-generator-command.ts"],"names":[],"mappings":"AAGA,wBAAgB,iCAAiC,QAMhD"}
@@ -1,7 +0,0 @@
1
- import {command}from'@warlock.js/core';import {generateJWTSecret}from'../services/generate-jwt-secret.js';function registerJWTSecretGeneratorCommand() {
2
- return command({
3
- name: "jwt.generate",
4
- description: "Generate JWT Secret key in .env file",
5
- action: generateJWTSecret,
6
- });
7
- }export{registerJWTSecretGeneratorCommand};//# sourceMappingURL=jwt-secret-generator-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jwt-secret-generator-command.js","sources":["../../src/commands/jwt-secret-generator-command.ts"],"sourcesContent":[null],"names":[],"mappings":"mHAGgB,iCAAiC,GAAA;AAC/C,IAAA,OAAO,OAAO,CAAC;AACb,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,WAAW,EAAE,sCAAsC;AACnD,QAAA,MAAM,EAAE,iBAAiB;AAC1B,KAAA,CAAC,CAAC;AACL"}
@@ -1,23 +0,0 @@
1
- export interface Authenticable {
2
- /**
3
- * Generate access token
4
- */
5
- generateAccessToken(): Promise<string>;
6
- /**
7
- * Generate refresh token
8
- */
9
- generateRefreshToken(): Promise<string>;
10
- /**
11
- * Change password
12
- */
13
- changePassword(password: string): Promise<void>;
14
- /**
15
- * Verify Password
16
- */
17
- verifyPassword(password: string): Promise<boolean>;
18
- /**
19
- * Get user type
20
- */
21
- getUserType(): string;
22
- }
23
- //# sourceMappingURL=auth-contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/auth-contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC;;OAEG;IACH,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC;CACvB"}
@@ -1,3 +0,0 @@
1
- export * from "./auth-contract";
2
- export * from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -1,134 +0,0 @@
1
- import { type Algorithm } from "fast-jwt";
2
- import type { Auth } from "../models/auth";
3
- import type { Duration, ExpiresIn } from "../utils/duration";
4
- /**
5
- * Symbol to indicate no expiration for tokens
6
- * Use this when you explicitly want tokens to never expire
7
- *
8
- * @example
9
- * ```typescript
10
- * // src/config/auth.ts
11
- * import { NO_EXPIRATION, type AuthConfigurations } from "@warlock.js/auth";
12
- *
13
- * const authConfigurations: AuthConfigurations = {
14
- * jwt: {
15
- * secret: env("JWT_SECRET"),
16
- * expiresIn: NO_EXPIRATION, // Token never expires
17
- * },
18
- * };
19
- *
20
- * export default authConfigurations;
21
- * ```
22
- */
23
- export declare const NO_EXPIRATION: unique symbol;
24
- export type AuthConfigurations = {
25
- /**
26
- * Define all user types
27
- * This is important to differentiate between user types when validating and generating tokens
28
- */
29
- userType: {
30
- [userType: string]: typeof Auth;
31
- };
32
- /**
33
- * JWT configurations
34
- */
35
- jwt: {
36
- /**
37
- * JWT secret key for signing access tokens
38
- */
39
- secret: string;
40
- /**
41
- * JWT algorithm
42
- * @default "HS256"
43
- */
44
- algorithm?: Algorithm;
45
- /**
46
- * Access token expiration time
47
- * Supports Duration object, string format, or NO_EXPIRATION
48
- * @example { hours: 1 }, { days: 7, hours: 12 }, "1h", "1d 2h", NO_EXPIRATION
49
- * @default { hours: 1 }
50
- */
51
- expiresIn?: ExpiresIn;
52
- /**
53
- * Refresh token configurations
54
- */
55
- refresh?: {
56
- /**
57
- * Separate secret for refresh tokens (recommended for security)
58
- * If not provided, falls back to main JWT secret
59
- */
60
- secret?: string;
61
- /**
62
- * Refresh token expiration time
63
- * Supports Duration object or string format
64
- * @example { days: 7 }, { weeks: 1 }, "7d", "1w"
65
- * @default { days: 7 }
66
- */
67
- expiresIn?: Duration | string | number;
68
- /**
69
- * Enable token rotation (issue new refresh token on each use)
70
- * Old refresh token is invalidated after use
71
- * @default true
72
- */
73
- rotation?: boolean;
74
- /**
75
- * Maximum number of active refresh tokens per user
76
- * When exceeded, oldest tokens are revoked
77
- * @default 5
78
- */
79
- maxPerUser?: number;
80
- };
81
- };
82
- /**
83
- * Password configurations
84
- */
85
- password?: {
86
- /**
87
- * Password salt
88
- * The higher the salt, the more secure the password is
89
- * But, it will take more time to generate the password
90
- * @default 12
91
- */
92
- salt?: number;
93
- };
94
- };
95
- /**
96
- * Token pair returned after login or token refresh
97
- */
98
- export type TokenPair = {
99
- /**
100
- * JWT access token (short-lived)
101
- */
102
- accessToken: string;
103
- /**
104
- * JWT refresh token (long-lived)
105
- */
106
- refreshToken: string;
107
- /**
108
- * Access token expiration time in seconds or time string
109
- */
110
- expiresIn: number | string;
111
- };
112
- /**
113
- * Device information for session tracking
114
- */
115
- export type DeviceInfo = {
116
- /**
117
- * User agent string from request
118
- */
119
- userAgent?: string;
120
- /**
121
- * Client IP address
122
- */
123
- ip?: string;
124
- /**
125
- * Optional device identifier
126
- */
127
- deviceId?: string;
128
- /**
129
- * Token family ID (for rotation tracking)
130
- * @internal
131
- */
132
- familyId?: string;
133
- };
134
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/contracts/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,eAA0B,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,QAAQ,EAAE;QACR,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,IAAI,CAAC;KACjC,CAAC;IACF;;OAEG;IACH,GAAG,EAAE;QACH;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QACf;;;WAGG;QACH,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB;;WAEG;QACH,OAAO,CAAC,EAAE;YACR;;;eAGG;YACH,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB;;;;;eAKG;YACH,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;YACvC;;;;eAIG;YACH,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB;;;;eAIG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACH,CAAC;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;;;;WAKG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Symbol to indicate no expiration for tokens
3
- * Use this when you explicitly want tokens to never expire
4
- *
5
- * @example
6
- * ```typescript
7
- * // src/config/auth.ts
8
- * import { NO_EXPIRATION, type AuthConfigurations } from "@warlock.js/auth";
9
- *
10
- * const authConfigurations: AuthConfigurations = {
11
- * jwt: {
12
- * secret: env("JWT_SECRET"),
13
- * expiresIn: NO_EXPIRATION, // Token never expires
14
- * },
15
- * };
16
- *
17
- * export default authConfigurations;
18
- * ```
19
- */
20
- const NO_EXPIRATION = Symbol("NO_EXPIRATION");export{NO_EXPIRATION};//# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sources":["../../src/contracts/types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;AAkBG;MACU,aAAa,GAAG,MAAM,CAAC,eAAe"}
package/esm/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./commands/auth-cleanup-command";
2
- export * from "./commands/jwt-secret-generator-command";
3
- export * from "./contracts";
4
- export * from "./middleware";
5
- export * from "./models";
6
- export * from "./services";
7
- export * from "./utils";
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function authMiddleware(allowedUserType?: string | string[]): Middleware;
2
- //# sourceMappingURL=auth.middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/auth.middleware.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,cAuFjE"}
@@ -1,73 +0,0 @@
1
- import {t,config}from'@warlock.js/core';import {log}from'@warlock.js/logger';import {AccessToken}from'../models/access-token/access-token.js';import'../models/access-token/migration.js';import {jwt}from'../services/jwt.js';import {AuthErrorCodes}from'../utils/auth-error-codes.js';function authMiddleware(allowedUserType) {
2
- const allowedTypes = !allowedUserType
3
- ? []
4
- : Array.isArray(allowedUserType)
5
- ? allowedUserType
6
- : [allowedUserType];
7
- const auth = async (request, response) => {
8
- try {
9
- const authorizationValue = request.authorizationValue;
10
- if (!allowedTypes.length && !authorizationValue)
11
- return;
12
- if (!authorizationValue) {
13
- return response.unauthorized({
14
- error: t("auth.errors.missingAccessToken"),
15
- errorCode: AuthErrorCodes.MissingAccessToken,
16
- });
17
- }
18
- // get current user jwt
19
- const user = await jwt.verify(authorizationValue);
20
- // store decoded access token object in request object
21
- request.decodedAccessToken = user;
22
- // use our own jwt verify to verify the token
23
- const accessToken = await AccessToken.first({
24
- token: authorizationValue,
25
- });
26
- if (!accessToken) {
27
- return response.unauthorized({
28
- error: t("auth.errors.invalidAccessToken"),
29
- errorCode: AuthErrorCodes.InvalidAccessToken,
30
- });
31
- }
32
- // now, we need to get an instance of user using its corresponding model
33
- const userType = user.userType || accessToken.get("userType");
34
- // check if the user type is allowed
35
- if (allowedTypes.length && !allowedTypes.includes(userType)) {
36
- return response.unauthorized({
37
- error: t("auth.errors.unauthorized"),
38
- errorCode: AuthErrorCodes.Unauthorized,
39
- });
40
- }
41
- // get user model class
42
- const UserModel = config.key(`auth.userType.${userType}`);
43
- if (!UserModel) {
44
- throw new Error(`User type ${userType} is unknown type.`);
45
- }
46
- // get user model instance
47
- const currentUser = await UserModel.find(user.id);
48
- if (!currentUser) {
49
- accessToken.destroy();
50
- return response.unauthorized({
51
- error: t("auth.errors.invalidAccessToken"),
52
- errorCode: AuthErrorCodes.InvalidAccessToken,
53
- });
54
- }
55
- // update last access
56
- accessToken.silentSaving({
57
- lastAccess: new Date(),
58
- });
59
- // set current user
60
- request.user = currentUser;
61
- }
62
- catch (err) {
63
- log.error("http", "auth", err);
64
- // unset current user
65
- request.clearCurrentUser();
66
- return response.unauthorized({
67
- error: t("auth.errors.invalidAccessToken"),
68
- errorCode: AuthErrorCodes.InvalidAccessToken,
69
- });
70
- }
71
- };
72
- return auth;
73
- }export{authMiddleware};//# sourceMappingURL=auth.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.middleware.js","sources":["../../src/middleware/auth.middleware.ts"],"sourcesContent":[null],"names":[],"mappings":"yRAMM,SAAU,cAAc,CAAC,eAAmC,EAAA;IAChE,MAAM,YAAY,GAAG,CAAC,eAAe;AACnC,UAAE,EAAE;AACJ,UAAE,KAAK,CAAC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":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -1,12 +0,0 @@
1
- import { Model, type Casts } from "@warlock.js/cascade";
2
- export declare class AccessToken extends Model {
3
- /**
4
- * {@inheritDoc}
5
- */
6
- static collection: string;
7
- /**
8
- * {@inheritDoc}
9
- */
10
- protected casts: Casts;
11
- }
12
- //# sourceMappingURL=access-token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"access-token.d.ts","sourceRoot":"","sources":["../../../src/models/access-token/access-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAExD,qBAAa,WAAY,SAAQ,KAAK;IACpC;;OAEG;IACH,OAAc,UAAU,SAAkB;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,KAAK,CAMpB;CACH"}
@@ -1,16 +0,0 @@
1
- import {Model}from'@warlock.js/cascade';class AccessToken extends Model {
2
- /**
3
- * {@inheritDoc}
4
- */
5
- static collection = "accessTokens";
6
- /**
7
- * {@inheritDoc}
8
- */
9
- casts = {
10
- lastAccess: "date",
11
- token: "string",
12
- "user.id": "int",
13
- "user._id": "string",
14
- "user.userType": "string",
15
- };
16
- }export{AccessToken};//# sourceMappingURL=access-token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"access-token.js","sources":["../../../src/models/access-token/access-token.ts"],"sourcesContent":[null],"names":[],"mappings":"wCAEM,MAAO,WAAY,SAAQ,KAAK,CAAA;AACpC;;AAEG;AACI,IAAA,OAAO,UAAU,GAAG,cAAc,CAAC;AAE1C;;AAEG;AACO,IAAA,KAAK,GAAU;AACvB,QAAA,UAAU,EAAE,MAAM;AAClB,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,UAAU,EAAE,QAAQ;AACpB,QAAA,eAAe,EAAE,QAAQ;KAC1B,CAAC;"}
@@ -1,3 +0,0 @@
1
- export * from "./access-token";
2
- export * from "./migration";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/access-token/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
3
- //# sourceMappingURL=migration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/models/access-token/migration.ts"],"names":[],"mappings":";AAGA,wBASG"}