@aura-stack/auth 0.1.0-rc.9 → 0.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.cjs +15 -15
- package/dist/@types/index.d.ts +7 -31
- package/dist/@types/index.js +1 -1
- package/dist/@types/router.d.cjs +1 -1
- package/dist/@types/router.d.d.ts +7 -7
- package/dist/@types/utility.cjs +15 -15
- package/dist/@types/utility.d.ts +4 -8
- package/dist/@types/utility.js +1 -1
- package/dist/actions/callback/access-token.cjs +176 -155
- package/dist/actions/callback/access-token.d.ts +15 -20
- package/dist/actions/callback/access-token.js +10 -4
- package/dist/actions/callback/callback.cjs +394 -490
- package/dist/actions/callback/callback.d.ts +10 -12
- package/dist/actions/callback/callback.js +16 -12
- package/dist/actions/callback/userinfo.cjs +166 -145
- package/dist/actions/callback/userinfo.d.ts +9 -9
- package/dist/actions/callback/userinfo.js +12 -6
- package/dist/actions/csrfToken/csrfToken.cjs +112 -190
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
- package/dist/actions/csrfToken/csrfToken.js +12 -8
- package/dist/actions/index.cjs +652 -814
- package/dist/actions/index.d.ts +13 -13
- package/dist/actions/index.js +34 -18
- package/dist/actions/session/session.cjs +86 -176
- package/dist/actions/session/session.d.ts +3 -3
- package/dist/actions/session/session.js +10 -7
- package/dist/actions/signIn/authorization.cjs +254 -263
- package/dist/actions/signIn/authorization.d.ts +12 -18
- package/dist/actions/signIn/authorization.js +16 -6
- package/dist/actions/signIn/signIn.cjs +320 -456
- package/dist/actions/signIn/signIn.d.ts +10 -10
- package/dist/actions/signIn/signIn.js +13 -10
- package/dist/actions/signOut/signOut.cjs +304 -473
- package/dist/actions/signOut/signOut.d.ts +3 -3
- package/dist/actions/signOut/signOut.js +14 -11
- package/dist/assert.cjs +40 -36
- package/dist/assert.d.ts +13 -4
- package/dist/assert.js +12 -2
- package/dist/chunk-3EUWD5BB.js +63 -0
- package/dist/chunk-42XB3YCW.js +19 -17
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/chunk-A3N4PVAT.js +70 -0
- package/dist/chunk-B737EUJV.js +22 -0
- package/dist/chunk-CXLATHS5.js +143 -0
- package/dist/chunk-E3OXBRYF.js +19 -17
- package/dist/chunk-EIL2FPSS.js +22 -0
- package/dist/chunk-EMKJA2GJ.js +89 -0
- package/dist/chunk-FIPU4MLT.js +18 -16
- package/dist/chunk-FKRDCWBF.js +19 -17
- package/dist/chunk-GA2SMTJO.js +58 -0
- package/dist/chunk-HP34YGGJ.js +22 -0
- package/dist/chunk-HT4YLL7N.js +35 -0
- package/dist/chunk-IKHPGFCW.js +11 -9
- package/dist/chunk-IUYZQTJV.js +30 -0
- package/dist/chunk-IVET23KF.js +58 -0
- package/dist/chunk-JVFTCTTE.js +33 -0
- package/dist/chunk-KRNOMBXQ.js +19 -17
- package/dist/chunk-KSWLO5ZU.js +102 -0
- package/dist/chunk-N2APGLXA.js +71 -0
- package/dist/chunk-N4SX7TZT.js +96 -0
- package/dist/chunk-RRLIF4PQ.js +55 -0
- package/dist/chunk-STHEPPUZ.js +8 -6
- package/dist/chunk-TLE4PXY3.js +39 -0
- package/dist/chunk-W6LG7BFW.js +197 -0
- package/dist/chunk-YRCB5FLE.js +79 -0
- package/dist/chunk-ZNCZVF6U.js +14 -0
- package/dist/cookie.cjs +222 -187
- package/dist/cookie.d.ts +39 -76
- package/dist/cookie.js +27 -34
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +49 -0
- package/dist/errors.js +18 -0
- package/dist/headers.cjs +28 -28
- package/dist/headers.d.ts +2 -2
- package/dist/headers.js +6 -2
- package/dist/index-DkaLJFn8.d.ts +679 -0
- package/dist/index.cjs +1074 -1007
- package/dist/index.d.ts +10 -31
- package/dist/index.js +85 -51
- package/dist/jose.cjs +74 -66
- package/dist/jose.d.ts +11 -8
- package/dist/jose.js +10 -5
- package/dist/oauth/bitbucket.cjs +38 -38
- package/dist/oauth/bitbucket.d.ts +7 -7
- package/dist/oauth/bitbucket.js +6 -2
- package/dist/oauth/discord.cjs +47 -48
- package/dist/oauth/discord.d.ts +7 -7
- package/dist/oauth/discord.js +6 -2
- package/dist/oauth/figma.cjs +39 -39
- package/dist/oauth/figma.d.ts +7 -7
- package/dist/oauth/figma.js +6 -2
- package/dist/oauth/github.cjs +31 -31
- package/dist/oauth/github.d.ts +7 -7
- package/dist/oauth/github.js +6 -2
- package/dist/oauth/gitlab.cjs +39 -39
- package/dist/oauth/gitlab.d.ts +7 -7
- package/dist/oauth/gitlab.js +6 -2
- package/dist/oauth/index.cjs +350 -180
- package/dist/oauth/index.d.ts +7 -26
- package/dist/oauth/index.js +51 -9
- package/dist/oauth/mailchimp.cjs +46 -0
- package/dist/oauth/mailchimp.d.ts +7 -0
- package/dist/oauth/mailchimp.js +6 -0
- package/dist/oauth/pinterest.cjs +46 -0
- package/dist/oauth/pinterest.d.ts +7 -0
- package/dist/oauth/pinterest.js +6 -0
- package/dist/oauth/spotify.cjs +39 -39
- package/dist/oauth/spotify.d.ts +7 -7
- package/dist/oauth/spotify.js +6 -2
- package/dist/oauth/strava.cjs +46 -0
- package/dist/oauth/strava.d.ts +7 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.cjs +39 -39
- package/dist/oauth/x.d.ts +7 -7
- package/dist/oauth/x.js +6 -2
- package/dist/request.cjs +38 -0
- package/dist/request.d.ts +13 -0
- package/dist/request.js +6 -0
- package/dist/schemas.cjs +103 -97
- package/dist/schemas.d.ts +96 -126
- package/dist/schemas.js +20 -18
- package/dist/secure.cjs +106 -101
- package/dist/secure.d.ts +17 -17
- package/dist/secure.js +19 -4
- package/dist/utils.cjs +197 -135
- package/dist/utils.d.ts +20 -26
- package/dist/utils.js +25 -21
- package/package.json +8 -7
- package/dist/chunk-256KIVJL.js +0 -110
- package/dist/chunk-6SM22VVJ.js +0 -15
- package/dist/chunk-CAKJT3KS.js +0 -77
- package/dist/chunk-EBPE35JT.js +0 -29
- package/dist/chunk-FJUDBLCP.js +0 -52
- package/dist/chunk-GZU3RBTB.js +0 -51
- package/dist/chunk-HGJ4TXY4.js +0 -105
- package/dist/chunk-HMRKN75I.js +0 -74
- package/dist/chunk-JAPMIE6S.js +0 -8
- package/dist/chunk-LLR722CL.js +0 -75
- package/dist/chunk-RLT4RFKV.js +0 -36
- package/dist/chunk-SJPDVKUS.js +0 -93
- package/dist/chunk-SMQO5WD7.js +0 -20
- package/dist/chunk-UJJ7R56J.js +0 -42
- package/dist/chunk-UTDLUEEG.js +0 -25
- package/dist/chunk-VFTYH33W.js +0 -44
- package/dist/chunk-XXJKNKGQ.js +0 -27
- package/dist/chunk-ZV4BH47P.js +0 -156
- package/dist/error.cjs +0 -88
- package/dist/error.d.ts +0 -62
- package/dist/error.js +0 -9
- package/dist/index-DpfbvTZ_.d.ts +0 -597
- package/dist/response.cjs +0 -34
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -2
package/dist/oauth/index.cjs
CHANGED
|
@@ -1,213 +1,383 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var __defProp = Object.defineProperty
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
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
6
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
9
10
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
|
|
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);
|
|
18
19
|
|
|
19
20
|
// src/oauth/index.ts
|
|
20
|
-
var oauth_exports = {}
|
|
21
|
+
var oauth_exports = {};
|
|
21
22
|
__export(oauth_exports, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
bitbucket: () => bitbucket,
|
|
24
|
+
builtInOAuthProviders: () => builtInOAuthProviders,
|
|
25
|
+
createBuiltInOAuthProviders: () => createBuiltInOAuthProviders,
|
|
26
|
+
discord: () => discord,
|
|
27
|
+
figma: () => figma,
|
|
28
|
+
github: () => github,
|
|
29
|
+
gitlab: () => gitlab,
|
|
30
|
+
mailchimp: () => mailchimp,
|
|
31
|
+
pinterest: () => pinterest,
|
|
32
|
+
spotify: () => spotify,
|
|
33
|
+
strava: () => strava,
|
|
34
|
+
x: () => x
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(oauth_exports);
|
|
33
37
|
|
|
34
38
|
// src/oauth/github.ts
|
|
35
39
|
var github = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
40
|
+
id: "github",
|
|
41
|
+
name: "GitHub",
|
|
42
|
+
authorizeURL: "https://github.com/login/oauth/authorize",
|
|
43
|
+
accessToken: "https://github.com/login/oauth/access_token",
|
|
44
|
+
userInfo: "https://api.github.com/user",
|
|
45
|
+
scope: "read:user user:email",
|
|
46
|
+
responseType: "code"
|
|
47
|
+
};
|
|
44
48
|
|
|
45
49
|
// src/oauth/bitbucket.ts
|
|
46
50
|
var bitbucket = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
51
|
+
id: "bitbucket",
|
|
52
|
+
name: "Bitbucket",
|
|
53
|
+
authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
|
|
54
|
+
accessToken: "https://bitbucket.org/site/oauth2/access_token",
|
|
55
|
+
userInfo: "https://api.bitbucket.org/2.0/user",
|
|
56
|
+
scope: "account email",
|
|
57
|
+
responseType: "code",
|
|
58
|
+
profile(profile) {
|
|
59
|
+
return {
|
|
60
|
+
sub: profile.uuid ?? profile.account_id,
|
|
61
|
+
name: profile.display_name ?? profile.nickname,
|
|
62
|
+
image: profile.links.avatar.href
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
};
|
|
62
66
|
|
|
63
67
|
// src/oauth/figma.ts
|
|
64
68
|
var figma = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
69
|
+
id: "figma",
|
|
70
|
+
name: "Figma",
|
|
71
|
+
authorizeURL: "https://www.figma.com/oauth",
|
|
72
|
+
accessToken: "https://api.figma.com/v1/oauth/token",
|
|
73
|
+
userInfo: "https://api.figma.com/v1/me",
|
|
74
|
+
scope: "current_user:read",
|
|
75
|
+
responseType: "code",
|
|
76
|
+
profile(profile) {
|
|
77
|
+
return {
|
|
78
|
+
sub: profile.id,
|
|
79
|
+
name: profile.handle,
|
|
80
|
+
email: profile.email,
|
|
81
|
+
image: profile.img_url
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
81
85
|
|
|
82
86
|
// src/oauth/discord.ts
|
|
83
87
|
var discord = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
88
|
+
id: "discord",
|
|
89
|
+
name: "Discord",
|
|
90
|
+
authorizeURL: "https://discord.com/oauth2/authorize",
|
|
91
|
+
accessToken: "https://discord.com/api/oauth2/token",
|
|
92
|
+
userInfo: "https://discord.com/api/users/@me",
|
|
93
|
+
scope: "identify email",
|
|
94
|
+
responseType: "code",
|
|
95
|
+
profile(profile) {
|
|
96
|
+
let image = "";
|
|
97
|
+
if (profile.avatar === null) {
|
|
98
|
+
const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5;
|
|
99
|
+
image = `https://cdn.discordapp.com/embed/avatars/${index}.png`;
|
|
100
|
+
} else {
|
|
101
|
+
const format = profile.avatar.startsWith("a_") ? "gif" : "png";
|
|
102
|
+
image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
sub: profile.id,
|
|
106
|
+
name: profile.global_name ?? profile.username,
|
|
107
|
+
email: profile.email ?? "",
|
|
108
|
+
image
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
109
112
|
|
|
110
113
|
// src/oauth/gitlab.ts
|
|
111
114
|
var gitlab = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
115
|
+
id: "gitlab",
|
|
116
|
+
name: "GitLab",
|
|
117
|
+
authorizeURL: "https://gitlab.com/oauth/authorize",
|
|
118
|
+
accessToken: "https://gitlab.com/oauth/token",
|
|
119
|
+
userInfo: "https://gitlab.com/api/v4/user",
|
|
120
|
+
scope: "read_user",
|
|
121
|
+
responseType: "code",
|
|
122
|
+
profile(profile) {
|
|
123
|
+
return {
|
|
124
|
+
sub: profile.id.toString(),
|
|
125
|
+
name: profile.name ?? profile.username,
|
|
126
|
+
email: profile.email,
|
|
127
|
+
avatar: profile.avatar_url
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
128
131
|
|
|
129
132
|
// src/oauth/spotify.ts
|
|
130
133
|
var spotify = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
134
|
+
id: "spotify",
|
|
135
|
+
name: "Spotify",
|
|
136
|
+
authorizeURL: "https://accounts.spotify.com/authorize",
|
|
137
|
+
accessToken: "https://accounts.spotify.com/api/token",
|
|
138
|
+
userInfo: "https://api.spotify.com/v1/me",
|
|
139
|
+
scope: "user-read-email user-read-private",
|
|
140
|
+
responseType: "token",
|
|
141
|
+
profile(profile) {
|
|
142
|
+
return {
|
|
143
|
+
sub: profile.id,
|
|
144
|
+
name: profile.display_name,
|
|
145
|
+
email: profile.email,
|
|
146
|
+
image: profile.images?.[0]?.url
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
};
|
|
147
150
|
|
|
148
151
|
// src/oauth/x.ts
|
|
149
152
|
var x = {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
153
|
+
id: "x",
|
|
154
|
+
name: "X",
|
|
155
|
+
authorizeURL: "https://x.com/i/oauth2/authorize",
|
|
156
|
+
accessToken: "https://api.x.com/2/oauth2/token",
|
|
157
|
+
userInfo: "https://api.x.com/2/users/me?user.fields=profile_image_url",
|
|
158
|
+
scope: "users.read users.email tweet.read offline.access",
|
|
159
|
+
responseType: "code",
|
|
160
|
+
profile({ data }) {
|
|
161
|
+
return {
|
|
162
|
+
sub: data.id,
|
|
163
|
+
name: data.name,
|
|
164
|
+
image: data.profile_image_url,
|
|
165
|
+
email: ""
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/oauth/strava.ts
|
|
171
|
+
var strava = {
|
|
172
|
+
id: "strava",
|
|
173
|
+
name: "Strava",
|
|
174
|
+
authorizeURL: "https://www.strava.com/oauth/authorize",
|
|
175
|
+
accessToken: "https://www.strava.com/oauth/token",
|
|
176
|
+
userInfo: "https://www.strava.com/api/v3/athlete",
|
|
177
|
+
scope: "read",
|
|
178
|
+
responseType: "code",
|
|
179
|
+
profile(profile) {
|
|
180
|
+
return {
|
|
181
|
+
sub: profile.id.toString(),
|
|
182
|
+
name: `${profile.firstname} ${profile.lastname}`,
|
|
183
|
+
image: profile.profile,
|
|
184
|
+
email: ""
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// src/oauth/mailchimp.ts
|
|
190
|
+
var mailchimp = {
|
|
191
|
+
id: "mailchimp",
|
|
192
|
+
name: "Mailchimp",
|
|
193
|
+
authorizeURL: "https://login.mailchimp.com/oauth2/authorize",
|
|
194
|
+
accessToken: "https://login.mailchimp.com/oauth2/token",
|
|
195
|
+
userInfo: "https://login.mailchimp.com/oauth2/metadata",
|
|
196
|
+
scope: "",
|
|
197
|
+
responseType: "code",
|
|
198
|
+
profile(profile) {
|
|
199
|
+
return {
|
|
200
|
+
sub: profile.user_id,
|
|
201
|
+
name: profile.accountname,
|
|
202
|
+
email: profile.login.login_email,
|
|
203
|
+
image: null
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/oauth/pinterest.ts
|
|
209
|
+
var pinterest = {
|
|
210
|
+
id: "pinterest",
|
|
211
|
+
name: "Pinterest",
|
|
212
|
+
authorizeURL: "https://api.pinterest.com/oauth/",
|
|
213
|
+
accessToken: "https://api.pinterest.com/v5/oauth/token",
|
|
214
|
+
userInfo: "https://api.pinterest.com/v5/user_account",
|
|
215
|
+
scope: "user_accounts:read",
|
|
216
|
+
responseType: "code",
|
|
217
|
+
profile(profile) {
|
|
218
|
+
return {
|
|
219
|
+
sub: profile.id,
|
|
220
|
+
name: profile.username,
|
|
221
|
+
email: null,
|
|
222
|
+
image: profile.profile_image
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// src/schemas.ts
|
|
228
|
+
var import_zod = require("zod");
|
|
229
|
+
var OAuthProviderConfigSchema = (0, import_zod.object)({
|
|
230
|
+
authorizeURL: (0, import_zod.string)().url(),
|
|
231
|
+
accessToken: (0, import_zod.string)().url(),
|
|
232
|
+
scope: (0, import_zod.string)().optional(),
|
|
233
|
+
userInfo: (0, import_zod.string)().url(),
|
|
234
|
+
responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
|
|
235
|
+
clientId: (0, import_zod.string)(),
|
|
236
|
+
clientSecret: (0, import_zod.string)()
|
|
237
|
+
});
|
|
238
|
+
var OAuthAuthorization = OAuthProviderConfigSchema.extend({
|
|
239
|
+
redirectURI: (0, import_zod.string)(),
|
|
240
|
+
state: (0, import_zod.string)(),
|
|
241
|
+
codeChallenge: (0, import_zod.string)(),
|
|
242
|
+
codeChallengeMethod: (0, import_zod.enum)(["plain", "S256"])
|
|
243
|
+
});
|
|
244
|
+
var OAuthAuthorizationResponse = (0, import_zod.object)({
|
|
245
|
+
state: (0, import_zod.string)({ message: "Missing state parameter in the OAuth authorization response." }),
|
|
246
|
+
code: (0, import_zod.string)({ message: "Missing code parameter in the OAuth authorization response." })
|
|
247
|
+
});
|
|
248
|
+
var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
|
|
249
|
+
error: (0, import_zod.enum)([
|
|
250
|
+
"invalid_request",
|
|
251
|
+
"unauthorized_client",
|
|
252
|
+
"access_denied",
|
|
253
|
+
"unsupported_response_type",
|
|
254
|
+
"invalid_scope",
|
|
255
|
+
"server_error",
|
|
256
|
+
"temporarily_unavailable"
|
|
257
|
+
]),
|
|
258
|
+
error_description: (0, import_zod.string)().optional(),
|
|
259
|
+
error_uri: (0, import_zod.string)().optional(),
|
|
260
|
+
state: (0, import_zod.string)()
|
|
261
|
+
});
|
|
262
|
+
var OAuthAccessToken = OAuthProviderConfigSchema.extend({
|
|
263
|
+
redirectURI: (0, import_zod.string)(),
|
|
264
|
+
code: (0, import_zod.string)(),
|
|
265
|
+
codeVerifier: (0, import_zod.string)().min(43).max(128)
|
|
266
|
+
});
|
|
267
|
+
var OAuthAccessTokenResponse = (0, import_zod.object)({
|
|
268
|
+
access_token: (0, import_zod.string)(),
|
|
269
|
+
token_type: (0, import_zod.string)().optional(),
|
|
270
|
+
expires_in: (0, import_zod.number)().optional(),
|
|
271
|
+
refresh_token: (0, import_zod.string)().optional(),
|
|
272
|
+
scope: (0, import_zod.string)().optional().or((0, import_zod.null)())
|
|
273
|
+
});
|
|
274
|
+
var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
|
|
275
|
+
error: (0, import_zod.enum)([
|
|
276
|
+
"invalid_request",
|
|
277
|
+
"invalid_client",
|
|
278
|
+
"invalid_grant",
|
|
279
|
+
"unauthorized_client",
|
|
280
|
+
"unsupported_grant_type",
|
|
281
|
+
"invalid_scope"
|
|
282
|
+
]),
|
|
283
|
+
error_description: (0, import_zod.string)().optional(),
|
|
284
|
+
error_uri: (0, import_zod.string)().optional()
|
|
285
|
+
});
|
|
286
|
+
var OAuthErrorResponse = (0, import_zod.object)({
|
|
287
|
+
error: (0, import_zod.string)(),
|
|
288
|
+
error_description: (0, import_zod.string)().optional()
|
|
289
|
+
});
|
|
290
|
+
var OAuthEnvSchema = (0, import_zod.object)({
|
|
291
|
+
clientId: import_zod.z.string().min(1, "OAuth Client ID is required in the environment variables."),
|
|
292
|
+
clientSecret: import_zod.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// src/errors.ts
|
|
296
|
+
var AuthInternalError = class extends Error {
|
|
297
|
+
type = "AUTH_INTERNAL_ERROR";
|
|
298
|
+
code;
|
|
299
|
+
constructor(code, message, options2) {
|
|
300
|
+
super(message, options2);
|
|
301
|
+
this.code = code;
|
|
302
|
+
this.name = new.target.name;
|
|
303
|
+
Error.captureStackTrace(this, new.target);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// src/utils.ts
|
|
308
|
+
var import_router = require("@aura-stack/router");
|
|
309
|
+
var formatZodError = (error) => {
|
|
310
|
+
if (!error.issues || error.issues.length === 0) {
|
|
311
|
+
return {};
|
|
312
|
+
}
|
|
313
|
+
return error.issues.reduce((previous, issue) => {
|
|
314
|
+
const key = issue.path.join(".");
|
|
315
|
+
return {
|
|
316
|
+
...previous,
|
|
317
|
+
[key]: {
|
|
318
|
+
code: issue.code,
|
|
319
|
+
message: issue.message
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}, {});
|
|
323
|
+
};
|
|
166
324
|
|
|
167
325
|
// src/oauth/index.ts
|
|
168
326
|
var builtInOAuthProviders = {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
327
|
+
github,
|
|
328
|
+
bitbucket,
|
|
329
|
+
figma,
|
|
330
|
+
discord,
|
|
331
|
+
gitlab,
|
|
332
|
+
spotify,
|
|
333
|
+
x,
|
|
334
|
+
strava,
|
|
335
|
+
mailchimp,
|
|
336
|
+
pinterest
|
|
337
|
+
};
|
|
177
338
|
var defineOAuthEnvironment = (oauth) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
}
|
|
339
|
+
const env = process.env;
|
|
340
|
+
const clientIdSuffix = `${oauth.toUpperCase()}_CLIENT_ID`;
|
|
341
|
+
const clientSecretSuffix = `${oauth.toUpperCase()}_CLIENT_SECRET`;
|
|
342
|
+
const loadEnvs = OAuthEnvSchema.safeParse({
|
|
343
|
+
clientId: env[`AURA_AUTH_${clientIdSuffix}`] ?? env[`AUTH_${clientIdSuffix}`] ?? env[`${clientIdSuffix}`],
|
|
344
|
+
clientSecret: env[`AURA_AUTH_${clientSecretSuffix}`] ?? env[`AUTH_${clientSecretSuffix}`] ?? env[`${clientSecretSuffix}`]
|
|
345
|
+
});
|
|
346
|
+
if (!loadEnvs.success) {
|
|
347
|
+
const msg = JSON.stringify(formatZodError(loadEnvs.error), null, 2);
|
|
348
|
+
throw new AuthInternalError("INVALID_ENVIRONMENT_CONFIGURATION", msg);
|
|
349
|
+
}
|
|
350
|
+
return loadEnvs.data;
|
|
351
|
+
};
|
|
184
352
|
var defineOAuthProviderConfig = (config) => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
353
|
+
if (typeof config === "string") {
|
|
354
|
+
const definition = defineOAuthEnvironment(config);
|
|
355
|
+
const oauthConfig = builtInOAuthProviders[config];
|
|
356
|
+
return {
|
|
357
|
+
...oauthConfig,
|
|
358
|
+
...definition
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return config;
|
|
362
|
+
};
|
|
195
363
|
var createBuiltInOAuthProviders = (oauth = []) => {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
364
|
+
return oauth.reduce((previous, config) => {
|
|
365
|
+
const oauthConfig = defineOAuthProviderConfig(config);
|
|
366
|
+
return { ...previous, [oauthConfig.id]: oauthConfig };
|
|
367
|
+
}, {});
|
|
368
|
+
};
|
|
201
369
|
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
-
0 &&
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
370
|
+
0 && (module.exports = {
|
|
371
|
+
bitbucket,
|
|
372
|
+
builtInOAuthProviders,
|
|
373
|
+
createBuiltInOAuthProviders,
|
|
374
|
+
discord,
|
|
375
|
+
figma,
|
|
376
|
+
github,
|
|
377
|
+
gitlab,
|
|
378
|
+
mailchimp,
|
|
379
|
+
pinterest,
|
|
380
|
+
spotify,
|
|
381
|
+
strava,
|
|
382
|
+
x
|
|
383
|
+
});
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
N as Nameplate,
|
|
9
|
-
g as SpotifyProfile,
|
|
10
|
-
X as XProfile,
|
|
11
|
-
k as bitbucket,
|
|
12
|
-
n as builtInOAuthProviders,
|
|
13
|
-
o as createBuiltInOAuthProviders,
|
|
14
|
-
i as discord,
|
|
15
|
-
j as figma,
|
|
16
|
-
m as github,
|
|
17
|
-
h as gitlab,
|
|
18
|
-
s as spotify,
|
|
19
|
-
x,
|
|
20
|
-
} from "../index-DpfbvTZ_.js"
|
|
21
|
-
import "../@types/utility.js"
|
|
22
|
-
import "zod/v4"
|
|
23
|
-
import "@aura-stack/jose/jose"
|
|
24
|
-
import "../schemas.js"
|
|
25
|
-
import "zod/v4/core"
|
|
26
|
-
import "cookie"
|
|
1
|
+
export { B as BitbucketProfile, K as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, w as GitHubProfile, G as GitLabProfile, I as Image, L as Login, M as MailchimpProfile, N as Nameplate, P as PinterestProfile, o as SpotifyProfile, n as StravaProfile, k as SummaryClub, l as SummaryGear, X as XProfile, v as bitbucket, z as builtInOAuthProviders, H as createBuiltInOAuthProviders, t as discord, u as figma, y as github, r as gitlab, m as mailchimp, p as pinterest, q as spotify, s as strava, x } from '../index-DkaLJFn8.js';
|
|
2
|
+
import '../@types/utility.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '../schemas.js';
|
|
5
|
+
import '@aura-stack/router/cookie';
|
|
6
|
+
import '@aura-stack/jose';
|
|
7
|
+
import '@aura-stack/jose/jose';
|
package/dist/oauth/index.js
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import {
|
|
2
|
+
builtInOAuthProviders,
|
|
3
|
+
createBuiltInOAuthProviders
|
|
4
|
+
} from "../chunk-EMKJA2GJ.js";
|
|
5
|
+
import {
|
|
6
|
+
x
|
|
7
|
+
} from "../chunk-42XB3YCW.js";
|
|
8
|
+
import {
|
|
9
|
+
figma
|
|
10
|
+
} from "../chunk-FKRDCWBF.js";
|
|
11
|
+
import {
|
|
12
|
+
github
|
|
13
|
+
} from "../chunk-IKHPGFCW.js";
|
|
14
|
+
import {
|
|
15
|
+
gitlab
|
|
16
|
+
} from "../chunk-KRNOMBXQ.js";
|
|
17
|
+
import {
|
|
18
|
+
mailchimp
|
|
19
|
+
} from "../chunk-B737EUJV.js";
|
|
20
|
+
import {
|
|
21
|
+
pinterest
|
|
22
|
+
} from "../chunk-HP34YGGJ.js";
|
|
23
|
+
import {
|
|
24
|
+
spotify
|
|
25
|
+
} from "../chunk-E3OXBRYF.js";
|
|
26
|
+
import {
|
|
27
|
+
strava
|
|
28
|
+
} from "../chunk-6R2YZ4AC.js";
|
|
29
|
+
import {
|
|
30
|
+
bitbucket
|
|
31
|
+
} from "../chunk-FIPU4MLT.js";
|
|
32
|
+
import {
|
|
33
|
+
discord
|
|
34
|
+
} from "../chunk-IUYZQTJV.js";
|
|
35
|
+
import "../chunk-CXLATHS5.js";
|
|
36
|
+
import "../chunk-RRLIF4PQ.js";
|
|
37
|
+
import "../chunk-YRCB5FLE.js";
|
|
38
|
+
export {
|
|
39
|
+
bitbucket,
|
|
40
|
+
builtInOAuthProviders,
|
|
41
|
+
createBuiltInOAuthProviders,
|
|
42
|
+
discord,
|
|
43
|
+
figma,
|
|
44
|
+
github,
|
|
45
|
+
gitlab,
|
|
46
|
+
mailchimp,
|
|
47
|
+
pinterest,
|
|
48
|
+
spotify,
|
|
49
|
+
strava,
|
|
50
|
+
x
|
|
51
|
+
};
|