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