@draftlab/auth 0.15.0 → 0.16.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.
Files changed (272) hide show
  1. package/dist/esm/allow.js +26 -0
  2. package/dist/esm/client.js +254 -0
  3. package/dist/esm/core.js +597 -0
  4. package/dist/esm/css.d.js +0 -0
  5. package/dist/esm/error.js +88 -0
  6. package/dist/esm/index.js +5 -0
  7. package/dist/esm/keys.js +126 -0
  8. package/dist/esm/mutex.js +53 -0
  9. package/dist/esm/pkce.js +87 -0
  10. package/dist/esm/provider/apple.js +15 -0
  11. package/dist/esm/provider/code.js +62 -0
  12. package/dist/esm/provider/discord.js +15 -0
  13. package/dist/esm/provider/facebook.js +15 -0
  14. package/dist/esm/provider/github.js +15 -0
  15. package/dist/esm/provider/gitlab.js +15 -0
  16. package/dist/esm/provider/google.js +16 -0
  17. package/dist/esm/provider/linkedin.js +15 -0
  18. package/dist/esm/provider/magiclink.js +83 -0
  19. package/dist/esm/provider/microsoft.js +15 -0
  20. package/dist/esm/provider/oauth2.js +130 -0
  21. package/dist/esm/provider/password.js +331 -0
  22. package/dist/esm/provider/provider.js +18 -0
  23. package/dist/esm/provider/reddit.js +15 -0
  24. package/dist/esm/provider/slack.js +15 -0
  25. package/dist/esm/provider/spotify.js +15 -0
  26. package/dist/esm/provider/twitch.js +15 -0
  27. package/dist/esm/provider/vercel.js +17 -0
  28. package/dist/esm/random.js +40 -0
  29. package/dist/esm/revocation.js +27 -0
  30. package/dist/esm/storage/memory.js +110 -0
  31. package/dist/esm/storage/storage.js +56 -0
  32. package/dist/esm/storage/turso.js +93 -0
  33. package/dist/esm/storage/unstorage.js +78 -0
  34. package/dist/esm/subject.js +7 -0
  35. package/dist/esm/themes/theme.js +115 -0
  36. package/dist/esm/toolkit/client.js +119 -0
  37. package/dist/esm/toolkit/index.js +25 -0
  38. package/dist/esm/toolkit/providers/facebook.js +11 -0
  39. package/dist/esm/toolkit/providers/github.js +11 -0
  40. package/dist/esm/toolkit/providers/google.js +11 -0
  41. package/dist/esm/toolkit/providers/strategy.js +0 -0
  42. package/dist/esm/toolkit/storage.js +81 -0
  43. package/dist/esm/toolkit/utils.js +18 -0
  44. package/dist/esm/types.js +0 -0
  45. package/dist/esm/ui/base.js +478 -0
  46. package/dist/esm/ui/code.js +186 -0
  47. package/dist/esm/ui/form.js +46 -0
  48. package/dist/esm/ui/icon.js +242 -0
  49. package/dist/esm/ui/magiclink.js +158 -0
  50. package/dist/esm/ui/password.js +435 -0
  51. package/dist/esm/ui/select.js +102 -0
  52. package/dist/esm/util.js +59 -0
  53. package/dist/{allow.d.mts → types/allow.d.ts} +9 -11
  54. package/dist/types/allow.d.ts.map +1 -0
  55. package/dist/types/client.d.ts +462 -0
  56. package/dist/types/client.d.ts.map +1 -0
  57. package/dist/types/core.d.ts +113 -0
  58. package/dist/types/core.d.ts.map +1 -0
  59. package/dist/{error.d.mts → types/error.d.ts} +95 -97
  60. package/dist/types/error.d.ts.map +1 -0
  61. package/dist/types/index.d.ts +2 -0
  62. package/dist/types/index.d.ts.map +1 -0
  63. package/dist/{keys.d.mts → types/keys.d.ts} +20 -24
  64. package/dist/types/keys.d.ts.map +1 -0
  65. package/dist/types/mutex.d.ts +42 -0
  66. package/dist/types/mutex.d.ts.map +1 -0
  67. package/dist/{pkce.d.mts → types/pkce.d.ts} +10 -11
  68. package/dist/types/pkce.d.ts.map +1 -0
  69. package/dist/types/provider/apple.d.ts +197 -0
  70. package/dist/types/provider/apple.d.ts.map +1 -0
  71. package/dist/types/provider/code.d.ts +288 -0
  72. package/dist/types/provider/code.d.ts.map +1 -0
  73. package/dist/types/provider/discord.d.ts +206 -0
  74. package/dist/types/provider/discord.d.ts.map +1 -0
  75. package/dist/types/provider/facebook.d.ts +200 -0
  76. package/dist/types/provider/facebook.d.ts.map +1 -0
  77. package/dist/types/provider/github.d.ts +220 -0
  78. package/dist/types/provider/github.d.ts.map +1 -0
  79. package/dist/types/provider/gitlab.d.ts +180 -0
  80. package/dist/types/provider/gitlab.d.ts.map +1 -0
  81. package/dist/types/provider/google.d.ts +158 -0
  82. package/dist/types/provider/google.d.ts.map +1 -0
  83. package/dist/types/provider/linkedin.d.ts +190 -0
  84. package/dist/types/provider/linkedin.d.ts.map +1 -0
  85. package/dist/types/provider/magiclink.d.ts +141 -0
  86. package/dist/types/provider/magiclink.d.ts.map +1 -0
  87. package/dist/types/provider/microsoft.d.ts +247 -0
  88. package/dist/types/provider/microsoft.d.ts.map +1 -0
  89. package/dist/types/provider/oauth2.d.ts +229 -0
  90. package/dist/types/provider/oauth2.d.ts.map +1 -0
  91. package/dist/types/provider/password.d.ts +408 -0
  92. package/dist/types/provider/password.d.ts.map +1 -0
  93. package/dist/types/provider/provider.d.ts +226 -0
  94. package/dist/types/provider/provider.d.ts.map +1 -0
  95. package/dist/types/provider/reddit.d.ts +159 -0
  96. package/dist/types/provider/reddit.d.ts.map +1 -0
  97. package/dist/types/provider/slack.d.ts +171 -0
  98. package/dist/types/provider/slack.d.ts.map +1 -0
  99. package/dist/types/provider/spotify.d.ts +168 -0
  100. package/dist/types/provider/spotify.d.ts.map +1 -0
  101. package/dist/types/provider/twitch.d.ts +163 -0
  102. package/dist/types/provider/twitch.d.ts.map +1 -0
  103. package/dist/types/provider/vercel.d.ts +294 -0
  104. package/dist/types/provider/vercel.d.ts.map +1 -0
  105. package/dist/{random.d.mts → types/random.d.ts} +4 -6
  106. package/dist/types/random.d.ts.map +1 -0
  107. package/dist/types/revocation.d.ts +76 -0
  108. package/dist/types/revocation.d.ts.map +1 -0
  109. package/dist/{storage/memory.d.mts → types/storage/memory.d.ts} +17 -21
  110. package/dist/types/storage/memory.d.ts.map +1 -0
  111. package/dist/types/storage/storage.d.ts +177 -0
  112. package/dist/types/storage/storage.d.ts.map +1 -0
  113. package/dist/{storage/turso.d.mts → types/storage/turso.d.ts} +4 -8
  114. package/dist/types/storage/turso.d.ts.map +1 -0
  115. package/dist/{storage/unstorage.d.mts → types/storage/unstorage.d.ts} +12 -11
  116. package/dist/types/storage/unstorage.d.ts.map +1 -0
  117. package/dist/types/subject.d.ts +115 -0
  118. package/dist/types/subject.d.ts.map +1 -0
  119. package/dist/types/themes/theme.d.ts +207 -0
  120. package/dist/types/themes/theme.d.ts.map +1 -0
  121. package/dist/types/toolkit/client.d.ts +235 -0
  122. package/dist/types/toolkit/client.d.ts.map +1 -0
  123. package/dist/types/toolkit/index.d.ts +45 -0
  124. package/dist/types/toolkit/index.d.ts.map +1 -0
  125. package/dist/types/toolkit/providers/facebook.d.ts +8 -0
  126. package/dist/types/toolkit/providers/facebook.d.ts.map +1 -0
  127. package/dist/types/toolkit/providers/github.d.ts +8 -0
  128. package/dist/types/toolkit/providers/github.d.ts.map +1 -0
  129. package/dist/types/toolkit/providers/google.d.ts +8 -0
  130. package/dist/types/toolkit/providers/google.d.ts.map +1 -0
  131. package/dist/types/toolkit/providers/strategy.d.ts +38 -0
  132. package/dist/types/toolkit/providers/strategy.d.ts.map +1 -0
  133. package/dist/{toolkit/storage.d.mts → types/toolkit/storage.d.ts} +37 -39
  134. package/dist/types/toolkit/storage.d.ts.map +1 -0
  135. package/dist/{toolkit/utils.d.mts → types/toolkit/utils.d.ts} +2 -4
  136. package/dist/types/toolkit/utils.d.ts.map +1 -0
  137. package/dist/types/types.d.ts +92 -0
  138. package/dist/types/types.d.ts.map +1 -0
  139. package/dist/types/ui/base.d.ts +18 -0
  140. package/dist/types/ui/base.d.ts.map +1 -0
  141. package/dist/types/ui/code.d.ts +43 -0
  142. package/dist/types/ui/code.d.ts.map +1 -0
  143. package/dist/types/ui/form.d.ts +24 -0
  144. package/dist/types/ui/form.d.ts.map +1 -0
  145. package/dist/types/ui/icon.d.ts +60 -0
  146. package/dist/types/ui/icon.d.ts.map +1 -0
  147. package/dist/types/ui/magiclink.d.ts +41 -0
  148. package/dist/types/ui/magiclink.d.ts.map +1 -0
  149. package/dist/types/ui/password.d.ts +43 -0
  150. package/dist/types/ui/password.d.ts.map +1 -0
  151. package/dist/types/ui/select.d.ts +33 -0
  152. package/dist/types/ui/select.d.ts.map +1 -0
  153. package/dist/{util.d.mts → types/util.d.ts} +11 -13
  154. package/dist/types/util.d.ts.map +1 -0
  155. package/package.json +10 -16
  156. package/dist/adapters/node.d.mts +0 -18
  157. package/dist/adapters/node.mjs +0 -69
  158. package/dist/allow.mjs +0 -63
  159. package/dist/client.d.mts +0 -456
  160. package/dist/client.mjs +0 -283
  161. package/dist/core.d.mts +0 -110
  162. package/dist/core.mjs +0 -595
  163. package/dist/error.mjs +0 -237
  164. package/dist/index.d.mts +0 -2
  165. package/dist/index.mjs +0 -3
  166. package/dist/keys.mjs +0 -146
  167. package/dist/mutex.d.mts +0 -44
  168. package/dist/mutex.mjs +0 -110
  169. package/dist/pkce.mjs +0 -157
  170. package/dist/provider/apple.d.mts +0 -111
  171. package/dist/provider/apple.mjs +0 -164
  172. package/dist/provider/code.d.mts +0 -228
  173. package/dist/provider/code.mjs +0 -246
  174. package/dist/provider/discord.d.mts +0 -146
  175. package/dist/provider/discord.mjs +0 -156
  176. package/dist/provider/facebook.d.mts +0 -142
  177. package/dist/provider/facebook.mjs +0 -150
  178. package/dist/provider/github.d.mts +0 -140
  179. package/dist/provider/github.mjs +0 -169
  180. package/dist/provider/gitlab.d.mts +0 -106
  181. package/dist/provider/gitlab.mjs +0 -147
  182. package/dist/provider/google.d.mts +0 -112
  183. package/dist/provider/google.mjs +0 -109
  184. package/dist/provider/linkedin.d.mts +0 -132
  185. package/dist/provider/linkedin.mjs +0 -142
  186. package/dist/provider/magiclink.d.mts +0 -89
  187. package/dist/provider/magiclink.mjs +0 -143
  188. package/dist/provider/microsoft.d.mts +0 -178
  189. package/dist/provider/microsoft.mjs +0 -177
  190. package/dist/provider/oauth2.d.mts +0 -176
  191. package/dist/provider/oauth2.mjs +0 -222
  192. package/dist/provider/passkey.d.mts +0 -104
  193. package/dist/provider/passkey.mjs +0 -320
  194. package/dist/provider/password.d.mts +0 -412
  195. package/dist/provider/password.mjs +0 -363
  196. package/dist/provider/provider.d.mts +0 -227
  197. package/dist/provider/provider.mjs +0 -44
  198. package/dist/provider/reddit.d.mts +0 -107
  199. package/dist/provider/reddit.mjs +0 -127
  200. package/dist/provider/slack.d.mts +0 -114
  201. package/dist/provider/slack.mjs +0 -138
  202. package/dist/provider/spotify.d.mts +0 -113
  203. package/dist/provider/spotify.mjs +0 -135
  204. package/dist/provider/totp.d.mts +0 -112
  205. package/dist/provider/totp.mjs +0 -191
  206. package/dist/provider/twitch.d.mts +0 -108
  207. package/dist/provider/twitch.mjs +0 -131
  208. package/dist/provider/vercel.d.mts +0 -177
  209. package/dist/provider/vercel.mjs +0 -230
  210. package/dist/random.mjs +0 -86
  211. package/dist/revocation.d.mts +0 -55
  212. package/dist/revocation.mjs +0 -63
  213. package/dist/router/context.d.mts +0 -21
  214. package/dist/router/context.mjs +0 -193
  215. package/dist/router/cookies.d.mts +0 -8
  216. package/dist/router/cookies.mjs +0 -13
  217. package/dist/router/index.d.mts +0 -21
  218. package/dist/router/index.mjs +0 -107
  219. package/dist/router/matcher.d.mts +0 -15
  220. package/dist/router/matcher.mjs +0 -76
  221. package/dist/router/middleware/cors.d.mts +0 -15
  222. package/dist/router/middleware/cors.mjs +0 -114
  223. package/dist/router/safe-request.d.mts +0 -52
  224. package/dist/router/safe-request.mjs +0 -160
  225. package/dist/router/types.d.mts +0 -67
  226. package/dist/router/types.mjs +0 -1
  227. package/dist/router/variables.d.mts +0 -12
  228. package/dist/router/variables.mjs +0 -20
  229. package/dist/storage/memory.mjs +0 -125
  230. package/dist/storage/storage.d.mts +0 -179
  231. package/dist/storage/storage.mjs +0 -104
  232. package/dist/storage/turso.mjs +0 -117
  233. package/dist/storage/unstorage.mjs +0 -103
  234. package/dist/subject.d.mts +0 -62
  235. package/dist/subject.mjs +0 -36
  236. package/dist/themes/theme.d.mts +0 -209
  237. package/dist/themes/theme.mjs +0 -120
  238. package/dist/toolkit/client.d.mts +0 -169
  239. package/dist/toolkit/client.mjs +0 -209
  240. package/dist/toolkit/index.d.mts +0 -9
  241. package/dist/toolkit/index.mjs +0 -9
  242. package/dist/toolkit/providers/facebook.d.mts +0 -12
  243. package/dist/toolkit/providers/facebook.mjs +0 -16
  244. package/dist/toolkit/providers/github.d.mts +0 -12
  245. package/dist/toolkit/providers/github.mjs +0 -16
  246. package/dist/toolkit/providers/google.d.mts +0 -12
  247. package/dist/toolkit/providers/google.mjs +0 -20
  248. package/dist/toolkit/providers/strategy.d.mts +0 -40
  249. package/dist/toolkit/providers/strategy.mjs +0 -1
  250. package/dist/toolkit/storage.mjs +0 -157
  251. package/dist/toolkit/utils.mjs +0 -30
  252. package/dist/types.d.mts +0 -94
  253. package/dist/types.mjs +0 -1
  254. package/dist/ui/base.d.mts +0 -30
  255. package/dist/ui/base.mjs +0 -407
  256. package/dist/ui/code.d.mts +0 -43
  257. package/dist/ui/code.mjs +0 -173
  258. package/dist/ui/form.d.mts +0 -32
  259. package/dist/ui/form.mjs +0 -49
  260. package/dist/ui/icon.d.mts +0 -58
  261. package/dist/ui/icon.mjs +0 -247
  262. package/dist/ui/magiclink.d.mts +0 -41
  263. package/dist/ui/magiclink.mjs +0 -152
  264. package/dist/ui/passkey.d.mts +0 -27
  265. package/dist/ui/passkey.mjs +0 -323
  266. package/dist/ui/password.d.mts +0 -42
  267. package/dist/ui/password.mjs +0 -402
  268. package/dist/ui/select.d.mts +0 -34
  269. package/dist/ui/select.mjs +0 -98
  270. package/dist/ui/totp.d.mts +0 -34
  271. package/dist/ui/totp.mjs +0 -270
  272. package/dist/util.mjs +0 -128
