@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
package/dist/oauth/index.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
builtInOAuthProviders,
|
|
3
3
|
createBuiltInOAuthProviders
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-PDP3PHB3.js";
|
|
5
|
+
import {
|
|
6
|
+
mailchimp
|
|
7
|
+
} from "../chunk-LDU7A2JE.js";
|
|
8
|
+
import {
|
|
9
|
+
notion
|
|
10
|
+
} from "../chunk-PHYNROD4.js";
|
|
11
|
+
import {
|
|
12
|
+
pinterest
|
|
13
|
+
} from "../chunk-E6G5YCI6.js";
|
|
5
14
|
import {
|
|
6
15
|
spotify
|
|
7
16
|
} from "../chunk-IPKO6UQN.js";
|
|
8
17
|
import {
|
|
9
18
|
strava
|
|
10
19
|
} from "../chunk-54CZPKR4.js";
|
|
20
|
+
import {
|
|
21
|
+
twitch
|
|
22
|
+
} from "../chunk-2GQLSIJ2.js";
|
|
11
23
|
import {
|
|
12
24
|
x
|
|
13
25
|
} from "../chunk-EEE7UM5T.js";
|
|
26
|
+
import {
|
|
27
|
+
atlassian
|
|
28
|
+
} from "../chunk-C3A37LQC.js";
|
|
14
29
|
import {
|
|
15
30
|
bitbucket
|
|
16
31
|
} from "../chunk-4YHJ4IEQ.js";
|
|
17
32
|
import {
|
|
18
33
|
discord
|
|
19
34
|
} from "../chunk-OVHNRULD.js";
|
|
35
|
+
import {
|
|
36
|
+
dropbox
|
|
37
|
+
} from "../chunk-QQEKY4XP.js";
|
|
20
38
|
import {
|
|
21
39
|
figma
|
|
22
40
|
} from "../chunk-KMMAZFSJ.js";
|
|
@@ -26,27 +44,25 @@ import {
|
|
|
26
44
|
import {
|
|
27
45
|
gitlab
|
|
28
46
|
} from "../chunk-5LZ7TOM3.js";
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import
|
|
33
|
-
pinterest
|
|
34
|
-
} from "../chunk-E6G5YCI6.js";
|
|
35
|
-
import "../chunk-KJBAQZX2.js";
|
|
36
|
-
import "../chunk-QQVSRXGX.js";
|
|
37
|
-
import "../chunk-4MYWAOLG.js";
|
|
38
|
-
import "../chunk-RRLIF4PQ.js";
|
|
47
|
+
import "../chunk-2A5B7GWR.js";
|
|
48
|
+
import "../chunk-LX3TJ2TJ.js";
|
|
49
|
+
import "../chunk-WHNDRO3N.js";
|
|
50
|
+
import "../chunk-U5663F2U.js";
|
|
39
51
|
export {
|
|
52
|
+
atlassian,
|
|
40
53
|
bitbucket,
|
|
41
54
|
builtInOAuthProviders,
|
|
42
55
|
createBuiltInOAuthProviders,
|
|
43
56
|
discord,
|
|
57
|
+
dropbox,
|
|
44
58
|
figma,
|
|
45
59
|
github,
|
|
46
60
|
gitlab,
|
|
47
61
|
mailchimp,
|
|
62
|
+
notion,
|
|
48
63
|
pinterest,
|
|
49
64
|
spotify,
|
|
50
65
|
strava,
|
|
66
|
+
twitch,
|
|
51
67
|
x
|
|
52
68
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aa as Login, ab as MailchimpProfile, ac as mailchimp } from '../index-_aXtxb_s.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
7
8
|
import '@aura-stack/router/cookie';
|
|
8
9
|
import '../@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
|
@@ -0,0 +1,131 @@
|
|
|
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/oauth/notion.ts
|
|
21
|
+
var notion_exports = {};
|
|
22
|
+
__export(notion_exports, {
|
|
23
|
+
notion: () => notion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(notion_exports);
|
|
26
|
+
|
|
27
|
+
// src/utils.ts
|
|
28
|
+
var import_router = require("@aura-stack/router");
|
|
29
|
+
|
|
30
|
+
// src/errors.ts
|
|
31
|
+
var AuthInternalError = class extends Error {
|
|
32
|
+
type = "AUTH_INTERNAL_ERROR";
|
|
33
|
+
code;
|
|
34
|
+
constructor(code, message, options) {
|
|
35
|
+
super(message, options);
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.name = new.target.name;
|
|
38
|
+
Error.captureStackTrace(this, new.target);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// src/env.ts
|
|
43
|
+
var import_meta = {};
|
|
44
|
+
var env = new Proxy({}, {
|
|
45
|
+
get(_, prop) {
|
|
46
|
+
if (typeof prop !== "string") return void 0;
|
|
47
|
+
const hasProperty = (process2) => {
|
|
48
|
+
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
52
|
+
return process.env[prop];
|
|
53
|
+
}
|
|
54
|
+
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
55
|
+
return import_meta.env[prop];
|
|
56
|
+
}
|
|
57
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
58
|
+
return Deno.env.get(prop);
|
|
59
|
+
}
|
|
60
|
+
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
61
|
+
return Bun.env[prop];
|
|
62
|
+
}
|
|
63
|
+
const globalValue = globalThis[prop];
|
|
64
|
+
return typeof globalValue === "string" ? globalValue : void 0;
|
|
65
|
+
} catch {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var getEnv = (key) => {
|
|
71
|
+
const keys = [`AURA_AUTH_${key.toUpperCase()}`, `AURA_${key.toUpperCase()}`, `AUTH_${key.toUpperCase()}`, key.toUpperCase()];
|
|
72
|
+
return env[keys.find((k) => env[k]) ?? ""];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/assert.ts
|
|
76
|
+
var import_crypto = require("@aura-stack/jose/crypto");
|
|
77
|
+
|
|
78
|
+
// src/utils.ts
|
|
79
|
+
var createBasicAuthHeader = (username, password) => {
|
|
80
|
+
const getUsername = getEnv(username.toUpperCase()) ?? username;
|
|
81
|
+
const getPassword = getEnv(password.toUpperCase()) ?? password;
|
|
82
|
+
if (!getUsername || !getPassword) {
|
|
83
|
+
throw new AuthInternalError("INVALID_OAUTH_CONFIGURATION", "Missing client credentials for OAuth provider configuration.");
|
|
84
|
+
}
|
|
85
|
+
const credentials = `${getUsername}:${getPassword}`;
|
|
86
|
+
return `Basic ${btoa(credentials)}`;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/oauth/notion.ts
|
|
90
|
+
var notion = (options) => {
|
|
91
|
+
return {
|
|
92
|
+
id: "notion",
|
|
93
|
+
name: "Notion",
|
|
94
|
+
authorize: {
|
|
95
|
+
url: "https://api.notion.com/v1/oauth/authorize",
|
|
96
|
+
params: {
|
|
97
|
+
owner: "user",
|
|
98
|
+
scope: "user:read",
|
|
99
|
+
responseType: "code"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
accessToken: {
|
|
103
|
+
url: "https://api.notion.com/v1/oauth/token",
|
|
104
|
+
headers: {
|
|
105
|
+
Authorization: createBasicAuthHeader(
|
|
106
|
+
options?.clientId ?? "NOTION_CLIENT_ID",
|
|
107
|
+
options?.clientSecret ?? "NOTION_CLIENT_SECRET"
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
userInfo: {
|
|
112
|
+
url: "https://api.notion.com/v1/users/me",
|
|
113
|
+
headers: {
|
|
114
|
+
"Notion-Version": "2022-06-28"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
profile(profile) {
|
|
118
|
+
return {
|
|
119
|
+
sub: profile.id,
|
|
120
|
+
name: profile.name,
|
|
121
|
+
image: profile.avatar_url ?? "",
|
|
122
|
+
email: profile?.bot?.owner?.user?.person?.email
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
...options
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
notion
|
|
131
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { a0 as Bot, a1 as NotionProfile, a2 as Owner, a3 as Person, a4 as User, a5 as notion } 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';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a8 as PinterestProfile, a9 as pinterest } from '../index-_aXtxb_s.js';
|
|
2
2
|
import '../@types/utility.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
5
|
+
import 'zod/v4';
|
|
6
6
|
import '@aura-stack/jose';
|
|
7
7
|
import '@aura-stack/jose/jose';
|
|
8
|
+
import '@aura-stack/jose/crypto';
|
|
8
9
|
import '@aura-stack/router/cookie';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/oauth/spotify.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aj as SpotifyImage, ak as SpotifyProfile, al as spotify } from '../index-_aXtxb_s.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
7
8
|
import '@aura-stack/router/cookie';
|
|
8
9
|
import '../@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/oauth/strava.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ad as StravaProfile, ae as SummaryClub, af as SummaryGear, ag as strava } from '../index-_aXtxb_s.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
7
8
|
import '@aura-stack/router/cookie';
|
|
8
9
|
import '../@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
|
@@ -0,0 +1,95 @@
|
|
|
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/oauth/twitch.ts
|
|
21
|
+
var twitch_exports = {};
|
|
22
|
+
__export(twitch_exports, {
|
|
23
|
+
twitch: () => twitch
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(twitch_exports);
|
|
26
|
+
|
|
27
|
+
// src/env.ts
|
|
28
|
+
var import_meta = {};
|
|
29
|
+
var env = new Proxy({}, {
|
|
30
|
+
get(_, prop) {
|
|
31
|
+
if (typeof prop !== "string") return void 0;
|
|
32
|
+
const hasProperty = (process2) => {
|
|
33
|
+
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
37
|
+
return process.env[prop];
|
|
38
|
+
}
|
|
39
|
+
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
40
|
+
return import_meta.env[prop];
|
|
41
|
+
}
|
|
42
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
43
|
+
return Deno.env.get(prop);
|
|
44
|
+
}
|
|
45
|
+
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
46
|
+
return Bun.env[prop];
|
|
47
|
+
}
|
|
48
|
+
const globalValue = globalThis[prop];
|
|
49
|
+
return typeof globalValue === "string" ? globalValue : void 0;
|
|
50
|
+
} catch {
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
var getEnv = (key) => {
|
|
56
|
+
const keys = [`AURA_AUTH_${key.toUpperCase()}`, `AURA_${key.toUpperCase()}`, `AUTH_${key.toUpperCase()}`, key.toUpperCase()];
|
|
57
|
+
return env[keys.find((k) => env[k]) ?? ""];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/oauth/twitch.ts
|
|
61
|
+
var twitch = (options) => {
|
|
62
|
+
const clientId = options?.clientId ?? getEnv("TWITCH_CLIENT_ID");
|
|
63
|
+
return {
|
|
64
|
+
id: "twitch",
|
|
65
|
+
name: "Twitch",
|
|
66
|
+
authorize: {
|
|
67
|
+
url: "https://id.twitch.tv/oauth2/authorize",
|
|
68
|
+
params: { scope: "user:read:email", responseType: "code" }
|
|
69
|
+
},
|
|
70
|
+
accessToken: "https://id.twitch.tv/oauth2/token",
|
|
71
|
+
userInfo: {
|
|
72
|
+
url: "https://api.twitch.tv/helix/users",
|
|
73
|
+
headers: {
|
|
74
|
+
"Client-ID": clientId
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
profile(profile) {
|
|
78
|
+
const user = profile.data[0];
|
|
79
|
+
if (!user) {
|
|
80
|
+
throw new Error("No user data found in Twitch profile response");
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
sub: user.id,
|
|
84
|
+
name: user.display_name,
|
|
85
|
+
email: user.email,
|
|
86
|
+
picture: user.profile_image_url
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
...options
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
twitch
|
|
95
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { a6 as TwitchProfile, a7 as twitch } 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';
|
package/dist/oauth/x.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ah as XProfile, ai as x } from '../index-_aXtxb_s.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import 'zod/v4';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/jose/crypto';
|
|
7
8
|
import '@aura-stack/router/cookie';
|
|
8
9
|
import '../@types/utility.js';
|
|
10
|
+
import 'jose';
|
|
11
|
+
import '@aura-stack/router';
|
|
12
|
+
import 'zod/v4/core';
|
package/dist/schemas.cjs
CHANGED
|
@@ -32,40 +32,73 @@ __export(schemas_exports, {
|
|
|
32
32
|
OAuthProviderCredentialsSchema: () => OAuthProviderCredentialsSchema
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(schemas_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
var import_v4 = require("zod/v4");
|
|
36
|
+
var AuthorizeConfigSchema = import_v4.z.union([
|
|
37
|
+
(0, import_v4.string)().url(),
|
|
38
|
+
(0, import_v4.object)({
|
|
39
|
+
url: (0, import_v4.string)().url(),
|
|
40
|
+
params: (0, import_v4.object)({
|
|
41
|
+
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
42
|
+
scope: (0, import_v4.string)().optional()
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
]);
|
|
46
|
+
var AccessTokenConfigSchema = import_v4.z.union([
|
|
47
|
+
(0, import_v4.string)().url(),
|
|
48
|
+
(0, import_v4.object)({
|
|
49
|
+
url: (0, import_v4.string)().url(),
|
|
50
|
+
headers: import_v4.z.record((0, import_v4.string)(), (0, import_v4.string)()).optional()
|
|
51
|
+
})
|
|
52
|
+
]);
|
|
53
|
+
var UserInfoConfigSchema = import_v4.z.union([
|
|
54
|
+
(0, import_v4.string)().url(),
|
|
55
|
+
(0, import_v4.object)({
|
|
56
|
+
url: (0, import_v4.string)().url(),
|
|
57
|
+
headers: import_v4.z.record((0, import_v4.string)(), (0, import_v4.string)()).optional(),
|
|
58
|
+
method: (0, import_v4.string)().optional()
|
|
59
|
+
})
|
|
60
|
+
]);
|
|
61
|
+
var OAuthProviderCredentialsSchema = (0, import_v4.object)({
|
|
62
|
+
id: (0, import_v4.string)(),
|
|
63
|
+
name: (0, import_v4.string)(),
|
|
64
|
+
authorize: AuthorizeConfigSchema.optional(),
|
|
65
|
+
/** @deprecated */
|
|
66
|
+
authorizeURL: (0, import_v4.string)().url().optional(),
|
|
67
|
+
accessToken: AccessTokenConfigSchema,
|
|
68
|
+
/** @deprecated */
|
|
69
|
+
scope: (0, import_v4.string)().optional(),
|
|
70
|
+
userInfo: UserInfoConfigSchema,
|
|
71
|
+
/** @deprecated */
|
|
72
|
+
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
73
|
+
clientId: (0, import_v4.string)(),
|
|
74
|
+
clientSecret: (0, import_v4.string)(),
|
|
75
|
+
profile: import_v4.z.function().optional()
|
|
47
76
|
});
|
|
48
|
-
var OAuthProviderConfigSchema = (0,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
var OAuthProviderConfigSchema = (0, import_v4.object)({
|
|
78
|
+
authorize: AuthorizeConfigSchema.optional(),
|
|
79
|
+
/** @deprecated */
|
|
80
|
+
authorizeURL: (0, import_v4.string)().url().optional(),
|
|
81
|
+
accessToken: AccessTokenConfigSchema,
|
|
82
|
+
/** @deprecated */
|
|
83
|
+
scope: (0, import_v4.string)().optional(),
|
|
84
|
+
userInfo: UserInfoConfigSchema,
|
|
85
|
+
/** @deprecated */
|
|
86
|
+
responseType: (0, import_v4.enum)(["code", "token", "id_token", "refresh_token"]).optional(),
|
|
87
|
+
clientId: (0, import_v4.string)(),
|
|
88
|
+
clientSecret: (0, import_v4.string)()
|
|
56
89
|
});
|
|
57
90
|
var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
58
|
-
redirectURI: (0,
|
|
59
|
-
state: (0,
|
|
60
|
-
codeChallenge: (0,
|
|
61
|
-
codeChallengeMethod: (0,
|
|
91
|
+
redirectURI: (0, import_v4.string)(),
|
|
92
|
+
state: (0, import_v4.string)(),
|
|
93
|
+
codeChallenge: (0, import_v4.string)(),
|
|
94
|
+
codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
|
|
62
95
|
});
|
|
63
|
-
var OAuthAuthorizationResponse = (0,
|
|
64
|
-
state: (0,
|
|
65
|
-
code: (0,
|
|
96
|
+
var OAuthAuthorizationResponse = (0, import_v4.object)({
|
|
97
|
+
state: (0, import_v4.string)({ message: "Missing state parameter in the OAuth authorization response." }),
|
|
98
|
+
code: (0, import_v4.string)({ message: "Missing code parameter in the OAuth authorization response." })
|
|
66
99
|
});
|
|
67
|
-
var OAuthAuthorizationErrorResponse = (0,
|
|
68
|
-
error: (0,
|
|
100
|
+
var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
|
|
101
|
+
error: (0, import_v4.enum)([
|
|
69
102
|
"invalid_request",
|
|
70
103
|
"unauthorized_client",
|
|
71
104
|
"access_denied",
|
|
@@ -74,24 +107,24 @@ var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
|
|
|
74
107
|
"server_error",
|
|
75
108
|
"temporarily_unavailable"
|
|
76
109
|
]),
|
|
77
|
-
error_description: (0,
|
|
78
|
-
error_uri: (0,
|
|
79
|
-
state: (0,
|
|
110
|
+
error_description: (0, import_v4.string)().optional(),
|
|
111
|
+
error_uri: (0, import_v4.string)().optional(),
|
|
112
|
+
state: (0, import_v4.string)()
|
|
80
113
|
});
|
|
81
114
|
var OAuthAccessToken = OAuthProviderConfigSchema.extend({
|
|
82
|
-
redirectURI: (0,
|
|
83
|
-
code: (0,
|
|
84
|
-
codeVerifier: (0,
|
|
115
|
+
redirectURI: (0, import_v4.string)(),
|
|
116
|
+
code: (0, import_v4.string)(),
|
|
117
|
+
codeVerifier: (0, import_v4.string)().min(43).max(128)
|
|
85
118
|
});
|
|
86
|
-
var OAuthAccessTokenResponse = (0,
|
|
87
|
-
access_token: (0,
|
|
88
|
-
token_type: (0,
|
|
89
|
-
expires_in: (0,
|
|
90
|
-
refresh_token: (0,
|
|
91
|
-
scope: (0,
|
|
119
|
+
var OAuthAccessTokenResponse = (0, import_v4.object)({
|
|
120
|
+
access_token: (0, import_v4.string)(),
|
|
121
|
+
token_type: (0, import_v4.string)().optional(),
|
|
122
|
+
expires_in: (0, import_v4.number)().optional(),
|
|
123
|
+
refresh_token: (0, import_v4.string)().optional(),
|
|
124
|
+
scope: (0, import_v4.union)([(0, import_v4.string)().optional().or((0, import_v4.null)()), (0, import_v4.array)((0, import_v4.string)()).optional()])
|
|
92
125
|
});
|
|
93
|
-
var OAuthAccessTokenErrorResponse = (0,
|
|
94
|
-
error: (0,
|
|
126
|
+
var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
|
|
127
|
+
error: (0, import_v4.enum)([
|
|
95
128
|
"invalid_request",
|
|
96
129
|
"invalid_client",
|
|
97
130
|
"invalid_grant",
|
|
@@ -99,16 +132,16 @@ var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
|
|
|
99
132
|
"unsupported_grant_type",
|
|
100
133
|
"invalid_scope"
|
|
101
134
|
]),
|
|
102
|
-
error_description: (0,
|
|
103
|
-
error_uri: (0,
|
|
135
|
+
error_description: (0, import_v4.string)().optional(),
|
|
136
|
+
error_uri: (0, import_v4.string)().optional()
|
|
104
137
|
});
|
|
105
|
-
var OAuthErrorResponse = (0,
|
|
106
|
-
error: (0,
|
|
107
|
-
error_description: (0,
|
|
138
|
+
var OAuthErrorResponse = (0, import_v4.object)({
|
|
139
|
+
error: (0, import_v4.string)(),
|
|
140
|
+
error_description: (0, import_v4.string)().optional()
|
|
108
141
|
});
|
|
109
|
-
var OAuthEnvSchema = (0,
|
|
110
|
-
clientId:
|
|
111
|
-
clientSecret:
|
|
142
|
+
var OAuthEnvSchema = (0, import_v4.object)({
|
|
143
|
+
clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
144
|
+
clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
112
145
|
});
|
|
113
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
114
147
|
0 && (module.exports = {
|