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.
- package/README.md +21 -1078
- package/adapters.d.ts +2 -0
- package/adapters.d.ts.map +1 -0
- package/adapters.js +1 -0
- package/index.d.ts +329 -0
- package/index.d.ts.map +1 -0
- package/index.js +145 -0
- package/jwt.d.ts +9 -0
- package/jwt.d.ts.map +1 -0
- package/jwt.js +8 -0
- package/lib/actions.d.ts +13 -0
- package/lib/actions.d.ts.map +1 -0
- package/lib/actions.js +86 -0
- package/lib/client.d.ts +104 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +95 -0
- package/lib/env.d.ts +12 -0
- package/lib/env.d.ts.map +1 -0
- package/lib/env.js +38 -0
- package/lib/index.d.ts +56 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +187 -0
- package/lib/types.d.ts +24 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -0
- package/middleware.d.ts +9 -0
- package/middleware.d.ts.map +1 -0
- package/middleware.js +12 -0
- package/next.d.ts +9 -0
- package/next.d.ts.map +1 -0
- package/next.js +12 -0
- package/package.json +117 -73
- package/providers/42-school.d.ts +3 -0
- package/providers/42-school.d.ts.map +1 -0
- package/providers/42-school.js +2 -0
- package/providers/apple.d.ts +3 -0
- package/providers/apple.d.ts.map +1 -0
- package/providers/apple.js +2 -0
- package/providers/asgardeo.d.ts +3 -0
- package/providers/asgardeo.d.ts.map +1 -0
- package/providers/asgardeo.js +2 -0
- package/providers/atlassian.d.ts +3 -0
- package/providers/atlassian.d.ts.map +1 -0
- package/providers/atlassian.js +2 -0
- package/providers/auth0.d.ts +3 -0
- package/providers/auth0.d.ts.map +1 -0
- package/providers/auth0.js +2 -0
- package/providers/authentik.d.ts +3 -0
- package/providers/authentik.d.ts.map +1 -0
- package/providers/authentik.js +2 -0
- package/providers/azure-ad-b2c.d.ts +3 -0
- package/providers/azure-ad-b2c.d.ts.map +1 -0
- package/providers/azure-ad-b2c.js +2 -0
- package/providers/azure-ad.d.ts +3 -0
- package/providers/azure-ad.d.ts.map +1 -0
- package/providers/azure-ad.js +2 -0
- package/providers/azure-devops.d.ts +3 -0
- package/providers/azure-devops.d.ts.map +1 -0
- package/providers/azure-devops.js +2 -0
- package/providers/bankid-no.d.ts +3 -0
- package/providers/bankid-no.d.ts.map +1 -0
- package/providers/bankid-no.js +2 -0
- package/providers/battlenet.d.ts +3 -0
- package/providers/battlenet.d.ts.map +1 -0
- package/providers/battlenet.js +2 -0
- package/providers/beyondidentity.d.ts +3 -0
- package/providers/beyondidentity.d.ts.map +1 -0
- package/providers/beyondidentity.js +2 -0
- package/providers/bitbucket.d.ts +3 -0
- package/providers/bitbucket.d.ts.map +1 -0
- package/providers/bitbucket.js +2 -0
- package/providers/box.d.ts +3 -0
- package/providers/box.d.ts.map +1 -0
- package/providers/box.js +2 -0
- package/providers/boxyhq-saml.d.ts +3 -0
- package/providers/boxyhq-saml.d.ts.map +1 -0
- package/providers/boxyhq-saml.js +2 -0
- package/providers/bungie.d.ts +3 -0
- package/providers/bungie.d.ts.map +1 -0
- package/providers/bungie.js +2 -0
- package/providers/click-up.d.ts +3 -0
- package/providers/click-up.d.ts.map +1 -0
- package/providers/click-up.js +2 -0
- package/providers/cognito.d.ts +3 -0
- package/providers/cognito.d.ts.map +1 -0
- package/providers/cognito.js +2 -0
- package/providers/coinbase.d.ts +3 -0
- package/providers/coinbase.d.ts.map +1 -0
- package/providers/coinbase.js +2 -0
- package/providers/concept2.d.ts +3 -0
- package/providers/concept2.d.ts.map +1 -0
- package/providers/concept2.js +2 -0
- package/providers/credentials.d.ts +3 -0
- package/providers/credentials.d.ts.map +1 -0
- package/providers/credentials.js +2 -0
- package/providers/descope.d.ts +3 -0
- package/providers/descope.d.ts.map +1 -0
- package/providers/descope.js +2 -0
- package/providers/discord.d.ts +3 -0
- package/providers/discord.d.ts.map +1 -0
- package/providers/discord.js +2 -0
- package/providers/dribbble.d.ts +3 -0
- package/providers/dribbble.d.ts.map +1 -0
- package/providers/dribbble.js +2 -0
- package/providers/dropbox.d.ts +3 -0
- package/providers/dropbox.d.ts.map +1 -0
- package/providers/dropbox.js +2 -0
- package/providers/duende-identity-server6.d.ts +3 -0
- package/providers/duende-identity-server6.d.ts.map +1 -0
- package/providers/duende-identity-server6.js +2 -0
- package/providers/email.d.ts +3 -0
- package/providers/email.d.ts.map +1 -0
- package/providers/email.js +2 -0
- package/providers/eventbrite.d.ts +3 -0
- package/providers/eventbrite.d.ts.map +1 -0
- package/providers/eventbrite.js +2 -0
- package/providers/eveonline.d.ts +3 -0
- package/providers/eveonline.d.ts.map +1 -0
- package/providers/eveonline.js +2 -0
- package/providers/facebook.d.ts +3 -0
- package/providers/facebook.d.ts.map +1 -0
- package/providers/facebook.js +2 -0
- package/providers/faceit.d.ts +3 -0
- package/providers/faceit.d.ts.map +1 -0
- package/providers/faceit.js +2 -0
- package/providers/figma.d.ts +3 -0
- package/providers/figma.d.ts.map +1 -0
- package/providers/figma.js +2 -0
- package/providers/forwardemail.d.ts +3 -0
- package/providers/forwardemail.d.ts.map +1 -0
- package/providers/forwardemail.js +2 -0
- package/providers/foursquare.d.ts +3 -0
- package/providers/foursquare.d.ts.map +1 -0
- package/providers/foursquare.js +2 -0
- package/providers/freshbooks.d.ts +3 -0
- package/providers/freshbooks.d.ts.map +1 -0
- package/providers/freshbooks.js +2 -0
- package/providers/frontegg.d.ts +3 -0
- package/providers/frontegg.d.ts.map +1 -0
- package/providers/frontegg.js +2 -0
- package/providers/fusionauth.d.ts +3 -0
- package/providers/fusionauth.d.ts.map +1 -0
- package/providers/fusionauth.js +2 -0
- package/providers/github.d.ts +3 -0
- package/providers/github.d.ts.map +1 -0
- package/providers/github.js +2 -0
- package/providers/gitlab.d.ts +3 -0
- package/providers/gitlab.d.ts.map +1 -0
- package/providers/gitlab.js +2 -0
- package/providers/google.d.ts +3 -0
- package/providers/google.d.ts.map +1 -0
- package/providers/google.js +2 -0
- package/providers/hubspot.d.ts +3 -0
- package/providers/hubspot.d.ts.map +1 -0
- package/providers/hubspot.js +2 -0
- package/providers/huggingface.d.ts +3 -0
- package/providers/huggingface.d.ts.map +1 -0
- package/providers/huggingface.js +2 -0
- package/providers/identity-server4.d.ts +3 -0
- package/providers/identity-server4.d.ts.map +1 -0
- package/providers/identity-server4.js +2 -0
- package/providers/index.d.ts +2 -0
- package/providers/index.d.ts.map +1 -0
- package/providers/index.js +1 -0
- package/providers/instagram.d.ts +3 -0
- package/providers/instagram.d.ts.map +1 -0
- package/providers/instagram.js +2 -0
- package/providers/kakao.d.ts +3 -0
- package/providers/kakao.d.ts.map +1 -0
- package/providers/kakao.js +2 -0
- package/providers/keycloak.d.ts +3 -0
- package/providers/keycloak.d.ts.map +1 -0
- package/providers/keycloak.js +2 -0
- package/providers/kinde.d.ts +3 -0
- package/providers/kinde.d.ts.map +1 -0
- package/providers/kinde.js +2 -0
- package/providers/line.d.ts +3 -0
- package/providers/line.d.ts.map +1 -0
- package/providers/line.js +2 -0
- package/providers/linkedin.d.ts +3 -0
- package/providers/linkedin.d.ts.map +1 -0
- package/providers/linkedin.js +2 -0
- package/providers/logto.d.ts +3 -0
- package/providers/logto.d.ts.map +1 -0
- package/providers/logto.js +2 -0
- package/providers/loops.d.ts +3 -0
- package/providers/loops.d.ts.map +1 -0
- package/providers/loops.js +2 -0
- package/providers/mailchimp.d.ts +3 -0
- package/providers/mailchimp.d.ts.map +1 -0
- package/providers/mailchimp.js +2 -0
- package/providers/mailgun.d.ts +3 -0
- package/providers/mailgun.d.ts.map +1 -0
- package/providers/mailgun.js +2 -0
- package/providers/mailru.d.ts +3 -0
- package/providers/mailru.d.ts.map +1 -0
- package/providers/mailru.js +2 -0
- package/providers/mastodon.d.ts +3 -0
- package/providers/mastodon.d.ts.map +1 -0
- package/providers/mastodon.js +2 -0
- package/providers/mattermost.d.ts +3 -0
- package/providers/mattermost.d.ts.map +1 -0
- package/providers/mattermost.js +2 -0
- package/providers/medium.d.ts +3 -0
- package/providers/medium.d.ts.map +1 -0
- package/providers/medium.js +2 -0
- package/providers/microsoft-entra-id.d.ts +3 -0
- package/providers/microsoft-entra-id.d.ts.map +1 -0
- package/providers/microsoft-entra-id.js +2 -0
- package/providers/naver.d.ts +3 -0
- package/providers/naver.d.ts.map +1 -0
- package/providers/naver.js +2 -0
- package/providers/netlify.d.ts +3 -0
- package/providers/netlify.d.ts.map +1 -0
- package/providers/netlify.js +2 -0
- package/providers/netsuite.d.ts +3 -0
- package/providers/netsuite.d.ts.map +1 -0
- package/providers/netsuite.js +2 -0
- package/providers/nextcloud.d.ts +3 -0
- package/providers/nextcloud.d.ts.map +1 -0
- package/providers/nextcloud.js +2 -0
- package/providers/nodemailer.d.ts +3 -0
- package/providers/nodemailer.d.ts.map +1 -0
- package/providers/nodemailer.js +2 -0
- package/providers/notion.d.ts +3 -0
- package/providers/notion.d.ts.map +1 -0
- package/providers/notion.js +2 -0
- package/providers/okta.d.ts +3 -0
- package/providers/okta.d.ts.map +1 -0
- package/providers/okta.js +2 -0
- package/providers/onelogin.d.ts +3 -0
- package/providers/onelogin.d.ts.map +1 -0
- package/providers/onelogin.js +2 -0
- package/providers/ory-hydra.d.ts +3 -0
- package/providers/ory-hydra.d.ts.map +1 -0
- package/providers/ory-hydra.js +2 -0
- package/providers/osso.d.ts +3 -0
- package/providers/osso.d.ts.map +1 -0
- package/providers/osso.js +2 -0
- package/providers/osu.d.ts +3 -0
- package/providers/osu.d.ts.map +1 -0
- package/providers/osu.js +2 -0
- package/providers/passage.d.ts +3 -0
- package/providers/passage.d.ts.map +1 -0
- package/providers/passage.js +2 -0
- package/providers/passkey.d.ts +3 -0
- package/providers/passkey.d.ts.map +1 -0
- package/providers/passkey.js +2 -0
- package/providers/patreon.d.ts +3 -0
- package/providers/patreon.d.ts.map +1 -0
- package/providers/patreon.js +2 -0
- package/providers/ping-id.d.ts +3 -0
- package/providers/ping-id.d.ts.map +1 -0
- package/providers/ping-id.js +2 -0
- package/providers/pinterest.d.ts +3 -0
- package/providers/pinterest.d.ts.map +1 -0
- package/providers/pinterest.js +2 -0
- package/providers/pipedrive.d.ts +3 -0
- package/providers/pipedrive.d.ts.map +1 -0
- package/providers/pipedrive.js +2 -0
- package/providers/postmark.d.ts +3 -0
- package/providers/postmark.d.ts.map +1 -0
- package/providers/postmark.js +2 -0
- package/providers/reddit.d.ts +3 -0
- package/providers/reddit.d.ts.map +1 -0
- package/providers/reddit.js +2 -0
- package/providers/resend.d.ts +3 -0
- package/providers/resend.d.ts.map +1 -0
- package/providers/resend.js +2 -0
- package/providers/roblox.d.ts +3 -0
- package/providers/roblox.d.ts.map +1 -0
- package/providers/roblox.js +2 -0
- package/providers/salesforce.d.ts +3 -0
- package/providers/salesforce.d.ts.map +1 -0
- package/providers/salesforce.js +2 -0
- package/providers/sendgrid.d.ts +3 -0
- package/providers/sendgrid.d.ts.map +1 -0
- package/providers/sendgrid.js +2 -0
- package/providers/simplelogin.d.ts +3 -0
- package/providers/simplelogin.d.ts.map +1 -0
- package/providers/simplelogin.js +2 -0
- package/providers/slack.d.ts +3 -0
- package/providers/slack.d.ts.map +1 -0
- package/providers/slack.js +2 -0
- package/providers/spotify.d.ts +3 -0
- package/providers/spotify.d.ts.map +1 -0
- package/providers/spotify.js +2 -0
- package/providers/strava.d.ts +3 -0
- package/providers/strava.d.ts.map +1 -0
- package/providers/strava.js +2 -0
- package/providers/threads.d.ts +3 -0
- package/providers/threads.d.ts.map +1 -0
- package/providers/threads.js +2 -0
- package/providers/tiktok.d.ts +3 -0
- package/providers/tiktok.d.ts.map +1 -0
- package/providers/tiktok.js +2 -0
- package/providers/todoist.d.ts +3 -0
- package/providers/todoist.d.ts.map +1 -0
- package/providers/todoist.js +2 -0
- package/providers/trakt.d.ts +3 -0
- package/providers/trakt.d.ts.map +1 -0
- package/providers/trakt.js +2 -0
- package/providers/twitch.d.ts +3 -0
- package/providers/twitch.d.ts.map +1 -0
- package/providers/twitch.js +2 -0
- package/providers/twitter.d.ts +3 -0
- package/providers/twitter.d.ts.map +1 -0
- package/providers/twitter.js +2 -0
- package/providers/united-effects.d.ts +3 -0
- package/providers/united-effects.d.ts.map +1 -0
- package/providers/united-effects.js +2 -0
- package/providers/vipps.d.ts +3 -0
- package/providers/vipps.d.ts.map +1 -0
- package/providers/vipps.js +2 -0
- package/providers/vk.d.ts +3 -0
- package/providers/vk.d.ts.map +1 -0
- package/providers/vk.js +2 -0
- package/providers/webauthn.d.ts +3 -0
- package/providers/webauthn.d.ts.map +1 -0
- package/providers/webauthn.js +2 -0
- package/providers/webex.d.ts +3 -0
- package/providers/webex.d.ts.map +1 -0
- package/providers/webex.js +2 -0
- package/providers/wechat.d.ts +3 -0
- package/providers/wechat.d.ts.map +1 -0
- package/providers/wechat.js +2 -0
- package/providers/wikimedia.d.ts +3 -0
- package/providers/wikimedia.d.ts.map +1 -0
- package/providers/wikimedia.js +2 -0
- package/providers/wordpress.d.ts +3 -0
- package/providers/wordpress.d.ts.map +1 -0
- package/providers/wordpress.js +2 -0
- package/providers/workos.d.ts +3 -0
- package/providers/workos.d.ts.map +1 -0
- package/providers/workos.js +2 -0
- package/providers/yandex.d.ts +3 -0
- package/providers/yandex.d.ts.map +1 -0
- package/providers/yandex.js +2 -0
- package/providers/zitadel.d.ts +3 -0
- package/providers/zitadel.d.ts.map +1 -0
- package/providers/zitadel.js +2 -0
- package/providers/zoho.d.ts +3 -0
- package/providers/zoho.d.ts.map +1 -0
- package/providers/zoho.js +2 -0
- package/providers/zoom.d.ts +3 -0
- package/providers/zoom.d.ts.map +1 -0
- package/providers/zoom.js +2 -0
- package/react.d.ts +102 -0
- package/react.d.ts.map +1 -0
- package/react.js +361 -0
- package/src/adapters.ts +1 -0
- package/src/index.ts +430 -0
- package/src/jwt.ts +9 -0
- package/src/lib/actions.ts +144 -0
- package/src/lib/client.ts +245 -0
- package/src/lib/env.ts +36 -0
- package/src/lib/index.ts +313 -0
- package/src/lib/types.ts +30 -0
- package/src/middleware.ts +16 -0
- package/src/next.ts +16 -0
- package/src/providers/42-school.ts +2 -0
- package/src/providers/apple.ts +2 -0
- package/src/providers/asgardeo.ts +2 -0
- package/src/providers/atlassian.ts +2 -0
- package/src/providers/auth0.ts +2 -0
- package/src/providers/authentik.ts +2 -0
- package/src/providers/azure-ad-b2c.ts +2 -0
- package/src/providers/azure-ad.ts +2 -0
- package/src/providers/azure-devops.ts +2 -0
- package/src/providers/bankid-no.ts +2 -0
- package/src/providers/battlenet.ts +2 -0
- package/src/providers/beyondidentity.ts +2 -0
- package/src/providers/bitbucket.ts +2 -0
- package/src/providers/box.ts +2 -0
- package/src/providers/boxyhq-saml.ts +2 -0
- package/src/providers/bungie.ts +2 -0
- package/src/providers/click-up.ts +2 -0
- package/src/providers/cognito.ts +2 -0
- package/src/providers/coinbase.ts +2 -0
- package/src/providers/concept2.ts +2 -0
- package/src/providers/credentials.ts +2 -0
- package/src/providers/descope.ts +2 -0
- package/src/providers/discord.ts +2 -0
- package/src/providers/dribbble.ts +2 -0
- package/src/providers/dropbox.ts +2 -0
- package/src/providers/duende-identity-server6.ts +2 -0
- package/src/providers/email.ts +2 -0
- package/src/providers/eventbrite.ts +2 -0
- package/src/providers/eveonline.ts +2 -0
- package/src/providers/facebook.ts +2 -0
- package/src/providers/faceit.ts +2 -0
- package/src/providers/figma.ts +2 -0
- package/src/providers/forwardemail.ts +2 -0
- package/src/providers/foursquare.ts +2 -0
- package/src/providers/freshbooks.ts +2 -0
- package/src/providers/frontegg.ts +2 -0
- package/src/providers/fusionauth.ts +2 -0
- package/src/providers/github.ts +2 -0
- package/src/providers/gitlab.ts +2 -0
- package/src/providers/google.ts +2 -0
- package/src/providers/hubspot.ts +2 -0
- package/src/providers/huggingface.ts +2 -0
- package/src/providers/identity-server4.ts +2 -0
- package/src/providers/index.ts +1 -0
- package/src/providers/instagram.ts +2 -0
- package/src/providers/kakao.ts +2 -0
- package/src/providers/keycloak.ts +2 -0
- package/src/providers/kinde.ts +2 -0
- package/src/providers/line.ts +2 -0
- package/src/providers/linkedin.ts +2 -0
- package/src/providers/logto.ts +2 -0
- package/src/providers/loops.ts +2 -0
- package/src/providers/mailchimp.ts +2 -0
- package/src/providers/mailgun.ts +2 -0
- package/src/providers/mailru.ts +2 -0
- package/src/providers/mastodon.ts +2 -0
- package/src/providers/mattermost.ts +2 -0
- package/src/providers/medium.ts +2 -0
- package/src/providers/microsoft-entra-id.ts +2 -0
- package/src/providers/naver.ts +2 -0
- package/src/providers/netlify.ts +2 -0
- package/src/providers/netsuite.ts +2 -0
- package/src/providers/nextcloud.ts +2 -0
- package/src/providers/nodemailer.ts +2 -0
- package/src/providers/notion.ts +2 -0
- package/src/providers/okta.ts +2 -0
- package/src/providers/onelogin.ts +2 -0
- package/src/providers/ory-hydra.ts +2 -0
- package/src/providers/osso.ts +2 -0
- package/src/providers/osu.ts +2 -0
- package/src/providers/passage.ts +2 -0
- package/src/providers/passkey.ts +2 -0
- package/src/providers/patreon.ts +2 -0
- package/src/providers/ping-id.ts +2 -0
- package/src/providers/pinterest.ts +2 -0
- package/src/providers/pipedrive.ts +2 -0
- package/src/providers/postmark.ts +2 -0
- package/src/providers/reddit.ts +2 -0
- package/src/providers/resend.ts +2 -0
- package/src/providers/roblox.ts +2 -0
- package/src/providers/salesforce.ts +2 -0
- package/src/providers/sendgrid.ts +2 -0
- package/src/providers/simplelogin.ts +2 -0
- package/src/providers/slack.ts +2 -0
- package/src/providers/spotify.ts +2 -0
- package/src/providers/strava.ts +2 -0
- package/src/providers/threads.ts +2 -0
- package/src/providers/tiktok.ts +2 -0
- package/src/providers/todoist.ts +2 -0
- package/src/providers/trakt.ts +2 -0
- package/src/providers/twitch.ts +2 -0
- package/src/providers/twitter.ts +2 -0
- package/src/providers/united-effects.ts +2 -0
- package/src/providers/vipps.ts +2 -0
- package/src/providers/vk.ts +2 -0
- package/src/providers/webauthn.ts +2 -0
- package/src/providers/webex.ts +2 -0
- package/src/providers/wechat.ts +2 -0
- package/src/providers/wikimedia.ts +2 -0
- package/src/providers/wordpress.ts +2 -0
- package/src/providers/workos.ts +2 -0
- package/src/providers/yandex.ts +2 -0
- package/src/providers/zitadel.ts +2 -0
- package/src/providers/zoho.ts +2 -0
- package/src/providers/zoom.ts +2 -0
- package/src/react.tsx +546 -0
- package/src/webauthn.ts +152 -0
- package/webauthn.d.ts +9 -0
- package/webauthn.d.ts.map +1 -0
- package/webauthn.js +92 -0
- package/LICENSE +0 -70
- package/dist/actions-CExpv_dD.js +0 -1
- package/dist/actions-DeCfLtHA.mjs +0 -184
- package/dist/client/hooks.d.ts +0 -122
- package/dist/client/index.d.ts +0 -5
- package/dist/client/index.js +0 -1
- package/dist/client/index.mjs +0 -478
- package/dist/client/provider.d.ts +0 -69
- package/dist/client/server-actions-helper.d.ts +0 -22
- package/dist/components/AccountPicker.d.ts +0 -11
- package/dist/components/OAuthButton.d.ts +0 -11
- package/dist/components/PassKeyButton.d.ts +0 -11
- package/dist/components/PassKeyRegister.d.ts +0 -10
- package/dist/components/TwoFactorSetup.d.ts +0 -8
- package/dist/components/TwoFactorVerify.d.ts +0 -9
- package/dist/core/account-picker/encryption.d.ts +0 -22
- package/dist/core/account-picker/index.d.ts +0 -22
- package/dist/core/auth/index.d.ts +0 -40
- package/dist/core/auth/oauth-providers.d.ts +0 -197
- package/dist/core/auth/oauth-state-store-cookie.d.ts +0 -83
- package/dist/core/auth/oauth-state-store-redis.d.ts +0 -25
- package/dist/core/auth/oauth-state-store.d.ts +0 -45
- package/dist/core/auth/oauth.d.ts +0 -20
- package/dist/core/auth/passkey.d.ts +0 -35
- package/dist/core/auth/password.d.ts +0 -22
- package/dist/core/auth/signin-unified.d.ts +0 -33
- package/dist/core/auth/two-factor.d.ts +0 -28
- package/dist/core/client/index.d.ts +0 -132
- package/dist/core/client/token-refresh-manager.d.ts +0 -48
- package/dist/core/index.d.ts +0 -11
- package/dist/core/mulguard/auth-handlers.d.ts +0 -100
- package/dist/core/mulguard/defaults.d.ts +0 -58
- package/dist/core/mulguard/index.d.ts +0 -9
- package/dist/core/mulguard/oauth-handler.d.ts +0 -93
- package/dist/core/mulguard/session-manager.d.ts +0 -94
- package/dist/core/security/csrf.d.ts +0 -46
- package/dist/core/security/headers.d.ts +0 -24
- package/dist/core/security/index.d.ts +0 -132
- package/dist/core/security/rate-limit.d.ts +0 -39
- package/dist/core/security/validation.d.ts +0 -251
- package/dist/core/security/xss.d.ts +0 -20
- package/dist/core/session/index.d.ts +0 -35
- package/dist/core/types/auth.d.ts +0 -290
- package/dist/core/types/errors.d.ts +0 -200
- package/dist/core/types/index.d.ts +0 -462
- package/dist/core/utils/auth-helpers.d.ts +0 -136
- package/dist/core/utils/logger.d.ts +0 -121
- package/dist/handlers/api.d.ts +0 -10
- package/dist/handlers/route.d.ts +0 -76
- package/dist/index/index.js +0 -1
- package/dist/index/index.mjs +0 -2229
- package/dist/index.d.ts +0 -21
- package/dist/middleware/index.d.ts +0 -28
- package/dist/middleware/proxy.d.ts +0 -53
- package/dist/middleware/security.d.ts +0 -9
- package/dist/mulguard.d.ts +0 -373
- package/dist/oauth-state-DKle8eCr.mjs +0 -289
- package/dist/oauth-state-DlvrCV11.js +0 -1
- package/dist/server/actions.d.ts +0 -86
- package/dist/server/auth.d.ts +0 -65
- package/dist/server/cookies.d.ts +0 -42
- package/dist/server/helpers.d.ts +0 -10
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +0 -1
- package/dist/server/index.mjs +0 -31
- package/dist/server/middleware.d.ts +0 -39
- package/dist/server/oauth-state.d.ts +0 -30
- package/dist/server/session-helpers.d.ts +0 -26
- package/dist/server/session.d.ts +0 -28
- package/dist/server/utils.d.ts +0 -10
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Session } from '../types';
|
|
2
|
-
export interface TokenRefreshConfig {
|
|
3
|
-
/** Enable/disable automatic token refresh */
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
/** Time before token expiration to refresh (in seconds) */
|
|
6
|
-
refreshThreshold?: number;
|
|
7
|
-
/** Maximum number of refresh retries on failure */
|
|
8
|
-
maxRetries?: number;
|
|
9
|
-
/** Delay between retries (milliseconds) */
|
|
10
|
-
retryDelay?: number;
|
|
11
|
-
/** Maximum refresh requests per minute */
|
|
12
|
-
rateLimit?: number;
|
|
13
|
-
/** Enable/disable auto sign-out on refresh failure */
|
|
14
|
-
autoSignOutOnFailure?: boolean;
|
|
15
|
-
/** Login page URL for redirect on failure */
|
|
16
|
-
redirectToLogin?: string;
|
|
17
|
-
/** Enable/disable auto redirect on failure */
|
|
18
|
-
autoRedirectOnFailure?: boolean;
|
|
19
|
-
/** Callback on successful token refresh */
|
|
20
|
-
onTokenRefreshed?: (session: Session) => void | Promise<void>;
|
|
21
|
-
/** Callback on token refresh failure (before sign-out) */
|
|
22
|
-
onTokenRefreshFailed?: (error: Error) => void | Promise<void>;
|
|
23
|
-
/** Callback before redirect (can return false to cancel redirect) */
|
|
24
|
-
onBeforeRedirect?: (error: Error) => boolean | Promise<boolean>;
|
|
25
|
-
}
|
|
26
|
-
export interface TokenRefreshManager {
|
|
27
|
-
/** Refresh token with single refresh queue */
|
|
28
|
-
refreshToken(): Promise<Session | null>;
|
|
29
|
-
/** Check if refresh is in progress */
|
|
30
|
-
isRefreshing(): boolean;
|
|
31
|
-
/** Wait for current refresh to complete */
|
|
32
|
-
waitForRefresh(): Promise<Session | null>;
|
|
33
|
-
/** Clear state (on sign-out) */
|
|
34
|
-
clear(): void;
|
|
35
|
-
/** Handle token refresh failure */
|
|
36
|
-
handleRefreshFailure(error: Error): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
type RefreshFunction = () => Promise<Session | null>;
|
|
39
|
-
type SignOutFunction = () => Promise<{
|
|
40
|
-
success: boolean;
|
|
41
|
-
error?: string;
|
|
42
|
-
}>;
|
|
43
|
-
type ClearSessionFunction = () => Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Create Token Refresh Manager
|
|
46
|
-
*/
|
|
47
|
-
export declare function createTokenRefreshManager(refreshFn: RefreshFunction, signOutFn: SignOutFunction, clearSessionFn: ClearSessionFunction, config?: TokenRefreshConfig): TokenRefreshManager;
|
|
48
|
-
export {};
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core authentication library - framework agnostic
|
|
3
|
-
* Part of mulguard package
|
|
4
|
-
*/
|
|
5
|
-
export type { MulguardConfig, SessionConfig, SecurityConfig, CallbacksConfig, AuthActions, Session, User, AuthResult, EmailCredentials, RegisterData, RequestContext, } from './types';
|
|
6
|
-
export * from './security';
|
|
7
|
-
export * from './utils/auth-helpers';
|
|
8
|
-
export * from './auth/signin-unified';
|
|
9
|
-
export * from './auth/oauth-providers';
|
|
10
|
-
export * from './auth/oauth-state-store';
|
|
11
|
-
export * from './auth/oauth-state-store-redis';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { AuthResult, EmailCredentials, RegisterData, User, Session, AuthActions, CallbacksConfig } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Authentication handlers configuration.
|
|
4
|
-
*/
|
|
5
|
-
export interface AuthHandlersConfig<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
|
|
6
|
-
readonly actions: AuthActions<TUser, TSession>;
|
|
7
|
-
readonly callbacks: CallbacksConfig;
|
|
8
|
-
readonly saveSessionAfterAuth: (result: AuthResult<TUser, TSession>) => Promise<{
|
|
9
|
-
success: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
warning?: string;
|
|
12
|
-
}>;
|
|
13
|
-
readonly onError?: (error: Error, context: string) => Promise<void> | void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Sign-in handlers result.
|
|
17
|
-
*/
|
|
18
|
-
export interface SignInHandlers<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
|
|
19
|
-
readonly email: (credentials: EmailCredentials) => Promise<AuthResult<TUser, TSession>>;
|
|
20
|
-
readonly oauth?: (provider: string) => Promise<{
|
|
21
|
-
url: string;
|
|
22
|
-
state: string;
|
|
23
|
-
}>;
|
|
24
|
-
readonly passkey?: (options?: {
|
|
25
|
-
userId?: string;
|
|
26
|
-
}) => Promise<AuthResult<TUser, TSession>>;
|
|
27
|
-
readonly otp?: (email: string, code?: string) => Promise<AuthResult<TUser, TSession>>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Creates unified sign-in handler that supports both provider-based and direct method calls.
|
|
31
|
-
*
|
|
32
|
-
* @template TUser - User type
|
|
33
|
-
* @template TSession - Session type
|
|
34
|
-
* @param config - Handler configuration
|
|
35
|
-
* @param storeOAuthState - Function to store OAuth state
|
|
36
|
-
* @returns Unified sign-in handler
|
|
37
|
-
*/
|
|
38
|
-
export declare function createUnifiedSignInHandler<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>>(config: AuthHandlersConfig<TUser, TSession>, storeOAuthState: (state: string, provider: string) => Promise<void>): SignInHandlers<TUser, TSession> & {
|
|
39
|
-
(provider: string): Promise<{
|
|
40
|
-
url: string;
|
|
41
|
-
state: string;
|
|
42
|
-
}>;
|
|
43
|
-
(provider: 'credentials', credentials: EmailCredentials): Promise<AuthResult<TUser, TSession>>;
|
|
44
|
-
(provider: 'otp', options: {
|
|
45
|
-
email: string;
|
|
46
|
-
code?: string;
|
|
47
|
-
}): Promise<AuthResult<TUser, TSession>>;
|
|
48
|
-
(provider: 'passkey', options?: {
|
|
49
|
-
userId?: string;
|
|
50
|
-
}): Promise<AuthResult<TUser, TSession>>;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Creates sign-up handler.
|
|
54
|
-
*
|
|
55
|
-
* @template TUser - User type
|
|
56
|
-
* @template TSession - Session type
|
|
57
|
-
* @param config - Handler configuration
|
|
58
|
-
* @returns Sign-up handler
|
|
59
|
-
*/
|
|
60
|
-
export declare function createSignUpHandler<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>>(config: AuthHandlersConfig<TUser, TSession>): (data: RegisterData) => Promise<AuthResult<TUser, TSession>>;
|
|
61
|
-
/**
|
|
62
|
-
* TODO: Performance
|
|
63
|
-
* - [ ] Add request deduplication for concurrent sign-in attempts
|
|
64
|
-
* - [ ] Implement rate limiting per email/IP
|
|
65
|
-
* - [ ] Add sign-in attempt caching
|
|
66
|
-
* - [ ] Optimize validation logic
|
|
67
|
-
*
|
|
68
|
-
* TODO: Features
|
|
69
|
-
* - [ ] Add social login account linking
|
|
70
|
-
* - [ ] Implement sign-in with magic link
|
|
71
|
-
* - [ ] Add biometric authentication support
|
|
72
|
-
* - [ ] Create sign-in attempt tracking
|
|
73
|
-
*
|
|
74
|
-
* TODO: Type Safety
|
|
75
|
-
* - [ ] Add runtime validation for all inputs
|
|
76
|
-
* - [ ] Create type-safe credential builders
|
|
77
|
-
* - [ ] Implement compile-time provider validation
|
|
78
|
-
*
|
|
79
|
-
* TODO: Security
|
|
80
|
-
* - [ ] Add CAPTCHA support for repeated failures
|
|
81
|
-
* - [ ] Implement account lockout after failed attempts
|
|
82
|
-
* - [ ] Add device fingerprinting
|
|
83
|
-
* - [ ] Create security event logging
|
|
84
|
-
*
|
|
85
|
-
* TODO: Testing
|
|
86
|
-
* - [ ] Add comprehensive handler tests
|
|
87
|
-
* - [ ] Test all validation scenarios
|
|
88
|
-
* - [ ] Test error handling
|
|
89
|
-
* - [ ] Add integration tests
|
|
90
|
-
*
|
|
91
|
-
* TODO: Documentation
|
|
92
|
-
* - [ ] Document all sign-in methods
|
|
93
|
-
* - [ ] Add usage examples
|
|
94
|
-
* - [ ] Create troubleshooting guide
|
|
95
|
-
*
|
|
96
|
-
* TODO: Limitations
|
|
97
|
-
* - [ ] Input validation is basic (consider schema validation)
|
|
98
|
-
* - [ ] No support for custom validation rules
|
|
99
|
-
* - [ ] Error messages may be too generic
|
|
100
|
-
*/
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { SessionConfig } from '../types';
|
|
2
|
-
import { TokenRefreshConfig } from '../client/token-refresh-manager';
|
|
3
|
-
/**
|
|
4
|
-
* Default session configuration.
|
|
5
|
-
*
|
|
6
|
-
* Auto-detects environment and applies secure defaults.
|
|
7
|
-
*
|
|
8
|
-
* @returns Default session configuration
|
|
9
|
-
*/
|
|
10
|
-
export declare function getDefaultSessionConfig(): SessionConfig;
|
|
11
|
-
/**
|
|
12
|
-
* Default token refresh configuration.
|
|
13
|
-
*
|
|
14
|
-
* Optimized to prevent infinite loops and improve performance.
|
|
15
|
-
*
|
|
16
|
-
* @returns Default token refresh configuration
|
|
17
|
-
*/
|
|
18
|
-
export declare function getDefaultTokenRefreshConfig(): TokenRefreshConfig;
|
|
19
|
-
/**
|
|
20
|
-
* Gets the base URL for OAuth redirects.
|
|
21
|
-
*
|
|
22
|
-
* Detects the base URL from environment variables or defaults to localhost.
|
|
23
|
-
*
|
|
24
|
-
* @returns Base URL string
|
|
25
|
-
*/
|
|
26
|
-
export declare function getBaseUrl(): string;
|
|
27
|
-
/**
|
|
28
|
-
* TODO: Performance
|
|
29
|
-
* - [ ] Cache base URL detection result
|
|
30
|
-
* - [ ] Add configuration validation at startup
|
|
31
|
-
* - [ ] Implement configuration hot-reload support
|
|
32
|
-
*
|
|
33
|
-
* TODO: Features
|
|
34
|
-
* - [ ] Add environment-specific configuration presets
|
|
35
|
-
* - [ ] Create configuration builder pattern
|
|
36
|
-
* - [ ] Add configuration schema validation
|
|
37
|
-
* - [ ] Implement configuration inheritance
|
|
38
|
-
*
|
|
39
|
-
* TODO: Type Safety
|
|
40
|
-
* - [ ] Add type-level validation for configuration values
|
|
41
|
-
* - [ ] Create branded types for configuration
|
|
42
|
-
* - [ ] Implement compile-time configuration checking
|
|
43
|
-
*
|
|
44
|
-
* TODO: Testing
|
|
45
|
-
* - [ ] Add tests for default configurations
|
|
46
|
-
* - [ ] Test environment detection
|
|
47
|
-
* - [ ] Test configuration merging
|
|
48
|
-
*
|
|
49
|
-
* TODO: Documentation
|
|
50
|
-
* - [ ] Document all default values
|
|
51
|
-
* - [ ] Add configuration examples
|
|
52
|
-
* - [ ] Create configuration reference guide
|
|
53
|
-
*
|
|
54
|
-
* TODO: Limitations
|
|
55
|
-
* - [ ] Base URL detection is basic (consider more sophisticated detection)
|
|
56
|
-
* - [ ] No configuration validation at runtime
|
|
57
|
-
* - [ ] Defaults are fixed (consider configurable defaults)
|
|
58
|
-
*/
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { AuthResult, OAuthUserInfo, User, Session, OAuthProviderConfig, OAuthProvidersConfig, CallbacksConfig } from '../types';
|
|
2
|
-
import { exchangeOAuthCode } from '../auth/oauth-providers';
|
|
3
|
-
/**
|
|
4
|
-
* OAuth handler configuration.
|
|
5
|
-
*/
|
|
6
|
-
export interface OAuthHandlerConfig<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>> {
|
|
7
|
-
readonly oauthProviders: OAuthProvidersConfig;
|
|
8
|
-
readonly baseUrl: string;
|
|
9
|
-
readonly callbacks: CallbacksConfig;
|
|
10
|
-
readonly createSession: (user: TUser, userInfo: OAuthUserInfo, tokens: Awaited<ReturnType<typeof exchangeOAuthCode>>) => TSession;
|
|
11
|
-
readonly saveSession: (session: TSession) => Promise<void>;
|
|
12
|
-
readonly onError?: (error: Error, context: string) => Promise<void> | void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* OAuth state validation function.
|
|
16
|
-
*/
|
|
17
|
-
export type ValidateOAuthState = (state: string, provider: string) => Promise<boolean>;
|
|
18
|
-
/**
|
|
19
|
-
* Creates OAuth callback handler.
|
|
20
|
-
*
|
|
21
|
-
* Automatically handles:
|
|
22
|
-
* 1. Code exchange for tokens
|
|
23
|
-
* 2. User profile retrieval
|
|
24
|
-
* 3. User creation/lookup via callback
|
|
25
|
-
* 4. Session creation and storage
|
|
26
|
-
*
|
|
27
|
-
* @template TUser - User type
|
|
28
|
-
* @template TSession - Session type
|
|
29
|
-
* @param config - OAuth handler configuration
|
|
30
|
-
* @param validateState - Function to validate OAuth state
|
|
31
|
-
* @returns OAuth callback handler
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const handler = createOAuthCallbackHandler(config, validateState)
|
|
36
|
-
* const result = await handler('google', 'code123', 'state456')
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function createOAuthCallbackHandler<TUser extends User = User, TSession extends Session<TUser> = Session<TUser>>(config: OAuthHandlerConfig<TUser, TSession>, _validateState: ValidateOAuthState): (provider: string, code: string, _state: string) => Promise<AuthResult<TUser, TSession>>;
|
|
40
|
-
/**
|
|
41
|
-
* Creates OAuth initiation action if providers are configured.
|
|
42
|
-
*
|
|
43
|
-
* @param oauthProviders - OAuth providers configuration
|
|
44
|
-
* @param baseUrl - Base URL for redirects
|
|
45
|
-
* @param generateState - Function to generate CSRF state
|
|
46
|
-
* @param buildAuthUrl - Function to build authorization URL
|
|
47
|
-
* @returns OAuth initiation action or undefined
|
|
48
|
-
*/
|
|
49
|
-
export declare function createOAuthInitiationAction(oauthProviders: OAuthProvidersConfig, baseUrl: string, generateState: () => string, buildAuthUrl: (provider: string, config: OAuthProviderConfig, baseUrl: string, state: string) => string): ((provider: string) => Promise<{
|
|
50
|
-
url: string;
|
|
51
|
-
state: string;
|
|
52
|
-
}>) | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* TODO: Performance
|
|
55
|
-
* - [ ] Add token exchange result caching
|
|
56
|
-
* - [ ] Implement request retry logic
|
|
57
|
-
* - [ ] Add connection pooling for OAuth API calls
|
|
58
|
-
* - [ ] Cache user profile data
|
|
59
|
-
*
|
|
60
|
-
* TODO: Features
|
|
61
|
-
* - [ ] Add PKCE support
|
|
62
|
-
* - [ ] Implement token refresh flow
|
|
63
|
-
* - [ ] Add OAuth 2.1 compliance
|
|
64
|
-
* - [ ] Support for OpenID Connect
|
|
65
|
-
* - [ ] Add account linking
|
|
66
|
-
*
|
|
67
|
-
* TODO: Type Safety
|
|
68
|
-
* - [ ] Add type-safe provider configuration
|
|
69
|
-
* - [ ] Create type-level endpoint validation
|
|
70
|
-
* - [ ] Implement compile-time provider validation
|
|
71
|
-
*
|
|
72
|
-
* TODO: Security
|
|
73
|
-
* - [ ] Add token validation before use
|
|
74
|
-
* - [ ] Implement token encryption
|
|
75
|
-
* - [ ] Add request signing
|
|
76
|
-
* - [ ] Create security audit logging
|
|
77
|
-
*
|
|
78
|
-
* TODO: Testing
|
|
79
|
-
* - [ ] Add comprehensive OAuth handler tests
|
|
80
|
-
* - [ ] Test all provider flows
|
|
81
|
-
* - [ ] Test error handling
|
|
82
|
-
* - [ ] Add integration tests
|
|
83
|
-
*
|
|
84
|
-
* TODO: Documentation
|
|
85
|
-
* - [ ] Document OAuth flow
|
|
86
|
-
* - [ ] Add provider setup guides
|
|
87
|
-
* - [ ] Create troubleshooting guide
|
|
88
|
-
*
|
|
89
|
-
* TODO: Limitations
|
|
90
|
-
* - [ ] No support for OAuth 1.0
|
|
91
|
-
* - [ ] Token refresh not implemented
|
|
92
|
-
* - [ ] No PKCE support yet
|
|
93
|
-
*/
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Session, SessionConfig } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Session cache entry.
|
|
4
|
-
*/
|
|
5
|
-
interface SessionCacheEntry {
|
|
6
|
-
readonly session: Session | null;
|
|
7
|
-
readonly timestamp: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Session manager configuration.
|
|
11
|
-
*/
|
|
12
|
-
export interface SessionManagerConfig {
|
|
13
|
-
readonly sessionConfig: SessionConfig;
|
|
14
|
-
readonly cacheTtl: number;
|
|
15
|
-
readonly getSessionAction?: () => Promise<Session | null>;
|
|
16
|
-
readonly onSessionExpired?: (session: Session) => Promise<void> | void;
|
|
17
|
-
readonly onError?: (error: Error, context: string) => Promise<void> | void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Session operation result.
|
|
21
|
-
*/
|
|
22
|
-
export interface SessionResult {
|
|
23
|
-
readonly success: boolean;
|
|
24
|
-
readonly error?: string;
|
|
25
|
-
readonly warning?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates a session manager instance.
|
|
29
|
-
*
|
|
30
|
-
* @param config - Session manager configuration
|
|
31
|
-
* @returns Session manager functions
|
|
32
|
-
*/
|
|
33
|
-
export declare function createSessionManager(config: SessionManagerConfig): {
|
|
34
|
-
getSession: () => Promise<Session | null>;
|
|
35
|
-
setSession: (session: Session) => Promise<SessionResult>;
|
|
36
|
-
clearSessionCookie: () => Promise<void>;
|
|
37
|
-
getAccessToken: () => Promise<string | null>;
|
|
38
|
-
getRefreshToken: () => Promise<string | null>;
|
|
39
|
-
hasValidTokens: () => Promise<boolean>;
|
|
40
|
-
clearCache: () => void;
|
|
41
|
-
getSessionConfig: () => {
|
|
42
|
-
cookieName: string;
|
|
43
|
-
config: SessionConfig;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Type predicate to check if a value is a valid session cache entry.
|
|
48
|
-
*
|
|
49
|
-
* @param value - Value to check
|
|
50
|
-
* @returns True if value is a valid cache entry
|
|
51
|
-
*/
|
|
52
|
-
export declare function isSessionCacheEntry(value: unknown): value is SessionCacheEntry;
|
|
53
|
-
export {};
|
|
54
|
-
/**
|
|
55
|
-
* TODO: Performance
|
|
56
|
-
* - [ ] Add session compression for large sessions
|
|
57
|
-
* - [ ] Implement session chunking for very large sessions
|
|
58
|
-
* - [ ] Add session cache invalidation strategies
|
|
59
|
-
* - [ ] Consider using WeakMap for session references
|
|
60
|
-
*
|
|
61
|
-
* TODO: Features
|
|
62
|
-
* - [ ] Add session encryption at rest
|
|
63
|
-
* - [ ] Implement session rotation
|
|
64
|
-
* - [ ] Add session fingerprinting
|
|
65
|
-
* - [ ] Create session analytics
|
|
66
|
-
* - [ ] Add session migration support
|
|
67
|
-
*
|
|
68
|
-
* TODO: Type Safety
|
|
69
|
-
* - [ ] Add type-level session validation
|
|
70
|
-
* - [ ] Create type-safe session builders
|
|
71
|
-
* - [ ] Implement session schema validation
|
|
72
|
-
*
|
|
73
|
-
* TODO: Security
|
|
74
|
-
* - [ ] Add session hijacking detection
|
|
75
|
-
* - [ ] Implement session timeout warnings
|
|
76
|
-
* - [ ] Add session audit logging
|
|
77
|
-
* - [ ] Create session security monitoring
|
|
78
|
-
*
|
|
79
|
-
* TODO: Testing
|
|
80
|
-
* - [ ] Add comprehensive session manager tests
|
|
81
|
-
* - [ ] Test cache invalidation
|
|
82
|
-
* - [ ] Test session expiration
|
|
83
|
-
* - [ ] Test error handling
|
|
84
|
-
*
|
|
85
|
-
* TODO: Documentation
|
|
86
|
-
* - [ ] Document session lifecycle
|
|
87
|
-
* - [ ] Add session best practices guide
|
|
88
|
-
* - [ ] Create troubleshooting guide
|
|
89
|
-
*
|
|
90
|
-
* TODO: Limitations
|
|
91
|
-
* - [ ] Session cache is in-memory (not shared across instances)
|
|
92
|
-
* - [ ] No session persistence (consider database-backed sessions)
|
|
93
|
-
* - [ ] Session validation is basic (consider schema validation)
|
|
94
|
-
*/
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSRF Protection utilities
|
|
3
|
-
*/
|
|
4
|
-
export interface CSRFTokenStore {
|
|
5
|
-
get(key: string): string | null;
|
|
6
|
-
set(key: string, value: string, expiresIn?: number): void;
|
|
7
|
-
delete(key: string): void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* In-memory CSRF token store (for server-side)
|
|
11
|
-
*/
|
|
12
|
-
export declare class MemoryCSRFStore implements CSRFTokenStore {
|
|
13
|
-
private tokens;
|
|
14
|
-
get(key: string): string | null;
|
|
15
|
-
set(key: string, value: string, expiresIn?: number): void;
|
|
16
|
-
delete(key: string): void;
|
|
17
|
-
clear(): void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* CSRF Protection manager
|
|
21
|
-
*/
|
|
22
|
-
export declare class CSRFProtection {
|
|
23
|
-
private store;
|
|
24
|
-
private tokenLength;
|
|
25
|
-
constructor(store?: CSRFTokenStore, tokenLength?: number);
|
|
26
|
-
/**
|
|
27
|
-
* Generate CSRF token
|
|
28
|
-
*/
|
|
29
|
-
generateToken(key: string, expiresIn?: number): string;
|
|
30
|
-
/**
|
|
31
|
-
* Validate CSRF token
|
|
32
|
-
*/
|
|
33
|
-
validateToken(key: string, token: string): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Get stored token without validating
|
|
36
|
-
*/
|
|
37
|
-
getToken(key: string): string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Delete token
|
|
40
|
-
*/
|
|
41
|
-
deleteToken(key: string): void;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Create CSRF protection instance
|
|
45
|
-
*/
|
|
46
|
-
export declare function createCSRFProtection(store?: CSRFTokenStore): CSRFProtection;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Headers utilities
|
|
3
|
-
*/
|
|
4
|
-
export interface SecurityHeaders {
|
|
5
|
-
'X-Content-Type-Options'?: string;
|
|
6
|
-
'X-Frame-Options'?: string;
|
|
7
|
-
'X-XSS-Protection'?: string;
|
|
8
|
-
'Strict-Transport-Security'?: string;
|
|
9
|
-
'Content-Security-Policy'?: string;
|
|
10
|
-
'Referrer-Policy'?: string;
|
|
11
|
-
'Permissions-Policy'?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Default security headers
|
|
15
|
-
*/
|
|
16
|
-
export declare const DEFAULT_SECURITY_HEADERS: SecurityHeaders;
|
|
17
|
-
/**
|
|
18
|
-
* Get security headers
|
|
19
|
-
*/
|
|
20
|
-
export declare function getSecurityHeaders(custom?: Partial<SecurityHeaders>): SecurityHeaders;
|
|
21
|
-
/**
|
|
22
|
-
* Apply security headers to response
|
|
23
|
-
*/
|
|
24
|
-
export declare function applySecurityHeaders(headers: Headers, custom?: Partial<SecurityHeaders>): void;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security utilities for Mulguard Authentication Library.
|
|
3
|
-
*
|
|
4
|
-
* Provides token generation, CSRF protection, input sanitization, and validation.
|
|
5
|
-
*
|
|
6
|
-
* @module @mulguard/core/security
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Generates a cryptographically secure random token.
|
|
10
|
-
*
|
|
11
|
-
* @param length - Token length in bytes (default: 32)
|
|
12
|
-
* @returns Base64url-encoded token
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const token = generateToken(32)
|
|
17
|
-
* // Returns: 'abc123xyz...' (base64url encoded)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateToken(length?: number): string;
|
|
21
|
-
/**
|
|
22
|
-
* Generates a CSRF token for state validation.
|
|
23
|
-
*
|
|
24
|
-
* @returns Base64url-encoded CSRF token
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const state = generateCSRFToken()
|
|
29
|
-
* // Store state for validation
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function generateCSRFToken(): string;
|
|
33
|
-
/**
|
|
34
|
-
* Validates a CSRF token using constant-time comparison.
|
|
35
|
-
*
|
|
36
|
-
* Uses constant-time comparison to prevent timing attacks.
|
|
37
|
-
*
|
|
38
|
-
* @param token - Token to validate
|
|
39
|
-
* @param expected - Expected token value
|
|
40
|
-
* @returns True if tokens match
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* const isValid = validateCSRFToken(receivedToken, storedToken)
|
|
45
|
-
* if (!isValid) {
|
|
46
|
-
* throw new Error('Invalid CSRF token')
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export declare function validateCSRFToken(token: unknown, expected: unknown): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Type predicate to check if CSRF token is valid.
|
|
53
|
-
*
|
|
54
|
-
* @param token - Token to check
|
|
55
|
-
* @param expected - Expected token
|
|
56
|
-
* @returns True if token is valid
|
|
57
|
-
*/
|
|
58
|
-
export declare function isValidCSRFToken(token: unknown, expected: unknown): token is string;
|
|
59
|
-
/**
|
|
60
|
-
* Sanitizes string input by trimming and removing dangerous characters.
|
|
61
|
-
*
|
|
62
|
-
* @param input - Input to sanitize
|
|
63
|
-
* @returns Sanitized string
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const sanitized = sanitizeInput(' <script>alert("xss")</script> ')
|
|
68
|
-
* // Returns: 'scriptalert("xss")script'
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export declare function sanitizeInput(input: unknown): string;
|
|
72
|
-
/**
|
|
73
|
-
* Validates email format.
|
|
74
|
-
*
|
|
75
|
-
* @param email - Email to validate
|
|
76
|
-
* @returns True if email is valid
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* if (isValidEmail('user@example.com')) {
|
|
81
|
-
* // Email is valid
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare function isValidEmail(email: unknown): email is string;
|
|
86
|
-
export * from './rate-limit';
|
|
87
|
-
export * from './headers';
|
|
88
|
-
export * from './validation';
|
|
89
|
-
export * from './csrf';
|
|
90
|
-
export * from './xss';
|
|
91
|
-
/**
|
|
92
|
-
* TODO: Performance
|
|
93
|
-
* - [ ] Add token generation caching for high-frequency operations
|
|
94
|
-
* - [ ] Optimize constant-time comparison for very long tokens
|
|
95
|
-
* - [ ] Consider using Web Crypto API for token generation
|
|
96
|
-
* - [ ] Add input sanitization result caching
|
|
97
|
-
*
|
|
98
|
-
* TODO: Features
|
|
99
|
-
* - [ ] Add token expiration validation
|
|
100
|
-
* - [ ] Implement token rotation support
|
|
101
|
-
* - [ ] Add rate limiting for token generation
|
|
102
|
-
* - [ ] Create token strength scoring
|
|
103
|
-
* - [ ] Add token format validation helpers
|
|
104
|
-
*
|
|
105
|
-
* TODO: Type Safety
|
|
106
|
-
* - [ ] Add branded types for tokens
|
|
107
|
-
* - [ ] Create type-safe token validation
|
|
108
|
-
* - [ ] Add type guards for all security functions
|
|
109
|
-
* - [ ] Implement type-level security constraints
|
|
110
|
-
*
|
|
111
|
-
* TODO: Security
|
|
112
|
-
* - [ ] Add token generation logging (with masking)
|
|
113
|
-
* - [ ] Implement token blacklisting
|
|
114
|
-
* - [ ] Add security event monitoring
|
|
115
|
-
* - [ ] Create security audit logging
|
|
116
|
-
*
|
|
117
|
-
* TODO: Testing
|
|
118
|
-
* - [ ] Add comprehensive security tests
|
|
119
|
-
* - [ ] Test timing attack resistance
|
|
120
|
-
* - [ ] Test token generation randomness
|
|
121
|
-
* - [ ] Add fuzzing tests
|
|
122
|
-
*
|
|
123
|
-
* TODO: Documentation
|
|
124
|
-
* - [ ] Document security best practices
|
|
125
|
-
* - [ ] Add security considerations guide
|
|
126
|
-
* - [ ] Document token lifecycle
|
|
127
|
-
*
|
|
128
|
-
* TODO: Limitations
|
|
129
|
-
* - [ ] Token generation uses Node.js Buffer (consider Web Crypto API for browsers)
|
|
130
|
-
* - [ ] Constant-time comparison may have micro-optimizations
|
|
131
|
-
* - [ ] Email validation is basic (use validation.ts for comprehensive validation)
|
|
132
|
-
*/
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rate Limiting utilities
|
|
3
|
-
* Client-side rate limiting helpers (actual rate limiting should be on backend)
|
|
4
|
-
*/
|
|
5
|
-
export interface RateLimitConfig {
|
|
6
|
-
maxAttempts: number;
|
|
7
|
-
windowMs: number;
|
|
8
|
-
keyPrefix?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface RateLimitResult {
|
|
11
|
-
allowed: boolean;
|
|
12
|
-
remaining: number;
|
|
13
|
-
resetAt: Date;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Client-side rate limit tracker
|
|
17
|
-
* Note: This is just a helper. Real rate limiting must be enforced on the backend.
|
|
18
|
-
*/
|
|
19
|
-
export declare class RateLimiter {
|
|
20
|
-
private attempts;
|
|
21
|
-
private config;
|
|
22
|
-
constructor(config: RateLimitConfig);
|
|
23
|
-
/**
|
|
24
|
-
* Check if request is allowed
|
|
25
|
-
*/
|
|
26
|
-
check(key: string): RateLimitResult;
|
|
27
|
-
/**
|
|
28
|
-
* Reset rate limit for a key
|
|
29
|
-
*/
|
|
30
|
-
reset(key: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Clear all rate limits
|
|
33
|
-
*/
|
|
34
|
-
clear(): void;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create rate limiter instance
|
|
38
|
-
*/
|
|
39
|
-
export declare function createRateLimiter(config: RateLimitConfig): RateLimiter;
|