@@ -0,0 +1,229 @@
1
+ /**
2
+ * OAuth 2.0 authentication provider for Draft Auth.
3
+ * Implements the Authorization Code Grant flow with optional PKCE support.
4
+ *
5
+ * ## Quick Setup
6
+ *
7
+ * ```ts
8
+ * import { Oauth2Provider } from "@draftlab/auth/provider/oauth2"
9
+ *
10
+ * export default issuer({
11
+ * providers: {
12
+ * github: Oauth2Provider({
13
+ * clientID: process.env.GITHUB_CLIENT_ID,
14
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET,
15
+ * endpoint: {
16
+ * authorization: "https://github.com/login/oauth/authorize",
17
+ * token: "https://github.com/login/oauth/access_token"
18
+ * },
19
+ * scopes: ["user:email", "read:user"]
20
+ * }),
21
+ * discord: Oauth2Provider({
22
+ * clientID: process.env.DISCORD_CLIENT_ID,
23
+ * clientSecret: process.env.DISCORD_CLIENT_SECRET,
24
+ * endpoint: {
25
+ * authorization: "https://discord.com/api/oauth2/authorize",
26
+ * token: "https://discord.com/api/oauth2/token"
27
+ * },
28
+ * scopes: ["identify", "email"],
29
+ * pkce: true // Required by some providers
30
+ * })
31
+ * }
32
+ * })
33
+ * ```
34
+ *
35
+ * ## Features
36
+ *
37
+ * - **Authorization Code Grant**: Secure server-side OAuth 2.0 flow
38
+ * - **PKCE Support**: Optional Proof Key for Code Exchange for enhanced security
39
+ * - **Flexible Endpoints**: Configure custom authorization and token endpoints
40
+ * - **Custom Parameters**: Support for provider-specific authorization parameters
41
+ *
42
+ * ## User Data
43
+ *
44
+ * The provider returns access tokens:
45
+ *
46
+ * ```ts
47
+ * success: async (ctx, value) => {
48
+ * if (value.provider === "oauth2") {
49
+ * // Access token for API calls: value.tokenset.access
50
+ * // Refresh token (if provided): value.tokenset.refresh
51
+ * // Client ID used: value.clientID
52
+ * }
53
+ * }
54
+ * ```
55
+ *
56
+ * @packageDocumentation
57
+ */
58
+ import type { Provider } from "./provider";
59
+ /**
60
+ * Configuration options for the OAuth 2.0 provider.
61
+ */
62
+ export interface Oauth2Config {
63
+ /**
64
+ * Provider type identifier for internal use.
65
+ * @internal
66
+ * @default "oauth2"
67
+ */
68
+ readonly type?: string;
69
+ /**
70
+ * The client ID registered with the OAuth 2.0 provider.
71
+ * This public identifier is used in authorization requests.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * {
76
+ * clientID: "github-app-12345"
77
+ * }
78
+ * ```
79
+ */
80
+ readonly clientID: string;
81
+ /**
82
+ * The client secret for authenticating with the OAuth 2.0 provider.
83
+ * This private credential must be kept secure and not exposed to clients.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * {
88
+ * clientSecret: process.env.OAUTH_CLIENT_SECRET
89
+ * }
90
+ * ```
91
+ */
92
+ readonly clientSecret: string;
93
+ /**
94
+ * OAuth 2.0 endpoint URLs for the authorization and token flows.
95
+ */
96
+ readonly endpoint: {
97
+ /**
98
+ * The authorization endpoint where users are redirected for authentication.
99
+ *
100
+ * @example "https://github.com/login/oauth/authorize"
101
+ */
102
+ readonly authorization: string;
103
+ /**
104
+ * The token endpoint for exchanging authorization codes for access tokens.
105
+ *
106
+ * @example "https://github.com/login/oauth/access_token"
107
+ */
108
+ readonly token: string;
109
+ /**
110
+ * Optional JWKS endpoint for verifying ID tokens.
111
+ * Required only if the provider returns ID tokens that need verification.
112
+ *
113
+ * @example "https://provider.com/.well-known/jwks.json"
114
+ */
115
+ readonly jwks?: string;
116
+ };
117
+ /**
118
+ * OAuth 2.0 scopes to request during authorization.
119
+ * Scopes define the level of access being requested.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * {
124
+ * scopes: ["user:email", "read:user", "repo"]
125
+ * }
126
+ * ```
127
+ */
128
+ readonly scopes: string[];
129
+ /**
130
+ * Whether to use PKCE (Proof Key for Code Exchange) for enhanced security.
131
+ * Recommended for public clients and required by some providers.
132
+ *
133
+ * @default false
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * {
138
+ * pkce: true // Required for Twitter/X, recommended for mobile apps
139
+ * }
140
+ * ```
141
+ */
142
+ readonly pkce?: boolean;
143
+ /**
144
+ * Additional query parameters to include in the authorization request.
145
+ * Useful for provider-specific parameters or customizing the auth flow.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * {
150
+ * query: {
151
+ * access_type: "offline", // Request refresh token
152
+ * prompt: "consent", // Force consent screen
153
+ * hd: "mycompany.com" // Google Workspace domain
154
+ * }
155
+ * }
156
+ * ```
157
+ */
158
+ readonly query?: Record<string, string>;
159
+ }
160
+ /**
161
+ * OAuth 2.0 configuration without endpoint-specific fields.
162
+ * Used internally for provider wrapping.
163
+ * @internal
164
+ */
165
+ export type Oauth2WrappedConfig = Omit<Oauth2Config, "endpoint" | "name">;
166
+ /**
167
+ * OAuth 2.0 token response containing access tokens and metadata.
168
+ * Provides a structured interface for token data with lazy property access.
169
+ * @internal
170
+ */
171
+ export interface Oauth2Token {
172
+ /** Access token for making authenticated API requests */
173
+ readonly access: string;
174
+ /** Refresh token for obtaining new access tokens (if provided) */
175
+ readonly refresh: string;
176
+ /** Token expiration time in seconds (if provided) */
177
+ readonly expiry: number;
178
+ /** Raw token response from the provider */
179
+ readonly raw: Record<string, unknown>;
180
+ }
181
+ /**
182
+ * User data returned by successful OAuth 2.0 authentication.
183
+ */
184
+ export interface Oauth2UserData {
185
+ /** Token set containing access token, refresh token, and metadata */
186
+ readonly tokenset: Oauth2Token;
187
+ /** Client ID used for this authentication */
188
+ readonly clientID: string;
189
+ }
190
+ /**
191
+ * Creates an OAuth 2.0 authentication provider.
192
+ * Implements the Authorization Code Grant flow with optional PKCE support.
193
+ *
194
+ * @param config - OAuth 2.0 provider configuration
195
+ * @returns Provider instance implementing OAuth 2.0 authentication
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * // GitHub provider with basic configuration
200
+ * const githubProvider = Oauth2Provider({
201
+ * clientID: process.env.GITHUB_CLIENT_ID,
202
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET,
203
+ * endpoint: {
204
+ * authorization: "https://github.com/login/oauth/authorize",
205
+ * token: "https://github.com/login/oauth/access_token"
206
+ * },
207
+ * scopes: ["user:email", "read:user"]
208
+ * })
209
+ *
210
+ * // Provider with PKCE and custom parameters
211
+ * const customProvider = Oauth2Provider({
212
+ * clientID: "my-client-id",
213
+ * clientSecret: "my-client-secret",
214
+ * endpoint: {
215
+ * authorization: "https://provider.com/oauth/authorize",
216
+ * token: "https://provider.com/oauth/token",
217
+ * jwks: "https://provider.com/.well-known/jwks.json"
218
+ * },
219
+ * scopes: ["read", "write"],
220
+ * pkce: true,
221
+ * query: {
222
+ * prompt: "consent",
223
+ * access_type: "offline"
224
+ * }
225
+ * })
226
+ * ```
227
+ */
228
+ export declare const Oauth2Provider: (config: Oauth2Config) => Provider<Oauth2UserData>;
229
+ //# sourceMappingURL=oauth2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../src/provider/oauth2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAQH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE;QAClB;;;;WAIG;QACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;QAE9B;;;;WAIG;QACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QAEtB;;;;;WAKG;QACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;IAEzB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IAEvB;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,CAAC,CAAA;AAEzE;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAoCD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,YAAY,KAAG,QAAQ,CAAC,cAAc,CA2M5E,CAAA"}
@@ -0,0 +1,408 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import type { Provider } from "./provider";
3
+ /**
4
+ * Password-based authentication provider for Draft Auth.
5
+ * Supports user registration, login, and password changes with email verification.
6
+ *
7
+ * ## Quick Setup
8
+ *
9
+ * ```ts
10
+ * import { PasswordUI } from "@draftlab/auth/ui/password"
11
+ * import { PasswordProvider } from "@draftlab/auth/provider/password"
12
+ *
13
+ * export default issuer({
14
+ * providers: {
15
+ * password: PasswordProvider(
16
+ * PasswordUI({
17
+ * copy: {
18
+ * error_email_taken: "This email is already taken."
19
+ * },
20
+ * sendCode: async (email, code) => {
21
+ * await sendEmail(email, `Your verification code: ${code}`)
22
+ * }
23
+ * })
24
+ * )
25
+ * }
26
+ * })
27
+ * ```
28
+ *
29
+ * ## Custom UI Implementation
30
+ *
31
+ * For full control over the user interface, implement the handlers directly:
32
+ *
33
+ * ```ts
34
+ * PasswordProvider({
35
+ * login: async (req, form, error) => {
36
+ * return new Response(renderLoginPage(form, error))
37
+ * },
38
+ * register: async (req, state, form, error) => {
39
+ * return new Response(renderRegisterPage(state, form, error))
40
+ * },
41
+ * change: async (req, state, form, error) => {
42
+ * return new Response(renderChangePage(state, form, error))
43
+ * },
44
+ * sendCode: async (email, code) => {
45
+ * await yourEmailService.send(email, code)
46
+ * }
47
+ * })
48
+ * ```
49
+ *
50
+ * ## Features
51
+ *
52
+ * - **Email verification**: Secure registration with email confirmation codes
53
+ * - **Password hashing**: Built-in Scrypt and PBKDF2 support with secure defaults
54
+ * - **Password validation**: Configurable password strength requirements
55
+ * - **Password reset**: Secure password change flow with email verification
56
+ * - **Session management**: Automatic invalidation on password changes
57
+ *
58
+ * @packageDocumentation
59
+ */
60
+ /**
61
+ * Password hashing interface for secure password storage.
62
+ * Implement this interface to use custom password hashing algorithms.
63
+ *
64
+ * @template T - The hash storage format (usually an object with hash, salt, and params)
65
+ * @internal
66
+ */
67
+ export interface PasswordHasher<T> {
68
+ /**
69
+ * Hashes a plaintext password for secure storage.
70
+ *
71
+ * @param password - The plaintext password to hash
72
+ * @returns Promise resolving to the hash data structure
73
+ */
74
+ hash(password: string): Promise<T>;
75
+ /**
76
+ * Verifies a plaintext password against a stored hash.
77
+ *
78
+ * @param password - The plaintext password to verify
79
+ * @param compare - The stored hash data to compare against
80
+ * @returns Promise resolving to true if password matches
81
+ */
82
+ verify(password: string, compare: T): Promise<boolean>;
83
+ }
84
+ /**
85
+ * Configuration for the password authentication provider.
86
+ */
87
+ export interface PasswordConfig {
88
+ /**
89
+ * Length of verification codes sent to users.
90
+ * @internal
91
+ * @default 6
92
+ */
93
+ readonly length?: number;
94
+ /**
95
+ * Password hashing implementation to use.
96
+ * @internal
97
+ * @default ScryptHasher()
98
+ */
99
+ readonly hasher?: PasswordHasher<unknown>;
100
+ /**
101
+ * Request handler for rendering the login screen.
102
+ * Receives the request, optional form data, and any login errors.
103
+ *
104
+ * @param req - The HTTP request object
105
+ * @param form - Form data from POST requests (if any)
106
+ * @param error - Login error to display (if any)
107
+ * @returns Promise resolving to the login page response
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * login: async (req, form, error) => {
112
+ * const html = renderLoginPage({
113
+ * email: form?.get('email'),
114
+ * error: error?.type
115
+ * })
116
+ * return new Response(html, {
117
+ * headers: { 'Content-Type': 'text/html' }
118
+ * })
119
+ * }
120
+ * ```
121
+ */
122
+ login: (req: Request, form?: FormData, error?: PasswordLoginError) => Promise<Response>;
123
+ /**
124
+ * Request handler for rendering the registration screen.
125
+ * Handles both initial registration form and email verification.
126
+ *
127
+ * @param req - The HTTP request object
128
+ * @param state - Current registration state (start or code verification)
129
+ * @param form - Form data from POST requests (if any)
130
+ * @param error - Registration error to display (if any)
131
+ * @returns Promise resolving to the registration page response
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * register: async (req, state, form, error) => {
136
+ * if (state.type === 'start') {
137
+ * return new Response(renderRegistrationForm(error))
138
+ * } else {
139
+ * return new Response(renderCodeVerification(state.email, error))
140
+ * }
141
+ * }
142
+ * ```
143
+ */
144
+ register: (req: Request, state: PasswordRegisterState, form?: FormData, error?: PasswordRegisterError) => Promise<Response>;
145
+ /**
146
+ * Request handler for rendering the password change screen.
147
+ * Handles email entry, code verification, and password update steps.
148
+ *
149
+ * @param req - The HTTP request object
150
+ * @param state - Current password change state
151
+ * @param form - Form data from POST requests (if any)
152
+ * @param error - Password change error to display (if any)
153
+ * @returns Promise resolving to the password change page response
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * change: async (req, state, form, error) => {
158
+ * switch (state.type) {
159
+ * case 'start':
160
+ * return new Response(renderEmailForm(error))
161
+ * case 'code':
162
+ * return new Response(renderCodeForm(state.email, error))
163
+ * case 'update':
164
+ * return new Response(renderPasswordForm(error))
165
+ * }
166
+ * }
167
+ * ```
168
+ */
169
+ change: (req: Request, state: PasswordChangeState, form?: FormData, error?: PasswordChangeError) => Promise<Response>;
170
+ /**
171
+ * Callback for sending verification codes to users via email.
172
+ * Implement this to integrate with your email service provider.
173
+ *
174
+ * The context parameter indicates why the code is being sent:
175
+ * - "register": User is registering for the first time
176
+ * - "register:resend": User requested to resend registration code
177
+ * - "reset": User is resetting their password
178
+ * - "reset:resend": User requested to resend password reset code
179
+ *
180
+ * @param email - The recipient's email address
181
+ * @param code - The verification code to send
182
+ * @param context - The context of why the code is being sent
183
+ * @returns Promise that resolves when email is sent
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * sendCode: async (email, code, context) => {
188
+ * const templates = {
189
+ * "register": {
190
+ * subject: "Welcome! Verify your email",
191
+ * body: `Welcome! Your verification code is: ${code}`
192
+ * },
193
+ * "register:resend": {
194
+ * subject: "Your verification code (resent)",
195
+ * body: `Here's your code again: ${code}`
196
+ * },
197
+ * "reset": {
198
+ * subject: "Reset your password",
199
+ * body: `Your password reset code is: ${code}`
200
+ * },
201
+ * "reset:resend": {
202
+ * subject: "Password reset code (resent)",
203
+ * body: `Here's your reset code again: ${code}`
204
+ * }
205
+ * }
206
+ *
207
+ * const template = templates[context]
208
+ * await emailService.send({
209
+ * to: email,
210
+ * subject: template.subject,
211
+ * text: template.body
212
+ * })
213
+ * }
214
+ * ```
215
+ */
216
+ sendCode: (email: string, code: string, context: "register" | "register:resend" | "reset" | "reset:resend") => Promise<void>;
217
+ /**
218
+ * Optional password validation function or schema.
219
+ * Can be either a validation function or a standard-schema validator.
220
+ *
221
+ * @param password - The password to validate
222
+ * @returns Error message if invalid, undefined if valid
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * // Function-based validation
227
+ * validatePassword: (password) => {
228
+ * if (password.length < 8) return "Password must be at least 8 characters"
229
+ * if (!/[A-Z]/.test(password)) return "Password must contain uppercase letter"
230
+ * return undefined
231
+ * }
232
+ *
233
+ * // Schema-based validation
234
+ * validatePassword: pipe(
235
+ * string(),
236
+ * minLength(8, "Password must be at least 8 characters"),
237
+ * regex(/[A-Z]/, "Password must contain uppercase letter")
238
+ * )
239
+ * ```
240
+ */
241
+ readonly validatePassword?: StandardSchemaV1 | ((password: string) => Promise<string | undefined> | string | undefined);
242
+ }
243
+ /**
244
+ * Registration flow states that determine which UI to show.
245
+ * The registration process moves through these states sequentially.
246
+ */
247
+ export type PasswordRegisterState = {
248
+ /** Initial state: user enters email and password */
249
+ readonly type: "start";
250
+ } | {
251
+ /** Code verification state: user enters emailed verification code */
252
+ readonly type: "code";
253
+ /** The verification code sent to the user */
254
+ readonly code: string;
255
+ /** The user's email address */
256
+ readonly email: string;
257
+ /** The hashed password (ready for storage) */
258
+ readonly password: unknown;
259
+ };
260
+ /**
261
+ * Possible errors during user registration.
262
+ */
263
+ export type PasswordRegisterError = {
264
+ /** The verification code entered is incorrect */
265
+ readonly type: "invalid_code";
266
+ } | {
267
+ /** The email address is already registered */
268
+ readonly type: "email_taken";
269
+ } | {
270
+ /** The email address format is invalid */
271
+ readonly type: "invalid_email";
272
+ } | {
273
+ /** The password does not meet requirements */
274
+ readonly type: "invalid_password";
275
+ } | {
276
+ /** Password and confirmation password don't match */
277
+ readonly type: "password_mismatch";
278
+ } | {
279
+ /** Custom validation error from validatePassword callback */
280
+ readonly type: "validation_error";
281
+ readonly message?: string;
282
+ };
283
+ /**
284
+ * Password change flow states that determine which UI to show.
285
+ */
286
+ export type PasswordChangeState = {
287
+ /** Initial state: user enters their email address */
288
+ readonly type: "start";
289
+ /** URL to redirect to after successful password change */
290
+ readonly redirect: string;
291
+ } | {
292
+ /** Code verification state: user enters emailed verification code */
293
+ readonly type: "code";
294
+ /** The verification code sent to the user */
295
+ readonly code: string;
296
+ /** The user's email address */
297
+ readonly email: string;
298
+ /** URL to redirect to after completion */
299
+ readonly redirect: string;
300
+ } | {
301
+ /** Password update state: user enters new password */
302
+ readonly type: "update";
303
+ /** URL to redirect to after completion */
304
+ readonly redirect: string;
305
+ /** The verified email address */
306
+ readonly email: string;
307
+ };
308
+ /**
309
+ * Possible errors during password changes.
310
+ */
311
+ export type PasswordChangeError = {
312
+ /** The email address format is invalid */
313
+ readonly type: "invalid_email";
314
+ } | {
315
+ /** The verification code entered is incorrect */
316
+ readonly type: "invalid_code";
317
+ } | {
318
+ /** The new password does not meet requirements */
319
+ readonly type: "invalid_password";
320
+ } | {
321
+ /** New password and confirmation don't match */
322
+ readonly type: "password_mismatch";
323
+ } | {
324
+ /** Custom validation error from validatePassword callback */
325
+ readonly type: "validation_error";
326
+ readonly message: string;
327
+ };
328
+ /**
329
+ * Possible errors during login attempts.
330
+ */
331
+ export type PasswordLoginError = {
332
+ /** The email address format is invalid */
333
+ readonly type: "invalid_email";
334
+ } | {
335
+ /** The password is incorrect or email not found */
336
+ readonly type: "invalid_password";
337
+ };
338
+ /**
339
+ * User data returned by successful password authentication.
340
+ */
341
+ export interface PasswordUserData {
342
+ /** The authenticated user's email address */
343
+ readonly email: string;
344
+ }
345
+ /**
346
+ * Creates a password authentication provider with email verification.
347
+ * Implements secure registration, login, and password change flows.
348
+ *
349
+ * @param config - Provider configuration including UI handlers and email service
350
+ * @returns Provider instance implementing password authentication
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * const provider = PasswordProvider({
355
+ * login: async (req, form, error) => {
356
+ * return new Response(renderLogin(form, error))
357
+ * },
358
+ * register: async (req, state, form, error) => {
359
+ * return new Response(renderRegister(state, form, error))
360
+ * },
361
+ * change: async (req, state, form, error) => {
362
+ * return new Response(renderChange(state, form, error))
363
+ * },
364
+ * sendCode: async (email, code) => {
365
+ * await emailService.send(email, `Code: ${code}`)
366
+ * },
367
+ * validatePassword: (pwd) => {
368
+ * return pwd.length >= 8 ? undefined : "Too short"
369
+ * }
370
+ * })
371
+ * ```
372
+ */
373
+ export declare const PasswordProvider: (config: PasswordConfig) => Provider<PasswordUserData>;
374
+ /**
375
+ * PBKDF2 password hasher with configurable iterations.
376
+ * Good choice for compatibility but slower than Scrypt.
377
+ *
378
+ * @param opts - Configuration options
379
+ * @returns Password hasher using PBKDF2 algorithm
380
+ * @internal
381
+ */
382
+ export declare const PBKDF2Hasher: (opts?: {
383
+ iterations?: number;
384
+ }) => PasswordHasher<{
385
+ hash: string;
386
+ salt: string;
387
+ iterations: number;
388
+ }>;
389
+ /**
390
+ * Scrypt password hasher with secure defaults.
391
+ * Recommended choice for new applications due to memory-hard properties.
392
+ *
393
+ * @param opts - Scrypt parameters (N, r, p)
394
+ * @returns Password hasher using Scrypt algorithm
395
+ * @internal
396
+ */
397
+ export declare const ScryptHasher: (opts?: {
398
+ N?: number;
399
+ r?: number;
400
+ p?: number;
401
+ }) => PasswordHasher<{
402
+ hash: string;
403
+ salt: string;
404
+ N: number;
405
+ r: number;
406
+ p: number;
407
+ }>;
408
+ //# sourceMappingURL=password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/provider/password.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAK7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAElC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IAEzC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,EA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