@aura-stack/auth 0.4.0 → 0.6.0

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 (179) hide show
  1. package/README.md +36 -1
  2. package/dist/@types/index.cjs +0 -18
  3. package/dist/@types/index.d.ts +2 -8
  4. package/dist/@types/index.js +0 -1
  5. package/dist/assert-B3iQSYlK.js +3 -0
  6. package/dist/assert-NJGroSJd.cjs +3 -0
  7. package/dist/client/index.cjs +1 -0
  8. package/dist/client/index.d.ts +11 -0
  9. package/dist/client/index.js +1 -0
  10. package/dist/crypto-Bz8nIciY.js +1 -0
  11. package/dist/crypto-CoXA5w_4.cjs +1 -0
  12. package/dist/env-bq387KyP.cjs +1 -0
  13. package/dist/env-nvh8QBNz.js +1 -0
  14. package/dist/errors-CCYPHuBO.cjs +1 -0
  15. package/dist/errors-DFWHOho6.js +1 -0
  16. package/dist/index-BkpwQ0l4.d.cts +2279 -0
  17. package/dist/index-nqLV2t91.d.ts +2279 -0
  18. package/dist/index.cjs +1 -1839
  19. package/dist/index.d.cts +2 -0
  20. package/dist/index.d.ts +2 -35
  21. package/dist/index.js +1 -132
  22. package/dist/logger-C59_CDMk.js +1 -0
  23. package/dist/logger-UnUhYL2V.cjs +1 -0
  24. package/dist/oauth/atlassian.cjs +1 -0
  25. package/dist/oauth/atlassian.d.ts +2 -0
  26. package/dist/oauth/atlassian.js +1 -0
  27. package/dist/oauth/bitbucket.cjs +1 -49
  28. package/dist/oauth/bitbucket.d.ts +2 -8
  29. package/dist/oauth/bitbucket.js +1 -6
  30. package/dist/oauth/discord.cjs +1 -57
  31. package/dist/oauth/discord.d.ts +2 -8
  32. package/dist/oauth/discord.js +1 -6
  33. package/dist/oauth/dropbox.cjs +1 -0
  34. package/dist/oauth/dropbox.d.ts +2 -0
  35. package/dist/oauth/dropbox.js +1 -0
  36. package/dist/oauth/figma.cjs +1 -49
  37. package/dist/oauth/figma.d.ts +2 -8
  38. package/dist/oauth/figma.js +1 -6
  39. package/dist/oauth/github.cjs +1 -49
  40. package/dist/oauth/github.d.ts +2 -8
  41. package/dist/oauth/github.js +1 -6
  42. package/dist/oauth/gitlab.cjs +1 -49
  43. package/dist/oauth/gitlab.d.ts +2 -8
  44. package/dist/oauth/gitlab.js +1 -6
  45. package/dist/oauth/index.cjs +1 -483
  46. package/dist/oauth/index.d.ts +2 -8
  47. package/dist/oauth/index.js +1 -52
  48. package/dist/oauth/mailchimp.cjs +1 -49
  49. package/dist/oauth/mailchimp.d.ts +2 -8
  50. package/dist/oauth/mailchimp.js +1 -6
  51. package/dist/oauth/notion.cjs +1 -0
  52. package/dist/oauth/notion.d.ts +2 -0
  53. package/dist/oauth/notion.js +1 -0
  54. package/dist/oauth/pinterest.cjs +1 -49
  55. package/dist/oauth/pinterest.d.ts +2 -8
  56. package/dist/oauth/pinterest.js +1 -6
  57. package/dist/oauth/spotify.cjs +1 -49
  58. package/dist/oauth/spotify.d.ts +2 -8
  59. package/dist/oauth/spotify.js +1 -6
  60. package/dist/oauth/strava.cjs +1 -49
  61. package/dist/oauth/strava.d.ts +2 -8
  62. package/dist/oauth/strava.js +1 -6
  63. package/dist/oauth/twitch.cjs +1 -0
  64. package/dist/oauth/twitch.d.ts +2 -0
  65. package/dist/oauth/twitch.js +1 -0
  66. package/dist/oauth/x.cjs +1 -49
  67. package/dist/oauth/x.d.ts +2 -8
  68. package/dist/oauth/x.js +1 -6
  69. package/dist/oauth-BntNm6aE.cjs +1 -0
  70. package/dist/oauth-DmHy9VrB.js +1 -0
  71. package/dist/shared/crypto.cjs +1 -0
  72. package/dist/shared/crypto.d.ts +47 -0
  73. package/dist/shared/crypto.js +1 -0
  74. package/dist/shared/identity.cjs +1 -0
  75. package/dist/shared/identity.d.ts +2 -0
  76. package/dist/shared/identity.js +1 -0
  77. package/dist/shared/index.cjs +1 -0
  78. package/dist/shared/index.d.ts +5 -0
  79. package/dist/shared/index.js +1 -0
  80. package/package.json +39 -12
  81. package/dist/@types/router.d.cjs +0 -1
  82. package/dist/@types/router.d.d.ts +0 -12
  83. package/dist/@types/router.d.js +0 -0
  84. package/dist/@types/utility.cjs +0 -18
  85. package/dist/@types/utility.d.ts +0 -6
  86. package/dist/@types/utility.js +0 -1
  87. package/dist/actions/callback/access-token.cjs +0 -206
  88. package/dist/actions/callback/access-token.d.ts +0 -29
  89. package/dist/actions/callback/access-token.js +0 -9
  90. package/dist/actions/callback/callback.cjs +0 -649
  91. package/dist/actions/callback/callback.d.ts +0 -13
  92. package/dist/actions/callback/callback.js +0 -19
  93. package/dist/actions/callback/userinfo.cjs +0 -250
  94. package/dist/actions/callback/userinfo.d.ts +0 -21
  95. package/dist/actions/callback/userinfo.js +0 -14
  96. package/dist/actions/csrfToken/csrfToken.cjs +0 -197
  97. package/dist/actions/csrfToken/csrfToken.d.ts +0 -5
  98. package/dist/actions/csrfToken/csrfToken.js +0 -14
  99. package/dist/actions/index.cjs +0 -954
  100. package/dist/actions/index.d.ts +0 -14
  101. package/dist/actions/index.js +0 -36
  102. package/dist/actions/session/session.cjs +0 -136
  103. package/dist/actions/session/session.d.ts +0 -5
  104. package/dist/actions/session/session.js +0 -10
  105. package/dist/actions/signIn/authorization.cjs +0 -322
  106. package/dist/actions/signIn/authorization.d.ts +0 -53
  107. package/dist/actions/signIn/authorization.js +0 -18
  108. package/dist/actions/signIn/signIn.cjs +0 -467
  109. package/dist/actions/signIn/signIn.d.ts +0 -13
  110. package/dist/actions/signIn/signIn.js +0 -15
  111. package/dist/actions/signOut/signOut.cjs +0 -493
  112. package/dist/actions/signOut/signOut.d.ts +0 -8
  113. package/dist/actions/signOut/signOut.js +0 -16
  114. package/dist/assert.cjs +0 -161
  115. package/dist/assert.d.ts +0 -33
  116. package/dist/assert.js +0 -26
  117. package/dist/chunk-4EKY7655.js +0 -123
  118. package/dist/chunk-4MYWAOLG.js +0 -31
  119. package/dist/chunk-4YHJ4IEQ.js +0 -25
  120. package/dist/chunk-54CZPKR4.js +0 -25
  121. package/dist/chunk-5LZ7TOM3.js +0 -25
  122. package/dist/chunk-5W4BRQYG.js +0 -201
  123. package/dist/chunk-6MXFPFR3.js +0 -143
  124. package/dist/chunk-7QF22LHP.js +0 -67
  125. package/dist/chunk-ALG3GIV4.js +0 -95
  126. package/dist/chunk-E6G5YCI6.js +0 -25
  127. package/dist/chunk-EBAMFRB7.js +0 -34
  128. package/dist/chunk-EEE7UM5T.js +0 -25
  129. package/dist/chunk-FRJFWTOY.js +0 -70
  130. package/dist/chunk-FW4W3REU.js +0 -25
  131. package/dist/chunk-ICAZ4OVS.js +0 -37
  132. package/dist/chunk-IPKO6UQN.js +0 -25
  133. package/dist/chunk-ITQ7352M.js +0 -0
  134. package/dist/chunk-KJBAQZX2.js +0 -92
  135. package/dist/chunk-KMMAZFSJ.js +0 -25
  136. package/dist/chunk-LDU7A2JE.js +0 -25
  137. package/dist/chunk-NUDITUKX.js +0 -73
  138. package/dist/chunk-OVHNRULD.js +0 -33
  139. package/dist/chunk-PG7UYFG5.js +0 -0
  140. package/dist/chunk-PHFH2MGS.js +0 -36
  141. package/dist/chunk-QQVSRXGX.js +0 -149
  142. package/dist/chunk-RRLIF4PQ.js +0 -55
  143. package/dist/chunk-TM5IPSNF.js +0 -113
  144. package/dist/chunk-TZB6MUXN.js +0 -78
  145. package/dist/chunk-VNCNJKS2.js +0 -267
  146. package/dist/chunk-XGLBNXL4.js +0 -75
  147. package/dist/chunk-XUP6KKNG.js +0 -106
  148. package/dist/chunk-ZNCZVF6U.js +0 -14
  149. package/dist/cookie.cjs +0 -246
  150. package/dist/cookie.d.ts +0 -85
  151. package/dist/cookie.js +0 -29
  152. package/dist/env.cjs +0 -56
  153. package/dist/env.d.ts +0 -7
  154. package/dist/env.js +0 -6
  155. package/dist/errors.cjs +0 -85
  156. package/dist/errors.d.ts +0 -50
  157. package/dist/errors.js +0 -18
  158. package/dist/headers.cjs +0 -61
  159. package/dist/headers.d.ts +0 -33
  160. package/dist/headers.js +0 -12
  161. package/dist/index-CSyIJmCM.d.ts +0 -1007
  162. package/dist/jose.cjs +0 -128
  163. package/dist/jose.d.ts +0 -25
  164. package/dist/jose.js +0 -12
  165. package/dist/logger.cjs +0 -292
  166. package/dist/logger.d.ts +0 -8
  167. package/dist/logger.js +0 -8
  168. package/dist/request.cjs +0 -38
  169. package/dist/request.d.ts +0 -13
  170. package/dist/request.js +0 -6
  171. package/dist/schemas.cjs +0 -125
  172. package/dist/schemas.d.ts +0 -149
  173. package/dist/schemas.js +0 -24
  174. package/dist/secure.cjs +0 -170
  175. package/dist/secure.d.ts +0 -35
  176. package/dist/secure.js +0 -19
  177. package/dist/utils.cjs +0 -223
  178. package/dist/utils.d.ts +0 -24
  179. package/dist/utils.js +0 -29
