mulguard 1.1.6 → 1.1.8

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 (540) hide show
  1. package/README.md +21 -1078
  2. package/adapters.d.ts +2 -0
  3. package/adapters.d.ts.map +1 -0
  4. package/adapters.js +1 -0
  5. package/index.d.ts +329 -0
  6. package/index.d.ts.map +1 -0
  7. package/index.js +145 -0
  8. package/jwt.d.ts +9 -0
  9. package/jwt.d.ts.map +1 -0
  10. package/jwt.js +8 -0
  11. package/lib/actions.d.ts +13 -0
  12. package/lib/actions.d.ts.map +1 -0
  13. package/lib/actions.js +86 -0
  14. package/lib/client.d.ts +104 -0
  15. package/lib/client.d.ts.map +1 -0
  16. package/lib/client.js +95 -0
  17. package/lib/env.d.ts +12 -0
  18. package/lib/env.d.ts.map +1 -0
  19. package/lib/env.js +38 -0
  20. package/lib/index.d.ts +56 -0
  21. package/lib/index.d.ts.map +1 -0
  22. package/lib/index.js +187 -0
  23. package/lib/types.d.ts +24 -0
  24. package/lib/types.d.ts.map +1 -0
  25. package/lib/types.js +1 -0
  26. package/middleware.d.ts +9 -0
  27. package/middleware.d.ts.map +1 -0
  28. package/middleware.js +12 -0
  29. package/next.d.ts +9 -0
  30. package/next.d.ts.map +1 -0
  31. package/next.js +12 -0
  32. package/package.json +117 -73
  33. package/providers/42-school.d.ts +3 -0
  34. package/providers/42-school.d.ts.map +1 -0
  35. package/providers/42-school.js +2 -0
  36. package/providers/apple.d.ts +3 -0
  37. package/providers/apple.d.ts.map +1 -0
  38. package/providers/apple.js +2 -0
  39. package/providers/asgardeo.d.ts +3 -0
  40. package/providers/asgardeo.d.ts.map +1 -0
  41. package/providers/asgardeo.js +2 -0
  42. package/providers/atlassian.d.ts +3 -0
  43. package/providers/atlassian.d.ts.map +1 -0
  44. package/providers/atlassian.js +2 -0
  45. package/providers/auth0.d.ts +3 -0
  46. package/providers/auth0.d.ts.map +1 -0
  47. package/providers/auth0.js +2 -0
  48. package/providers/authentik.d.ts +3 -0
  49. package/providers/authentik.d.ts.map +1 -0
  50. package/providers/authentik.js +2 -0
  51. package/providers/azure-ad-b2c.d.ts +3 -0
  52. package/providers/azure-ad-b2c.d.ts.map +1 -0
  53. package/providers/azure-ad-b2c.js +2 -0
  54. package/providers/azure-ad.d.ts +3 -0
  55. package/providers/azure-ad.d.ts.map +1 -0
  56. package/providers/azure-ad.js +2 -0
  57. package/providers/azure-devops.d.ts +3 -0
  58. package/providers/azure-devops.d.ts.map +1 -0
  59. package/providers/azure-devops.js +2 -0
  60. package/providers/bankid-no.d.ts +3 -0
  61. package/providers/bankid-no.d.ts.map +1 -0
  62. package/providers/bankid-no.js +2 -0
  63. package/providers/battlenet.d.ts +3 -0
  64. package/providers/battlenet.d.ts.map +1 -0
  65. package/providers/battlenet.js +2 -0
  66. package/providers/beyondidentity.d.ts +3 -0
  67. package/providers/beyondidentity.d.ts.map +1 -0
  68. package/providers/beyondidentity.js +2 -0
  69. package/providers/bitbucket.d.ts +3 -0
  70. package/providers/bitbucket.d.ts.map +1 -0
  71. package/providers/bitbucket.js +2 -0
  72. package/providers/box.d.ts +3 -0
  73. package/providers/box.d.ts.map +1 -0
  74. package/providers/box.js +2 -0
  75. package/providers/boxyhq-saml.d.ts +3 -0
  76. package/providers/boxyhq-saml.d.ts.map +1 -0
  77. package/providers/boxyhq-saml.js +2 -0
  78. package/providers/bungie.d.ts +3 -0
  79. package/providers/bungie.d.ts.map +1 -0
  80. package/providers/bungie.js +2 -0
  81. package/providers/click-up.d.ts +3 -0
  82. package/providers/click-up.d.ts.map +1 -0
  83. package/providers/click-up.js +2 -0
  84. package/providers/cognito.d.ts +3 -0
  85. package/providers/cognito.d.ts.map +1 -0
  86. package/providers/cognito.js +2 -0
  87. package/providers/coinbase.d.ts +3 -0
  88. package/providers/coinbase.d.ts.map +1 -0
  89. package/providers/coinbase.js +2 -0
  90. package/providers/concept2.d.ts +3 -0
  91. package/providers/concept2.d.ts.map +1 -0
  92. package/providers/concept2.js +2 -0
  93. package/providers/credentials.d.ts +3 -0
  94. package/providers/credentials.d.ts.map +1 -0
  95. package/providers/credentials.js +2 -0
  96. package/providers/descope.d.ts +3 -0
  97. package/providers/descope.d.ts.map +1 -0
  98. package/providers/descope.js +2 -0
  99. package/providers/discord.d.ts +3 -0
  100. package/providers/discord.d.ts.map +1 -0
  101. package/providers/discord.js +2 -0
  102. package/providers/dribbble.d.ts +3 -0
  103. package/providers/dribbble.d.ts.map +1 -0
  104. package/providers/dribbble.js +2 -0
  105. package/providers/dropbox.d.ts +3 -0
  106. package/providers/dropbox.d.ts.map +1 -0
  107. package/providers/dropbox.js +2 -0
  108. package/providers/duende-identity-server6.d.ts +3 -0
  109. package/providers/duende-identity-server6.d.ts.map +1 -0
  110. package/providers/duende-identity-server6.js +2 -0
  111. package/providers/email.d.ts +3 -0
  112. package/providers/email.d.ts.map +1 -0
  113. package/providers/email.js +2 -0
  114. package/providers/eventbrite.d.ts +3 -0
  115. package/providers/eventbrite.d.ts.map +1 -0
  116. package/providers/eventbrite.js +2 -0
  117. package/providers/eveonline.d.ts +3 -0
  118. package/providers/eveonline.d.ts.map +1 -0
  119. package/providers/eveonline.js +2 -0
  120. package/providers/facebook.d.ts +3 -0
  121. package/providers/facebook.d.ts.map +1 -0
  122. package/providers/facebook.js +2 -0
  123. package/providers/faceit.d.ts +3 -0
  124. package/providers/faceit.d.ts.map +1 -0
  125. package/providers/faceit.js +2 -0
  126. package/providers/figma.d.ts +3 -0
  127. package/providers/figma.d.ts.map +1 -0
  128. package/providers/figma.js +2 -0
  129. package/providers/forwardemail.d.ts +3 -0
  130. package/providers/forwardemail.d.ts.map +1 -0
  131. package/providers/forwardemail.js +2 -0
  132. package/providers/foursquare.d.ts +3 -0
  133. package/providers/foursquare.d.ts.map +1 -0
  134. package/providers/foursquare.js +2 -0
  135. package/providers/freshbooks.d.ts +3 -0
  136. package/providers/freshbooks.d.ts.map +1 -0
  137. package/providers/freshbooks.js +2 -0
  138. package/providers/frontegg.d.ts +3 -0
  139. package/providers/frontegg.d.ts.map +1 -0
  140. package/providers/frontegg.js +2 -0
  141. package/providers/fusionauth.d.ts +3 -0
  142. package/providers/fusionauth.d.ts.map +1 -0
  143. package/providers/fusionauth.js +2 -0
  144. package/providers/github.d.ts +3 -0
  145. package/providers/github.d.ts.map +1 -0
  146. package/providers/github.js +2 -0
  147. package/providers/gitlab.d.ts +3 -0
  148. package/providers/gitlab.d.ts.map +1 -0
  149. package/providers/gitlab.js +2 -0
  150. package/providers/google.d.ts +3 -0
  151. package/providers/google.d.ts.map +1 -0
  152. package/providers/google.js +2 -0
  153. package/providers/hubspot.d.ts +3 -0
  154. package/providers/hubspot.d.ts.map +1 -0
  155. package/providers/hubspot.js +2 -0
  156. package/providers/huggingface.d.ts +3 -0
  157. package/providers/huggingface.d.ts.map +1 -0
  158. package/providers/huggingface.js +2 -0
  159. package/providers/identity-server4.d.ts +3 -0
  160. package/providers/identity-server4.d.ts.map +1 -0
  161. package/providers/identity-server4.js +2 -0
  162. package/providers/index.d.ts +2 -0
  163. package/providers/index.d.ts.map +1 -0
  164. package/providers/index.js +1 -0
  165. package/providers/instagram.d.ts +3 -0
  166. package/providers/instagram.d.ts.map +1 -0
  167. package/providers/instagram.js +2 -0
  168. package/providers/kakao.d.ts +3 -0
  169. package/providers/kakao.d.ts.map +1 -0
  170. package/providers/kakao.js +2 -0
  171. package/providers/keycloak.d.ts +3 -0
  172. package/providers/keycloak.d.ts.map +1 -0
  173. package/providers/keycloak.js +2 -0
  174. package/providers/kinde.d.ts +3 -0
  175. package/providers/kinde.d.ts.map +1 -0
  176. package/providers/kinde.js +2 -0
  177. package/providers/line.d.ts +3 -0
  178. package/providers/line.d.ts.map +1 -0
  179. package/providers/line.js +2 -0
  180. package/providers/linkedin.d.ts +3 -0
  181. package/providers/linkedin.d.ts.map +1 -0
  182. package/providers/linkedin.js +2 -0
  183. package/providers/logto.d.ts +3 -0
  184. package/providers/logto.d.ts.map +1 -0
  185. package/providers/logto.js +2 -0
  186. package/providers/loops.d.ts +3 -0
  187. package/providers/loops.d.ts.map +1 -0
  188. package/providers/loops.js +2 -0
  189. package/providers/mailchimp.d.ts +3 -0
  190. package/providers/mailchimp.d.ts.map +1 -0
  191. package/providers/mailchimp.js +2 -0
  192. package/providers/mailgun.d.ts +3 -0
  193. package/providers/mailgun.d.ts.map +1 -0
  194. package/providers/mailgun.js +2 -0
  195. package/providers/mailru.d.ts +3 -0
  196. package/providers/mailru.d.ts.map +1 -0
  197. package/providers/mailru.js +2 -0
  198. package/providers/mastodon.d.ts +3 -0
  199. package/providers/mastodon.d.ts.map +1 -0
  200. package/providers/mastodon.js +2 -0
  201. package/providers/mattermost.d.ts +3 -0
  202. package/providers/mattermost.d.ts.map +1 -0
  203. package/providers/mattermost.js +2 -0
  204. package/providers/medium.d.ts +3 -0
  205. package/providers/medium.d.ts.map +1 -0
  206. package/providers/medium.js +2 -0
  207. package/providers/microsoft-entra-id.d.ts +3 -0
  208. package/providers/microsoft-entra-id.d.ts.map +1 -0
  209. package/providers/microsoft-entra-id.js +2 -0
  210. package/providers/naver.d.ts +3 -0
  211. package/providers/naver.d.ts.map +1 -0
  212. package/providers/naver.js +2 -0
  213. package/providers/netlify.d.ts +3 -0
  214. package/providers/netlify.d.ts.map +1 -0
  215. package/providers/netlify.js +2 -0
  216. package/providers/netsuite.d.ts +3 -0
  217. package/providers/netsuite.d.ts.map +1 -0
  218. package/providers/netsuite.js +2 -0
  219. package/providers/nextcloud.d.ts +3 -0
  220. package/providers/nextcloud.d.ts.map +1 -0
  221. package/providers/nextcloud.js +2 -0
  222. package/providers/nodemailer.d.ts +3 -0
  223. package/providers/nodemailer.d.ts.map +1 -0
  224. package/providers/nodemailer.js +2 -0
  225. package/providers/notion.d.ts +3 -0
  226. package/providers/notion.d.ts.map +1 -0
  227. package/providers/notion.js +2 -0
  228. package/providers/okta.d.ts +3 -0
  229. package/providers/okta.d.ts.map +1 -0
  230. package/providers/okta.js +2 -0
  231. package/providers/onelogin.d.ts +3 -0
  232. package/providers/onelogin.d.ts.map +1 -0
  233. package/providers/onelogin.js +2 -0
  234. package/providers/ory-hydra.d.ts +3 -0
  235. package/providers/ory-hydra.d.ts.map +1 -0
  236. package/providers/ory-hydra.js +2 -0
  237. package/providers/osso.d.ts +3 -0
  238. package/providers/osso.d.ts.map +1 -0
  239. package/providers/osso.js +2 -0
  240. package/providers/osu.d.ts +3 -0
  241. package/providers/osu.d.ts.map +1 -0
  242. package/providers/osu.js +2 -0
  243. package/providers/passage.d.ts +3 -0
  244. package/providers/passage.d.ts.map +1 -0
  245. package/providers/passage.js +2 -0
  246. package/providers/passkey.d.ts +3 -0
  247. package/providers/passkey.d.ts.map +1 -0
  248. package/providers/passkey.js +2 -0
  249. package/providers/patreon.d.ts +3 -0
  250. package/providers/patreon.d.ts.map +1 -0
  251. package/providers/patreon.js +2 -0
  252. package/providers/ping-id.d.ts +3 -0
  253. package/providers/ping-id.d.ts.map +1 -0
  254. package/providers/ping-id.js +2 -0
  255. package/providers/pinterest.d.ts +3 -0
  256. package/providers/pinterest.d.ts.map +1 -0
  257. package/providers/pinterest.js +2 -0
  258. package/providers/pipedrive.d.ts +3 -0
  259. package/providers/pipedrive.d.ts.map +1 -0
  260. package/providers/pipedrive.js +2 -0
  261. package/providers/postmark.d.ts +3 -0
  262. package/providers/postmark.d.ts.map +1 -0
  263. package/providers/postmark.js +2 -0
  264. package/providers/reddit.d.ts +3 -0
  265. package/providers/reddit.d.ts.map +1 -0
  266. package/providers/reddit.js +2 -0
  267. package/providers/resend.d.ts +3 -0
  268. package/providers/resend.d.ts.map +1 -0
  269. package/providers/resend.js +2 -0
  270. package/providers/roblox.d.ts +3 -0
  271. package/providers/roblox.d.ts.map +1 -0
  272. package/providers/roblox.js +2 -0
  273. package/providers/salesforce.d.ts +3 -0
  274. package/providers/salesforce.d.ts.map +1 -0
  275. package/providers/salesforce.js +2 -0
  276. package/providers/sendgrid.d.ts +3 -0
  277. package/providers/sendgrid.d.ts.map +1 -0
  278. package/providers/sendgrid.js +2 -0
  279. package/providers/simplelogin.d.ts +3 -0
  280. package/providers/simplelogin.d.ts.map +1 -0
  281. package/providers/simplelogin.js +2 -0
  282. package/providers/slack.d.ts +3 -0
  283. package/providers/slack.d.ts.map +1 -0
  284. package/providers/slack.js +2 -0
  285. package/providers/spotify.d.ts +3 -0
  286. package/providers/spotify.d.ts.map +1 -0
  287. package/providers/spotify.js +2 -0
  288. package/providers/strava.d.ts +3 -0
  289. package/providers/strava.d.ts.map +1 -0
  290. package/providers/strava.js +2 -0
  291. package/providers/threads.d.ts +3 -0
  292. package/providers/threads.d.ts.map +1 -0
  293. package/providers/threads.js +2 -0
  294. package/providers/tiktok.d.ts +3 -0
  295. package/providers/tiktok.d.ts.map +1 -0
  296. package/providers/tiktok.js +2 -0
  297. package/providers/todoist.d.ts +3 -0
  298. package/providers/todoist.d.ts.map +1 -0
  299. package/providers/todoist.js +2 -0
  300. package/providers/trakt.d.ts +3 -0
  301. package/providers/trakt.d.ts.map +1 -0
  302. package/providers/trakt.js +2 -0
  303. package/providers/twitch.d.ts +3 -0
  304. package/providers/twitch.d.ts.map +1 -0
  305. package/providers/twitch.js +2 -0
  306. package/providers/twitter.d.ts +3 -0
  307. package/providers/twitter.d.ts.map +1 -0
  308. package/providers/twitter.js +2 -0
  309. package/providers/united-effects.d.ts +3 -0
  310. package/providers/united-effects.d.ts.map +1 -0
  311. package/providers/united-effects.js +2 -0
  312. package/providers/vipps.d.ts +3 -0
  313. package/providers/vipps.d.ts.map +1 -0
  314. package/providers/vipps.js +2 -0
  315. package/providers/vk.d.ts +3 -0
  316. package/providers/vk.d.ts.map +1 -0
  317. package/providers/vk.js +2 -0
  318. package/providers/webauthn.d.ts +3 -0
  319. package/providers/webauthn.d.ts.map +1 -0
  320. package/providers/webauthn.js +2 -0
  321. package/providers/webex.d.ts +3 -0
  322. package/providers/webex.d.ts.map +1 -0
  323. package/providers/webex.js +2 -0
  324. package/providers/wechat.d.ts +3 -0
  325. package/providers/wechat.d.ts.map +1 -0
  326. package/providers/wechat.js +2 -0
  327. package/providers/wikimedia.d.ts +3 -0
  328. package/providers/wikimedia.d.ts.map +1 -0
  329. package/providers/wikimedia.js +2 -0
  330. package/providers/wordpress.d.ts +3 -0
  331. package/providers/wordpress.d.ts.map +1 -0
  332. package/providers/wordpress.js +2 -0
  333. package/providers/workos.d.ts +3 -0
  334. package/providers/workos.d.ts.map +1 -0
  335. package/providers/workos.js +2 -0
  336. package/providers/yandex.d.ts +3 -0
  337. package/providers/yandex.d.ts.map +1 -0
  338. package/providers/yandex.js +2 -0
  339. package/providers/zitadel.d.ts +3 -0
  340. package/providers/zitadel.d.ts.map +1 -0
  341. package/providers/zitadel.js +2 -0
  342. package/providers/zoho.d.ts +3 -0
  343. package/providers/zoho.d.ts.map +1 -0
  344. package/providers/zoho.js +2 -0
  345. package/providers/zoom.d.ts +3 -0
  346. package/providers/zoom.d.ts.map +1 -0
  347. package/providers/zoom.js +2 -0
  348. package/react.d.ts +102 -0
  349. package/react.d.ts.map +1 -0
  350. package/react.js +361 -0
  351. package/src/adapters.ts +1 -0
  352. package/src/index.ts +430 -0
  353. package/src/jwt.ts +9 -0
  354. package/src/lib/actions.ts +144 -0
  355. package/src/lib/client.ts +245 -0
  356. package/src/lib/env.ts +36 -0
  357. package/src/lib/index.ts +313 -0
  358. package/src/lib/types.ts +30 -0
  359. package/src/middleware.ts +16 -0
  360. package/src/next.ts +16 -0
  361. package/src/providers/42-school.ts +2 -0
  362. package/src/providers/apple.ts +2 -0
  363. package/src/providers/asgardeo.ts +2 -0
  364. package/src/providers/atlassian.ts +2 -0
  365. package/src/providers/auth0.ts +2 -0
  366. package/src/providers/authentik.ts +2 -0
  367. package/src/providers/azure-ad-b2c.ts +2 -0
  368. package/src/providers/azure-ad.ts +2 -0
  369. package/src/providers/azure-devops.ts +2 -0
  370. package/src/providers/bankid-no.ts +2 -0
  371. package/src/providers/battlenet.ts +2 -0
  372. package/src/providers/beyondidentity.ts +2 -0
  373. package/src/providers/bitbucket.ts +2 -0
  374. package/src/providers/box.ts +2 -0
  375. package/src/providers/boxyhq-saml.ts +2 -0
  376. package/src/providers/bungie.ts +2 -0
  377. package/src/providers/click-up.ts +2 -0
  378. package/src/providers/cognito.ts +2 -0
  379. package/src/providers/coinbase.ts +2 -0
  380. package/src/providers/concept2.ts +2 -0
  381. package/src/providers/credentials.ts +2 -0
  382. package/src/providers/descope.ts +2 -0
  383. package/src/providers/discord.ts +2 -0
  384. package/src/providers/dribbble.ts +2 -0
  385. package/src/providers/dropbox.ts +2 -0
  386. package/src/providers/duende-identity-server6.ts +2 -0
  387. package/src/providers/email.ts +2 -0
  388. package/src/providers/eventbrite.ts +2 -0
  389. package/src/providers/eveonline.ts +2 -0
  390. package/src/providers/facebook.ts +2 -0
  391. package/src/providers/faceit.ts +2 -0
  392. package/src/providers/figma.ts +2 -0
  393. package/src/providers/forwardemail.ts +2 -0
  394. package/src/providers/foursquare.ts +2 -0
  395. package/src/providers/freshbooks.ts +2 -0
  396. package/src/providers/frontegg.ts +2 -0
  397. package/src/providers/fusionauth.ts +2 -0
  398. package/src/providers/github.ts +2 -0
  399. package/src/providers/gitlab.ts +2 -0
  400. package/src/providers/google.ts +2 -0
  401. package/src/providers/hubspot.ts +2 -0
  402. package/src/providers/huggingface.ts +2 -0
  403. package/src/providers/identity-server4.ts +2 -0
  404. package/src/providers/index.ts +1 -0
  405. package/src/providers/instagram.ts +2 -0
  406. package/src/providers/kakao.ts +2 -0
  407. package/src/providers/keycloak.ts +2 -0
  408. package/src/providers/kinde.ts +2 -0
  409. package/src/providers/line.ts +2 -0
  410. package/src/providers/linkedin.ts +2 -0
  411. package/src/providers/logto.ts +2 -0
  412. package/src/providers/loops.ts +2 -0
  413. package/src/providers/mailchimp.ts +2 -0
  414. package/src/providers/mailgun.ts +2 -0
  415. package/src/providers/mailru.ts +2 -0
  416. package/src/providers/mastodon.ts +2 -0
  417. package/src/providers/mattermost.ts +2 -0
  418. package/src/providers/medium.ts +2 -0
  419. package/src/providers/microsoft-entra-id.ts +2 -0
  420. package/src/providers/naver.ts +2 -0
  421. package/src/providers/netlify.ts +2 -0
  422. package/src/providers/netsuite.ts +2 -0
  423. package/src/providers/nextcloud.ts +2 -0
  424. package/src/providers/nodemailer.ts +2 -0
  425. package/src/providers/notion.ts +2 -0
  426. package/src/providers/okta.ts +2 -0
  427. package/src/providers/onelogin.ts +2 -0
  428. package/src/providers/ory-hydra.ts +2 -0
  429. package/src/providers/osso.ts +2 -0
  430. package/src/providers/osu.ts +2 -0
  431. package/src/providers/passage.ts +2 -0
  432. package/src/providers/passkey.ts +2 -0
  433. package/src/providers/patreon.ts +2 -0
  434. package/src/providers/ping-id.ts +2 -0
  435. package/src/providers/pinterest.ts +2 -0
  436. package/src/providers/pipedrive.ts +2 -0
  437. package/src/providers/postmark.ts +2 -0
  438. package/src/providers/reddit.ts +2 -0
  439. package/src/providers/resend.ts +2 -0
  440. package/src/providers/roblox.ts +2 -0
  441. package/src/providers/salesforce.ts +2 -0
  442. package/src/providers/sendgrid.ts +2 -0
  443. package/src/providers/simplelogin.ts +2 -0
  444. package/src/providers/slack.ts +2 -0
  445. package/src/providers/spotify.ts +2 -0
  446. package/src/providers/strava.ts +2 -0
  447. package/src/providers/threads.ts +2 -0
  448. package/src/providers/tiktok.ts +2 -0
  449. package/src/providers/todoist.ts +2 -0
  450. package/src/providers/trakt.ts +2 -0
  451. package/src/providers/twitch.ts +2 -0
  452. package/src/providers/twitter.ts +2 -0
  453. package/src/providers/united-effects.ts +2 -0
  454. package/src/providers/vipps.ts +2 -0
  455. package/src/providers/vk.ts +2 -0
  456. package/src/providers/webauthn.ts +2 -0
  457. package/src/providers/webex.ts +2 -0
  458. package/src/providers/wechat.ts +2 -0
  459. package/src/providers/wikimedia.ts +2 -0
  460. package/src/providers/wordpress.ts +2 -0
  461. package/src/providers/workos.ts +2 -0
  462. package/src/providers/yandex.ts +2 -0
  463. package/src/providers/zitadel.ts +2 -0
  464. package/src/providers/zoho.ts +2 -0
  465. package/src/providers/zoom.ts +2 -0
  466. package/src/react.tsx +546 -0
  467. package/src/webauthn.ts +152 -0
  468. package/webauthn.d.ts +9 -0
  469. package/webauthn.d.ts.map +1 -0
  470. package/webauthn.js +92 -0
  471. package/LICENSE +0 -70
  472. package/dist/actions-CExpv_dD.js +0 -1
  473. package/dist/actions-DeCfLtHA.mjs +0 -184
  474. package/dist/client/hooks.d.ts +0 -122
  475. package/dist/client/index.d.ts +0 -5
  476. package/dist/client/index.js +0 -1
  477. package/dist/client/index.mjs +0 -478
  478. package/dist/client/provider.d.ts +0 -69
  479. package/dist/client/server-actions-helper.d.ts +0 -22
  480. package/dist/components/AccountPicker.d.ts +0 -11
  481. package/dist/components/OAuthButton.d.ts +0 -11
  482. package/dist/components/PassKeyButton.d.ts +0 -11
  483. package/dist/components/PassKeyRegister.d.ts +0 -10
  484. package/dist/components/TwoFactorSetup.d.ts +0 -8
  485. package/dist/components/TwoFactorVerify.d.ts +0 -9
  486. package/dist/core/account-picker/encryption.d.ts +0 -22
  487. package/dist/core/account-picker/index.d.ts +0 -22
  488. package/dist/core/auth/index.d.ts +0 -40
  489. package/dist/core/auth/oauth-providers.d.ts +0 -197
  490. package/dist/core/auth/oauth-state-store-cookie.d.ts +0 -83
  491. package/dist/core/auth/oauth-state-store-redis.d.ts +0 -25
  492. package/dist/core/auth/oauth-state-store.d.ts +0 -45
  493. package/dist/core/auth/oauth.d.ts +0 -20
  494. package/dist/core/auth/passkey.d.ts +0 -35
  495. package/dist/core/auth/password.d.ts +0 -22
  496. package/dist/core/auth/signin-unified.d.ts +0 -33
  497. package/dist/core/auth/two-factor.d.ts +0 -28
  498. package/dist/core/client/index.d.ts +0 -132
  499. package/dist/core/client/token-refresh-manager.d.ts +0 -48
  500. package/dist/core/index.d.ts +0 -11
  501. package/dist/core/mulguard/auth-handlers.d.ts +0 -100
  502. package/dist/core/mulguard/defaults.d.ts +0 -58
  503. package/dist/core/mulguard/index.d.ts +0 -9
  504. package/dist/core/mulguard/oauth-handler.d.ts +0 -93
  505. package/dist/core/mulguard/session-manager.d.ts +0 -94
  506. package/dist/core/security/csrf.d.ts +0 -46
  507. package/dist/core/security/headers.d.ts +0 -24
  508. package/dist/core/security/index.d.ts +0 -132
  509. package/dist/core/security/rate-limit.d.ts +0 -39
  510. package/dist/core/security/validation.d.ts +0 -251
  511. package/dist/core/security/xss.d.ts +0 -20
  512. package/dist/core/session/index.d.ts +0 -35
  513. package/dist/core/types/auth.d.ts +0 -290
  514. package/dist/core/types/errors.d.ts +0 -200
  515. package/dist/core/types/index.d.ts +0 -462
  516. package/dist/core/utils/auth-helpers.d.ts +0 -136
  517. package/dist/core/utils/logger.d.ts +0 -121
  518. package/dist/handlers/api.d.ts +0 -10
  519. package/dist/handlers/route.d.ts +0 -76
  520. package/dist/index/index.js +0 -1
  521. package/dist/index/index.mjs +0 -2229
  522. package/dist/index.d.ts +0 -21
  523. package/dist/middleware/index.d.ts +0 -28
  524. package/dist/middleware/proxy.d.ts +0 -53
  525. package/dist/middleware/security.d.ts +0 -9
  526. package/dist/mulguard.d.ts +0 -373
  527. package/dist/oauth-state-DKle8eCr.mjs +0 -289
  528. package/dist/oauth-state-DlvrCV11.js +0 -1
  529. package/dist/server/actions.d.ts +0 -86
  530. package/dist/server/auth.d.ts +0 -65
  531. package/dist/server/cookies.d.ts +0 -42
  532. package/dist/server/helpers.d.ts +0 -10
  533. package/dist/server/index.d.ts +0 -14
  534. package/dist/server/index.js +0 -1
  535. package/dist/server/index.mjs +0 -31
  536. package/dist/server/middleware.d.ts +0 -39
  537. package/dist/server/oauth-state.d.ts +0 -30
  538. package/dist/server/session-helpers.d.ts +0 -26
  539. package/dist/server/session.d.ts +0 -28
  540. package/dist/server/utils.d.ts +0 -10
