@entro314labs/entro-auth 0.0.0-stage → 1.8.0-beta.11
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/LICENSE.md +20 -0
- package/README.md +31 -2
- package/dist/_virtual/_rolldown/runtime.mjs +26 -0
- package/dist/adapters/drizzle-adapter/index.d.mts +1 -0
- package/dist/adapters/drizzle-adapter/index.mjs +2 -0
- package/dist/adapters/index.d.mts +19 -0
- package/dist/adapters/index.mjs +8 -0
- package/dist/adapters/kysely-adapter/index.d.mts +1 -0
- package/dist/adapters/kysely-adapter/index.mjs +2 -0
- package/dist/adapters/memory-adapter/index.d.mts +1 -0
- package/dist/adapters/memory-adapter/index.mjs +2 -0
- package/dist/api/dispatch.d.mts +31 -0
- package/dist/api/dispatch.mjs +318 -0
- package/dist/api/index.d.mts +4117 -0
- package/dist/api/index.mjs +227 -0
- package/dist/api/middlewares/authorization.d.mts +70 -0
- package/dist/api/middlewares/authorization.mjs +78 -0
- package/dist/api/middlewares/index.d.mts +3 -0
- package/dist/api/middlewares/origin-check.d.mts +12 -0
- package/dist/api/middlewares/origin-check.mjs +154 -0
- package/dist/api/rate-limiter/index.mjs +322 -0
- package/dist/api/routes/account.d.mts +407 -0
- package/dist/api/routes/account.mjs +642 -0
- package/dist/api/routes/callback.d.mts +27 -0
- package/dist/api/routes/callback.mjs +184 -0
- package/dist/api/routes/email-verification.d.mts +153 -0
- package/dist/api/routes/email-verification.mjs +315 -0
- package/dist/api/routes/error.d.mts +22 -0
- package/dist/api/routes/error.mjs +386 -0
- package/dist/api/routes/id-token-nonce.d.mts +83 -0
- package/dist/api/routes/id-token-nonce.mjs +79 -0
- package/dist/api/routes/index.d.mts +14 -0
- package/dist/api/routes/ok.d.mts +30 -0
- package/dist/api/routes/ok.mjs +26 -0
- package/dist/api/routes/password.d.mts +177 -0
- package/dist/api/routes/password.mjs +198 -0
- package/dist/api/routes/session.d.mts +446 -0
- package/dist/api/routes/session.mjs +488 -0
- package/dist/api/routes/sign-in.d.mts +182 -0
- package/dist/api/routes/sign-in.mjs +374 -0
- package/dist/api/routes/sign-out.d.mts +46 -0
- package/dist/api/routes/sign-out.mjs +101 -0
- package/dist/api/routes/sign-up.d.mts +155 -0
- package/dist/api/routes/sign-up.mjs +279 -0
- package/dist/api/routes/update-session.d.mts +70 -0
- package/dist/api/routes/update-session.mjs +56 -0
- package/dist/api/routes/update-user.d.mts +424 -0
- package/dist/api/routes/update-user.mjs +524 -0
- package/dist/api/state/oauth.d.mts +48 -0
- package/dist/api/state/oauth.mjs +38 -0
- package/dist/api/state/should-session-refresh.d.mts +10 -0
- package/dist/api/state/should-session-refresh.mjs +12 -0
- package/dist/api/to-auth-endpoints.mjs +59 -0
- package/dist/auth/base.mjs +60 -0
- package/dist/auth/full.d.mts +25 -0
- package/dist/auth/full.mjs +28 -0
- package/dist/auth/minimal.d.mts +8 -0
- package/dist/auth/minimal.mjs +10 -0
- package/dist/auth/trusted-origins.mjs +130 -0
- package/dist/client/broadcast-channel.d.mts +16 -0
- package/dist/client/broadcast-channel.mjs +44 -0
- package/dist/client/config.d.mts +84 -0
- package/dist/client/config.mjs +111 -0
- package/dist/client/equality.d.mts +15 -0
- package/dist/client/equality.mjs +41 -0
- package/dist/client/fetch-plugins.mjs +16 -0
- package/dist/client/focus-manager.d.mts +7 -0
- package/dist/client/focus-manager.mjs +30 -0
- package/dist/client/index.d.mts +35 -0
- package/dist/client/index.mjs +21 -0
- package/dist/client/lynx/index.d.mts +40 -0
- package/dist/client/lynx/index.mjs +22 -0
- package/dist/client/lynx/lynx-store.d.mts +43 -0
- package/dist/client/lynx/lynx-store.mjs +43 -0
- package/dist/client/online-manager.d.mts +8 -0
- package/dist/client/online-manager.mjs +33 -0
- package/dist/client/parser.d.mts +12 -0
- package/dist/client/parser.mjs +59 -0
- package/dist/client/path-to-object.d.mts +110 -0
- package/dist/client/plugins/index.d.mts +44 -0
- package/dist/client/plugins/index.mjs +30 -0
- package/dist/client/plugins/infer-plugin.d.mts +12 -0
- package/dist/client/plugins/infer-plugin.mjs +10 -0
- package/dist/client/proxy.mjs +70 -0
- package/dist/client/query-atom.mjs +12 -0
- package/dist/client/query.d.mts +19 -0
- package/dist/client/query.mjs +133 -0
- package/dist/client/react/index.d.mts +41 -0
- package/dist/client/react/index.mjs +22 -0
- package/dist/client/react/react-store.d.mts +43 -0
- package/dist/client/react/react-store.mjs +44 -0
- package/dist/client/session-atom.d.mts +9 -0
- package/dist/client/session-atom.mjs +179 -0
- package/dist/client/session-refresh.d.mts +16 -0
- package/dist/client/session-refresh.mjs +131 -0
- package/dist/client/solid/index.d.mts +41 -0
- package/dist/client/solid/index.mjs +22 -0
- package/dist/client/solid/solid-store.mjs +20 -0
- package/dist/client/svelte/index.d.mts +41 -0
- package/dist/client/svelte/index.mjs +18 -0
- package/dist/client/types.d.mts +49 -0
- package/dist/client/vanilla.d.mts +39 -0
- package/dist/client/vanilla.mjs +18 -0
- package/dist/client/vue/index.d.mts +64 -0
- package/dist/client/vue/index.mjs +60 -0
- package/dist/client/vue/vue-store.mjs +22 -0
- package/dist/context/create-context.mjs +229 -0
- package/dist/context/helpers.mjs +159 -0
- package/dist/context/init-minimal.mjs +15 -0
- package/dist/context/init.mjs +16 -0
- package/dist/context/secret-utils.mjs +52 -0
- package/dist/context/store-capabilities.mjs +11 -0
- package/dist/cookies/cache.mjs +33 -0
- package/dist/cookies/cookie-utils.d.mts +70 -0
- package/dist/cookies/cookie-utils.mjs +200 -0
- package/dist/cookies/index.d.mts +121 -0
- package/dist/cookies/index.mjs +356 -0
- package/dist/cookies/jwt.mjs +44 -0
- package/dist/cookies/session-store.d.mts +31 -0
- package/dist/cookies/session-store.mjs +183 -0
- package/dist/crypto/buffer.d.mts +4 -0
- package/dist/crypto/buffer.mjs +15 -0
- package/dist/crypto/index.d.mts +24 -0
- package/dist/crypto/index.mjs +70 -0
- package/dist/crypto/jwt.d.mts +5 -0
- package/dist/crypto/jwt.mjs +141 -0
- package/dist/crypto/password.d.mts +7 -0
- package/dist/crypto/password.mjs +13 -0
- package/dist/crypto/purpose.d.mts +12 -0
- package/dist/crypto/purpose.mjs +27 -0
- package/dist/crypto/random.d.mts +1 -0
- package/dist/crypto/random.mjs +4 -0
- package/dist/db/adapter-base.d.mts +3 -0
- package/dist/db/adapter-base.mjs +24 -0
- package/dist/db/adapter-kysely.d.mts +3 -0
- package/dist/db/adapter-kysely.mjs +16 -0
- package/dist/db/field-converter.d.mts +3 -0
- package/dist/db/field-converter.mjs +18 -0
- package/dist/db/field.d.mts +38 -0
- package/dist/db/get-migration.d.mts +50 -0
- package/dist/db/get-migration.mjs +685 -0
- package/dist/db/get-schema.d.mts +9 -0
- package/dist/db/get-schema.mjs +54 -0
- package/dist/db/index.d.mts +10 -0
- package/dist/db/index.mjs +34 -0
- package/dist/db/internal-adapter.d.mts +10 -0
- package/dist/db/internal-adapter.mjs +1083 -0
- package/dist/db/revoke-unproven-account-access.d.mts +18 -0
- package/dist/db/revoke-unproven-account-access.mjs +57 -0
- package/dist/db/schema.d.mts +59 -0
- package/dist/db/schema.mjs +172 -0
- package/dist/db/to-zod.d.mts +31 -0
- package/dist/db/to-zod.mjs +32 -0
- package/dist/db/verification-token-storage.mjs +24 -0
- package/dist/db/with-hooks.d.mts +33 -0
- package/dist/db/with-hooks.mjs +248 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.mjs +16 -0
- package/dist/integrations/cookie-plugin-guard.mjs +17 -0
- package/dist/integrations/next-js.d.mts +23 -0
- package/dist/integrations/next-js.mjs +104 -0
- package/dist/integrations/node.d.mts +7 -0
- package/dist/integrations/node.mjs +14 -0
- package/dist/integrations/solid-start.d.mts +19 -0
- package/dist/integrations/solid-start.mjs +14 -0
- package/dist/integrations/svelte-kit.d.mts +28 -0
- package/dist/integrations/svelte-kit.mjs +56 -0
- package/dist/integrations/tanstack-start-solid.d.mts +27 -0
- package/dist/integrations/tanstack-start-solid.mjs +56 -0
- package/dist/integrations/tanstack-start.d.mts +27 -0
- package/dist/integrations/tanstack-start.mjs +56 -0
- package/dist/oauth2/account-fields.mjs +51 -0
- package/dist/oauth2/account-key.mjs +42 -0
- package/dist/oauth2/callback.mjs +67 -0
- package/dist/oauth2/dpop-client.d.mts +1 -0
- package/dist/oauth2/dpop-client.mjs +2 -0
- package/dist/oauth2/errors.mjs +48 -0
- package/dist/oauth2/index.d.mts +5 -0
- package/dist/oauth2/index.mjs +5 -0
- package/dist/oauth2/link-account.d.mts +126 -0
- package/dist/oauth2/link-account.mjs +429 -0
- package/dist/oauth2/state.d.mts +49 -0
- package/dist/oauth2/state.mjs +66 -0
- package/dist/oauth2/utils.d.mts +21 -0
- package/dist/oauth2/utils.mjs +44 -0
- package/dist/package.mjs +3 -0
- package/dist/plugins/access/access.d.mts +13 -0
- package/dist/plugins/access/access.mjs +77 -0
- package/dist/plugins/access/index.d.mts +3 -0
- package/dist/plugins/access/index.mjs +1 -0
- package/dist/plugins/access/types.d.mts +20 -0
- package/dist/plugins/additional-fields/client.d.mts +96 -0
- package/dist/plugins/additional-fields/client.mjs +10 -0
- package/dist/plugins/admin/access/index.d.mts +2 -0
- package/dist/plugins/admin/access/index.mjs +1 -0
- package/dist/plugins/admin/access/statement.d.mts +49 -0
- package/dist/plugins/admin/access/statement.mjs +53 -0
- package/dist/plugins/admin/admin.d.mts +908 -0
- package/dist/plugins/admin/admin.mjs +90 -0
- package/dist/plugins/admin/client.d.mts +84 -0
- package/dist/plugins/admin/client.mjs +38 -0
- package/dist/plugins/admin/error-codes.d.mts +30 -0
- package/dist/plugins/admin/error-codes.mjs +33 -0
- package/dist/plugins/admin/has-permission.mjs +11 -0
- package/dist/plugins/admin/index.d.mts +3 -0
- package/dist/plugins/admin/index.mjs +1 -0
- package/dist/plugins/admin/routes.mjs +940 -0
- package/dist/plugins/admin/schema.d.mts +37 -0
- package/dist/plugins/admin/schema.mjs +32 -0
- package/dist/plugins/admin/types.d.mts +89 -0
- package/dist/plugins/anonymous/client.d.mts +28 -0
- package/dist/plugins/anonymous/client.mjs +20 -0
- package/dist/plugins/anonymous/error-codes.d.mts +10 -0
- package/dist/plugins/anonymous/error-codes.mjs +13 -0
- package/dist/plugins/anonymous/index.d.mts +170 -0
- package/dist/plugins/anonymous/index.mjs +220 -0
- package/dist/plugins/anonymous/schema.d.mts +12 -0
- package/dist/plugins/anonymous/schema.mjs +8 -0
- package/dist/plugins/anonymous/types.d.mts +62 -0
- package/dist/plugins/bearer/index.d.mts +39 -0
- package/dist/plugins/bearer/index.mjs +73 -0
- package/dist/plugins/captcha/constants.d.mts +7 -0
- package/dist/plugins/captcha/constants.mjs +27 -0
- package/dist/plugins/captcha/error-codes.mjs +12 -0
- package/dist/plugins/captcha/index.d.mts +22 -0
- package/dist/plugins/captcha/index.mjs +84 -0
- package/dist/plugins/captcha/types.d.mts +90 -0
- package/dist/plugins/captcha/utils.mjs +18 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +26 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +46 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +31 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +26 -0
- package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +26 -0
- package/dist/plugins/custom-session/client.d.mts +13 -0
- package/dist/plugins/custom-session/client.mjs +6 -0
- package/dist/plugins/custom-session/index.d.mts +65 -0
- package/dist/plugins/custom-session/index.mjs +57 -0
- package/dist/plugins/device-authorization/client.d.mts +13 -0
- package/dist/plugins/device-authorization/client.mjs +17 -0
- package/dist/plugins/device-authorization/error-codes.mjs +18 -0
- package/dist/plugins/device-authorization/index.d.mts +550 -0
- package/dist/plugins/device-authorization/index.mjs +79 -0
- package/dist/plugins/device-authorization/routes.d.mts +96 -0
- package/dist/plugins/device-authorization/routes.mjs +734 -0
- package/dist/plugins/device-authorization/schema.d.mts +15 -0
- package/dist/plugins/device-authorization/schema.mjs +62 -0
- package/dist/plugins/email-otp/client.d.mts +17 -0
- package/dist/plugins/email-otp/client.mjs +16 -0
- package/dist/plugins/email-otp/error-codes.d.mts +5 -0
- package/dist/plugins/email-otp/error-codes.mjs +8 -0
- package/dist/plugins/email-otp/index.d.mts +542 -0
- package/dist/plugins/email-otp/index.mjs +144 -0
- package/dist/plugins/email-otp/otp-token.mjs +66 -0
- package/dist/plugins/email-otp/routes.mjs +774 -0
- package/dist/plugins/email-otp/types.d.mts +105 -0
- package/dist/plugins/email-otp/utils.mjs +16 -0
- package/dist/plugins/generic-oauth/error-codes.mjs +8 -0
- package/dist/plugins/generic-oauth/index.d.mts +57 -0
- package/dist/plugins/generic-oauth/index.mjs +459 -0
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs +48 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +27 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +61 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +65 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +11 -0
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +46 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +50 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +92 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +35 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +104 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs +47 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +25 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +25 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs +65 -0
- package/dist/plugins/generic-oauth/providers/token-endpoint-audience.mjs +15 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +25 -0
- package/dist/plugins/generic-oauth/providers/yandex.mjs +66 -0
- package/dist/plugins/generic-oauth/types.d.mts +328 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +57 -0
- package/dist/plugins/haveibeenpwned/index.mjs +80 -0
- package/dist/plugins/index.d.mts +76 -0
- package/dist/plugins/index.mjs +53 -0
- package/dist/plugins/jwt/adapter.mjs +78 -0
- package/dist/plugins/jwt/client.d.mts +38 -0
- package/dist/plugins/jwt/client.mjs +18 -0
- package/dist/plugins/jwt/cookie-cache.mjs +71 -0
- package/dist/plugins/jwt/index.d.mts +241 -0
- package/dist/plugins/jwt/index.mjs +213 -0
- package/dist/plugins/jwt/schema.d.mts +30 -0
- package/dist/plugins/jwt/schema.mjs +28 -0
- package/dist/plugins/jwt/sign.d.mts +127 -0
- package/dist/plugins/jwt/sign.mjs +134 -0
- package/dist/plugins/jwt/types.d.mts +255 -0
- package/dist/plugins/jwt/utils.d.mts +36 -0
- package/dist/plugins/jwt/utils.mjs +63 -0
- package/dist/plugins/jwt/verify.d.mts +7 -0
- package/dist/plugins/jwt/verify.mjs +50 -0
- package/dist/plugins/last-login-method/client.d.mts +45 -0
- package/dist/plugins/last-login-method/client.mjs +47 -0
- package/dist/plugins/last-login-method/index.d.mts +121 -0
- package/dist/plugins/last-login-method/index.mjs +98 -0
- package/dist/plugins/magic-link/client.d.mts +6 -0
- package/dist/plugins/magic-link/client.mjs +10 -0
- package/dist/plugins/magic-link/index.d.mts +208 -0
- package/dist/plugins/magic-link/index.mjs +223 -0
- package/dist/plugins/magic-link/utils.mjs +8 -0
- package/dist/plugins/multi-session/client.d.mts +15 -0
- package/dist/plugins/multi-session/client.mjs +18 -0
- package/dist/plugins/multi-session/error-codes.d.mts +3 -0
- package/dist/plugins/multi-session/error-codes.mjs +4 -0
- package/dist/plugins/multi-session/index.d.mts +206 -0
- package/dist/plugins/multi-session/index.mjs +216 -0
- package/dist/plugins/oauth-popup/client.d.mts +74 -0
- package/dist/plugins/oauth-popup/client.mjs +204 -0
- package/dist/plugins/oauth-popup/constants.d.mts +8 -0
- package/dist/plugins/oauth-popup/constants.mjs +10 -0
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -0
- package/dist/plugins/oauth-popup/error-codes.mjs +9 -0
- package/dist/plugins/oauth-popup/index.d.mts +61 -0
- package/dist/plugins/oauth-popup/index.mjs +232 -0
- package/dist/plugins/oauth-popup/types.d.mts +26 -0
- package/dist/plugins/oauth-proxy/index.d.mts +123 -0
- package/dist/plugins/oauth-proxy/index.mjs +397 -0
- package/dist/plugins/oauth-proxy/utils.mjs +54 -0
- package/dist/plugins/one-tap/client.d.mts +187 -0
- package/dist/plugins/one-tap/client.mjs +208 -0
- package/dist/plugins/one-tap/index.d.mts +117 -0
- package/dist/plugins/one-tap/index.mjs +146 -0
- package/dist/plugins/one-time-token/client.d.mts +7 -0
- package/dist/plugins/one-time-token/client.mjs +10 -0
- package/dist/plugins/one-time-token/index.d.mts +128 -0
- package/dist/plugins/one-time-token/index.mjs +106 -0
- package/dist/plugins/one-time-token/utils.mjs +8 -0
- package/dist/plugins/open-api/generator.d.mts +124 -0
- package/dist/plugins/open-api/generator.mjs +557 -0
- package/dist/plugins/open-api/index.d.mts +93 -0
- package/dist/plugins/open-api/index.mjs +64 -0
- package/dist/plugins/open-api/logo.mjs +12 -0
- package/dist/plugins/organization/access/index.d.mts +2 -0
- package/dist/plugins/organization/access/index.mjs +1 -0
- package/dist/plugins/organization/access/statement.d.mts +111 -0
- package/dist/plugins/organization/access/statement.mjs +76 -0
- package/dist/plugins/organization/adapter.d.mts +786 -0
- package/dist/plugins/organization/adapter.mjs +821 -0
- package/dist/plugins/organization/call.mjs +14 -0
- package/dist/plugins/organization/client.d.mts +375 -0
- package/dist/plugins/organization/client.mjs +108 -0
- package/dist/plugins/organization/error-codes.d.mts +62 -0
- package/dist/plugins/organization/error-codes.mjs +65 -0
- package/dist/plugins/organization/has-permission.d.mts +12 -0
- package/dist/plugins/organization/has-permission.mjs +72 -0
- package/dist/plugins/organization/index.d.mts +7 -0
- package/dist/plugins/organization/index.mjs +5 -0
- package/dist/plugins/organization/organization.d.mts +418 -0
- package/dist/plugins/organization/organization.mjs +888 -0
- package/dist/plugins/organization/permission.d.mts +12 -0
- package/dist/plugins/organization/permission.mjs +13 -0
- package/dist/plugins/organization/roles.d.mts +6 -0
- package/dist/plugins/organization/roles.mjs +25 -0
- package/dist/plugins/organization/routes/crud-access-control.d.mts +509 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs +674 -0
- package/dist/plugins/organization/routes/crud-invites.d.mts +1173 -0
- package/dist/plugins/organization/routes/crud-invites.mjs +619 -0
- package/dist/plugins/organization/routes/crud-members.d.mts +1010 -0
- package/dist/plugins/organization/routes/crud-members.mjs +515 -0
- package/dist/plugins/organization/routes/crud-org.d.mts +914 -0
- package/dist/plugins/organization/routes/crud-org.mjs +465 -0
- package/dist/plugins/organization/routes/crud-team.d.mts +1235 -0
- package/dist/plugins/organization/routes/crud-team.mjs +767 -0
- package/dist/plugins/organization/schema.d.mts +388 -0
- package/dist/plugins/organization/schema.mjs +64 -0
- package/dist/plugins/organization/types.d.mts +688 -0
- package/dist/plugins/phone-number/client.d.mts +29 -0
- package/dist/plugins/phone-number/client.mjs +18 -0
- package/dist/plugins/phone-number/error-codes.d.mts +16 -0
- package/dist/plugins/phone-number/error-codes.mjs +19 -0
- package/dist/plugins/phone-number/index.d.mts +376 -0
- package/dist/plugins/phone-number/index.mjs +72 -0
- package/dist/plugins/phone-number/routes.mjs +612 -0
- package/dist/plugins/phone-number/schema.d.mts +19 -0
- package/dist/plugins/phone-number/schema.mjs +17 -0
- package/dist/plugins/phone-number/types.d.mts +119 -0
- package/dist/plugins/siwe/client.d.mts +10 -0
- package/dist/plugins/siwe/client.mjs +14 -0
- package/dist/plugins/siwe/index.d.mts +58 -0
- package/dist/plugins/siwe/index.mjs +288 -0
- package/dist/plugins/siwe/parse-message.mjs +57 -0
- package/dist/plugins/siwe/schema.d.mts +32 -0
- package/dist/plugins/siwe/schema.mjs +29 -0
- package/dist/plugins/siwe/types.d.mts +41 -0
- package/dist/plugins/test-utils/auth-helpers.mjs +34 -0
- package/dist/plugins/test-utils/cookie-builder.mjs +54 -0
- package/dist/plugins/test-utils/db-helpers.mjs +64 -0
- package/dist/plugins/test-utils/factories.mjs +37 -0
- package/dist/plugins/test-utils/index.d.mts +69 -0
- package/dist/plugins/test-utils/index.mjs +96 -0
- package/dist/plugins/test-utils/otp-sink.mjs +20 -0
- package/dist/plugins/test-utils/types.d.mts +49 -0
- package/dist/plugins/two-factor/backup-codes/index.d.mts +286 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs +354 -0
- package/dist/plugins/two-factor/claim.d.mts +86 -0
- package/dist/plugins/two-factor/claim.mjs +171 -0
- package/dist/plugins/two-factor/client.d.mts +76 -0
- package/dist/plugins/two-factor/client.mjs +40 -0
- package/dist/plugins/two-factor/constant.d.mts +7 -0
- package/dist/plugins/two-factor/constant.mjs +12 -0
- package/dist/plugins/two-factor/error-code.d.mts +20 -0
- package/dist/plugins/two-factor/error-code.mjs +23 -0
- package/dist/plugins/two-factor/index.d.mts +746 -0
- package/dist/plugins/two-factor/index.mjs +493 -0
- package/dist/plugins/two-factor/otp/index.d.mts +211 -0
- package/dist/plugins/two-factor/otp/index.mjs +262 -0
- package/dist/plugins/two-factor/passkey.mjs +47 -0
- package/dist/plugins/two-factor/schema.d.mts +66 -0
- package/dist/plugins/two-factor/schema.mjs +66 -0
- package/dist/plugins/two-factor/totp/index.d.mts +214 -0
- package/dist/plugins/two-factor/totp/index.mjs +290 -0
- package/dist/plugins/two-factor/types.d.mts +112 -0
- package/dist/plugins/two-factor/utils.mjs +8 -0
- package/dist/plugins/two-factor/verify-two-factor.d.mts +121 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs +314 -0
- package/dist/plugins/username/client.d.mts +34 -0
- package/dist/plugins/username/client.mjs +16 -0
- package/dist/plugins/username/error-codes.d.mts +11 -0
- package/dist/plugins/username/error-codes.mjs +14 -0
- package/dist/plugins/username/index.d.mts +319 -0
- package/dist/plugins/username/index.mjs +304 -0
- package/dist/plugins/username/schema.d.mts +45 -0
- package/dist/plugins/username/schema.mjs +24 -0
- package/dist/social-providers/index.d.mts +1 -0
- package/dist/social-providers/index.mjs +2 -0
- package/dist/state.d.mts +48 -0
- package/dist/state.mjs +153 -0
- package/dist/test-utils/headers.d.mts +5 -0
- package/dist/test-utils/headers.mjs +16 -0
- package/dist/test-utils/http-test-instance.d.mts +420 -0
- package/dist/test-utils/http-test-instance.mjs +106 -0
- package/dist/test-utils/index.d.mts +4 -0
- package/dist/test-utils/index.mjs +4 -0
- package/dist/test-utils/test-instance.d.mts +55 -0
- package/dist/test-utils/test-instance.mjs +252 -0
- package/dist/types/adapter.d.mts +2 -0
- package/dist/types/api.d.mts +24 -0
- package/dist/types/auth.d.mts +28 -0
- package/dist/types/helper.d.mts +23 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/models.d.mts +7 -0
- package/dist/types/plugins.d.mts +16 -0
- package/dist/utils/constants.mjs +3 -0
- package/dist/utils/date.mjs +5 -0
- package/dist/utils/hashing.mjs +17 -0
- package/dist/utils/hide-metadata.d.mts +2 -0
- package/dist/utils/hide-metadata.mjs +1 -0
- package/dist/utils/index.d.mts +5 -0
- package/dist/utils/is-api-error.d.mts +2 -0
- package/dist/utils/is-api-error.mjs +1 -0
- package/dist/utils/is-atom.mjs +5 -0
- package/dist/utils/is-promise.mjs +5 -0
- package/dist/utils/middleware-response.mjs +9 -0
- package/dist/utils/password.mjs +90 -0
- package/dist/utils/plugin-helper.mjs +13 -0
- package/dist/utils/request.mjs +22 -0
- package/dist/utils/shim.mjs +21 -0
- package/dist/utils/time.d.mts +46 -0
- package/dist/utils/time.mjs +97 -0
- package/dist/utils/url.d.mts +74 -0
- package/dist/utils/url.mjs +237 -0
- package/dist/utils/validate-user-info.mjs +43 -0
- package/dist/utils/wildcard.mjs +107 -0
- package/dist/version.mjs +4 -0
- package/package.json +601 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare module "@entro314labs/entro-auth-core" {
|
|
2
|
+
interface EntroAuthPluginRegistry<AuthOptions, Options> {
|
|
3
|
+
"have-i-been-pwned": {
|
|
4
|
+
creator: typeof haveIBeenPwned;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether a password appears in the Have I Been Pwned password corpus.
|
|
10
|
+
* Only the first five characters of its SHA-1 hash are sent to the service.
|
|
11
|
+
*
|
|
12
|
+
* @returns Whether the password has been compromised.
|
|
13
|
+
* @throws {APIError} When the password could not be checked.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isPasswordCompromised(password: string): Promise<boolean>;
|
|
16
|
+
export interface HaveIBeenPwnedOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Custom error message shown when a compromised password is detected.
|
|
19
|
+
*/
|
|
20
|
+
customPasswordCompromisedMessage?: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Paths to check for password
|
|
23
|
+
*
|
|
24
|
+
* @default ["/sign-up/email", "/change-password", "/reset-password", "/email-otp/reset-password", "/phone-number/reset-password", "/admin/create-user", "/admin/set-user-password"]
|
|
25
|
+
*/
|
|
26
|
+
paths?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Enable or disable password checks against the HIBP database.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
enabled?: boolean | undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefined) => {
|
|
35
|
+
id: "have-i-been-pwned";
|
|
36
|
+
version: string;
|
|
37
|
+
init(ctx: import("@entro314labs/entro-auth-core").AuthContext): {
|
|
38
|
+
context: {
|
|
39
|
+
password: {
|
|
40
|
+
hash(password: string): Promise<string>;
|
|
41
|
+
verify: (data: {
|
|
42
|
+
password: string;
|
|
43
|
+
hash: string;
|
|
44
|
+
}) => Promise<boolean>;
|
|
45
|
+
config: {
|
|
46
|
+
minPasswordLength: number;
|
|
47
|
+
maxPasswordLength: number;
|
|
48
|
+
};
|
|
49
|
+
checkPassword: (userId: string, ctx: import("@entro314labs/entro-auth-core").GenericEndpointContext<import("@entro314labs/entro-auth-core").EntroAuthOptions>) => Promise<boolean>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
options: HaveIBeenPwnedOptions | undefined;
|
|
54
|
+
$ERROR_CODES: {
|
|
55
|
+
PASSWORD_COMPROMISED: import("@entro314labs/entro-auth-core/utils/error-codes").RawError<"PASSWORD_COMPROMISED">;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { APIError } from "../../api/index.mjs";
|
|
2
|
+
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
3
|
+
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
4
|
+
import { getCurrentAuthEndpointContext } from "@entro314labs/entro-auth-core/context";
|
|
5
|
+
import { defineErrorCodes } from "@entro314labs/entro-auth-core/utils/error-codes";
|
|
6
|
+
import { createHash } from "@better-auth/utils/hash";
|
|
7
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
8
|
+
// src/plugins/haveibeenpwned/index.ts
|
|
9
|
+
const ERROR_CODES = defineErrorCodes({ PASSWORD_COMPROMISED: "The password you entered has been compromised. Please choose a different password." });
|
|
10
|
+
function getPasswordCompromiseCount(response, hashSuffix) {
|
|
11
|
+
const matchingEntryPrefix = `${hashSuffix.toUpperCase()}:`;
|
|
12
|
+
for (const line of response.split(/\r?\n/)) {
|
|
13
|
+
if (line.slice(0, matchingEntryPrefix.length).toUpperCase() !== matchingEntryPrefix) continue;
|
|
14
|
+
const compromiseCountText = line.slice(matchingEntryPrefix.length);
|
|
15
|
+
const compromiseCount = Number(compromiseCountText);
|
|
16
|
+
if (!(Number.isSafeInteger(compromiseCount) && compromiseCount >= 0 && String(compromiseCount) === compromiseCountText)) throw new Error("Invalid password compromise count");
|
|
17
|
+
return compromiseCount;
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether a password appears in the Have I Been Pwned password corpus.
|
|
23
|
+
* Only the first five characters of its SHA-1 hash are sent to the service.
|
|
24
|
+
*
|
|
25
|
+
* @returns Whether the password has been compromised.
|
|
26
|
+
* @throws {APIError} When the password could not be checked.
|
|
27
|
+
*/
|
|
28
|
+
async function isPasswordCompromised(password) {
|
|
29
|
+
try {
|
|
30
|
+
const sha1Hash = (await createHash("SHA-1", "hex").digest(password)).toUpperCase();
|
|
31
|
+
const prefix = sha1Hash.substring(0, 5);
|
|
32
|
+
const suffix = sha1Hash.substring(5);
|
|
33
|
+
const { data, error } = await betterFetch(`https://api.pwnedpasswords.com/range/${prefix}`, { headers: {
|
|
34
|
+
"Add-Padding": "true",
|
|
35
|
+
"User-Agent": "EntroAuth Password Checker"
|
|
36
|
+
} });
|
|
37
|
+
if (error) throw new APIError("INTERNAL_SERVER_ERROR", { message: `Failed to check password. Status: ${error.status}` });
|
|
38
|
+
return getPasswordCompromiseCount(data, suffix) > 0;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (isAPIError(error)) throw error;
|
|
41
|
+
throw new APIError("INTERNAL_SERVER_ERROR", { message: "Failed to check password. Please try again later." });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function rejectCompromisedPassword(password, customMessage) {
|
|
45
|
+
if (await isPasswordCompromised(password)) throw APIError.from("BAD_REQUEST", {
|
|
46
|
+
message: customMessage || ERROR_CODES.PASSWORD_COMPROMISED.message,
|
|
47
|
+
code: ERROR_CODES.PASSWORD_COMPROMISED.code
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const haveIBeenPwned = (options) => {
|
|
51
|
+
const paths = options?.paths || [
|
|
52
|
+
"/sign-up/email",
|
|
53
|
+
"/change-password",
|
|
54
|
+
"/reset-password",
|
|
55
|
+
"/email-otp/reset-password",
|
|
56
|
+
"/phone-number/reset-password",
|
|
57
|
+
"/admin/create-user",
|
|
58
|
+
"/admin/set-user-password"
|
|
59
|
+
];
|
|
60
|
+
return {
|
|
61
|
+
id: "have-i-been-pwned",
|
|
62
|
+
version: PACKAGE_VERSION,
|
|
63
|
+
init(ctx) {
|
|
64
|
+
const originalHash = ctx.password.hash;
|
|
65
|
+
return { context: { password: {
|
|
66
|
+
...ctx.password,
|
|
67
|
+
async hash(password) {
|
|
68
|
+
if (options?.enabled === false) return originalHash(password);
|
|
69
|
+
const c = getCurrentAuthEndpointContext();
|
|
70
|
+
if (!c.path || !paths.includes(c.path)) return originalHash(password);
|
|
71
|
+
await rejectCompromisedPassword(password, options?.customPasswordCompromisedMessage);
|
|
72
|
+
return originalHash(password);
|
|
73
|
+
}
|
|
74
|
+
} } };
|
|
75
|
+
},
|
|
76
|
+
options,
|
|
77
|
+
$ERROR_CODES: ERROR_CODES
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export { haveIBeenPwned, isPasswordCompromised };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginIDs } from "../types/plugins.mjs";
|
|
2
|
+
import { HIDE_METADATA } from "../utils/hide-metadata.mjs";
|
|
3
|
+
import { AccessControl, ArrayElement, ExactRoleStatements, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, Statements, SubArray, Subset } from "./access/types.mjs";
|
|
4
|
+
import { AuthorizeResponse, createAccessControl, role } from "./access/access.mjs";
|
|
5
|
+
import "./access/index.mjs";
|
|
6
|
+
import { OrganizationOptions } from "./organization/types.mjs";
|
|
7
|
+
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema } from "./organization/schema.mjs";
|
|
8
|
+
import { getOrgAdapter } from "./organization/adapter.mjs";
|
|
9
|
+
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "./admin/types.mjs";
|
|
10
|
+
import { admin } from "./admin/admin.mjs";
|
|
11
|
+
import "./admin/index.mjs";
|
|
12
|
+
import { AnonymousOptions, AnonymousSession, UserWithAnonymous } from "./anonymous/types.mjs";
|
|
13
|
+
import { anonymous } from "./anonymous/index.mjs";
|
|
14
|
+
import { BearerOptions, bearer } from "./bearer/index.mjs";
|
|
15
|
+
import { BaseCaptchaOptions, BotIdVerification, CaptchaFoxOptions, CaptchaOptions, CloudflareTurnstileOptions, GoogleRecaptchaOptions, HCaptchaOptions, Provider, ValidateRequestContext, VercelBotIdOptions } from "./captcha/types.mjs";
|
|
16
|
+
import { captcha } from "./captcha/index.mjs";
|
|
17
|
+
import { CustomSessionPluginOptions, customSession } from "./custom-session/index.mjs";
|
|
18
|
+
import { TimeString, ms, sec } from "../utils/time.mjs";
|
|
19
|
+
import { DeviceCode } from "./device-authorization/schema.mjs";
|
|
20
|
+
import { DeviceCodeRedemptionAuthorization, DeviceCodeRedemptionPreparation, DeviceCodeRedemptionResult, assertDeviceCodePending, buildVerificationUris, decideDeviceCode, findDeviceCodeByUserCode, prepareDeviceCodeRedemption, redeemDeviceCode } from "./device-authorization/routes.mjs";
|
|
21
|
+
import { DeviceAuthorizationGrant, DeviceAuthorizationGrantAuthorization, DeviceAuthorizationOptions, DeviceAuthorizationPluginOptions, DeviceAuthorizationRequest, deviceAuthorization, deviceAuthorizationOptionsSchema } from "./device-authorization/index.mjs";
|
|
22
|
+
import { EmailOTPOptions } from "./email-otp/types.mjs";
|
|
23
|
+
import { emailOTP } from "./email-otp/index.mjs";
|
|
24
|
+
import { GenericOAuthConfig, GenericOAuthOptions, GenericOAuthUserInfo } from "./generic-oauth/types.mjs";
|
|
25
|
+
import { Auth0Options, auth0 } from "./generic-oauth/providers/auth0.mjs";
|
|
26
|
+
import { GumroadOptions, gumroad } from "./generic-oauth/providers/gumroad.mjs";
|
|
27
|
+
import { HubSpotOptions, hubspot } from "./generic-oauth/providers/hubspot.mjs";
|
|
28
|
+
import { KeycloakOptions, keycloak } from "./generic-oauth/providers/keycloak.mjs";
|
|
29
|
+
import { LineOptions, line } from "./generic-oauth/providers/line.mjs";
|
|
30
|
+
import { MicrosoftEntraIdOptions, microsoftEntraId } from "./generic-oauth/providers/microsoft-entra-id.mjs";
|
|
31
|
+
import { OktaOptions, okta } from "./generic-oauth/providers/okta.mjs";
|
|
32
|
+
import { PatreonOptions, patreon } from "./generic-oauth/providers/patreon.mjs";
|
|
33
|
+
import { SlackOptions, slack } from "./generic-oauth/providers/slack.mjs";
|
|
34
|
+
import { YandexOptions, yandex } from "./generic-oauth/providers/yandex.mjs";
|
|
35
|
+
import { BaseOAuthProviderOptions, genericOAuth } from "./generic-oauth/index.mjs";
|
|
36
|
+
import { HaveIBeenPwnedOptions, haveIBeenPwned, isPasswordCompromised } from "./haveibeenpwned/index.mjs";
|
|
37
|
+
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./jwt/types.mjs";
|
|
38
|
+
import { getJwtToken, resolveSigningKey, signJWT } from "./jwt/sign.mjs";
|
|
39
|
+
import { createJwk, generateExportedKeyPair, toExpJWT } from "./jwt/utils.mjs";
|
|
40
|
+
import { verifyJWT } from "./jwt/verify.mjs";
|
|
41
|
+
import { jwt } from "./jwt/index.mjs";
|
|
42
|
+
import { LastLoginMethodOptions, lastLoginMethod } from "./last-login-method/index.mjs";
|
|
43
|
+
import { MagicLinkOptions, magicLink } from "./magic-link/index.mjs";
|
|
44
|
+
import { MULTI_SESSION_ERROR_CODES } from "./multi-session/error-codes.mjs";
|
|
45
|
+
import { MultiSessionConfig, multiSession } from "./multi-session/index.mjs";
|
|
46
|
+
import { OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_MESSAGE_TYPE, POPUP_MARKER_COOKIE } from "./oauth-popup/constants.mjs";
|
|
47
|
+
import { OAUTH_POPUP_ERROR_CODES } from "./oauth-popup/error-codes.mjs";
|
|
48
|
+
import { OAuthPopupData, OAuthPopupMessage } from "./oauth-popup/types.mjs";
|
|
49
|
+
import { OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_SCRIPT_CSP_HASH, oauthPopup } from "./oauth-popup/index.mjs";
|
|
50
|
+
import { OAuthProxyOptions, oAuthProxy } from "./oauth-proxy/index.mjs";
|
|
51
|
+
import { OneTapOptions, oneTap } from "./one-tap/index.mjs";
|
|
52
|
+
import { OneTimeTokenOptions, oneTimeToken } from "./one-time-token/index.mjs";
|
|
53
|
+
import { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator } from "./open-api/generator.mjs";
|
|
54
|
+
import { OpenAPIOptions, openAPI } from "./open-api/index.mjs";
|
|
55
|
+
import { PhoneNumberOptions, UserWithPhoneNumber } from "./phone-number/types.mjs";
|
|
56
|
+
import "./organization/index.mjs";
|
|
57
|
+
import { phoneNumber } from "./phone-number/index.mjs";
|
|
58
|
+
import { LoginResult, TestAuthOptions, TestCookie, TestHelpers, TestUtilsOptions } from "./test-utils/types.mjs";
|
|
59
|
+
import { SIWEPluginOptions, siwe } from "./siwe/index.mjs";
|
|
60
|
+
import { BackupCodeOptions, backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, verifyBackupCode } from "./two-factor/backup-codes/index.mjs";
|
|
61
|
+
import { OTPOptions, otp2fa } from "./two-factor/otp/index.mjs";
|
|
62
|
+
import { TOTPOptions, totp2fa } from "./two-factor/totp/index.mjs";
|
|
63
|
+
import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./two-factor/types.mjs";
|
|
64
|
+
import { TwoFactorClaim, withTwoFactorClaim } from "./two-factor/claim.mjs";
|
|
65
|
+
import { BACKUP_CODES_ONLY, DEFAULT_TWO_FACTOR_ALLOWED_ATTEMPTS } from "./two-factor/constant.mjs";
|
|
66
|
+
import { TWO_FACTOR_ERROR_CODES } from "./two-factor/error-code.mjs";
|
|
67
|
+
import { assertTwoFactorNotLocked, discardUnfinishedEnrollment, recordTwoFactorFailure, resetTwoFactorFailures, twoFactorIsOn, verifyTwoFactor } from "./two-factor/verify-two-factor.mjs";
|
|
68
|
+
import { twoFactorClient } from "./two-factor/client.mjs";
|
|
69
|
+
import { testUtils } from "./test-utils/index.mjs";
|
|
70
|
+
import { USERNAME_ERROR_CODES } from "./username/error-codes.mjs";
|
|
71
|
+
import { twoFactor } from "./two-factor/index.mjs";
|
|
72
|
+
import { hasPermission } from "./organization/has-permission.mjs";
|
|
73
|
+
import { parseRoles } from "./organization/roles.mjs";
|
|
74
|
+
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization } from "./organization/organization.mjs";
|
|
75
|
+
import { UsernameOptions, UsernamePlugin, UsernamePluginWithoutDisplayUsername, username } from "./username/index.mjs";
|
|
76
|
+
export { AccessControl, type AdminOptions, type AnonymousOptions, type AnonymousSession, ArrayElement, type Auth0Options, AuthorizeResponse, BACKUP_CODES_ONLY, type BackupCodeOptions, type BaseCaptchaOptions, BaseOAuthProviderOptions, BearerOptions, type BotIdVerification, type CaptchaFoxOptions, type CaptchaOptions, type CloudflareTurnstileOptions, CustomSessionPluginOptions, DEFAULT_TWO_FACTOR_ALLOWED_ATTEMPTS, DefaultOrganizationPlugin, DeviceAuthorizationGrant, DeviceAuthorizationGrantAuthorization, DeviceAuthorizationOptions, DeviceAuthorizationPluginOptions, DeviceAuthorizationRequest, type DeviceCode, type DeviceCodeRedemptionAuthorization, type DeviceCodeRedemptionPreparation, type DeviceCodeRedemptionResult, DynamicAccessControlEndpoints, MULTI_SESSION_ERROR_CODES as ERROR_CODES, type EmailOTPOptions, ExactRoleStatements, type FieldSchema, type GenericOAuthConfig, type GenericOAuthOptions, type GenericOAuthUserInfo, type GoogleRecaptchaOptions, type GumroadOptions, type HCaptchaOptions, HIDE_METADATA, HaveIBeenPwnedOptions, type HubSpotOptions, type InferAdminRolesFromOption, type InferInvitation, type InferMember, InferOptionSchema, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, InferPluginContext, InferPluginErrorCodes, InferPluginIDs, type InferTeam, type Invitation, type InvitationInput, type InvitationStatus, type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, type KeycloakOptions, LastLoginMethodOptions, type LineOptions, type LoginResult, MagicLinkOptions, type Member, type MemberInput, type MicrosoftEntraIdOptions, MultiSessionConfig, OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_ERROR_CODES, OAUTH_POPUP_MESSAGE_TYPE, OAUTH_POPUP_SCRIPT_CSP_HASH, type OAuthPopupData, type OAuthPopupMessage, OAuthProxyOptions, type OTPOptions, type OktaOptions, OneTapOptions, OneTimeTokenOptions, type OpenAPIModelSchema, OpenAPIOptions, type OpenAPIParameter, type OpenAPISchema, type Organization, OrganizationCreator, OrganizationEndpoints, type OrganizationInput, type OrganizationOptions, OrganizationPlugin, type OrganizationRole, type OrganizationSchema, POPUP_MARKER_COOKIE, type Path, type PatreonOptions, type PhoneNumberOptions, type Provider, type ResolvedSigningKey, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, SIWEPluginOptions, type SessionWithImpersonatedBy, type SlackOptions, Statements, SubArray, Subset, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type Team, TeamEndpoints, type TeamInput, type TeamMember, type TeamMemberInput, type TestAuthOptions, type TestCookie, type TestHelpers, type TestUtilsOptions, type TimeString, type TwoFactorClaim, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, USERNAME_ERROR_CODES, type UserWithAnonymous, type UserWithPhoneNumber, type UserWithRole, UserWithTwoFactor, UsernameOptions, UsernamePlugin, UsernamePluginWithoutDisplayUsername, type ValidateRequestContext, type VercelBotIdOptions, type YandexOptions, admin, anonymous, assertDeviceCodePending, assertTwoFactorNotLocked, auth0, type backupCode2fa, bearer, buildVerificationUris, captcha, createAccessControl, createJwk, customSession, decideDeviceCode, type defaultRolesSchema, deviceAuthorization, deviceAuthorizationOptionsSchema, discardUnfinishedEnrollment, emailOTP, type encodeBackupCodes, findDeviceCodeByUserCode, type generateBackupCodes, generateExportedKeyPair, type generator, genericOAuth, type getBackupCodes, getJwtToken, getOrgAdapter, gumroad, hasPermission, haveIBeenPwned, hubspot, type invitationSchema, type invitationStatus, isPasswordCompromised, jwt, keycloak, lastLoginMethod, line, magicLink, type memberSchema, microsoftEntraId, type ms, multiSession, oAuthProxy, oauthPopup, okta, oneTap, oneTimeToken, openAPI, organization, type organizationRoleSchema, type organizationSchema, type otp2fa, parseRoles, patreon, phoneNumber, prepareDeviceCodeRedemption, recordTwoFactorFailure, redeemDeviceCode, resetTwoFactorFailures, resolveSigningKey, role, type roleSchema, type sec, signJWT, siwe, slack, type teamMemberSchema, type teamSchema, testUtils, toExpJWT, type totp2fa, twoFactor, twoFactorClient, twoFactorIsOn, username, type verifyBackupCode, verifyJWT, verifyTwoFactor, withTwoFactorClaim, yandex };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HIDE_METADATA } from "../utils/hide-metadata.mjs";
|
|
2
|
+
import { createAccessControl, role } from "./access/access.mjs";
|
|
3
|
+
import { MULTI_SESSION_ERROR_CODES } from "./multi-session/error-codes.mjs";
|
|
4
|
+
import { OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_MESSAGE_TYPE, POPUP_MARKER_COOKIE } from "./oauth-popup/constants.mjs";
|
|
5
|
+
import { OAUTH_POPUP_ERROR_CODES } from "./oauth-popup/error-codes.mjs";
|
|
6
|
+
import { parseRoles } from "./organization/roles.mjs";
|
|
7
|
+
import { TWO_FACTOR_ERROR_CODES } from "./two-factor/error-code.mjs";
|
|
8
|
+
import { twoFactorClient } from "./two-factor/client.mjs";
|
|
9
|
+
import { USERNAME_ERROR_CODES } from "./username/error-codes.mjs";
|
|
10
|
+
import { withTwoFactorClaim } from "./two-factor/claim.mjs";
|
|
11
|
+
import { BACKUP_CODES_ONLY, DEFAULT_TWO_FACTOR_ALLOWED_ATTEMPTS } from "./two-factor/constant.mjs";
|
|
12
|
+
import { assertTwoFactorNotLocked, discardUnfinishedEnrollment, recordTwoFactorFailure, resetTwoFactorFailures, twoFactorIsOn, verifyTwoFactor } from "./two-factor/verify-two-factor.mjs";
|
|
13
|
+
import { admin } from "./admin/admin.mjs";
|
|
14
|
+
import { anonymous } from "./anonymous/index.mjs";
|
|
15
|
+
import { bearer } from "./bearer/index.mjs";
|
|
16
|
+
import { captcha } from "./captcha/index.mjs";
|
|
17
|
+
import { customSession } from "./custom-session/index.mjs";
|
|
18
|
+
import { assertDeviceCodePending, buildVerificationUris, decideDeviceCode, findDeviceCodeByUserCode, prepareDeviceCodeRedemption, redeemDeviceCode } from "./device-authorization/routes.mjs";
|
|
19
|
+
import { deviceAuthorization, deviceAuthorizationOptionsSchema } from "./device-authorization/index.mjs";
|
|
20
|
+
import { emailOTP } from "./email-otp/index.mjs";
|
|
21
|
+
import { auth0 } from "./generic-oauth/providers/auth0.mjs";
|
|
22
|
+
import { gumroad } from "./generic-oauth/providers/gumroad.mjs";
|
|
23
|
+
import { hubspot } from "./generic-oauth/providers/hubspot.mjs";
|
|
24
|
+
import { keycloak } from "./generic-oauth/providers/keycloak.mjs";
|
|
25
|
+
import { line } from "./generic-oauth/providers/line.mjs";
|
|
26
|
+
import { microsoftEntraId } from "./generic-oauth/providers/microsoft-entra-id.mjs";
|
|
27
|
+
import { okta } from "./generic-oauth/providers/okta.mjs";
|
|
28
|
+
import { patreon } from "./generic-oauth/providers/patreon.mjs";
|
|
29
|
+
import { slack } from "./generic-oauth/providers/slack.mjs";
|
|
30
|
+
import { yandex } from "./generic-oauth/providers/yandex.mjs";
|
|
31
|
+
import { genericOAuth } from "./generic-oauth/index.mjs";
|
|
32
|
+
import { haveIBeenPwned, isPasswordCompromised } from "./haveibeenpwned/index.mjs";
|
|
33
|
+
import { createJwk, generateExportedKeyPair, toExpJWT } from "./jwt/utils.mjs";
|
|
34
|
+
import { getJwtToken, resolveSigningKey, signJWT } from "./jwt/sign.mjs";
|
|
35
|
+
import { verifyJWT } from "./jwt/verify.mjs";
|
|
36
|
+
import { jwt } from "./jwt/index.mjs";
|
|
37
|
+
import { lastLoginMethod } from "./last-login-method/index.mjs";
|
|
38
|
+
import { magicLink } from "./magic-link/index.mjs";
|
|
39
|
+
import { multiSession } from "./multi-session/index.mjs";
|
|
40
|
+
import { OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_SCRIPT_CSP_HASH, oauthPopup } from "./oauth-popup/index.mjs";
|
|
41
|
+
import { oAuthProxy } from "./oauth-proxy/index.mjs";
|
|
42
|
+
import { oneTap } from "./one-tap/index.mjs";
|
|
43
|
+
import { oneTimeToken } from "./one-time-token/index.mjs";
|
|
44
|
+
import { openAPI } from "./open-api/index.mjs";
|
|
45
|
+
import { getOrgAdapter } from "./organization/adapter.mjs";
|
|
46
|
+
import { hasPermission } from "./organization/has-permission.mjs";
|
|
47
|
+
import { organization } from "./organization/organization.mjs";
|
|
48
|
+
import { phoneNumber } from "./phone-number/index.mjs";
|
|
49
|
+
import { siwe } from "./siwe/index.mjs";
|
|
50
|
+
import { testUtils } from "./test-utils/index.mjs";
|
|
51
|
+
import { twoFactor } from "./two-factor/index.mjs";
|
|
52
|
+
import { username } from "./username/index.mjs";
|
|
53
|
+
export { BACKUP_CODES_ONLY, DEFAULT_TWO_FACTOR_ALLOWED_ATTEMPTS, MULTI_SESSION_ERROR_CODES as ERROR_CODES, HIDE_METADATA, OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_ERROR_CODES, OAUTH_POPUP_MESSAGE_TYPE, OAUTH_POPUP_SCRIPT_CSP_HASH, POPUP_MARKER_COOKIE, TWO_FACTOR_ERROR_CODES, USERNAME_ERROR_CODES, admin, anonymous, assertDeviceCodePending, assertTwoFactorNotLocked, auth0, bearer, buildVerificationUris, captcha, createAccessControl, createJwk, customSession, decideDeviceCode, deviceAuthorization, deviceAuthorizationOptionsSchema, discardUnfinishedEnrollment, emailOTP, findDeviceCodeByUserCode, generateExportedKeyPair, genericOAuth, getJwtToken, getOrgAdapter, gumroad, hasPermission, haveIBeenPwned, hubspot, isPasswordCompromised, jwt, keycloak, lastLoginMethod, line, magicLink, microsoftEntraId, multiSession, oAuthProxy, oauthPopup, okta, oneTap, oneTimeToken, openAPI, organization, parseRoles, patreon, phoneNumber, prepareDeviceCodeRedemption, recordTwoFactorFailure, redeemDeviceCode, resetTwoFactorFailures, resolveSigningKey, role, signJWT, siwe, slack, testUtils, toExpJWT, twoFactor, twoFactorClient, twoFactorIsOn, username, verifyJWT, verifyTwoFactor, withTwoFactorClaim, yandex };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { getCurrentAdapter } from "@entro314labs/entro-auth-core/context";
|
|
2
|
+
// src/plugins/jwt/adapter.ts
|
|
3
|
+
/**
|
|
4
|
+
* Algorithm of the key the plugin generates when `jwks.keyPairConfig` is unset.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_JWK_ALG = "EdDSA";
|
|
7
|
+
/**
|
|
8
|
+
* Algorithm for new keys, and for stored keys saved before the `alg` column
|
|
9
|
+
* existed.
|
|
10
|
+
*/
|
|
11
|
+
function getDefaultKeyAlg(options) {
|
|
12
|
+
return options?.jwks?.keyPairConfig?.alg ?? "EdDSA";
|
|
13
|
+
}
|
|
14
|
+
const getJwksAdapter = (baseAdapter, options) => {
|
|
15
|
+
return {
|
|
16
|
+
getAllKeys: async (ctx) => {
|
|
17
|
+
if (options?.adapter?.getJwks) return await options.adapter.getJwks(ctx);
|
|
18
|
+
return await (await getCurrentAdapter(baseAdapter)).findMany({ model: "jwks" });
|
|
19
|
+
},
|
|
20
|
+
getLatestKey: async (ctx) => {
|
|
21
|
+
const now = /* @__PURE__ */ new Date();
|
|
22
|
+
const isLive = (k) => !k.expiresAt || k.expiresAt > now;
|
|
23
|
+
if (options?.adapter?.getJwks) return (await options.adapter.getJwks(ctx))?.filter(isLive).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0];
|
|
24
|
+
return (await (await getCurrentAdapter(baseAdapter)).findMany({ model: "jwks" }))?.filter(isLive).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0];
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Look up a key by its `id` (matches the JWS `kid` header). Returns
|
|
28
|
+
* `undefined` when no key with that id exists.
|
|
29
|
+
*
|
|
30
|
+
* When `options.adapter.getJwks` is configured (custom keyring),
|
|
31
|
+
* filters in-memory after fetching the full set — the custom adapter
|
|
32
|
+
* isn't required to implement an id index.
|
|
33
|
+
*/
|
|
34
|
+
getKeyById: async (ctx, id) => {
|
|
35
|
+
if (options?.adapter?.getJwks) return (await options.adapter.getJwks(ctx))?.find((k) => k.id === id);
|
|
36
|
+
return await (await getCurrentAdapter(baseAdapter)).findOne({
|
|
37
|
+
model: "jwks",
|
|
38
|
+
where: [{
|
|
39
|
+
field: "id",
|
|
40
|
+
value: id
|
|
41
|
+
}]
|
|
42
|
+
}) ?? void 0;
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Find the most recent key matching a specific algorithm. Used when
|
|
46
|
+
* a caller (e.g. an OAuth audience) specifies `signingAlgorithm` but
|
|
47
|
+
* not a specific `kid`. Returns `undefined` if no key with the alg
|
|
48
|
+
* exists — callers decide whether to mint one or reject.
|
|
49
|
+
*
|
|
50
|
+
* Legacy rows persisted before the `alg` column existed have
|
|
51
|
+
* `alg: null`. Per `schema.ts`, those rows are treated as the
|
|
52
|
+
* configured default alg ({@link getDefaultKeyAlg}),
|
|
53
|
+
* so deployments that have only legacy rows can still satisfy an
|
|
54
|
+
* audience-pinned `signingAlgorithm` matching the default.
|
|
55
|
+
*
|
|
56
|
+
* Expired keys are filtered out here — see `getLatestKey` for
|
|
57
|
+
* rationale.
|
|
58
|
+
*/
|
|
59
|
+
getLatestKeyByAlg: async (ctx, alg) => {
|
|
60
|
+
const candidates = options?.adapter?.getJwks ? await options.adapter.getJwks(ctx) : await (await getCurrentAdapter(baseAdapter)).findMany({ model: "jwks" });
|
|
61
|
+
if (!candidates) return void 0;
|
|
62
|
+
const configAlg = getDefaultKeyAlg(options);
|
|
63
|
+
const now = /* @__PURE__ */ new Date();
|
|
64
|
+
return candidates.filter((k) => k.alg === alg || k.alg == null && configAlg === alg).filter((k) => !k.expiresAt || k.expiresAt > now).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0];
|
|
65
|
+
},
|
|
66
|
+
createJwk: async (ctx, webKey) => {
|
|
67
|
+
if (options?.adapter?.createJwk) return await options.adapter.createJwk(webKey, ctx);
|
|
68
|
+
return await (await getCurrentAdapter(baseAdapter)).create({
|
|
69
|
+
model: "jwks",
|
|
70
|
+
data: {
|
|
71
|
+
...webKey,
|
|
72
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export { DEFAULT_JWK_ALG, getDefaultKeyAlg, getJwksAdapter };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jwt } from "./index.mjs";
|
|
2
|
+
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
3
|
+
import { ClientFetchOption, ClientStore, EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
4
|
+
import { JSONWebKeySet } from "jose";
|
|
5
|
+
import { BetterFetch } from "@better-fetch/fetch";
|
|
6
|
+
interface JwtClientOptions {
|
|
7
|
+
jwks?: {
|
|
8
|
+
/**
|
|
9
|
+
* The path of the endpoint exposing the JWKS.
|
|
10
|
+
* Must match the server configuration.
|
|
11
|
+
*
|
|
12
|
+
* @default /jwks
|
|
13
|
+
*/
|
|
14
|
+
jwksPath?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare const jwtClient: (options?: JwtClientOptions) => {
|
|
18
|
+
id: "entro-auth-client";
|
|
19
|
+
version: string;
|
|
20
|
+
$InferServerPlugin: ReturnType<typeof jwt>;
|
|
21
|
+
pathMethods: {
|
|
22
|
+
[x: string]: "GET";
|
|
23
|
+
};
|
|
24
|
+
getActions: ($fetch: BetterFetch, _$store: ClientStore, _options: EntroAuthClientOptions | undefined) => {
|
|
25
|
+
jwks: (fetchOptions?: ClientFetchOption) => Promise<{
|
|
26
|
+
data: null;
|
|
27
|
+
error: {
|
|
28
|
+
message?: string | undefined;
|
|
29
|
+
status: number;
|
|
30
|
+
statusText: string;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
data: JSONWebKeySet;
|
|
34
|
+
error: null;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
|
+
// src/plugins/jwt/client.ts
|
|
3
|
+
const jwtClient = (options) => {
|
|
4
|
+
const jwksPath = options?.jwks?.jwksPath ?? "/jwks";
|
|
5
|
+
return {
|
|
6
|
+
id: "entro-auth-client",
|
|
7
|
+
version: PACKAGE_VERSION,
|
|
8
|
+
$InferServerPlugin: {},
|
|
9
|
+
pathMethods: { [jwksPath]: "GET" },
|
|
10
|
+
getActions: ($fetch, _$store, _options) => ({ jwks: async (fetchOptions) => {
|
|
11
|
+
return await $fetch(jwksPath, {
|
|
12
|
+
method: "GET",
|
|
13
|
+
...fetchOptions
|
|
14
|
+
});
|
|
15
|
+
} })
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export { jwtClient };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { SESSION_COOKIE_JWT_AUDIENCE, SESSION_COOKIE_JWT_TYPE, getSessionCookieJwtVerifyOptions, parseSessionCookieJwtPayload } from "../../cookies/jwt.mjs";
|
|
2
|
+
import { getDefaultKeyAlg, getJwksAdapter } from "./adapter.mjs";
|
|
3
|
+
import { resolveSigningKey } from "./sign.mjs";
|
|
4
|
+
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
5
|
+
import { SignJWT, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
|
|
6
|
+
// src/plugins/jwt/cookie-cache.ts
|
|
7
|
+
function getCookieCacheJwtIssuer(ctx) {
|
|
8
|
+
const baseURL = ctx.context.options.baseURL;
|
|
9
|
+
return typeof baseURL === "string" ? baseURL || "entro-auth:session-cache" : ctx.context.baseURL || "entro-auth:session-cache";
|
|
10
|
+
}
|
|
11
|
+
async function importLocalPublicKey(ctx, token, options) {
|
|
12
|
+
const kid = decodeProtectedHeader(token).kid;
|
|
13
|
+
if (!kid) {
|
|
14
|
+
ctx.context.logger.debug("Cookie-cache JWT missing kid in header");
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const keys = await getJwksAdapter(ctx.context.adapter, options).getAllKeys(ctx);
|
|
18
|
+
if (!keys?.length) {
|
|
19
|
+
ctx.context.logger.debug("No JWKS keys available for cookie-cache JWT");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const key = keys.find((entry) => entry.id === kid);
|
|
23
|
+
if (!key) {
|
|
24
|
+
ctx.context.logger.debug(`No JWKS key found for cookie-cache JWT kid: ${kid}`);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const alg = key.alg ?? getDefaultKeyAlg(options);
|
|
28
|
+
return {
|
|
29
|
+
alg,
|
|
30
|
+
publicKey: await importJWK(JSON.parse(key.publicKey), alg)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function signCookieCacheJWT(ctx, payload, expiresIn, options) {
|
|
34
|
+
const resolvedKey = await resolveSigningKey(ctx, options);
|
|
35
|
+
if (!resolvedKey) throw new EntroAuthError("`jwt({ sessionCookieCache: true })` requires locally managed JWT plugin keys and does not support `jwt.sign`.");
|
|
36
|
+
return await new SignJWT({
|
|
37
|
+
...payload,
|
|
38
|
+
sid: payload.session.token
|
|
39
|
+
}).setProtectedHeader({
|
|
40
|
+
alg: resolvedKey.alg,
|
|
41
|
+
kid: resolvedKey.kid,
|
|
42
|
+
typ: SESSION_COOKIE_JWT_TYPE
|
|
43
|
+
}).setIssuedAt().setExpirationTime(Math.floor(Date.now() / 1e3) + expiresIn).setIssuer(getCookieCacheJwtIssuer(ctx)).setAudience(SESSION_COOKIE_JWT_AUDIENCE).setSubject(payload.user.id).sign(resolvedKey.privateKey);
|
|
44
|
+
}
|
|
45
|
+
async function verifyCookieCacheJWT(ctx, token, options) {
|
|
46
|
+
try {
|
|
47
|
+
if (decodeProtectedHeader(token).typ !== "entro-auth.session-cache+jwt") return null;
|
|
48
|
+
const key = await importLocalPublicKey(ctx, token, options);
|
|
49
|
+
if (!key) return null;
|
|
50
|
+
const { payload } = await jwtVerify(token, key.publicKey, {
|
|
51
|
+
...getSessionCookieJwtVerifyOptions({ issuer: getCookieCacheJwtIssuer(ctx) }),
|
|
52
|
+
algorithms: [key.alg]
|
|
53
|
+
});
|
|
54
|
+
const parsed = parseSessionCookieJwtPayload(payload);
|
|
55
|
+
if (!parsed) return null;
|
|
56
|
+
return {
|
|
57
|
+
payload: parsed,
|
|
58
|
+
expiresAt: parsed.exp ? parsed.exp * 1e3 : Date.now()
|
|
59
|
+
};
|
|
60
|
+
} catch (error) {
|
|
61
|
+
ctx.context.logger.debug("Cookie-cache JWT verification failed", error);
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function createCookieCacheSigner(options) {
|
|
66
|
+
return {
|
|
67
|
+
sign: (ctx, payload, expiresIn) => signCookieCacheJWT(ctx, payload, expiresIn, options),
|
|
68
|
+
verify: (ctx, token) => verifyCookieCacheJWT(ctx, token, options)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export { createCookieCacheSigner };
|