package/dist/jose.cjs DELETED
@@ -1,128 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/jose.ts
21
- var jose_exports = {};
22
- __export(jose_exports, {
23
- createJoseInstance: () => createJoseInstance,
24
- decodeJWTOptions: () => decodeJWTOptions,
25
- jwtVerificationOptions: () => jwtVerificationOptions
26
- });
27
- module.exports = __toCommonJS(jose_exports);
28
-
29
- // src/env.ts
30
- var import_meta = {};
31
- var env = new Proxy({}, {
32
- get(_, prop) {
33
- if (typeof prop !== "string") return void 0;
34
- const hasProperty = (process2) => {
35
- return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
36
- };
37
- try {
38
- if (typeof process !== "undefined" && hasProperty(process.env)) {
39
- return process.env[prop];
40
- }
41
- if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
42
- return import_meta.env[prop];
43
- }
44
- if (typeof Deno !== "undefined" && Deno.env?.get) {
45
- return Deno.env.get(prop);
46
- }
47
- if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
48
- return Bun.env[prop];
49
- }
50
- const globalValue = globalThis[prop];
51
- return typeof globalValue === "string" ? globalValue : void 0;
52
- } catch {
53
- return void 0;
54
- }
55
- }
56
- });
57
-
58
- // src/jose.ts
59
- var import_jose = require("@aura-stack/jose");
60
-
61
- // src/errors.ts
62
- var AuthInternalError = class extends Error {
63
- type = "AUTH_INTERNAL_ERROR";
64
- code;
65
- constructor(code, message, options) {
66
- super(message, options);
67
- this.code = code;
68
- this.name = new.target.name;
69
- Error.captureStackTrace(this, new.target);
70
- }
71
- };
72
-
73
- // src/jose.ts
74
- var createJoseInstance = (secret) => {
75
- secret ??= env.AURA_AUTH_SECRET ?? env.AUTH_SECRET;
76
- if (!secret) {
77
- throw new AuthInternalError(
78
- "JOSE_INITIALIZATION_FAILED",
79
- "AURA_AUTH_SECRET environment variable is not set and no secret was provided."
80
- );
81
- }
82
- const salt = env.AURA_AUTH_SALT ?? env.AUTH_SALT;
83
- if (!salt) {
84
- throw new AuthInternalError(
85
- "JOSE_INITIALIZATION_FAILED",
86
- "AURA_AUTH_SALT or AUTH_SALT environment variable is not set. A salt value is required for key derivation."
87
- );
88
- }
89
- try {
90
- (0, import_jose.createSecret)(salt);
91
- } catch (error) {
92
- throw new AuthInternalError(
93
- "INVALID_SALT_SECRET_VALUE",
94
- "AURA_AUTH_SALT/AUTH_SALT is invalid. It must be at least 32 bytes long and meet entropy requirements.",
95
- { cause: error }
96
- );
97
- }
98
- const { derivedKey: derivedSigningKey } = (0, import_jose.createDeriveKey)(secret, salt, "signing");
99
- const { derivedKey: derivedEncryptionKey } = (0, import_jose.createDeriveKey)(secret, salt, "encryption");
100
- const { derivedKey: derivedCsrfTokenKey } = (0, import_jose.createDeriveKey)(secret, salt, "csrfToken");
101
- const { decodeJWT, encodeJWT } = (0, import_jose.createJWT)({ jws: derivedSigningKey, jwe: derivedEncryptionKey });
102
- const { signJWS, verifyJWS } = (0, import_jose.createJWS)(derivedCsrfTokenKey);
103
- const { encryptJWE, decryptJWE } = (0, import_jose.createJWE)(derivedEncryptionKey);
104
- return {
105
- decodeJWT,
106
- encodeJWT,
107
- signJWS,
108
- verifyJWS,
109
- encryptJWE,
110
- decryptJWE
111
- };
112
- };
113
- var jwtVerificationOptions = {
114
- algorithms: ["HS256"],
115
- typ: "JWT"
116
- };
117
- var decodeJWTOptions = {
118
- jws: jwtVerificationOptions,
119
- jwt: {
120
- typ: "JWT"
121
- }
122
- };
123
- // Annotate the CommonJS export names for ESM import in node:
124
- 0 && (module.exports = {
125
- createJoseInstance,
126
- decodeJWTOptions,
127
- jwtVerificationOptions
128
- });
package/dist/jose.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import * as _aura_stack_jose from '@aura-stack/jose';
2
- import { JWTVerifyOptions, DecodedJWTPayloadOptions } from '@aura-stack/jose';
3
- import * as _aura_stack_jose_jose from '@aura-stack/jose/jose';
4
- export { JWTPayload } from '@aura-stack/jose/jose';
5
-
6
- /**
7
- * Creates the JOSE instance used for signing and verifying tokens. It derives keys
8
- * for session tokens and CSRF tokens. For security and determinism, it's required
9
- * to set a salt value in `AURA_AUTH_SALT` or `AUTH_SALT` env.
10
- *
11
- * @param secret the base secret for key derivation
12
- * @returns jose instance with methods for encoding/decoding JWTs and signing/verifying JWSs
13
- */
14
- declare const createJoseInstance: (secret?: string) => {
15
- decodeJWT: (token: string) => Promise<_aura_stack_jose_jose.JWTPayload>;
16
- encodeJWT: (payload: _aura_stack_jose_jose.JWTPayload) => Promise<string>;
17
- signJWS: (payload: _aura_stack_jose_jose.JWTPayload) => Promise<string>;
18
- verifyJWS: (payload: string, options?: JWTVerifyOptions) => Promise<_aura_stack_jose_jose.JWTPayload>;
19
- encryptJWE: (payload: string, options?: _aura_stack_jose.EncryptOptions) => Promise<string>;
20
- decryptJWE: (payload: string, options?: _aura_stack_jose.JWTDecryptOptions) => Promise<string>;
21
- };
22
- declare const jwtVerificationOptions: JWTVerifyOptions;
23
- declare const decodeJWTOptions: DecodedJWTPayloadOptions;
24
-
25
- export { createJoseInstance, decodeJWTOptions, jwtVerificationOptions };
package/dist/jose.js DELETED
@@ -1,12 +0,0 @@
1
- import {
2
- createJoseInstance,
3
- decodeJWTOptions,
4
- jwtVerificationOptions
5
- } from "./chunk-FRJFWTOY.js";
6
- import "./chunk-4MYWAOLG.js";
7
- import "./chunk-RRLIF4PQ.js";
8
- export {
9
- createJoseInstance,
10
- decodeJWTOptions,
11
- jwtVerificationOptions
12
- };
package/dist/logger.cjs DELETED
@@ -1,292 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/logger.ts
21
- var logger_exports = {};
22
- __export(logger_exports, {
23
- createLogEntry: () => createLogEntry,
24
- logMessages: () => logMessages
25
- });
26
- module.exports = __toCommonJS(logger_exports);
27
- var logMessages = {
28
- ROUTER_INTERNAL_ERROR: {
29
- facility: 10,
30
- severity: "error",
31
- msgId: "ROUTER_INTERNAL_ERROR",
32
- message: "Unhandled router error while processing the request"
33
- },
34
- INVALID_REQUEST: {
35
- facility: 10,
36
- severity: "warning",
37
- msgId: "INVALID_REQUEST",
38
- message: "Request validation failed against the expected schema"
39
- },
40
- SERVER_ERROR: {
41
- facility: 10,
42
- severity: "error",
43
- msgId: "SERVER_ERROR",
44
- message: "Unexpected internal server error during authentication"
45
- },
46
- OAUTH_PROTOCOL_ERROR: {
47
- facility: 10,
48
- severity: "warning",
49
- msgId: "OAUTH_PROTOCOL_ERROR",
50
- message: "OAuth provider returned an invalid or unexpected protocol response"
51
- },
52
- OAUTH_AUTHORIZATION_ERROR: {
53
- facility: 10,
54
- severity: "error",
55
- msgId: "OAUTH_AUTHORIZATION_ERROR",
56
- message: "OAuth authorization request was rejected or failed"
57
- },
58
- INVALID_OAUTH_CONFIGURATION: {
59
- facility: 10,
60
- severity: "error",
61
- msgId: "INVALID_OAUTH_CONFIGURATION",
62
- message: "The OAuth provider configuration is invalid or incomplete"
63
- },
64
- OAUTH_ACCESS_TOKEN_REQUEST_INITIATED: {
65
- facility: 10,
66
- severity: "debug",
67
- msgId: "OAUTH_ACCESS_TOKEN_REQUEST_INITIATED",
68
- message: "Starting OAuth access token request to the provider"
69
- },
70
- INVALID_OAUTH_ACCESS_TOKEN_RESPONSE: {
71
- facility: 10,
72
- severity: "error",
73
- msgId: "INVALID_OAUTH_ACCESS_TOKEN_RESPONSE",
74
- message: "OAuth access token endpoint returned an invalid or malformed response"
75
- },
76
- OAUTH_ACCESS_TOKEN_ERROR: {
77
- facility: 10,
78
- severity: "error",
79
- msgId: "OAUTH_ACCESS_TOKEN_ERROR",
80
- message: "OAuth access token endpoint returned an error response"
81
- },
82
- OAUTH_ACCESS_TOKEN_SUCCESS: {
83
- facility: 10,
84
- severity: "info",
85
- msgId: "OAUTH_ACCESS_TOKEN_SUCCESS",
86
- message: "Successfully retrieved OAuth access token from the provider"
87
- },
88
- OAUTH_ACCESS_TOKEN_REQUEST_FAILED: {
89
- facility: 10,
90
- severity: "error",
91
- msgId: "OAUTH_ACCESS_TOKEN_REQUEST_FAILED",
92
- message: "Network or server error while requesting OAuth access token"
93
- },
94
- OAUTH_USERINFO_REQUEST_INITIATED: {
95
- facility: 10,
96
- severity: "debug",
97
- msgId: "OAUTH_USERINFO_REQUEST_INITIATED",
98
- message: "Starting OAuth userinfo request to the provider"
99
- },
100
- OAUTH_USERINFO_INVALID_RESPONSE: {
101
- facility: 10,
102
- severity: "error",
103
- msgId: "OAUTH_USERINFO_INVALID_RESPONSE",
104
- message: "OAuth userinfo endpoint returned an invalid or malformed response"
105
- },
106
- OAUTH_USERINFO_ERROR: {
107
- facility: 10,
108
- severity: "error",
109
- msgId: "OAUTH_USERINFO_ERROR",
110
- message: "OAuth userinfo endpoint returned an error response"
111
- },
112
- OAUTH_USERINFO_SUCCESS: {
113
- facility: 10,
114
- severity: "info",
115
- msgId: "OAUTH_USERINFO_SUCCESS",
116
- message: "Successfully retrieved user information from the OAuth provider"
117
- },
118
- OAUTH_USERINFO_REQUEST_FAILED: {
119
- facility: 10,
120
- severity: "error",
121
- msgId: "OAUTH_USERINFO_REQUEST_FAILED",
122
- message: "Network or server error while requesting user information from the OAuth provider"
123
- },
124
- OAUTH_CALLBACK_SUCCESS: {
125
- facility: 4,
126
- severity: "info",
127
- msgId: "OAUTH_CALLBACK_SUCCESS",
128
- message: "OAuth callback completed successfully and session was created"
129
- },
130
- MISMATCHING_STATE: {
131
- facility: 4,
132
- severity: "critical",
133
- msgId: "MISMATCHING_STATE",
134
- message: "OAuth response state parameter does not match the stored state value"
135
- },
136
- POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED: {
137
- facility: 4,
138
- severity: "critical",
139
- msgId: "POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED",
140
- message: "Blocked redirect to untrusted or external URL (potential open redirect attack)"
141
- },
142
- OPEN_REDIRECT_ATTACK: {
143
- facility: 4,
144
- severity: "warning",
145
- msgId: "OPEN_REDIRECT_ATTACK",
146
- message: "Detected redirect target that does not match the trusted origin"
147
- },
148
- SESSION_TOKEN_MISSING: {
149
- facility: 4,
150
- severity: "warning",
151
- msgId: "SESSION_TOKEN_MISSING",
152
- message: "Session cookie is missing from the request"
153
- },
154
- CSRF_TOKEN_MISSING: {
155
- facility: 4,
156
- severity: "warning",
157
- msgId: "CSRF_TOKEN_MISSING",
158
- message: "CSRF token cookie is missing from the request"
159
- },
160
- CSRF_HEADER_MISSING: {
161
- facility: 4,
162
- severity: "warning",
163
- msgId: "CSRF_HEADER_MISSING",
164
- message: "CSRF header is missing from the request"
165
- },
166
- CSRF_TOKEN_INVALID: {
167
- facility: 4,
168
- severity: "error",
169
- msgId: "CSRF_TOKEN_INVALID",
170
- message: "CSRF token verification failed or token is invalid"
171
- },
172
- SIGN_IN_INITIATED: {
173
- facility: 4,
174
- severity: "info",
175
- msgId: "SIGN_IN_INITIATED",
176
- message: "Starting OAuth sign-in flow for the selected provider"
177
- },
178
- SIGN_OUT_ATTEMPT: {
179
- facility: 4,
180
- severity: "debug",
181
- msgId: "SIGN_OUT_ATTEMPT",
182
- message: "Received sign-out request from client"
183
- },
184
- SIGN_OUT_CSRF_VERIFIED: {
185
- facility: 4,
186
- severity: "info",
187
- msgId: "SIGN_OUT_CSRF_VERIFIED",
188
- message: "CSRF token was successfully verified during sign-out"
189
- },
190
- SIGN_OUT_SUCCESS: {
191
- facility: 4,
192
- severity: "info",
193
- msgId: "SIGN_OUT_SUCCESS",
194
- message: "User session was cleared and sign-out completed successfully"
195
- },
196
- SIGN_OUT_REDIRECT: {
197
- facility: 4,
198
- severity: "debug",
199
- msgId: "SIGN_OUT_REDIRECT",
200
- message: "Redirecting client after successful sign-out"
201
- },
202
- AUTH_SESSION_VALID: {
203
- facility: 4,
204
- severity: "info",
205
- msgId: "AUTH_SESSION_VALID",
206
- message: "Session token is valid and user session was returned"
207
- },
208
- AUTH_SESSION_INVALID: {
209
- facility: 4,
210
- severity: "notice",
211
- msgId: "AUTH_SESSION_INVALID",
212
- message: "Session token is missing, expired, or invalid"
213
- },
214
- INVALID_JWT_TOKEN: {
215
- facility: 4,
216
- severity: "warning",
217
- msgId: "INVALID_JWT_TOKEN",
218
- message: "JWT session token failed validation during sign-out"
219
- },
220
- CSRF_TOKEN_REQUESTED: {
221
- facility: 4,
222
- severity: "debug",
223
- msgId: "CSRF_TOKEN_REQUESTED",
224
- message: "Client requested a CSRF token"
225
- },
226
- CSRF_TOKEN_ISSUED: {
227
- facility: 4,
228
- severity: "debug",
229
- msgId: "CSRF_TOKEN_ISSUED",
230
- message: "Issued a new CSRF token to the client"
231
- },
232
- INVALID_URL: {
233
- facility: 10,
234
- severity: "error",
235
- msgId: "INVALID_URL",
236
- message: "Derived origin URL is invalid or malformed"
237
- },
238
- COOKIE_HTTPONLY_DISABLED: {
239
- facility: 10,
240
- severity: "critical",
241
- msgId: "COOKIE_HTTPONLY_DISABLED",
242
- message: "Cookie is configured without HttpOnly. This allows JavaScript access via document.cookie and increases XSS exposure."
243
- },
244
- COOKIE_WILDCARD_DOMAIN: {
245
- facility: 10,
246
- severity: "critical",
247
- msgId: "COOKIE_WILDCARD_DOMAIN",
248
- message: "Cookie 'Domain' is set to a wildcard, which is insecure and should be avoided."
249
- },
250
- COOKIE_SECURE_DISABLED: {
251
- facility: 10,
252
- severity: "warning",
253
- msgId: "COOKIE_SECURE_DISABLED",
254
- message: "Cookie is configured with 'Secure' but the request is not HTTPS. The 'Secure' attribute will be ignored by the browser."
255
- },
256
- COOKIE_SAMESITE_NONE_WITHOUT_SECURE: {
257
- facility: 10,
258
- severity: "warning",
259
- msgId: "COOKIE_SAMESITE_NONE_WITHOUT_SECURE",
260
- message: "Cookie uses SameSite=None without Secure. Falling back to SameSite=Lax for safer defaults."
261
- },
262
- COOKIE_INSECURE_IN_PRODUCTION: {
263
- facility: 10,
264
- severity: "critical",
265
- msgId: "COOKIE_INSECURE_IN_PRODUCTION",
266
- message: "Cookies are being served over an insecure connection in production, which is a serious security risk."
267
- },
268
- COOKIE_HOST_STRATEGY_INSECURE: {
269
- facility: 10,
270
- severity: "critical",
271
- msgId: "COOKIE_HOST_STRATEGY_INSECURE",
272
- message: "__Host- cookies require a secure HTTPS context. Falling back to standard cookie settings."
273
- },
274
- UNTRUSTED_ORIGIN: {
275
- facility: 10,
276
- severity: "error",
277
- msgId: "UNTRUSTED_ORIGIN",
278
- message: "The constructed origin URL is not trusted."
279
- }
280
- };
281
- var createLogEntry = (key, overrides) => {
282
- const message = logMessages[key];
283
- return {
284
- ...message,
285
- ...overrides
286
- };
287
- };
288
- // Annotate the CommonJS export names for ESM import in node:
289
- 0 && (module.exports = {
290
- createLogEntry,
291
- logMessages
292
- });
package/dist/logger.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export { m as createLogEntry, l as logMessages } from './index-CSyIJmCM.js';
2
- import 'zod';
3
- import './schemas.js';
4
- import './jose.js';
5
- import '@aura-stack/jose';
6
- import '@aura-stack/jose/jose';
7
- import '@aura-stack/router/cookie';
8
- import './@types/utility.js';
package/dist/logger.js DELETED
@@ -1,8 +0,0 @@
1
- import {
2
- createLogEntry,
3
- logMessages
4
- } from "./chunk-VNCNJKS2.js";
5
- export {
6
- createLogEntry,
7
- logMessages
8
- };
package/dist/request.cjs DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/request.ts
21
- var request_exports = {};
22
- __export(request_exports, {
23
- fetchAsync: () => fetchAsync
24
- });
25
- module.exports = __toCommonJS(request_exports);
26
- var fetchAsync = async (url, options = {}, timeout = 5e3) => {
27
- const controller = new AbortController();
28
- const timeoutId = setTimeout(() => controller.abort(), timeout);
29
- const response = await fetch(url, {
30
- ...options,
31
- signal: controller.signal
32
- }).finally(() => clearTimeout(timeoutId));
33
- return response;
34
- };
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- fetchAsync
38
- });
package/dist/request.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * Fetches a resource with a timeout mechanism.
3
- *
4
- * @param url - The URL or Request object to fetch
5
- * @param options - Optional RequestInit configuration object
6
- * @param timeout - Timeout duration in milliseconds (default: 5000ms)
7
- * @returns A promise that resolves to the Response object
8
- * @example
9
- * const response = await fetchAsync('https://api.example.com/data', {}, 3000);
10
- */
11
- declare const fetchAsync: (url: string | Request, options?: RequestInit, timeout?: number) => Promise<Response>;
12
-
13
- export { fetchAsync };
package/dist/request.js DELETED
@@ -1,6 +0,0 @@
1
- import {
2
- fetchAsync
3
- } from "./chunk-ZNCZVF6U.js";
4
- export {
5
- fetchAsync
6
- };
package/dist/schemas.cjs DELETED
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/schemas.ts
21
- var schemas_exports = {};
22
- __export(schemas_exports, {
23
- OAuthAccessToken: () => OAuthAccessToken,
24
- OAuthAccessTokenErrorResponse: () => OAuthAccessTokenErrorResponse,
25
- OAuthAccessTokenResponse: () => OAuthAccessTokenResponse,
26
- OAuthAuthorization: () => OAuthAuthorization,
27
- OAuthAuthorizationErrorResponse: () => OAuthAuthorizationErrorResponse,
28
- OAuthAuthorizationResponse: () => OAuthAuthorizationResponse,
29
- OAuthEnvSchema: () => OAuthEnvSchema,
30
- OAuthErrorResponse: () => OAuthErrorResponse,
31
- OAuthProviderConfigSchema: () => OAuthProviderConfigSchema,
32
- OAuthProviderCredentialsSchema: () => OAuthProviderCredentialsSchema
33
- });
34
- module.exports = __toCommonJS(schemas_exports);
35
- var import_zod = require("zod");
36
- var OAuthProviderCredentialsSchema = (0, import_zod.object)({
37
- id: (0, import_zod.string)(),
38
- name: (0, import_zod.string)(),
39
- authorizeURL: (0, import_zod.string)().url(),
40
- accessToken: (0, import_zod.string)().url(),
41
- scope: (0, import_zod.string)(),
42
- userInfo: (0, import_zod.string)().url(),
43
- responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
44
- clientId: (0, import_zod.string)(),
45
- clientSecret: (0, import_zod.string)(),
46
- profile: import_zod.z.function().optional()
47
- });
48
- var OAuthProviderConfigSchema = (0, import_zod.object)({
49
- authorizeURL: (0, import_zod.string)().url(),
50
- accessToken: (0, import_zod.string)().url(),
51
- scope: (0, import_zod.string)().optional(),
52
- userInfo: (0, import_zod.string)().url(),
53
- responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
54
- clientId: (0, import_zod.string)(),
55
- clientSecret: (0, import_zod.string)()
56
- });
57
- var OAuthAuthorization = OAuthProviderConfigSchema.extend({
58
- redirectURI: (0, import_zod.string)(),
59
- state: (0, import_zod.string)(),
60
- codeChallenge: (0, import_zod.string)(),
61
- codeChallengeMethod: (0, import_zod.enum)(["plain", "S256"])
62
- });
63
- var OAuthAuthorizationResponse = (0, import_zod.object)({
64
- state: (0, import_zod.string)({ message: "Missing state parameter in the OAuth authorization response." }),
65
- code: (0, import_zod.string)({ message: "Missing code parameter in the OAuth authorization response." })
66
- });
67
- var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
68
- error: (0, import_zod.enum)([
69
- "invalid_request",
70
- "unauthorized_client",
71
- "access_denied",
72
- "unsupported_response_type",
73
- "invalid_scope",
74
- "server_error",
75
- "temporarily_unavailable"
76
- ]),
77
- error_description: (0, import_zod.string)().optional(),
78
- error_uri: (0, import_zod.string)().optional(),
79
- state: (0, import_zod.string)()
80
- });
81
- var OAuthAccessToken = OAuthProviderConfigSchema.extend({
82
- redirectURI: (0, import_zod.string)(),
83
- code: (0, import_zod.string)(),
84
- codeVerifier: (0, import_zod.string)().min(43).max(128)
85
- });
86
- var OAuthAccessTokenResponse = (0, import_zod.object)({
87
- access_token: (0, import_zod.string)(),
88
- token_type: (0, import_zod.string)().optional(),
89
- expires_in: (0, import_zod.number)().optional(),
90
- refresh_token: (0, import_zod.string)().optional(),
91
- scope: (0, import_zod.string)().optional().or((0, import_zod.null)())
92
- });
93
- var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
94
- error: (0, import_zod.enum)([
95
- "invalid_request",
96
- "invalid_client",
97
- "invalid_grant",
98
- "unauthorized_client",
99
- "unsupported_grant_type",
100
- "invalid_scope"
101
- ]),
102
- error_description: (0, import_zod.string)().optional(),
103
- error_uri: (0, import_zod.string)().optional()
104
- });
105
- var OAuthErrorResponse = (0, import_zod.object)({
106
- error: (0, import_zod.string)(),
107
- error_description: (0, import_zod.string)().optional()
108
- });
109
- var OAuthEnvSchema = (0, import_zod.object)({
110
- clientId: import_zod.z.string().min(1, "OAuth Client ID is required in the environment variables."),
111
- clientSecret: import_zod.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
112
- });
113
- // Annotate the CommonJS export names for ESM import in node:
114
- 0 && (module.exports = {
115
- OAuthAccessToken,
116
- OAuthAccessTokenErrorResponse,
117
- OAuthAccessTokenResponse,
118
- OAuthAuthorization,
119
- OAuthAuthorizationErrorResponse,
120
- OAuthAuthorizationResponse,
121
- OAuthEnvSchema,
122
- OAuthErrorResponse,
123
- OAuthProviderConfigSchema,
124
- OAuthProviderCredentialsSchema
125
- });