@aura-stack/auth 0.4.0 → 0.5.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.
- package/dist/@types/index.d.ts +6 -2
- package/dist/@types/router.d.d.ts +6 -2
- package/dist/actions/callback/access-token.cjs +103 -59
- package/dist/actions/callback/access-token.d.ts +7 -3
- package/dist/actions/callback/access-token.js +3 -3
- package/dist/actions/callback/callback.cjs +200 -134
- package/dist/actions/callback/callback.d.ts +32 -3
- package/dist/actions/callback/callback.js +11 -12
- package/dist/actions/callback/userinfo.cjs +103 -70
- package/dist/actions/callback/userinfo.d.ts +6 -2
- package/dist/actions/callback/userinfo.js +7 -8
- package/dist/actions/csrfToken/csrfToken.cjs +7 -15
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -1
- package/dist/actions/csrfToken/csrfToken.js +7 -8
- package/dist/actions/index.cjs +502 -295
- package/dist/actions/index.d.ts +5 -2
- package/dist/actions/index.js +23 -20
- package/dist/actions/session/session.cjs +76 -24
- package/dist/actions/session/session.d.ts +3 -1
- package/dist/actions/session/session.js +6 -4
- package/dist/actions/signIn/authorization-url.cjs +288 -0
- package/dist/actions/signIn/authorization-url.d.ts +31 -0
- package/dist/actions/signIn/authorization-url.js +16 -0
- package/dist/actions/signIn/authorization.cjs +91 -132
- package/dist/actions/signIn/authorization.d.ts +17 -16
- package/dist/actions/signIn/authorization.js +8 -7
- package/dist/actions/signIn/signIn.cjs +319 -191
- package/dist/actions/signIn/signIn.d.ts +32 -3
- package/dist/actions/signIn/signIn.js +10 -9
- package/dist/actions/signOut/signOut.cjs +211 -212
- package/dist/actions/signOut/signOut.d.ts +9 -1
- package/dist/actions/signOut/signOut.js +9 -10
- package/dist/api/createApi.cjs +750 -0
- package/dist/api/createApi.d.ts +12 -0
- package/dist/api/createApi.js +19 -0
- package/dist/api/getSession.cjs +141 -0
- package/dist/api/getSession.d.ts +16 -0
- package/dist/api/getSession.js +10 -0
- package/dist/api/signIn.cjs +549 -0
- package/dist/api/signIn.d.ts +26 -0
- package/dist/api/signIn.js +15 -0
- package/dist/api/signOut.cjs +279 -0
- package/dist/api/signOut.d.ts +16 -0
- package/dist/api/signOut.js +13 -0
- package/dist/assert.cjs +42 -9
- package/dist/assert.d.ts +8 -4
- package/dist/assert.js +5 -5
- package/dist/{chunk-KJBAQZX2.js → chunk-2A5B7GWR.js} +44 -11
- package/dist/chunk-2GQLSIJ2.js +40 -0
- package/dist/chunk-2IR674WX.js +44 -0
- package/dist/chunk-3J5TUH2I.js +50 -0
- package/dist/chunk-4RWSYUKX.js +98 -0
- package/dist/chunk-5X7JZMEF.js +0 -0
- package/dist/{chunk-TZB6MUXN.js → chunk-7BE46WWS.js} +21 -11
- package/dist/chunk-7YYXFKLR.js +35 -0
- package/dist/chunk-C3A37LQC.js +33 -0
- package/dist/chunk-CITNGXDA.js +31 -0
- package/dist/chunk-CWX724AG.js +78 -0
- package/dist/chunk-D2CSIUKP.js +74 -0
- package/dist/{chunk-ICAZ4OVS.js → chunk-FPCVZUVG.js} +2 -2
- package/dist/{chunk-XGLBNXL4.js → chunk-GNNBM2WJ.js} +17 -9
- package/dist/chunk-JOCGX3RP.js +59 -0
- package/dist/chunk-KBXWTD6E.js +94 -0
- package/dist/{chunk-XUP6KKNG.js → chunk-LATR3NIV.js} +48 -37
- package/dist/chunk-LAYPUDQF.js +39 -0
- package/dist/chunk-LX3TJ2TJ.js +294 -0
- package/dist/{chunk-6MXFPFR3.js → chunk-NHZBQNRR.js} +19 -19
- package/dist/{chunk-TM5IPSNF.js → chunk-PDP3PHB3.js} +33 -19
- package/dist/chunk-PHYNROD4.js +47 -0
- package/dist/chunk-QQEKY4XP.js +29 -0
- package/dist/{chunk-VNCNJKS2.js → chunk-U4RK4LKJ.js} +82 -1
- package/dist/{chunk-RRLIF4PQ.js → chunk-U5663F2U.js} +16 -1
- package/dist/chunk-UN7X6SU5.js +53 -0
- package/dist/chunk-UZQJJD6A.js +100 -0
- package/dist/{chunk-NUDITUKX.js → chunk-V6LLEAR4.js} +22 -15
- package/dist/{chunk-4MYWAOLG.js → chunk-WHNDRO3N.js} +20 -1
- package/dist/{chunk-5W4BRQYG.js → chunk-XY5R3EHH.js} +6 -3
- package/dist/client/client.cjs +135 -0
- package/dist/client/client.d.ts +85 -0
- package/dist/client/client.js +9 -0
- package/dist/client/index.cjs +135 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/index.js +10 -0
- package/dist/context.cjs +1237 -0
- package/dist/context.d.ts +16 -0
- package/dist/context.js +28 -0
- package/dist/cookie.cjs +33 -2
- package/dist/cookie.d.ts +9 -5
- package/dist/cookie.js +3 -2
- package/dist/createAuth.cjs +2320 -0
- package/dist/createAuth.d.ts +12 -0
- package/dist/createAuth.js +48 -0
- package/dist/env.cjs +24 -2
- package/dist/env.d.ts +4 -1
- package/dist/env.js +9 -3
- package/dist/errors.cjs +17 -0
- package/dist/errors.d.ts +13 -3
- package/dist/errors.js +5 -1
- package/dist/{index-CSyIJmCM.d.ts → index-_aXtxb_s.d.ts} +383 -13
- package/dist/index.cjs +2135 -1547
- package/dist/index.d.ts +9 -30
- package/dist/index.js +46 -119
- package/dist/jose.cjs +52 -14
- package/dist/jose.d.ts +12 -25
- package/dist/jose.js +11 -3
- package/dist/logger.cjs +132 -0
- package/dist/logger.d.ts +6 -2
- package/dist/logger.js +10 -1
- package/dist/oauth/atlassian.cjs +57 -0
- package/dist/oauth/atlassian.d.ts +12 -0
- package/dist/oauth/atlassian.js +6 -0
- package/dist/oauth/bitbucket.d.ts +6 -2
- package/dist/oauth/discord.d.ts +6 -2
- package/dist/oauth/dropbox.cjs +53 -0
- package/dist/oauth/dropbox.d.ts +12 -0
- package/dist/oauth/dropbox.js +6 -0
- package/dist/oauth/figma.d.ts +6 -2
- package/dist/oauth/github.d.ts +6 -2
- package/dist/oauth/gitlab.d.ts +6 -2
- package/dist/oauth/index.cjs +278 -88
- package/dist/oauth/index.d.ts +6 -2
- package/dist/oauth/index.js +27 -11
- package/dist/oauth/mailchimp.d.ts +6 -2
- package/dist/oauth/notion.cjs +131 -0
- package/dist/oauth/notion.d.ts +12 -0
- package/dist/oauth/notion.js +9 -0
- package/dist/oauth/pinterest.d.ts +6 -2
- package/dist/oauth/spotify.d.ts +6 -2
- package/dist/oauth/strava.d.ts +6 -2
- package/dist/oauth/twitch.cjs +95 -0
- package/dist/oauth/twitch.d.ts +12 -0
- package/dist/oauth/twitch.js +7 -0
- package/dist/oauth/x.d.ts +6 -2
- package/dist/schemas.cjs +84 -51
- package/dist/schemas.d.ts +103 -23
- package/dist/schemas.js +1 -1
- package/dist/secure.cjs +36 -36
- package/dist/secure.d.ts +10 -4
- package/dist/secure.js +7 -6
- package/dist/utils.cjs +109 -3
- package/dist/utils.d.ts +15 -4
- package/dist/utils.js +11 -4
- package/package.json +9 -5
- package/dist/chunk-4EKY7655.js +0 -123
- package/dist/chunk-7QF22LHP.js +0 -67
- package/dist/chunk-ALG3GIV4.js +0 -95
- package/dist/chunk-FRJFWTOY.js +0 -70
- package/dist/chunk-PHFH2MGS.js +0 -36
- package/dist/chunk-QQVSRXGX.js +0 -149
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { A as AuthConfig, I as InternalContext } from './index-_aXtxb_s.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import './schemas.js';
|
|
4
|
+
import 'zod/v4';
|
|
5
|
+
import '@aura-stack/jose';
|
|
6
|
+
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
8
|
+
import '@aura-stack/router/cookie';
|
|
9
|
+
import './@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
|
13
|
+
|
|
14
|
+
declare const createContext: (config?: AuthConfig) => InternalContext;
|
|
15
|
+
|
|
16
|
+
export { createContext };
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext
|
|
3
|
+
} from "./chunk-2IR674WX.js";
|
|
4
|
+
import "./chunk-PDP3PHB3.js";
|
|
5
|
+
import "./chunk-LDU7A2JE.js";
|
|
6
|
+
import "./chunk-PHYNROD4.js";
|
|
7
|
+
import "./chunk-E6G5YCI6.js";
|
|
8
|
+
import "./chunk-IPKO6UQN.js";
|
|
9
|
+
import "./chunk-54CZPKR4.js";
|
|
10
|
+
import "./chunk-2GQLSIJ2.js";
|
|
11
|
+
import "./chunk-EEE7UM5T.js";
|
|
12
|
+
import "./chunk-C3A37LQC.js";
|
|
13
|
+
import "./chunk-4YHJ4IEQ.js";
|
|
14
|
+
import "./chunk-OVHNRULD.js";
|
|
15
|
+
import "./chunk-QQEKY4XP.js";
|
|
16
|
+
import "./chunk-KMMAZFSJ.js";
|
|
17
|
+
import "./chunk-FW4W3REU.js";
|
|
18
|
+
import "./chunk-5LZ7TOM3.js";
|
|
19
|
+
import "./chunk-U4RK4LKJ.js";
|
|
20
|
+
import "./chunk-2A5B7GWR.js";
|
|
21
|
+
import "./chunk-UZQJJD6A.js";
|
|
22
|
+
import "./chunk-LX3TJ2TJ.js";
|
|
23
|
+
import "./chunk-XY5R3EHH.js";
|
|
24
|
+
import "./chunk-WHNDRO3N.js";
|
|
25
|
+
import "./chunk-U5663F2U.js";
|
|
26
|
+
export {
|
|
27
|
+
createContext
|
|
28
|
+
};
|
package/dist/cookie.cjs
CHANGED
|
@@ -34,6 +34,37 @@ __export(cookie_exports, {
|
|
|
34
34
|
setCookie: () => setCookie
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(cookie_exports);
|
|
37
|
+
|
|
38
|
+
// src/env.ts
|
|
39
|
+
var import_meta = {};
|
|
40
|
+
var env = new Proxy({}, {
|
|
41
|
+
get(_, prop) {
|
|
42
|
+
if (typeof prop !== "string") return void 0;
|
|
43
|
+
const hasProperty = (process2) => {
|
|
44
|
+
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
48
|
+
return process.env[prop];
|
|
49
|
+
}
|
|
50
|
+
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
51
|
+
return import_meta.env[prop];
|
|
52
|
+
}
|
|
53
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
54
|
+
return Deno.env.get(prop);
|
|
55
|
+
}
|
|
56
|
+
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
57
|
+
return Bun.env[prop];
|
|
58
|
+
}
|
|
59
|
+
const globalValue = globalThis[prop];
|
|
60
|
+
return typeof globalValue === "string" ? globalValue : void 0;
|
|
61
|
+
} catch {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// src/cookie.ts
|
|
37
68
|
var import_cookie = require("@aura-stack/router/cookie");
|
|
38
69
|
|
|
39
70
|
// src/errors.ts
|
|
@@ -86,7 +117,7 @@ var expiredCookieAttributes = {
|
|
|
86
117
|
secure: true
|
|
87
118
|
};
|
|
88
119
|
var getCookie = (request, cookieName) => {
|
|
89
|
-
const cookies = request.headers.get("Cookie");
|
|
120
|
+
const cookies = request instanceof Request ? request.headers.get("Cookie") : request.get("Cookie");
|
|
90
121
|
if (!cookies) {
|
|
91
122
|
throw new AuthInternalError("COOKIE_NOT_FOUND", "No cookies found. There is no active session");
|
|
92
123
|
}
|
|
@@ -131,7 +162,7 @@ var defineSecureCookieOptions = (useSecure, attributes, strategy, logger) => {
|
|
|
131
162
|
attributes.sameSite = "lax";
|
|
132
163
|
logger?.log("COOKIE_SAMESITE_NONE_WITHOUT_SECURE");
|
|
133
164
|
}
|
|
134
|
-
if (
|
|
165
|
+
if (env.NODE_ENV === "production") {
|
|
135
166
|
logger?.log("COOKIE_INSECURE_IN_PRODUCTION");
|
|
136
167
|
}
|
|
137
168
|
if (strategy === "host") {
|
package/dist/cookie.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { SerializeOptions } from '@aura-stack/router/cookie';
|
|
2
|
-
import {
|
|
3
|
-
import { A as AuthRuntimeConfig, I as InternalLogger, C as CookieConfig, a as CookieStoreConfig } from './index-CSyIJmCM.js';
|
|
2
|
+
import { C as CookieConfig, a as InternalLogger, b as CookieStoreConfig, c as AuthRuntimeConfig, U as User } from './index-_aXtxb_s.js';
|
|
4
3
|
import 'zod';
|
|
5
4
|
import './schemas.js';
|
|
6
|
-
import '
|
|
5
|
+
import 'zod/v4';
|
|
7
6
|
import '@aura-stack/jose';
|
|
7
|
+
import '@aura-stack/jose/jose';
|
|
8
|
+
import '@aura-stack/jose/crypto';
|
|
8
9
|
import './@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Prefix for all cookies set by Aura Auth.
|
|
@@ -42,7 +46,7 @@ declare const expiredCookieAttributes: SerializeOptions;
|
|
|
42
46
|
* @param cookie Cookie name to retrieve
|
|
43
47
|
* @returns The value of the cookie or throw an error if not found
|
|
44
48
|
*/
|
|
45
|
-
declare const getCookie: (request: Request, cookieName: string) => string;
|
|
49
|
+
declare const getCookie: (request: Request | Headers, cookieName: string) => string;
|
|
46
50
|
/**
|
|
47
51
|
* Get a Set-Cookie header value by cookie name from the response.
|
|
48
52
|
*
|
|
@@ -59,7 +63,7 @@ declare const getSetCookie: (response: Response, cookieName: string) => string |
|
|
|
59
63
|
* @param session - The JWT payload to be encoded in the session cookie
|
|
60
64
|
* @returns The serialized session cookie string
|
|
61
65
|
*/
|
|
62
|
-
declare const createSessionCookie: (jose: AuthRuntimeConfig["jose"], session:
|
|
66
|
+
declare const createSessionCookie: (jose: AuthRuntimeConfig["jose"], session: User) => Promise<string>;
|
|
63
67
|
/**
|
|
64
68
|
* Defines the cookie configuration based on the request security and cookie options passed
|
|
65
69
|
* in the Aura Auth configuration (`createAuth` function). This function ensures the correct
|
package/dist/cookie.js
CHANGED
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
getCookie,
|
|
12
12
|
getSetCookie,
|
|
13
13
|
setCookie
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-XY5R3EHH.js";
|
|
15
|
+
import "./chunk-WHNDRO3N.js";
|
|
16
|
+
import "./chunk-U5663F2U.js";
|
|
16
17
|
export {
|
|
17
18
|
COOKIE_NAME,
|
|
18
19
|
createCookieStore,
|