@sirketio/auth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/adapter/index.d.mts +4 -0
- package/dist/adapter/index.mjs +7 -0
- package/dist/api/index.d.mts +3872 -0
- package/dist/api/index.mjs +206 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/middlewares/index.d.mts +1 -0
- package/dist/api/middlewares/index.mjs +3 -0
- package/dist/api/middlewares/origin-check.d.mts +18 -0
- package/dist/api/middlewares/origin-check.mjs +140 -0
- package/dist/api/middlewares/origin-check.mjs.map +1 -0
- package/dist/api/rate-limiter/index.mjs +204 -0
- package/dist/api/rate-limiter/index.mjs.map +1 -0
- package/dist/api/routes/account.d.mts +410 -0
- package/dist/api/routes/account.mjs +493 -0
- package/dist/api/routes/account.mjs.map +1 -0
- package/dist/api/routes/callback.d.mts +31 -0
- package/dist/api/routes/callback.mjs +179 -0
- package/dist/api/routes/callback.mjs.map +1 -0
- package/dist/api/routes/email-verification.d.mts +161 -0
- package/dist/api/routes/email-verification.mjs +299 -0
- package/dist/api/routes/email-verification.mjs.map +1 -0
- package/dist/api/routes/error.d.mts +28 -0
- package/dist/api/routes/error.mjs +386 -0
- package/dist/api/routes/error.mjs.map +1 -0
- package/dist/api/routes/index.d.mts +11 -0
- package/dist/api/routes/index.mjs +13 -0
- package/dist/api/routes/ok.d.mts +36 -0
- package/dist/api/routes/ok.mjs +30 -0
- package/dist/api/routes/ok.mjs.map +1 -0
- package/dist/api/routes/password.d.mts +182 -0
- package/dist/api/routes/password.mjs +198 -0
- package/dist/api/routes/password.mjs.map +1 -0
- package/dist/api/routes/session.d.mts +415 -0
- package/dist/api/routes/session.mjs +483 -0
- package/dist/api/routes/session.mjs.map +1 -0
- package/dist/api/routes/sign-in.d.mts +171 -0
- package/dist/api/routes/sign-in.mjs +263 -0
- package/dist/api/routes/sign-in.mjs.map +1 -0
- package/dist/api/routes/sign-out.d.mts +36 -0
- package/dist/api/routes/sign-out.mjs +33 -0
- package/dist/api/routes/sign-out.mjs.map +1 -0
- package/dist/api/routes/sign-up.d.mts +160 -0
- package/dist/api/routes/sign-up.mjs +227 -0
- package/dist/api/routes/sign-up.mjs.map +1 -0
- package/dist/api/routes/update-user.d.mts +445 -0
- package/dist/api/routes/update-user.mjs +493 -0
- package/dist/api/routes/update-user.mjs.map +1 -0
- package/dist/api/state/oauth.d.mts +18 -0
- package/dist/api/state/oauth.mjs +8 -0
- package/dist/api/state/oauth.mjs.map +1 -0
- package/dist/api/state/should-session-refresh.d.mts +13 -0
- package/dist/api/state/should-session-refresh.mjs +16 -0
- package/dist/api/state/should-session-refresh.mjs.map +1 -0
- package/dist/api/to-auth-endpoints.mjs +197 -0
- package/dist/api/to-auth-endpoints.mjs.map +1 -0
- package/dist/auth/base.mjs +45 -0
- package/dist/auth/base.mjs.map +1 -0
- package/dist/auth/minimal.d.mts +12 -0
- package/dist/auth/minimal.mjs +14 -0
- package/dist/auth/minimal.mjs.map +1 -0
- package/dist/auth/trusted-origins.mjs +31 -0
- package/dist/auth/trusted-origins.mjs.map +1 -0
- package/dist/client/broadcast-channel.d.mts +20 -0
- package/dist/client/broadcast-channel.mjs +46 -0
- package/dist/client/broadcast-channel.mjs.map +1 -0
- package/dist/client/config.mjs +90 -0
- package/dist/client/config.mjs.map +1 -0
- package/dist/client/fetch-plugins.mjs +18 -0
- package/dist/client/fetch-plugins.mjs.map +1 -0
- package/dist/client/focus-manager.d.mts +11 -0
- package/dist/client/focus-manager.mjs +32 -0
- package/dist/client/focus-manager.mjs.map +1 -0
- package/dist/client/index.d.mts +33 -0
- package/dist/client/index.mjs +21 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/client/online-manager.d.mts +12 -0
- package/dist/client/online-manager.mjs +35 -0
- package/dist/client/online-manager.mjs.map +1 -0
- package/dist/client/parser.mjs +73 -0
- package/dist/client/parser.mjs.map +1 -0
- package/dist/client/path-to-object.d.mts +65 -0
- package/dist/client/plugins/index.d.mts +53 -0
- package/dist/client/plugins/index.mjs +30 -0
- package/dist/client/plugins/infer-plugin.d.mts +16 -0
- package/dist/client/plugins/infer-plugin.mjs +11 -0
- package/dist/client/plugins/infer-plugin.mjs.map +1 -0
- package/dist/client/proxy.mjs +79 -0
- package/dist/client/proxy.mjs.map +1 -0
- package/dist/client/query.d.mts +23 -0
- package/dist/client/query.mjs +98 -0
- package/dist/client/query.mjs.map +1 -0
- package/dist/client/react/index.d.mts +128 -0
- package/dist/client/react/index.mjs +24 -0
- package/dist/client/react/index.mjs.map +1 -0
- package/dist/client/react/react-store.d.mts +47 -0
- package/dist/client/react/react-store.mjs +47 -0
- package/dist/client/react/react-store.mjs.map +1 -0
- package/dist/client/session-atom.mjs +29 -0
- package/dist/client/session-atom.mjs.map +1 -0
- package/dist/client/session-refresh.d.mts +28 -0
- package/dist/client/session-refresh.mjs +140 -0
- package/dist/client/session-refresh.mjs.map +1 -0
- package/dist/client/types.d.mts +41 -0
- package/dist/client/vanilla.d.mts +127 -0
- package/dist/client/vanilla.mjs +20 -0
- package/dist/client/vanilla.mjs.map +1 -0
- package/dist/context/create-context.mjs +211 -0
- package/dist/context/create-context.mjs.map +1 -0
- package/dist/context/helpers.mjs +83 -0
- package/dist/context/helpers.mjs.map +1 -0
- package/dist/context/init.mjs +20 -0
- package/dist/context/init.mjs.map +1 -0
- package/dist/cookies/cookie-utils.d.mts +29 -0
- package/dist/cookies/cookie-utils.mjs +105 -0
- package/dist/cookies/cookie-utils.mjs.map +1 -0
- package/dist/cookies/index.d.mts +121 -0
- package/dist/cookies/index.mjs +261 -0
- package/dist/cookies/index.mjs.map +1 -0
- package/dist/cookies/session-store.d.mts +36 -0
- package/dist/cookies/session-store.mjs +200 -0
- package/dist/cookies/session-store.mjs.map +1 -0
- package/dist/crypto/buffer.d.mts +8 -0
- package/dist/crypto/buffer.mjs +18 -0
- package/dist/crypto/buffer.mjs.map +1 -0
- package/dist/crypto/index.d.mts +27 -0
- package/dist/crypto/index.mjs +38 -0
- package/dist/crypto/index.mjs.map +1 -0
- package/dist/crypto/jwt.d.mts +8 -0
- package/dist/crypto/jwt.mjs +95 -0
- package/dist/crypto/jwt.mjs.map +1 -0
- package/dist/crypto/password.d.mts +12 -0
- package/dist/crypto/password.mjs +36 -0
- package/dist/crypto/password.mjs.map +1 -0
- package/dist/crypto/random.d.mts +5 -0
- package/dist/crypto/random.mjs +8 -0
- package/dist/crypto/random.mjs.map +1 -0
- package/dist/db/adapter-base.d.mts +8 -0
- package/dist/db/adapter-base.mjs +19 -0
- package/dist/db/adapter-base.mjs.map +1 -0
- package/dist/db/field-converter.d.mts +8 -0
- package/dist/db/field-converter.mjs +21 -0
- package/dist/db/field-converter.mjs.map +1 -0
- package/dist/db/field.d.mts +42 -0
- package/dist/db/get-schema.d.mts +11 -0
- package/dist/db/get-schema.mjs +39 -0
- package/dist/db/get-schema.mjs.map +1 -0
- package/dist/db/index.d.mts +18 -0
- package/dist/db/index.mjs +34 -0
- package/dist/db/index.mjs.map +1 -0
- package/dist/db/internal-adapter.d.mts +14 -0
- package/dist/db/internal-adapter.mjs +616 -0
- package/dist/db/internal-adapter.mjs.map +1 -0
- package/dist/db/schema.d.mts +49 -0
- package/dist/db/schema.mjs +118 -0
- package/dist/db/schema.mjs.map +1 -0
- package/dist/db/to-zod.d.mts +36 -0
- package/dist/db/to-zod.mjs +26 -0
- package/dist/db/to-zod.mjs.map +1 -0
- package/dist/db/verification-token-storage.mjs +28 -0
- package/dist/db/verification-token-storage.mjs.map +1 -0
- package/dist/db/with-hooks.d.mts +33 -0
- package/dist/db/with-hooks.mjs +159 -0
- package/dist/db/with-hooks.mjs.map +1 -0
- package/dist/index.d.mts +53 -0
- package/dist/index.mjs +27 -0
- package/dist/integrations/next-js.d.mts +29 -0
- package/dist/integrations/next-js.mjs +85 -0
- package/dist/integrations/next-js.mjs.map +1 -0
- package/dist/oauth2/index.d.mts +5 -0
- package/dist/oauth2/index.mjs +7 -0
- package/dist/oauth2/link-account.d.mts +48 -0
- package/dist/oauth2/link-account.mjs +143 -0
- package/dist/oauth2/link-account.mjs.map +1 -0
- package/dist/oauth2/state.d.mts +26 -0
- package/dist/oauth2/state.mjs +51 -0
- package/dist/oauth2/state.mjs.map +1 -0
- package/dist/oauth2/utils.d.mts +8 -0
- package/dist/oauth2/utils.mjs +31 -0
- package/dist/oauth2/utils.mjs.map +1 -0
- package/dist/plugins/access/access.d.mts +30 -0
- package/dist/plugins/access/access.mjs +46 -0
- package/dist/plugins/access/access.mjs.map +1 -0
- package/dist/plugins/access/index.d.mts +3 -0
- package/dist/plugins/access/index.mjs +3 -0
- package/dist/plugins/access/types.d.mts +17 -0
- package/dist/plugins/additional-fields/client.d.mts +96 -0
- package/dist/plugins/additional-fields/client.mjs +11 -0
- package/dist/plugins/additional-fields/client.mjs.map +1 -0
- package/dist/plugins/admin/access/index.d.mts +2 -0
- package/dist/plugins/admin/access/index.mjs +3 -0
- package/dist/plugins/admin/access/statement.d.mts +118 -0
- package/dist/plugins/admin/access/statement.mjs +53 -0
- package/dist/plugins/admin/access/statement.mjs.map +1 -0
- package/dist/plugins/admin/admin.d.mts +911 -0
- package/dist/plugins/admin/admin.mjs +95 -0
- package/dist/plugins/admin/admin.mjs.map +1 -0
- package/dist/plugins/admin/client.d.mts +76 -0
- package/dist/plugins/admin/client.mjs +36 -0
- package/dist/plugins/admin/client.mjs.map +1 -0
- package/dist/plugins/admin/error-codes.d.mts +29 -0
- package/dist/plugins/admin/error-codes.mjs +30 -0
- package/dist/plugins/admin/error-codes.mjs.map +1 -0
- package/dist/plugins/admin/has-permission.mjs +16 -0
- package/dist/plugins/admin/has-permission.mjs.map +1 -0
- package/dist/plugins/admin/index.d.mts +3 -0
- package/dist/plugins/admin/index.mjs +3 -0
- package/dist/plugins/admin/routes.mjs +841 -0
- package/dist/plugins/admin/routes.mjs.map +1 -0
- package/dist/plugins/admin/schema.d.mts +40 -0
- package/dist/plugins/admin/schema.mjs +34 -0
- package/dist/plugins/admin/schema.mjs.map +1 -0
- package/dist/plugins/admin/types.d.mts +89 -0
- package/dist/plugins/api-key/adapter.mjs +468 -0
- package/dist/plugins/api-key/adapter.mjs.map +1 -0
- package/dist/plugins/api-key/client.d.mts +46 -0
- package/dist/plugins/api-key/client.mjs +19 -0
- package/dist/plugins/api-key/client.mjs.map +1 -0
- package/dist/plugins/api-key/error-codes.d.mts +33 -0
- package/dist/plugins/api-key/error-codes.mjs +34 -0
- package/dist/plugins/api-key/error-codes.mjs.map +1 -0
- package/dist/plugins/api-key/index.d.mts +1251 -0
- package/dist/plugins/api-key/index.mjs +134 -0
- package/dist/plugins/api-key/index.mjs.map +1 -0
- package/dist/plugins/api-key/rate-limit.mjs +74 -0
- package/dist/plugins/api-key/rate-limit.mjs.map +1 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs +252 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs +24 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs +74 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs +158 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/index.mjs +71 -0
- package/dist/plugins/api-key/routes/index.mjs.map +1 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs +194 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs +248 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs +224 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/schema.d.mts +199 -0
- package/dist/plugins/api-key/schema.mjs +130 -0
- package/dist/plugins/api-key/schema.mjs.map +1 -0
- package/dist/plugins/api-key/types.d.mts +346 -0
- package/dist/plugins/bearer/index.d.mts +45 -0
- package/dist/plugins/bearer/index.mjs +66 -0
- package/dist/plugins/bearer/index.mjs.map +1 -0
- package/dist/plugins/captcha/constants.d.mts +10 -0
- package/dist/plugins/captcha/constants.mjs +22 -0
- package/dist/plugins/captcha/constants.mjs.map +1 -0
- package/dist/plugins/captcha/error-codes.mjs +16 -0
- package/dist/plugins/captcha/error-codes.mjs.map +1 -0
- package/dist/plugins/captcha/index.d.mts +21 -0
- package/dist/plugins/captcha/index.mjs +62 -0
- package/dist/plugins/captcha/index.mjs.map +1 -0
- package/dist/plugins/captcha/types.d.mts +28 -0
- package/dist/plugins/captcha/utils.mjs +11 -0
- package/dist/plugins/captcha/utils.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +28 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +26 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +30 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +28 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
- package/dist/plugins/custom-session/client.d.mts +17 -0
- package/dist/plugins/custom-session/client.mjs +11 -0
- package/dist/plugins/custom-session/client.mjs.map +1 -0
- package/dist/plugins/custom-session/index.d.mts +72 -0
- package/dist/plugins/custom-session/index.mjs +78 -0
- package/dist/plugins/custom-session/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/client.d.mts +17 -0
- package/dist/plugins/device-authorization/client.mjs +18 -0
- package/dist/plugins/device-authorization/client.mjs.map +1 -0
- package/dist/plugins/device-authorization/error-codes.mjs +21 -0
- package/dist/plugins/device-authorization/error-codes.mjs.map +1 -0
- package/dist/plugins/device-authorization/index.d.mts +424 -0
- package/dist/plugins/device-authorization/index.mjs +50 -0
- package/dist/plugins/device-authorization/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/routes.mjs +510 -0
- package/dist/plugins/device-authorization/routes.mjs.map +1 -0
- package/dist/plugins/device-authorization/schema.mjs +57 -0
- package/dist/plugins/device-authorization/schema.mjs.map +1 -0
- package/dist/plugins/email-otp/client.d.mts +21 -0
- package/dist/plugins/email-otp/client.mjs +18 -0
- package/dist/plugins/email-otp/client.mjs.map +1 -0
- package/dist/plugins/email-otp/error-codes.d.mts +11 -0
- package/dist/plugins/email-otp/error-codes.mjs +12 -0
- package/dist/plugins/email-otp/error-codes.mjs.map +1 -0
- package/dist/plugins/email-otp/index.d.mts +428 -0
- package/dist/plugins/email-otp/index.mjs +130 -0
- package/dist/plugins/email-otp/index.mjs.map +1 -0
- package/dist/plugins/email-otp/otp-token.mjs +29 -0
- package/dist/plugins/email-otp/otp-token.mjs.map +1 -0
- package/dist/plugins/email-otp/routes.mjs +631 -0
- package/dist/plugins/email-otp/routes.mjs.map +1 -0
- package/dist/plugins/email-otp/types.d.mts +86 -0
- package/dist/plugins/email-otp/utils.mjs +17 -0
- package/dist/plugins/email-otp/utils.mjs.map +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +33 -0
- package/dist/plugins/generic-oauth/client.mjs +14 -0
- package/dist/plugins/generic-oauth/client.mjs.map +1 -0
- package/dist/plugins/generic-oauth/error-codes.d.mts +16 -0
- package/dist/plugins/generic-oauth/error-codes.mjs +17 -0
- package/dist/plugins/generic-oauth/error-codes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/index.d.mts +201 -0
- package/dist/plugins/generic-oauth/index.mjs +145 -0
- package/dist/plugins/generic-oauth/index.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +9 -0
- package/dist/plugins/generic-oauth/providers/index.mjs +11 -0
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +55 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +91 -0
- package/dist/plugins/generic-oauth/providers/line.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs.map +1 -0
- package/dist/plugins/generic-oauth/routes.mjs +411 -0
- package/dist/plugins/generic-oauth/routes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +159 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +46 -0
- package/dist/plugins/haveibeenpwned/index.mjs +57 -0
- package/dist/plugins/haveibeenpwned/index.mjs.map +1 -0
- package/dist/plugins/index.d.mts +65 -0
- package/dist/plugins/index.mjs +48 -0
- package/dist/plugins/jwt/adapter.mjs +27 -0
- package/dist/plugins/jwt/adapter.mjs.map +1 -0
- package/dist/plugins/jwt/client.d.mts +40 -0
- package/dist/plugins/jwt/client.mjs +19 -0
- package/dist/plugins/jwt/client.mjs.map +1 -0
- package/dist/plugins/jwt/index.d.mts +224 -0
- package/dist/plugins/jwt/index.mjs +202 -0
- package/dist/plugins/jwt/index.mjs.map +1 -0
- package/dist/plugins/jwt/schema.d.mts +26 -0
- package/dist/plugins/jwt/schema.mjs +23 -0
- package/dist/plugins/jwt/schema.mjs.map +1 -0
- package/dist/plugins/jwt/sign.d.mts +57 -0
- package/dist/plugins/jwt/sign.mjs +66 -0
- package/dist/plugins/jwt/sign.mjs.map +1 -0
- package/dist/plugins/jwt/types.d.mts +194 -0
- package/dist/plugins/jwt/utils.d.mts +42 -0
- package/dist/plugins/jwt/utils.mjs +64 -0
- package/dist/plugins/jwt/utils.mjs.map +1 -0
- package/dist/plugins/jwt/verify.d.mts +12 -0
- package/dist/plugins/jwt/verify.mjs +46 -0
- package/dist/plugins/jwt/verify.mjs.map +1 -0
- package/dist/plugins/last-login-method/client.d.mts +38 -0
- package/dist/plugins/last-login-method/client.mjs +32 -0
- package/dist/plugins/last-login-method/client.mjs.map +1 -0
- package/dist/plugins/last-login-method/index.d.mts +118 -0
- package/dist/plugins/last-login-method/index.mjs +76 -0
- package/dist/plugins/last-login-method/index.mjs.map +1 -0
- package/dist/plugins/magic-link/client.d.mts +10 -0
- package/dist/plugins/magic-link/client.mjs +11 -0
- package/dist/plugins/magic-link/client.mjs.map +1 -0
- package/dist/plugins/magic-link/index.d.mts +193 -0
- package/dist/plugins/magic-link/index.mjs +177 -0
- package/dist/plugins/magic-link/index.mjs.map +1 -0
- package/dist/plugins/magic-link/utils.mjs +12 -0
- package/dist/plugins/magic-link/utils.mjs.map +1 -0
- package/dist/plugins/mcp/authorize.mjs +133 -0
- package/dist/plugins/mcp/authorize.mjs.map +1 -0
- package/dist/plugins/mcp/index.d.mts +458 -0
- package/dist/plugins/mcp/index.mjs +717 -0
- package/dist/plugins/mcp/index.mjs.map +1 -0
- package/dist/plugins/multi-session/client.d.mts +19 -0
- package/dist/plugins/multi-session/client.mjs +20 -0
- package/dist/plugins/multi-session/client.mjs.map +1 -0
- package/dist/plugins/multi-session/error-codes.d.mts +9 -0
- package/dist/plugins/multi-session/error-codes.mjs +8 -0
- package/dist/plugins/multi-session/error-codes.mjs.map +1 -0
- package/dist/plugins/multi-session/index.d.mts +235 -0
- package/dist/plugins/multi-session/index.mjs +172 -0
- package/dist/plugins/multi-session/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/index.d.mts +97 -0
- package/dist/plugins/oauth-proxy/index.mjs +305 -0
- package/dist/plugins/oauth-proxy/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/utils.mjs +51 -0
- package/dist/plugins/oauth-proxy/utils.mjs.map +1 -0
- package/dist/plugins/oidc-provider/authorize.mjs +194 -0
- package/dist/plugins/oidc-provider/authorize.mjs.map +1 -0
- package/dist/plugins/oidc-provider/client.d.mts +12 -0
- package/dist/plugins/oidc-provider/client.mjs +11 -0
- package/dist/plugins/oidc-provider/client.mjs.map +1 -0
- package/dist/plugins/oidc-provider/error.mjs +17 -0
- package/dist/plugins/oidc-provider/error.mjs.map +1 -0
- package/dist/plugins/oidc-provider/index.d.mts +702 -0
- package/dist/plugins/oidc-provider/index.mjs +1093 -0
- package/dist/plugins/oidc-provider/index.mjs.map +1 -0
- package/dist/plugins/oidc-provider/schema.d.mts +160 -0
- package/dist/plugins/oidc-provider/schema.mjs +132 -0
- package/dist/plugins/oidc-provider/schema.mjs.map +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +517 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs.map +1 -0
- package/dist/plugins/oidc-provider/utils.mjs +15 -0
- package/dist/plugins/oidc-provider/utils.mjs.map +1 -0
- package/dist/plugins/one-tap/client.d.mts +174 -0
- package/dist/plugins/one-tap/client.mjs +188 -0
- package/dist/plugins/one-tap/client.mjs.map +1 -0
- package/dist/plugins/one-tap/index.d.mts +83 -0
- package/dist/plugins/one-tap/index.mjs +95 -0
- package/dist/plugins/one-tap/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/client.d.mts +10 -0
- package/dist/plugins/one-time-token/client.mjs +11 -0
- package/dist/plugins/one-time-token/client.mjs.map +1 -0
- package/dist/plugins/one-time-token/index.d.mts +133 -0
- package/dist/plugins/one-time-token/index.mjs +82 -0
- package/dist/plugins/one-time-token/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/utils.mjs +12 -0
- package/dist/plugins/one-time-token/utils.mjs.map +1 -0
- package/dist/plugins/open-api/generator.d.mts +115 -0
- package/dist/plugins/open-api/generator.mjs +315 -0
- package/dist/plugins/open-api/generator.mjs.map +1 -0
- package/dist/plugins/open-api/index.d.mts +97 -0
- package/dist/plugins/open-api/index.mjs +67 -0
- package/dist/plugins/open-api/index.mjs.map +1 -0
- package/dist/plugins/open-api/logo.mjs +15 -0
- package/dist/plugins/open-api/logo.mjs.map +1 -0
- package/dist/plugins/organization/access/index.d.mts +2 -0
- package/dist/plugins/organization/access/index.mjs +3 -0
- package/dist/plugins/organization/access/statement.d.mts +249 -0
- package/dist/plugins/organization/access/statement.mjs +81 -0
- package/dist/plugins/organization/access/statement.mjs.map +1 -0
- package/dist/plugins/organization/adapter.d.mts +792 -0
- package/dist/plugins/organization/adapter.mjs +624 -0
- package/dist/plugins/organization/adapter.mjs.map +1 -0
- package/dist/plugins/organization/call.mjs +19 -0
- package/dist/plugins/organization/call.mjs.map +1 -0
- package/dist/plugins/organization/client.d.mts +372 -0
- package/dist/plugins/organization/client.mjs +95 -0
- package/dist/plugins/organization/client.mjs.map +1 -0
- package/dist/plugins/organization/error-codes.d.mts +65 -0
- package/dist/plugins/organization/error-codes.mjs +66 -0
- package/dist/plugins/organization/error-codes.mjs.map +1 -0
- package/dist/plugins/organization/has-permission.mjs +35 -0
- package/dist/plugins/organization/has-permission.mjs.map +1 -0
- package/dist/plugins/organization/index.d.mts +5 -0
- package/dist/plugins/organization/index.mjs +4 -0
- package/dist/plugins/organization/organization.d.mts +394 -0
- package/dist/plugins/organization/organization.mjs +428 -0
- package/dist/plugins/organization/organization.mjs.map +1 -0
- package/dist/plugins/organization/permission.d.mts +17 -0
- package/dist/plugins/organization/permission.mjs +16 -0
- package/dist/plugins/organization/permission.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-access-control.d.mts +394 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs +678 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-invites.d.mts +1031 -0
- package/dist/plugins/organization/routes/crud-invites.mjs +551 -0
- package/dist/plugins/organization/routes/crud-invites.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-members.d.mts +940 -0
- package/dist/plugins/organization/routes/crud-members.mjs +466 -0
- package/dist/plugins/organization/routes/crud-members.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-org.d.mts +708 -0
- package/dist/plugins/organization/routes/crud-org.mjs +423 -0
- package/dist/plugins/organization/routes/crud-org.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-team.d.mts +1071 -0
- package/dist/plugins/organization/routes/crud-team.mjs +676 -0
- package/dist/plugins/organization/routes/crud-team.mjs.map +1 -0
- package/dist/plugins/organization/schema.d.mts +376 -0
- package/dist/plugins/organization/schema.mjs +68 -0
- package/dist/plugins/organization/schema.mjs.map +1 -0
- package/dist/plugins/organization/types.d.mts +677 -0
- package/dist/plugins/phone-number/client.d.mts +31 -0
- package/dist/plugins/phone-number/client.mjs +20 -0
- package/dist/plugins/phone-number/client.mjs.map +1 -0
- package/dist/plugins/phone-number/error-codes.d.mts +20 -0
- package/dist/plugins/phone-number/error-codes.mjs +21 -0
- package/dist/plugins/phone-number/error-codes.mjs.map +1 -0
- package/dist/plugins/phone-number/index.d.mts +318 -0
- package/dist/plugins/phone-number/index.mjs +49 -0
- package/dist/plugins/phone-number/index.mjs.map +1 -0
- package/dist/plugins/phone-number/routes.mjs +472 -0
- package/dist/plugins/phone-number/routes.mjs.map +1 -0
- package/dist/plugins/phone-number/schema.d.mts +23 -0
- package/dist/plugins/phone-number/schema.mjs +20 -0
- package/dist/plugins/phone-number/schema.mjs.map +1 -0
- package/dist/plugins/phone-number/types.d.mts +118 -0
- package/dist/plugins/two-factor/backup-codes/index.d.mts +279 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs.map +1 -0
- package/dist/plugins/two-factor/client.d.mts +55 -0
- package/dist/plugins/two-factor/client.mjs +37 -0
- package/dist/plugins/two-factor/client.mjs.map +1 -0
- package/dist/plugins/two-factor/constant.mjs +8 -0
- package/dist/plugins/two-factor/constant.mjs.map +1 -0
- package/dist/plugins/two-factor/error-code.d.mts +17 -0
- package/dist/plugins/two-factor/error-code.mjs +18 -0
- package/dist/plugins/two-factor/error-code.mjs.map +1 -0
- package/dist/plugins/two-factor/index.d.mts +670 -0
- package/dist/plugins/two-factor/index.mjs +228 -0
- package/dist/plugins/two-factor/index.mjs.map +1 -0
- package/dist/plugins/two-factor/otp/index.d.mts +216 -0
- package/dist/plugins/two-factor/otp/index.mjs +199 -0
- package/dist/plugins/two-factor/otp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/schema.d.mts +41 -0
- package/dist/plugins/two-factor/schema.mjs +36 -0
- package/dist/plugins/two-factor/schema.mjs.map +1 -0
- package/dist/plugins/two-factor/totp/index.d.mts +210 -0
- package/dist/plugins/two-factor/totp/index.mjs +157 -0
- package/dist/plugins/two-factor/totp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/types.d.mts +73 -0
- package/dist/plugins/two-factor/utils.mjs +12 -0
- package/dist/plugins/two-factor/utils.mjs.map +1 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs +85 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs.map +1 -0
- package/dist/plugins/username/client.d.mts +26 -0
- package/dist/plugins/username/client.mjs +18 -0
- package/dist/plugins/username/client.mjs.map +1 -0
- package/dist/plugins/username/error-codes.d.mts +16 -0
- package/dist/plugins/username/error-codes.mjs +17 -0
- package/dist/plugins/username/error-codes.mjs.map +1 -0
- package/dist/plugins/username/index.d.mts +251 -0
- package/dist/plugins/username/index.mjs +234 -0
- package/dist/plugins/username/index.mjs.map +1 -0
- package/dist/plugins/username/schema.d.mts +33 -0
- package/dist/plugins/username/schema.mjs +26 -0
- package/dist/plugins/username/schema.mjs.map +1 -0
- package/dist/providers/index.d.mts +1 -0
- package/dist/providers/index.mjs +3 -0
- package/dist/state.d.mts +42 -0
- package/dist/state.mjs +107 -0
- package/dist/state.mjs.map +1 -0
- package/dist/types/adapter.d.mts +2 -0
- package/dist/types/api.d.mts +29 -0
- package/dist/types/auth.d.mts +29 -0
- package/dist/types/helper.d.mts +10 -0
- package/dist/types/index.d.mts +11 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/models.d.mts +11 -0
- package/dist/types/plugins.d.mts +20 -0
- package/dist/utils/boolean.mjs +8 -0
- package/dist/utils/boolean.mjs.map +1 -0
- package/dist/utils/constants.mjs +6 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/date.mjs +8 -0
- package/dist/utils/date.mjs.map +1 -0
- package/dist/utils/get-request-ip.d.mts +7 -0
- package/dist/utils/get-request-ip.mjs +23 -0
- package/dist/utils/get-request-ip.mjs.map +1 -0
- package/dist/utils/hide-metadata.d.mts +7 -0
- package/dist/utils/hide-metadata.mjs +6 -0
- package/dist/utils/hide-metadata.mjs.map +1 -0
- package/dist/utils/index.d.mts +4 -0
- package/dist/utils/index.mjs +6 -0
- package/dist/utils/is-api-error.d.mts +7 -0
- package/dist/utils/is-api-error.mjs +11 -0
- package/dist/utils/is-api-error.mjs.map +1 -0
- package/dist/utils/is-atom.mjs +8 -0
- package/dist/utils/is-atom.mjs.map +1 -0
- package/dist/utils/is-promise.mjs +8 -0
- package/dist/utils/is-promise.mjs.map +1 -0
- package/dist/utils/middleware-response.mjs +9 -0
- package/dist/utils/middleware-response.mjs.map +1 -0
- package/dist/utils/password.mjs +26 -0
- package/dist/utils/password.mjs.map +1 -0
- package/dist/utils/plugin-helper.mjs +17 -0
- package/dist/utils/plugin-helper.mjs.map +1 -0
- package/dist/utils/shim.mjs +24 -0
- package/dist/utils/shim.mjs.map +1 -0
- package/dist/utils/time.d.mts +49 -0
- package/dist/utils/time.mjs +100 -0
- package/dist/utils/time.mjs.map +1 -0
- package/dist/utils/url.d.mts +8 -0
- package/dist/utils/url.mjs +92 -0
- package/dist/utils/url.mjs.map +1 -0
- package/dist/utils/wildcard.mjs +108 -0
- package/dist/utils/wildcard.mjs.map +1 -0
- package/package.json +428 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PHONE_NUMBER_ERROR_CODES } from "./error-codes.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/phone-number/client.ts
|
|
4
|
+
const phoneNumberClient = () => {
|
|
5
|
+
return {
|
|
6
|
+
id: "phoneNumber",
|
|
7
|
+
$InferServerPlugin: {},
|
|
8
|
+
atomListeners: [{
|
|
9
|
+
matcher(path) {
|
|
10
|
+
return path === "/phone-number/update" || path === "/phone-number/verify" || path === "/sign-in/phone-number";
|
|
11
|
+
},
|
|
12
|
+
signal: "$sessionSignal"
|
|
13
|
+
}],
|
|
14
|
+
$ERROR_CODES: PHONE_NUMBER_ERROR_CODES
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { phoneNumberClient };
|
|
20
|
+
//# sourceMappingURL=client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../../../src/plugins/phone-number/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"@better-auth/core\";\nimport type { phoneNumber } from \".\";\n\nimport { PHONE_NUMBER_ERROR_CODES } from \"./error-codes\";\n\nexport * from \"./error-codes\";\n\nexport const phoneNumberClient = () => {\n\treturn {\n\t\tid: \"phoneNumber\",\n\t\t$InferServerPlugin: {} as ReturnType<typeof phoneNumber>,\n\t\tatomListeners: [\n\t\t\t{\n\t\t\t\tmatcher(path) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tpath === \"/phone-number/update\" ||\n\t\t\t\t\t\tpath === \"/phone-number/verify\" ||\n\t\t\t\t\t\tpath === \"/sign-in/phone-number\"\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tsignal: \"$sessionSignal\",\n\t\t\t},\n\t\t],\n\t\t$ERROR_CODES: PHONE_NUMBER_ERROR_CODES,\n\t} satisfies BetterAuthClientPlugin;\n};\n\nexport type * from \"./types\";\n"],"mappings":";;;AAOA,MAAa,0BAA0B;AACtC,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EACtB,eAAe,CACd;GACC,QAAQ,MAAM;AACb,WACC,SAAS,0BACT,SAAS,0BACT,SAAS;;GAGX,QAAQ;GACR,CACD;EACD,cAAc;EACd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as _better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/phone-number/error-codes.d.ts
|
|
4
|
+
declare const PHONE_NUMBER_ERROR_CODES: {
|
|
5
|
+
UNEXPECTED_ERROR: _better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
6
|
+
INVALID_PHONE_NUMBER: _better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER">;
|
|
7
|
+
PHONE_NUMBER_EXIST: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_EXIST">;
|
|
8
|
+
PHONE_NUMBER_NOT_EXIST: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_EXIST">;
|
|
9
|
+
INVALID_PHONE_NUMBER_OR_PASSWORD: _better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER_OR_PASSWORD">;
|
|
10
|
+
OTP_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"OTP_NOT_FOUND">;
|
|
11
|
+
OTP_EXPIRED: _better_auth_core_utils_error_codes0.RawError<"OTP_EXPIRED">;
|
|
12
|
+
INVALID_OTP: _better_auth_core_utils_error_codes0.RawError<"INVALID_OTP">;
|
|
13
|
+
PHONE_NUMBER_NOT_VERIFIED: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_VERIFIED">;
|
|
14
|
+
PHONE_NUMBER_CANNOT_BE_UPDATED: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_CANNOT_BE_UPDATED">;
|
|
15
|
+
SEND_OTP_NOT_IMPLEMENTED: _better_auth_core_utils_error_codes0.RawError<"SEND_OTP_NOT_IMPLEMENTED">;
|
|
16
|
+
TOO_MANY_ATTEMPTS: _better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS">;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { PHONE_NUMBER_ERROR_CODES };
|
|
20
|
+
//# sourceMappingURL=error-codes.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/phone-number/error-codes.ts
|
|
4
|
+
const PHONE_NUMBER_ERROR_CODES = defineErrorCodes({
|
|
5
|
+
INVALID_PHONE_NUMBER: "Invalid phone number",
|
|
6
|
+
PHONE_NUMBER_EXIST: "Phone number already exists",
|
|
7
|
+
PHONE_NUMBER_NOT_EXIST: "phone number isn't registered",
|
|
8
|
+
INVALID_PHONE_NUMBER_OR_PASSWORD: "Invalid phone number or password",
|
|
9
|
+
UNEXPECTED_ERROR: "Unexpected error",
|
|
10
|
+
OTP_NOT_FOUND: "OTP not found",
|
|
11
|
+
OTP_EXPIRED: "OTP expired",
|
|
12
|
+
INVALID_OTP: "Invalid OTP",
|
|
13
|
+
PHONE_NUMBER_NOT_VERIFIED: "Phone number not verified",
|
|
14
|
+
PHONE_NUMBER_CANNOT_BE_UPDATED: "Phone number cannot be updated",
|
|
15
|
+
SEND_OTP_NOT_IMPLEMENTED: "sendOTP not implemented",
|
|
16
|
+
TOO_MANY_ATTEMPTS: "Too many attempts"
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { PHONE_NUMBER_ERROR_CODES };
|
|
21
|
+
//# sourceMappingURL=error-codes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-codes.mjs","names":[],"sources":["../../../src/plugins/phone-number/error-codes.ts"],"sourcesContent":["import { defineErrorCodes } from \"@better-auth/core/utils/error-codes\";\n\nexport const PHONE_NUMBER_ERROR_CODES = defineErrorCodes({\n\tINVALID_PHONE_NUMBER: \"Invalid phone number\",\n\tPHONE_NUMBER_EXIST: \"Phone number already exists\",\n\tPHONE_NUMBER_NOT_EXIST: \"phone number isn't registered\",\n\tINVALID_PHONE_NUMBER_OR_PASSWORD: \"Invalid phone number or password\",\n\tUNEXPECTED_ERROR: \"Unexpected error\",\n\tOTP_NOT_FOUND: \"OTP not found\",\n\tOTP_EXPIRED: \"OTP expired\",\n\tINVALID_OTP: \"Invalid OTP\",\n\tPHONE_NUMBER_NOT_VERIFIED: \"Phone number not verified\",\n\tPHONE_NUMBER_CANNOT_BE_UPDATED: \"Phone number cannot be updated\",\n\tSEND_OTP_NOT_IMPLEMENTED: \"sendOTP not implemented\",\n\tTOO_MANY_ATTEMPTS: \"Too many attempts\",\n});\n"],"mappings":";;;AAEA,MAAa,2BAA2B,iBAAiB;CACxD,sBAAsB;CACtB,oBAAoB;CACpB,wBAAwB;CACxB,kCAAkC;CAClC,kBAAkB;CAClB,eAAe;CACf,aAAa;CACb,aAAa;CACb,2BAA2B;CAC3B,gCAAgC;CAChC,0BAA0B;CAC1B,mBAAmB;CACnB,CAAC"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { PhoneNumberOptions, UserWithPhoneNumber } from "./types.mjs";
|
|
2
|
+
import * as _better_auth_core0 from "@better-auth/core";
|
|
3
|
+
import * as _better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
+
import * as better_call0 from "better-call";
|
|
5
|
+
import * as zod from "zod";
|
|
6
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
8
|
+
//#region src/plugins/phone-number/index.d.ts
|
|
9
|
+
declare module "@better-auth/core" {
|
|
10
|
+
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
11
|
+
"phone-number": {
|
|
12
|
+
creator: typeof phoneNumber;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
|
|
17
|
+
id: "phone-number";
|
|
18
|
+
hooks: {
|
|
19
|
+
before: {
|
|
20
|
+
matcher: (ctx: _better_auth_core0.HookEndpointContext) => boolean;
|
|
21
|
+
handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<never>;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
endpoints: {
|
|
25
|
+
signInPhoneNumber: better_call0.StrictEndpoint<"/sign-in/phone-number", {
|
|
26
|
+
method: "POST";
|
|
27
|
+
body: zod.ZodObject<{
|
|
28
|
+
phoneNumber: zod.ZodString;
|
|
29
|
+
password: zod.ZodString;
|
|
30
|
+
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
31
|
+
}, zod_v4_core0.$strip>;
|
|
32
|
+
metadata: {
|
|
33
|
+
openapi: {
|
|
34
|
+
summary: string;
|
|
35
|
+
description: string;
|
|
36
|
+
responses: {
|
|
37
|
+
200: {
|
|
38
|
+
description: string;
|
|
39
|
+
content: {
|
|
40
|
+
"application/json": {
|
|
41
|
+
schema: {
|
|
42
|
+
type: "object";
|
|
43
|
+
properties: {
|
|
44
|
+
user: {
|
|
45
|
+
$ref: string;
|
|
46
|
+
};
|
|
47
|
+
session: {
|
|
48
|
+
$ref: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
400: {
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}, {
|
|
62
|
+
token: string;
|
|
63
|
+
user: UserWithPhoneNumber;
|
|
64
|
+
}>;
|
|
65
|
+
sendPhoneNumberOTP: better_call0.StrictEndpoint<"/phone-number/send-otp", {
|
|
66
|
+
method: "POST";
|
|
67
|
+
body: zod.ZodObject<{
|
|
68
|
+
phoneNumber: zod.ZodString;
|
|
69
|
+
}, zod_v4_core0.$strip>;
|
|
70
|
+
metadata: {
|
|
71
|
+
openapi: {
|
|
72
|
+
summary: string;
|
|
73
|
+
description: string;
|
|
74
|
+
responses: {
|
|
75
|
+
200: {
|
|
76
|
+
description: string;
|
|
77
|
+
content: {
|
|
78
|
+
"application/json": {
|
|
79
|
+
schema: {
|
|
80
|
+
type: "object";
|
|
81
|
+
properties: {
|
|
82
|
+
message: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}, {
|
|
94
|
+
message: string;
|
|
95
|
+
}>;
|
|
96
|
+
verifyPhoneNumber: better_call0.StrictEndpoint<"/phone-number/verify", {
|
|
97
|
+
method: "POST";
|
|
98
|
+
body: zod.ZodIntersection<zod.ZodObject<{
|
|
99
|
+
phoneNumber: zod.ZodString;
|
|
100
|
+
code: zod.ZodString;
|
|
101
|
+
disableSession: zod.ZodOptional<zod.ZodBoolean>;
|
|
102
|
+
updatePhoneNumber: zod.ZodOptional<zod.ZodBoolean>;
|
|
103
|
+
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
104
|
+
metadata: {
|
|
105
|
+
openapi: {
|
|
106
|
+
summary: string;
|
|
107
|
+
description: string;
|
|
108
|
+
responses: {
|
|
109
|
+
"200": {
|
|
110
|
+
description: string;
|
|
111
|
+
content: {
|
|
112
|
+
"application/json": {
|
|
113
|
+
schema: {
|
|
114
|
+
type: "object";
|
|
115
|
+
properties: {
|
|
116
|
+
status: {
|
|
117
|
+
type: string;
|
|
118
|
+
description: string;
|
|
119
|
+
enum: boolean[];
|
|
120
|
+
};
|
|
121
|
+
token: {
|
|
122
|
+
type: string;
|
|
123
|
+
nullable: boolean;
|
|
124
|
+
description: string;
|
|
125
|
+
};
|
|
126
|
+
user: {
|
|
127
|
+
type: string;
|
|
128
|
+
nullable: boolean;
|
|
129
|
+
properties: {
|
|
130
|
+
id: {
|
|
131
|
+
type: string;
|
|
132
|
+
description: string;
|
|
133
|
+
};
|
|
134
|
+
email: {
|
|
135
|
+
type: string;
|
|
136
|
+
format: string;
|
|
137
|
+
nullable: boolean;
|
|
138
|
+
description: string;
|
|
139
|
+
};
|
|
140
|
+
emailVerified: {
|
|
141
|
+
type: string;
|
|
142
|
+
nullable: boolean;
|
|
143
|
+
description: string;
|
|
144
|
+
};
|
|
145
|
+
name: {
|
|
146
|
+
type: string;
|
|
147
|
+
nullable: boolean;
|
|
148
|
+
description: string;
|
|
149
|
+
};
|
|
150
|
+
image: {
|
|
151
|
+
type: string;
|
|
152
|
+
format: string;
|
|
153
|
+
nullable: boolean;
|
|
154
|
+
description: string;
|
|
155
|
+
};
|
|
156
|
+
phoneNumber: {
|
|
157
|
+
type: string;
|
|
158
|
+
description: string;
|
|
159
|
+
};
|
|
160
|
+
phoneNumberVerified: {
|
|
161
|
+
type: string;
|
|
162
|
+
description: string;
|
|
163
|
+
};
|
|
164
|
+
createdAt: {
|
|
165
|
+
type: string;
|
|
166
|
+
format: string;
|
|
167
|
+
description: string;
|
|
168
|
+
};
|
|
169
|
+
updatedAt: {
|
|
170
|
+
type: string;
|
|
171
|
+
format: string;
|
|
172
|
+
description: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
required: string[];
|
|
176
|
+
description: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
required: string[];
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
400: {
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
}, {
|
|
191
|
+
status: boolean;
|
|
192
|
+
token: string;
|
|
193
|
+
user: {
|
|
194
|
+
id: string;
|
|
195
|
+
createdAt: Date;
|
|
196
|
+
updatedAt: Date;
|
|
197
|
+
email: string;
|
|
198
|
+
emailVerified: boolean;
|
|
199
|
+
name: string;
|
|
200
|
+
image?: string | null | undefined;
|
|
201
|
+
} & UserWithPhoneNumber;
|
|
202
|
+
} | {
|
|
203
|
+
status: boolean;
|
|
204
|
+
token: null;
|
|
205
|
+
user: UserWithPhoneNumber;
|
|
206
|
+
}>;
|
|
207
|
+
requestPasswordResetPhoneNumber: better_call0.StrictEndpoint<"/phone-number/request-password-reset", {
|
|
208
|
+
method: "POST";
|
|
209
|
+
body: zod.ZodObject<{
|
|
210
|
+
phoneNumber: zod.ZodString;
|
|
211
|
+
}, zod_v4_core0.$strip>;
|
|
212
|
+
metadata: {
|
|
213
|
+
openapi: {
|
|
214
|
+
description: string;
|
|
215
|
+
responses: {
|
|
216
|
+
"200": {
|
|
217
|
+
description: string;
|
|
218
|
+
content: {
|
|
219
|
+
"application/json": {
|
|
220
|
+
schema: {
|
|
221
|
+
type: "object";
|
|
222
|
+
properties: {
|
|
223
|
+
status: {
|
|
224
|
+
type: string;
|
|
225
|
+
description: string;
|
|
226
|
+
enum: boolean[];
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
required: string[];
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
}, {
|
|
238
|
+
status: boolean;
|
|
239
|
+
}>;
|
|
240
|
+
resetPasswordPhoneNumber: better_call0.StrictEndpoint<"/phone-number/reset-password", {
|
|
241
|
+
method: "POST";
|
|
242
|
+
body: zod.ZodObject<{
|
|
243
|
+
otp: zod.ZodString;
|
|
244
|
+
phoneNumber: zod.ZodString;
|
|
245
|
+
newPassword: zod.ZodString;
|
|
246
|
+
}, zod_v4_core0.$strip>;
|
|
247
|
+
metadata: {
|
|
248
|
+
openapi: {
|
|
249
|
+
description: string;
|
|
250
|
+
responses: {
|
|
251
|
+
"200": {
|
|
252
|
+
description: string;
|
|
253
|
+
content: {
|
|
254
|
+
"application/json": {
|
|
255
|
+
schema: {
|
|
256
|
+
type: "object";
|
|
257
|
+
properties: {
|
|
258
|
+
status: {
|
|
259
|
+
type: string;
|
|
260
|
+
description: string;
|
|
261
|
+
enum: boolean[];
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
required: string[];
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
}, {
|
|
273
|
+
status: boolean;
|
|
274
|
+
}>;
|
|
275
|
+
};
|
|
276
|
+
schema: {
|
|
277
|
+
user: {
|
|
278
|
+
fields: {
|
|
279
|
+
phoneNumber: {
|
|
280
|
+
type: "string";
|
|
281
|
+
required: false;
|
|
282
|
+
unique: true;
|
|
283
|
+
sortable: true;
|
|
284
|
+
returned: true;
|
|
285
|
+
};
|
|
286
|
+
phoneNumberVerified: {
|
|
287
|
+
type: "boolean";
|
|
288
|
+
required: false;
|
|
289
|
+
returned: true;
|
|
290
|
+
input: false;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
rateLimit: {
|
|
296
|
+
pathMatcher(path: string): boolean;
|
|
297
|
+
window: number;
|
|
298
|
+
max: number;
|
|
299
|
+
}[];
|
|
300
|
+
options: PhoneNumberOptions | undefined;
|
|
301
|
+
$ERROR_CODES: {
|
|
302
|
+
UNEXPECTED_ERROR: _better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
303
|
+
INVALID_PHONE_NUMBER: _better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER">;
|
|
304
|
+
PHONE_NUMBER_EXIST: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_EXIST">;
|
|
305
|
+
PHONE_NUMBER_NOT_EXIST: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_EXIST">;
|
|
306
|
+
INVALID_PHONE_NUMBER_OR_PASSWORD: _better_auth_core_utils_error_codes0.RawError<"INVALID_PHONE_NUMBER_OR_PASSWORD">;
|
|
307
|
+
OTP_NOT_FOUND: _better_auth_core_utils_error_codes0.RawError<"OTP_NOT_FOUND">;
|
|
308
|
+
OTP_EXPIRED: _better_auth_core_utils_error_codes0.RawError<"OTP_EXPIRED">;
|
|
309
|
+
INVALID_OTP: _better_auth_core_utils_error_codes0.RawError<"INVALID_OTP">;
|
|
310
|
+
PHONE_NUMBER_NOT_VERIFIED: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_NOT_VERIFIED">;
|
|
311
|
+
PHONE_NUMBER_CANNOT_BE_UPDATED: _better_auth_core_utils_error_codes0.RawError<"PHONE_NUMBER_CANNOT_BE_UPDATED">;
|
|
312
|
+
SEND_OTP_NOT_IMPLEMENTED: _better_auth_core_utils_error_codes0.RawError<"SEND_OTP_NOT_IMPLEMENTED">;
|
|
313
|
+
TOO_MANY_ATTEMPTS: _better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS">;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
//#endregion
|
|
317
|
+
export { type PhoneNumberOptions, type UserWithPhoneNumber, phoneNumber };
|
|
318
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { mergeSchema } from "../../db/schema.mjs";
|
|
2
|
+
import { PHONE_NUMBER_ERROR_CODES } from "./error-codes.mjs";
|
|
3
|
+
import { requestPasswordResetPhoneNumber, resetPasswordPhoneNumber, sendPhoneNumberOTP, signInPhoneNumber, verifyPhoneNumber } from "./routes.mjs";
|
|
4
|
+
import { schema } from "./schema.mjs";
|
|
5
|
+
import { APIError } from "@better-auth/core/error";
|
|
6
|
+
import { createAuthMiddleware } from "@better-auth/core/api";
|
|
7
|
+
|
|
8
|
+
//#region src/plugins/phone-number/index.ts
|
|
9
|
+
const phoneNumber = (options) => {
|
|
10
|
+
const opts = {
|
|
11
|
+
expiresIn: options?.expiresIn || 300,
|
|
12
|
+
otpLength: options?.otpLength || 6,
|
|
13
|
+
...options,
|
|
14
|
+
phoneNumber: "phoneNumber",
|
|
15
|
+
phoneNumberVerified: "phoneNumberVerified",
|
|
16
|
+
code: "code",
|
|
17
|
+
createdAt: "createdAt"
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
id: "phone-number",
|
|
21
|
+
hooks: { before: [{
|
|
22
|
+
matcher: (ctx) => ctx.path === "/update-user" && "phoneNumber" in ctx.body,
|
|
23
|
+
handler: createAuthMiddleware(async (_ctx) => {
|
|
24
|
+
throw APIError.from("BAD_REQUEST", PHONE_NUMBER_ERROR_CODES.PHONE_NUMBER_CANNOT_BE_UPDATED);
|
|
25
|
+
})
|
|
26
|
+
}] },
|
|
27
|
+
endpoints: {
|
|
28
|
+
signInPhoneNumber: signInPhoneNumber(opts),
|
|
29
|
+
sendPhoneNumberOTP: sendPhoneNumberOTP(opts),
|
|
30
|
+
verifyPhoneNumber: verifyPhoneNumber(opts),
|
|
31
|
+
requestPasswordResetPhoneNumber: requestPasswordResetPhoneNumber(opts),
|
|
32
|
+
resetPasswordPhoneNumber: resetPasswordPhoneNumber(opts)
|
|
33
|
+
},
|
|
34
|
+
schema: mergeSchema(schema, options?.schema),
|
|
35
|
+
rateLimit: [{
|
|
36
|
+
pathMatcher(path) {
|
|
37
|
+
return path.startsWith("/phone-number");
|
|
38
|
+
},
|
|
39
|
+
window: 60,
|
|
40
|
+
max: 10
|
|
41
|
+
}],
|
|
42
|
+
options,
|
|
43
|
+
$ERROR_CODES: PHONE_NUMBER_ERROR_CODES
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { phoneNumber };
|
|
49
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/phone-number/index.ts"],"sourcesContent":["import type { BetterAuthPlugin } from \"@better-auth/core\";\nimport { createAuthMiddleware } from \"@better-auth/core/api\";\nimport { APIError } from \"@better-auth/core/error\";\nimport { mergeSchema } from \"../../db/schema\";\nimport { PHONE_NUMBER_ERROR_CODES } from \"./error-codes\";\nimport type { RequiredPhoneNumberOptions } from \"./routes\";\nimport {\n\trequestPasswordResetPhoneNumber,\n\tresetPasswordPhoneNumber,\n\tsendPhoneNumberOTP,\n\tsignInPhoneNumber,\n\tverifyPhoneNumber,\n} from \"./routes\";\nimport { schema } from \"./schema\";\nimport type { PhoneNumberOptions, UserWithPhoneNumber } from \"./types\";\n\nexport type { PhoneNumberOptions, UserWithPhoneNumber };\n\ndeclare module \"@better-auth/core\" {\n\tinterface BetterAuthPluginRegistry<AuthOptions, Options> {\n\t\t\"phone-number\": {\n\t\t\tcreator: typeof phoneNumber;\n\t\t};\n\t}\n}\n\nexport const phoneNumber = (options?: PhoneNumberOptions | undefined) => {\n\tconst opts = {\n\t\texpiresIn: options?.expiresIn || 300,\n\t\totpLength: options?.otpLength || 6,\n\t\t...options,\n\t\tphoneNumber: \"phoneNumber\",\n\t\tphoneNumberVerified: \"phoneNumberVerified\",\n\t\tcode: \"code\",\n\t\tcreatedAt: \"createdAt\",\n\t};\n\n\treturn {\n\t\tid: \"phone-number\",\n\t\thooks: {\n\t\t\tbefore: [\n\t\t\t\t{\n\t\t\t\t\t// Stop any requests attempting to update the user's phone number\n\t\t\t\t\tmatcher: (ctx) =>\n\t\t\t\t\t\tctx.path === \"/update-user\" && \"phoneNumber\" in ctx.body,\n\t\t\t\t\thandler: createAuthMiddleware(async (_ctx) => {\n\t\t\t\t\t\tthrow APIError.from(\n\t\t\t\t\t\t\t\"BAD_REQUEST\",\n\t\t\t\t\t\t\tPHONE_NUMBER_ERROR_CODES.PHONE_NUMBER_CANNOT_BE_UPDATED,\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tendpoints: {\n\t\t\tsignInPhoneNumber: signInPhoneNumber(opts as RequiredPhoneNumberOptions),\n\t\t\tsendPhoneNumberOTP: sendPhoneNumberOTP(\n\t\t\t\topts as RequiredPhoneNumberOptions,\n\t\t\t),\n\t\t\tverifyPhoneNumber: verifyPhoneNumber(opts as RequiredPhoneNumberOptions),\n\t\t\trequestPasswordResetPhoneNumber: requestPasswordResetPhoneNumber(\n\t\t\t\topts as RequiredPhoneNumberOptions,\n\t\t\t),\n\t\t\tresetPasswordPhoneNumber: resetPasswordPhoneNumber(\n\t\t\t\topts as RequiredPhoneNumberOptions,\n\t\t\t),\n\t\t},\n\t\tschema: mergeSchema(schema, options?.schema),\n\t\trateLimit: [\n\t\t\t{\n\t\t\t\tpathMatcher(path) {\n\t\t\t\t\treturn path.startsWith(\"/phone-number\");\n\t\t\t\t},\n\t\t\t\twindow: 60,\n\t\t\t\tmax: 10,\n\t\t\t},\n\t\t],\n\t\toptions,\n\t\t$ERROR_CODES: PHONE_NUMBER_ERROR_CODES,\n\t} satisfies BetterAuthPlugin;\n};\n"],"mappings":";;;;;;;;AA0BA,MAAa,eAAe,YAA6C;CACxE,MAAM,OAAO;EACZ,WAAW,SAAS,aAAa;EACjC,WAAW,SAAS,aAAa;EACjC,GAAG;EACH,aAAa;EACb,qBAAqB;EACrB,MAAM;EACN,WAAW;EACX;AAED,QAAO;EACN,IAAI;EACJ,OAAO,EACN,QAAQ,CACP;GAEC,UAAU,QACT,IAAI,SAAS,kBAAkB,iBAAiB,IAAI;GACrD,SAAS,qBAAqB,OAAO,SAAS;AAC7C,UAAM,SAAS,KACd,eACA,yBAAyB,+BACzB;KACA;GACF,CACD,EACD;EACD,WAAW;GACV,mBAAmB,kBAAkB,KAAmC;GACxE,oBAAoB,mBACnB,KACA;GACD,mBAAmB,kBAAkB,KAAmC;GACxE,iCAAiC,gCAChC,KACA;GACD,0BAA0B,yBACzB,KACA;GACD;EACD,QAAQ,YAAY,QAAQ,SAAS,OAAO;EAC5C,WAAW,CACV;GACC,YAAY,MAAM;AACjB,WAAO,KAAK,WAAW,gBAAgB;;GAExC,QAAQ;GACR,KAAK;GACL,CACD;EACD;EACA,cAAc;EACd"}
|