@draftlab/auth 0.15.0 → 0.15.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/adapters/node.d.mts +0 -1
- package/dist/client.d.mts +293 -287
- package/dist/client.mjs +1 -0
- package/dist/core.d.mts +22 -23
- package/dist/core.mjs +3 -3
- package/dist/error.d.mts +53 -53
- package/dist/keys.d.mts +0 -1
- package/dist/mutex.d.mts +14 -14
- package/dist/provider/apple.d.mts +34 -35
- package/dist/provider/code.d.mts +75 -85
- package/dist/provider/discord.d.mts +49 -50
- package/dist/provider/facebook.d.mts +49 -50
- package/dist/provider/github.d.mts +50 -51
- package/dist/provider/gitlab.d.mts +34 -35
- package/dist/provider/google.d.mts +49 -50
- package/dist/provider/linkedin.d.mts +47 -48
- package/dist/provider/magiclink.d.mts +28 -38
- package/dist/provider/microsoft.d.mts +67 -68
- package/dist/provider/oauth2.d.mts +75 -76
- package/dist/provider/passkey.d.mts +20 -21
- package/dist/provider/password.d.mts +174 -202
- package/dist/provider/provider.d.mts +105 -107
- package/dist/provider/reddit.d.mts +33 -34
- package/dist/provider/slack.d.mts +34 -35
- package/dist/provider/spotify.d.mts +34 -35
- package/dist/provider/totp.d.mts +43 -44
- package/dist/provider/twitch.d.mts +33 -34
- package/dist/provider/vercel.d.mts +65 -66
- package/dist/revocation.d.mts +29 -30
- package/dist/storage/memory.d.mts +11 -12
- package/dist/storage/storage.d.mts +110 -110
- package/dist/storage/turso.d.mts +0 -1
- package/dist/storage/unstorage.d.mts +0 -1
- package/dist/subject.d.mts +0 -1
- package/dist/themes/theme.d.mts +101 -101
- package/dist/toolkit/client.d.mts +56 -57
- package/dist/toolkit/providers/facebook.d.mts +0 -1
- package/dist/toolkit/providers/github.d.mts +0 -1
- package/dist/toolkit/providers/google.d.mts +0 -1
- package/dist/toolkit/storage.d.mts +8 -8
- package/dist/ui/base.d.mts +0 -1
- package/dist/ui/code.d.mts +5 -6
- package/dist/ui/form.d.mts +6 -7
- package/dist/ui/icon.d.mts +0 -1
- package/dist/ui/magiclink.d.mts +5 -6
- package/dist/ui/passkey.d.mts +0 -1
- package/dist/ui/password.d.mts +2 -3
- package/dist/ui/select.d.mts +0 -1
- package/dist/ui/totp.d.mts +0 -1
- package/dist/util.d.mts +0 -1
- package/package.json +3 -3
|
@@ -2,68 +2,67 @@ import { Provider } from "./provider.mjs";
|
|
|
2
2
|
import { Oauth2UserData, Oauth2WrappedConfig } from "./oauth2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/provider/discord.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for Discord OAuth 2.0 provider.
|
|
8
7
|
* Extends the base OAuth 2.0 configuration with Discord-specific documentation.
|
|
9
8
|
*/
|
|
10
9
|
interface DiscordConfig extends Oauth2WrappedConfig {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
* Discord OAuth 2.0 client ID from Discord Developer Portal.
|
|
12
|
+
* Found in your Discord application settings.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* {
|
|
17
|
+
* clientID: "1234567890123456789"
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
22
21
|
readonly clientID: string;
|
|
23
22
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
* Discord OAuth 2.0 client secret from Discord Developer Portal.
|
|
24
|
+
* Keep this secure and never expose it to client-side code.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* {
|
|
29
|
+
* clientSecret: process.env.DISCORD_CLIENT_SECRET
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
34
33
|
readonly clientSecret: string;
|
|
35
34
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
* Discord OAuth scopes to request access for.
|
|
36
|
+
* Determines what data and actions your app can access.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* {
|
|
41
|
+
* scopes: [
|
|
42
|
+
* "identify", // Basic user information
|
|
43
|
+
* "email", // Email address
|
|
44
|
+
* "guilds", // User's Discord servers
|
|
45
|
+
* "connections" // Connected accounts (Steam, etc.)
|
|
46
|
+
* ]
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
51
50
|
readonly scopes: string[];
|
|
52
51
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
* Additional query parameters for Discord OAuth authorization.
|
|
53
|
+
* Useful for Discord-specific options like permissions.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* {
|
|
58
|
+
* query: {
|
|
59
|
+
* permissions: "8", // Administrator permission
|
|
60
|
+
* guild_id: "123456789", // Pre-select specific guild
|
|
61
|
+
* disable_guild_select: "true" // Disable guild selection
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
67
66
|
readonly query?: Record<string, string>;
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
@@ -2,68 +2,67 @@ import { Provider } from "./provider.mjs";
|
|
|
2
2
|
import { Oauth2UserData, Oauth2WrappedConfig } from "./oauth2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/provider/facebook.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for Facebook OAuth 2.0 provider.
|
|
8
7
|
* Extends the base OAuth 2.0 configuration with Facebook-specific documentation.
|
|
9
8
|
*/
|
|
10
9
|
interface FacebookConfig extends Oauth2WrappedConfig {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
* Facebook App ID from your Facebook App Dashboard.
|
|
12
|
+
* This is the public identifier for your Facebook application.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* {
|
|
17
|
+
* clientID: "1234567890123456"
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
22
21
|
readonly clientID: string;
|
|
23
22
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
* Facebook App Secret from your Facebook App Dashboard.
|
|
24
|
+
* Keep this secure and never expose it to client-side code.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* {
|
|
29
|
+
* clientSecret: process.env.FACEBOOK_APP_SECRET
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
34
33
|
readonly clientSecret: string;
|
|
35
34
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
* Facebook permissions to request during login.
|
|
36
|
+
* Determines what data your app can access from the user's Facebook account.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* {
|
|
41
|
+
* scopes: [
|
|
42
|
+
* "email", // User's email address
|
|
43
|
+
* "public_profile", // Basic profile info
|
|
44
|
+
* "user_friends", // User's friends list
|
|
45
|
+
* "user_posts" // User's timeline posts
|
|
46
|
+
* ]
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
51
50
|
readonly scopes: string[];
|
|
52
51
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
* Additional query parameters for Facebook OAuth authorization.
|
|
53
|
+
* Useful for Facebook-specific options like response type or display mode.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* {
|
|
58
|
+
* query: {
|
|
59
|
+
* display: "popup", // Show login in popup
|
|
60
|
+
* auth_type: "rerequest", // Force permission re-request
|
|
61
|
+
* state: "custom-state" // Custom state parameter
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
67
66
|
readonly query?: Record<string, string>;
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
@@ -2,69 +2,68 @@ import { Provider } from "./provider.mjs";
|
|
|
2
2
|
import { Oauth2UserData, Oauth2WrappedConfig } from "./oauth2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/provider/github.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for GitHub OAuth 2.0 provider.
|
|
8
7
|
* Extends the base OAuth 2.0 configuration with GitHub-specific documentation.
|
|
9
8
|
*/
|
|
10
9
|
interface GithubConfig extends Oauth2WrappedConfig {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
* GitHub OAuth App client ID or GitHub App client ID.
|
|
12
|
+
* Found in your GitHub App settings or OAuth App settings.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* {
|
|
17
|
+
* clientID: "Iv1.a629723000043722" // OAuth App
|
|
18
|
+
* // or
|
|
19
|
+
* clientID: "Iv23liAG5t7VwMkUsKTi" // GitHub App
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
24
23
|
readonly clientID: string;
|
|
25
24
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
* GitHub OAuth App client secret or GitHub App client secret.
|
|
26
|
+
* Keep this secure and never expose it to client-side code.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* {
|
|
31
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
36
35
|
readonly clientSecret: string;
|
|
37
36
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
* GitHub OAuth scopes to request access for.
|
|
38
|
+
* Determines what data and actions your app can access.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* {
|
|
43
|
+
* scopes: [
|
|
44
|
+
* "user:email", // Access user email addresses
|
|
45
|
+
* "read:user", // Read user profile info
|
|
46
|
+
* "public_repo", // Access public repositories
|
|
47
|
+
* "read:org" // Read organization membership
|
|
48
|
+
* ]
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
53
52
|
readonly scopes: string[];
|
|
54
53
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
* Additional query parameters for GitHub OAuth authorization.
|
|
55
|
+
* Useful for GitHub-specific options like restricting to organizations.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* {
|
|
60
|
+
* query: {
|
|
61
|
+
* allow_signup: "false", // Disable new account creation
|
|
62
|
+
* login: "suggested-username" // Pre-fill username field
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
68
67
|
readonly query?: Record<string, string>;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
@@ -2,51 +2,50 @@ import { Provider } from "./provider.mjs";
|
|
|
2
2
|
import { Oauth2UserData, Oauth2WrappedConfig } from "./oauth2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/provider/gitlab.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for GitLab OAuth 2.0 provider.
|
|
8
7
|
* Extends the base OAuth 2.0 configuration with GitLab-specific documentation.
|
|
9
8
|
*/
|
|
10
9
|
interface GitlabConfig extends Oauth2WrappedConfig {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
* GitLab application client ID.
|
|
12
|
+
* Get this from your GitLab application settings.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* {
|
|
17
|
+
* clientID: "abcdef123456"
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
22
21
|
readonly clientID: string;
|
|
23
22
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
* GitLab application client secret.
|
|
24
|
+
* Keep this secure and never expose it to client-side code.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* {
|
|
29
|
+
* clientSecret: process.env.GITLAB_CLIENT_SECRET
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
34
33
|
readonly clientSecret: string;
|
|
35
34
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
* GitLab OAuth scopes to request access for.
|
|
36
|
+
* Determines what data and actions your app can access.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* {
|
|
41
|
+
* scopes: [
|
|
42
|
+
* "read_user", // Access user profile
|
|
43
|
+
* "read_api", // Read-access to API
|
|
44
|
+
* "read_repository" // Access repositories
|
|
45
|
+
* ]
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
50
49
|
readonly scopes: string[];
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
@@ -2,68 +2,67 @@ import { Provider } from "./provider.mjs";
|
|
|
2
2
|
import { Oauth2UserData, Oauth2WrappedConfig } from "./oauth2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/provider/google.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for Google OAuth 2.0 provider.
|
|
8
7
|
* Extends the base OAuth 2.0 configuration with Google-specific defaults.
|
|
9
8
|
*/
|
|
10
9
|
interface GoogleConfig extends Oauth2WrappedConfig {
|
|
11
10
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
* Google OAuth 2.0 client ID from Google Cloud Console.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* {
|
|
16
|
+
* clientID: "123456789-abc123.apps.googleusercontent.com"
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
21
20
|
readonly clientID: string;
|
|
22
21
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
* Google OAuth 2.0 client secret from Google Cloud Console.
|
|
23
|
+
* Required for server-side OAuth 2.0 flows.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* {
|
|
28
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
33
32
|
readonly clientSecret: string;
|
|
34
33
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
* Google OAuth 2.0 scopes to request.
|
|
35
|
+
* Common scopes include 'profile', 'email', and specific Google API scopes.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* {
|
|
40
|
+
* scopes: [
|
|
41
|
+
* "profile",
|
|
42
|
+
* "email",
|
|
43
|
+
* "https://www.googleapis.com/auth/calendar.readonly",
|
|
44
|
+
* "https://www.googleapis.com/auth/drive.file"
|
|
45
|
+
* ]
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
50
49
|
readonly scopes: string[];
|
|
51
50
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
* Additional query parameters for Google OAuth 2.0.
|
|
52
|
+
* Useful for Google-specific options like hosted domain restrictions.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* {
|
|
57
|
+
* query: {
|
|
58
|
+
* hd: "mycompany.com", // Restrict to Google Workspace domain
|
|
59
|
+
* access_type: "offline", // Request refresh token
|
|
60
|
+
* prompt: "consent", // Force consent screen
|
|
61
|
+
* include_granted_scopes: "true" // Incremental authorization
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
67
66
|
readonly query?: Record<string, string>;
|
|
68
67
|
}
|
|
69
68
|
/**
|