@@ -1,200 +0,0 @@
1
- /**
2
- * Authentication error codes and error handling types.
3
- *
4
- * @module @mulguard/core/types/errors
5
- */
6
- /**
7
- * Authentication error code enumeration.
8
- *
9
- * Provides specific error codes for programmatic error handling.
10
- *
11
- * @example
12
- * ```typescript
13
- * if (result.errorCode === AuthErrorCode.INVALID_CREDENTIALS) {
14
- * // Handle invalid credentials
15
- * } else if (result.errorCode === AuthErrorCode.TWO_FA_REQUIRED) {
16
- * // Handle 2FA requirement
17
- * }
18
- * ```
19
- */
20
- export declare enum AuthErrorCode {
21
- /** Invalid email or password credentials */
22
- INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
23
- /** Account is temporarily locked due to failed attempts */
24
- ACCOUNT_LOCKED = "ACCOUNT_LOCKED",
25
- /** Account is inactive or disabled */
26
- ACCOUNT_INACTIVE = "ACCOUNT_INACTIVE",
27
- /** Two-factor authentication is required */
28
- TWO_FA_REQUIRED = "TWO_FA_REQUIRED",
29
- /** Invalid two-factor authentication code */
30
- INVALID_TWO_FA_CODE = "INVALID_TWO_FA_CODE",
31
- /** Session has expired */
32
- SESSION_EXPIRED = "SESSION_EXPIRED",
33
- /** User is not authorized for this operation */
34
- UNAUTHORIZED = "UNAUTHORIZED",
35
- /** Network or API communication error */
36
- NETWORK_ERROR = "NETWORK_ERROR",
37
- /** Input validation error */
38
- VALIDATION_ERROR = "VALIDATION_ERROR",
39
- /** Rate limit exceeded */
40
- RATE_LIMITED = "RATE_LIMITED",
41
- /** Unknown or unexpected error */
42
- UNKNOWN_ERROR = "UNKNOWN_ERROR"
43
- }
44
- /**
45
- * Authentication error interface.
46
- *
47
- * Provides structured error information with code, message, and optional metadata.
48
- *
49
- * @property code - Specific error code
50
- * @property message - Human-readable error message
51
- * @property statusCode - HTTP status code (if applicable)
52
- * @property details - Additional error details (optional)
53
- *
54
- * @example
55
- * ```typescript
56
- * const error: AuthError = {
57
- * code: AuthErrorCode.INVALID_CREDENTIALS,
58
- * message: 'Invalid email or password',
59
- * statusCode: 401
60
- * }
61
- * ```
62
- */
63
- export interface AuthError {
64
- readonly code: AuthErrorCode;
65
- readonly message: string;
66
- readonly statusCode?: number;
67
- readonly details?: unknown;
68
- }
69
- /**
70
- * Error result type for failed operations.
71
- *
72
- * @template TCode - Error code type (defaults to AuthErrorCode)
73
- */
74
- export type ErrorResult<TCode extends AuthErrorCode = AuthErrorCode> = {
75
- readonly success: false;
76
- readonly error: string;
77
- readonly errorCode: TCode;
78
- readonly details?: unknown;
79
- };
80
- /**
81
- * Creates an authentication error object.
82
- *
83
- * @param code - Error code
84
- * @param message - Human-readable error message
85
- * @param statusCode - HTTP status code (optional)
86
- * @param details - Additional error details (optional)
87
- * @returns AuthError object
88
- *
89
- * @example
90
- * ```typescript
91
- * const error = createAuthError(
92
- * AuthErrorCode.INVALID_CREDENTIALS,
93
- * 'Invalid email or password',
94
- * 401
95
- * )
96
- * ```
97
- */
98
- export declare function createAuthError(code: AuthErrorCode, message: string, statusCode?: number, details?: unknown): AuthError;
99
- /**
100
- * Creates an error result for failed authentication operations.
101
- *
102
- * @template TCode - Error code type
103
- * @param code - Error code
104
- * @param message - Error message
105
- * @param details - Additional error details (optional)
106
- * @returns ErrorResult object
107
- *
108
- * @example
109
- * ```typescript
110
- * const result = createErrorResult(
111
- * AuthErrorCode.INVALID_CREDENTIALS,
112
- * 'Invalid email or password'
113
- * )
114
- * ```
115
- */
116
- export declare function createErrorResult<TCode extends AuthErrorCode = AuthErrorCode>(code: TCode, message: string, details?: unknown): ErrorResult<TCode>;
117
- /**
118
- * HTTP status code mapping for error codes.
119
- *
120
- * Maps authentication error codes to appropriate HTTP status codes.
121
- */
122
- export declare const ERROR_STATUS_MAP: Readonly<Record<AuthErrorCode, number>>;
123
- /**
124
- * Gets the HTTP status code for an error code.
125
- *
126
- * @param code - Error code
127
- * @returns HTTP status code
128
- *
129
- * @example
130
- * ```typescript
131
- * const statusCode = getErrorStatusCode(AuthErrorCode.INVALID_CREDENTIALS)
132
- * // Returns 401
133
- * ```
134
- */
135
- export declare function getErrorStatusCode(code: AuthErrorCode): number;
136
- /**
137
- * Type predicate to check if a value is an AuthError.
138
- *
139
- * @param value - Value to check
140
- * @returns True if value is an AuthError
141
- *
142
- * @example
143
- * ```typescript
144
- * if (isAuthError(error)) {
145
- * // TypeScript knows error is AuthError here
146
- * console.log(error.code, error.message)
147
- * }
148
- * ```
149
- */
150
- export declare function isAuthError(value: unknown): value is AuthError;
151
- /**
152
- * Type predicate to check if a value is an ErrorResult.
153
- *
154
- * @param value - Value to check
155
- * @returns True if value is an ErrorResult
156
- *
157
- * @example
158
- * ```typescript
159
- * if (isErrorResult(result)) {
160
- * // TypeScript knows result is ErrorResult here
161
- * console.log(result.errorCode, result.error)
162
- * }
163
- * ```
164
- */
165
- export declare function isErrorResult(value: unknown): value is ErrorResult;
166
- /**
167
- * TODO: Performance
168
- * - [ ] Consider using const assertions for error code strings
169
- * - [ ] Add type-level validation for error code mappings
170
- * - [ ] Implement compile-time error code exhaustiveness checking
171
- *
172
- * TODO: Features
173
- * - [ ] Add error recovery strategies
174
- * - [ ] Implement error code hierarchies/categories
175
- * - [ ] Add localized error messages support
176
- * - [ ] Create error code to user-friendly message mapping
177
- * - [ ] Add error code metadata (retryable, transient, etc.)
178
- *
179
- * TODO: Type Safety
180
- * - [ ] Add branded types for error codes
181
- * - [ ] Implement type-safe error code unions
182
- * - [ ] Add exhaustiveness checking for error handling
183
- * - [ ] Create type-safe error code validation
184
- *
185
- * TODO: Testing
186
- * - [ ] Add tests for error code mappings
187
- * - [ ] Test type guards with various inputs
188
- * - [ ] Verify error result type narrowing
189
- * - [ ] Test error factory functions
190
- *
191
- * TODO: Documentation
192
- * - [ ] Add examples for each error code
193
- * - [ ] Document error handling best practices
194
- * - [ ] Create error code reference guide
195
- *
196
- * TODO: Limitations
197
- * - [ ] Error code enum may need extension for custom errors
198
- * - [ ] Status code mapping is fixed (consider configurable)
199
- * - [ ] Error details type is unknown (consider generic)
200
- */
@@ -1,462 +0,0 @@
1
- import { User, Session, AuthResult, SuccessfulAuthResult, FailedAuthResult, TwoFactorAuthResult, EmailCredentials, RegisterData, Verify2FAData } from './auth';
2
- /**
3
- * Core type definitions for Mulguard Authentication Library
4
- *
5
- * @module @mulguard/core/types
6
- * @see {@link https://github.com/mulguard/mulguard} for documentation
7
- */
8
- export * from './auth';
9
- export * from './errors';
10
- /**
11
- * Generic HTTP client interface for making API requests.
12
- *
13
- * @template TResponse - Response data type
14
- * @template TRequest - Request data type (optional)
15
- *
16
- * @example
17
- * ```typescript
18
- * const client: ApiClient = {
19
- * get: async <T>(url: string) => ({ data: await fetch(url).then(r => r.json()) as T }),
20
- * post: async <T>(url: string, data?: unknown) => ({ data: await fetch(url, { method: 'POST', body: JSON.stringify(data) }).then(r => r.json()) as T }),
21
- * // ...
22
- * }
23
- * ```
24
- */
25
- export interface ApiClient {
26
- /** GET request */
27
- get: <TResponse = unknown>(url: string, config?: unknown) => Promise<{
28
- data: TResponse;
29
- }>;
30
- /** POST request */
31
- post: <TResponse = unknown, TRequest = unknown>(url: string, data?: TRequest, config?: unknown) => Promise<{
32
- data: TResponse;
33
- }>;
34
- /** PUT request */
35
- put: <TResponse = unknown, TRequest = unknown>(url: string, data?: TRequest, config?: unknown) => Promise<{
36
- data: TResponse;
37
- }>;
38
- /** DELETE request */
39
- delete: <TResponse = unknown>(url: string, config?: unknown) => Promise<{
40
- data: TResponse;
41
- }>;
42
- }
43
- /**
44
- * Authentication provider type.
45
- */
46
- export type AuthProvider = 'email' | 'oauth' | 'passkey';
47
- /**
48
- * Remembered user information for account picker functionality.
49
- *
50
- * @property userId - Unique user identifier
51
- * @property email - User email address
52
- * @property name - User display name
53
- * @property avatar - Optional avatar URL
54
- * @property provider - Authentication provider used
55
- * @property lastLoginAt - Timestamp of last login
56
- */
57
- export interface RememberedUser {
58
- readonly userId: string;
59
- readonly email: string;
60
- readonly name: string;
61
- readonly avatar?: string;
62
- readonly provider: AuthProvider;
63
- readonly lastLoginAt: Date;
64
- }
65
- /**
66
- * OAuth provider configuration.
67
- *
68
- * @property clientId - OAuth client identifier (required)
69
- * @property clientSecret - OAuth client secret (server-side only, optional)
70
- * @property redirectUri - Custom redirect URI (auto-generated if not provided)
71
- * @property scopes - OAuth scopes (defaults provided per provider)
72
- * @property params - Additional OAuth parameters
73
- */
74
- export interface OAuthProviderConfig {
75
- readonly clientId: string;
76
- readonly clientSecret?: string;
77
- readonly redirectUri?: string;
78
- readonly scopes?: readonly string[];
79
- readonly params?: Readonly<Record<string, string>>;
80
- }
81
- /**
82
- * OAuth providers configuration map.
83
- *
84
- * Supports built-in providers (google, github, apple, facebook) and custom providers.
85
- *
86
- * @example
87
- * ```typescript
88
- * const providers: OAuthProvidersConfig = {
89
- * google: { clientId: '...', clientSecret: '...' },
90
- * custom: { clientId: '...', scopes: ['read', 'write'] }
91
- * }
92
- * ```
93
- */
94
- export interface OAuthProvidersConfig {
95
- readonly google?: OAuthProviderConfig;
96
- readonly github?: OAuthProviderConfig;
97
- readonly apple?: OAuthProviderConfig;
98
- readonly facebook?: OAuthProviderConfig;
99
- readonly [key: string]: OAuthProviderConfig | undefined;
100
- }
101
- /**
102
- * OAuth token response from provider.
103
- *
104
- * @property access_token - Access token (required)
105
- * @property refresh_token - Refresh token (optional)
106
- * @property expires_in - Token expiration in seconds (optional)
107
- * @property token_type - Token type, typically 'Bearer' (optional)
108
- * @property id_token - ID token for OpenID Connect (optional)
109
- * @property scope - Granted scopes (optional)
110
- */
111
- export interface OAuthTokens {
112
- readonly access_token: string;
113
- readonly refresh_token?: string;
114
- readonly expires_in?: number;
115
- readonly token_type?: string;
116
- readonly id_token?: string;
117
- readonly scope?: string;
118
- }
119
- /**
120
- * Enhanced OAuth user information with tokens and provider metadata.
121
- *
122
- * This interface extends basic user info with OAuth-specific data required for
123
- * backend API integration and advanced use cases.
124
- *
125
- * @property id - User ID from OAuth provider
126
- * @property email - User email from OAuth provider
127
- * @property name - User display name
128
- * @property avatar - User avatar URL (optional)
129
- * @property emailVerified - Email verification status (optional)
130
- * @property provider - OAuth provider identifier (e.g., 'google', 'github')
131
- * @property accessToken - OAuth access token (required for backend API)
132
- * @property refreshToken - OAuth refresh token (optional)
133
- * @property tokens - Complete OAuth tokens object
134
- * @property rawProfile - Raw profile data from provider (for advanced use)
135
- *
136
- * @example
137
- * ```typescript
138
- * callbacks: {
139
- * onOAuthUser: async (userInfo) => {
140
- * // userInfo.accessToken available for backend API calls
141
- * // userInfo.rawProfile available for provider-specific data
142
- * return await createOrUpdateUser(userInfo)
143
- * }
144
- * }
145
- * ```
146
- */
147
- export interface OAuthUserInfo {
148
- readonly id: string;
149
- readonly email: string;
150
- readonly name: string;
151
- readonly avatar?: string;
152
- readonly emailVerified?: boolean;
153
- readonly provider: string;
154
- readonly accessToken: string;
155
- readonly refreshToken?: string;
156
- readonly tokens: OAuthTokens;
157
- readonly rawProfile?: Readonly<Record<string, unknown>>;
158
- readonly [key: string]: unknown;
159
- }
160
- /**
161
- * Session cookie configuration.
162
- *
163
- * @property cookieName - Cookie name (default: '__mulguard_session')
164
- * @property expiresIn - Session expiration in seconds (default: 7 days)
165
- * @property httpOnly - HttpOnly flag (default: true)
166
- * @property secure - Secure flag (default: true in production)
167
- * @property sameSite - SameSite policy (default: 'lax')
168
- * @property path - Cookie path (default: '/')
169
- * @property domain - Cookie domain (optional)
170
- * @property cacheTtl - Session cache TTL in milliseconds (default: 5000)
171
- */
172
- export interface SessionConfig {
173
- readonly cookieName?: string;
174
- readonly expiresIn?: number;
175
- readonly httpOnly?: boolean;
176
- readonly secure?: boolean;
177
- readonly sameSite?: 'strict' | 'lax' | 'none';
178
- readonly path?: string;
179
- readonly domain?: string;
180
- readonly cacheTtl?: number;
181
- }
182
- /**
183
- * Security configuration options.
184
- *
185
- * @property csrfProtection - Enable CSRF protection (default: true)
186
- * @property rateLimiting - Enable rate limiting (default: true)
187
- * @property requireHttps - Require HTTPS (default: true in production)
188
- * @property allowedOrigins - Allowed origins for CORS
189
- */
190
- export interface SecurityConfig {
191
- readonly csrfProtection?: boolean;
192
- readonly rateLimiting?: boolean;
193
- readonly requireHttps?: boolean;
194
- readonly allowedOrigins?: readonly string[];
195
- }
196
- /**
197
- * OAuth provider identifier.
198
- */
199
- export type OAuthProviderId = 'google' | 'github' | 'apple' | 'facebook' | string;
200
- /**
201
- * Sign-in provider type.
202
- */
203
- export type SignInProvider = OAuthProviderId | 'credentials' | 'passkey' | 'otp';
204
- /**
205
- * Sign-in options for unified interface.
206
- *
207
- * @property provider - Authentication provider
208
- * @property credentials - Email/password credentials (for 'credentials' provider)
209
- * @property formData - Form data (alternative to credentials)
210
- * @property options - Additional options (for 'otp' or 'passkey' providers)
211
- */
212
- export interface SignInOptions {
213
- readonly provider: SignInProvider;
214
- readonly credentials?: Readonly<EmailCredentials>;
215
- readonly formData?: FormData;
216
- readonly options?: Readonly<{
217
- userId?: string;
218
- email?: string;
219
- code?: string;
220
- }>;
221
- }
222
- /**
223
- * Lifecycle callbacks configuration.
224
- *
225
- * All callbacks are optional and can be used to hook into authentication events.
226
- *
227
- * @property onSignIn - Called after successful sign-in
228
- * @property onSignOut - Called after sign-out
229
- * @property onSessionUpdate - Called when session is updated (can modify session)
230
- * @property onError - Called on authentication errors
231
- * @property onTokenRefresh - Called when tokens are refreshed
232
- * @property onSessionExpired - Called when session expires
233
- * @property onOAuthUser - Called when OAuth user is received (for user creation/lookup)
234
- */
235
- export interface CallbacksConfig {
236
- readonly onSignIn?: (user: User, session: Session) => Promise<void> | void;
237
- readonly onSignOut?: (user: User) => Promise<void> | void;
238
- readonly onSessionUpdate?: (session: Session) => Promise<Session> | Session;
239
- readonly onError?: (error: Error, context?: string) => Promise<void> | void;
240
- readonly onTokenRefresh?: (oldSession: Session, newSession: Session) => Promise<void> | void;
241
- readonly onSessionExpired?: (session: Session) => Promise<void> | void;
242
- readonly onOAuthUser?: (userInfo: OAuthUserInfo, provider: string) => Promise<User>;
243
- }
244
- /**
245
- * Request context for Server Actions.
246
- *
247
- * Provides access to request metadata for authentication operations.
248
- *
249
- * @property headers - Request headers
250
- * @property cookies - Request cookies map
251
- * @property ip - Client IP address (optional)
252
- * @property userAgent - User agent string (optional)
253
- */
254
- export interface RequestContext {
255
- readonly headers: Headers;
256
- readonly cookies: ReadonlyMap<string, string>;
257
- readonly ip?: string;
258
- readonly userAgent?: string;
259
- }
260
- /**
261
- * Main Mulguard configuration interface.
262
- *
263
- * @template TUser - User type (extends base User)
264
- * @template TSession - Session type (extends base Session)
265
- *
266
- * @property session - Session configuration
267
- * @property actions - Custom authentication actions (required)
268
- * @property callbacks - Lifecycle callbacks (optional)
269
- * @property security - Security configuration (optional)
270
- * @property tokenRefresh - Token refresh configuration (optional)
271
- * @property providers - OAuth providers configuration (optional)
272
- * @property oauthStateStore - OAuth state store (optional, uses in-memory by default)
273
- * @property sessionCacheTtl - Session cache TTL in milliseconds (optional)
274
- */
275
- export interface MulguardConfig<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
276
- readonly session?: SessionConfig;
277
- readonly actions: AuthActions<TUser, TSession>;
278
- readonly callbacks?: CallbacksConfig;
279
- readonly security?: SecurityConfig;
280
- readonly tokenRefresh?: import('../client/token-refresh-manager').TokenRefreshConfig;
281
- readonly providers?: {
282
- readonly oauth?: OAuthProvidersConfig;
283
- };
284
- readonly oauthStateStore?: import('../auth/oauth-state-store').OAuthStateStore;
285
- readonly sessionCacheTtl?: number;
286
- }
287
- export type { User, Session, AuthResult, SuccessfulAuthResult, FailedAuthResult, TwoFactorAuthResult, EmailCredentials, RegisterData, Verify2FAData, };
288
- export { isAuthSuccess, isAuthFailure, isTwoFactorRequired } from './auth';
289
- /**
290
- * Custom authentication actions interface.
291
- *
292
- * Users implement these actions to provide custom authentication logic.
293
- * All actions are Server Actions that run on the server.
294
- *
295
- * @template TUser - User type
296
- * @template TSession - Session type
297
- */
298
- export interface AuthActions<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
299
- readonly signIn: SignInActions<TUser, TSession>;
300
- readonly signUp?: (data: RegisterData) => Promise<AuthResult<TUser, TSession>>;
301
- readonly signOut?: () => Promise<{
302
- success: boolean;
303
- error?: string;
304
- }>;
305
- readonly resetPassword?: (email: string) => Promise<{
306
- success: boolean;
307
- error?: string;
308
- }>;
309
- readonly verifyEmail?: (token: string) => Promise<{
310
- success: boolean;
311
- error?: string;
312
- }>;
313
- readonly getSession?: () => Promise<TSession | null>;
314
- readonly refreshSession?: () => Promise<TSession | null>;
315
- readonly oauthCallback?: (provider: string, code: string, state: string) => Promise<AuthResult<TUser, TSession>>;
316
- readonly passkey?: PasskeyActions<TUser, TSession>;
317
- readonly twoFactor?: TwoFactorActions<TUser, TSession>;
318
- readonly verify2FA?: (data: Verify2FAData) => Promise<AuthResult<TUser, TSession>>;
319
- }
320
- /**
321
- * Sign-in actions interface.
322
- *
323
- * @template TUser - User type
324
- * @template TSession - Session type
325
- */
326
- export interface SignInActions<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
327
- readonly email: (credentials: EmailCredentials) => Promise<AuthResult<TUser, TSession>>;
328
- readonly oauth?: (provider: string) => Promise<{
329
- url: string;
330
- state: string;
331
- }>;
332
- readonly passkey?: (options?: {
333
- userId?: string;
334
- }) => Promise<AuthResult<TUser, TSession>>;
335
- readonly otp?: (email: string, code?: string) => Promise<AuthResult<TUser, TSession>>;
336
- }
337
- /**
338
- * Passkey actions interface.
339
- *
340
- * @template TUser - User type
341
- * @template TSession - Session type
342
- */
343
- export interface PasskeyActions<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
344
- readonly register?: (options?: {
345
- name?: string;
346
- userId?: string;
347
- }) => Promise<{
348
- success: boolean;
349
- passkeyId?: string;
350
- error?: string;
351
- }>;
352
- readonly authenticate?: (options?: {
353
- userId?: string;
354
- }) => Promise<AuthResult<TUser, TSession>>;
355
- readonly list?: () => Promise<ReadonlyArray<{
356
- id: string;
357
- name: string;
358
- createdAt: Date;
359
- lastUsedAt?: Date;
360
- }>>;
361
- readonly remove?: (passKeyId: string) => Promise<{
362
- success: boolean;
363
- error?: string;
364
- }>;
365
- }
366
- /**
367
- * Two-factor authentication actions interface.
368
- *
369
- * @template TUser - User type
370
- * @template TSession - Session type
371
- */
372
- export interface TwoFactorActions<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
373
- readonly enable?: () => Promise<{
374
- success: boolean;
375
- qrCode?: string;
376
- secret?: string;
377
- error?: string;
378
- }>;
379
- readonly verify?: (code: string) => Promise<{
380
- success: boolean;
381
- backupCodes?: string[];
382
- error?: string;
383
- }>;
384
- readonly disable?: () => Promise<{
385
- success: boolean;
386
- error?: string;
387
- }>;
388
- readonly generateBackupCodes?: () => Promise<{
389
- success: boolean;
390
- backupCodes?: string[];
391
- error?: string;
392
- }>;
393
- readonly isEnabled?: () => Promise<boolean>;
394
- readonly verify2FA?: (data: Verify2FAData) => Promise<AuthResult<TUser, TSession>>;
395
- }
396
- /**
397
- * Type predicate to check if a value is a valid User object.
398
- *
399
- * @param value - Value to check
400
- * @returns True if value is a valid User
401
- *
402
- * @example
403
- * ```typescript
404
- * if (isUser(data)) {
405
- * // TypeScript knows data is User here
406
- * console.log(data.email)
407
- * }
408
- * ```
409
- */
410
- export declare function isUser(value: unknown): value is User;
411
- /**
412
- * Type predicate to check if a value is a valid Session object.
413
- *
414
- * @template TUser - User type
415
- * @param value - Value to check
416
- * @returns True if value is a valid Session
417
- *
418
- * @example
419
- * ```typescript
420
- * if (isSession(data)) {
421
- * // TypeScript knows data is Session here
422
- * console.log(data.user.email)
423
- * }
424
- * ```
425
- */
426
- export declare function isSession<TUser extends User = User>(value: unknown): value is Session<TUser>;
427
- /**
428
- * TODO: Performance
429
- * - [ ] Add type-level optimizations for large union types
430
- * - [ ] Consider using branded types for IDs to prevent mixing
431
- * - [ ] Add type-level validation for configuration objects
432
- * - [ ] Implement type-safe builder pattern for complex configurations
433
- *
434
- * TODO: Features
435
- * - [ ] Add conditional types for provider-specific OAuth configs
436
- * - [ ] Implement discriminated unions for AuthResult variants
437
- * - [ ] Add type-level session expiration checking
438
- * - [ ] Create type-safe middleware chain types
439
- * - [ ] Add generic constraints for custom User/Session extensions
440
- *
441
- * TODO: Type Safety
442
- * - [ ] Add branded types for sensitive data (tokens, passwords)
443
- * - [ ] Implement type-level validation for email formats
444
- * - [ ] Add type guards for all public interfaces
445
- * - [ ] Create type-safe error handling with exhaustiveness checking
446
- *
447
- * TODO: Testing
448
- * - [ ] Add type-level tests using ts-expect
449
- * - [ ] Test type inference in various scenarios
450
- * - [ ] Verify type narrowing with type predicates
451
- * - [ ] Test generic constraints and conditional types
452
- *
453
- * TODO: Documentation
454
- * - [ ] Add more JSDoc examples for complex types
455
- * - [ ] Document type-level patterns and best practices
456
- * - [ ] Create type usage guides
457
- *
458
- * TODO: Limitations
459
- * - [ ] Type inference may be limited with very complex generic chains
460
- * - [ ] Branded types add runtime overhead (consider compile-time only)
461
- * - [ ] Deep readonly types may impact performance with large objects
462
- */