@gatwech/auth 1.0.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/access-BO2g7QVe.mjs +45 -0
- package/dist/access-C6O_osEz.mjs +79 -0
- package/dist/access-DT1f6l5k.mjs +51 -0
- package/dist/adapter-factory-BZ2Qiqpn.mjs +640 -0
- package/dist/adapters/drizzle-adapter/index.d.mts +47 -0
- package/dist/adapters/drizzle-adapter/index.mjs +208 -0
- package/dist/adapters/index.d.mts +132 -0
- package/dist/adapters/index.mjs +18 -0
- package/dist/adapters/kysely-adapter/index.d.mts +47 -0
- package/dist/adapters/kysely-adapter/index.mjs +11 -0
- package/dist/adapters/memory-adapter/index.d.mts +14 -0
- package/dist/adapters/memory-adapter/index.mjs +154 -0
- package/dist/adapters/mongodb-adapter/index.d.mts +35 -0
- package/dist/adapters/mongodb-adapter/index.mjs +315 -0
- package/dist/adapters/prisma-adapter/index.d.mts +34 -0
- package/dist/adapters/prisma-adapter/index.mjs +159 -0
- package/dist/adapters/test.d.mts +81 -0
- package/dist/adapters/test.mjs +793 -0
- package/dist/admin-Bcq53Nwj.mjs +743 -0
- package/dist/admin-DtfO1PLg.d.mts +1689 -0
- package/dist/anonymous-CRt1imBW.mjs +107 -0
- package/dist/api/index.d.mts +6 -0
- package/dist/api/index.mjs +17 -0
- package/dist/api-0pR_I-Nx.mjs +3139 -0
- package/dist/auth-CBUoBX6o.mjs +233 -0
- package/dist/bearer-Djf_awfo.mjs +63 -0
- package/dist/bun-sqlite-dialect-CeNvMaZz.mjs +155 -0
- package/dist/captcha-BqaMxlKC.mjs +178 -0
- package/dist/chunk-BK_LfMhE.mjs +40 -0
- package/dist/client/index.d.mts +186 -0
- package/dist/client/index.mjs +7 -0
- package/dist/client/plugins/index.d.mts +949 -0
- package/dist/client/plugins/index.mjs +539 -0
- package/dist/client/react/index.d.mts +179 -0
- package/dist/client/react/index.mjs +69 -0
- package/dist/client-BOX93C3d.d.mts +1250 -0
- package/dist/client-CNY0tn9g.d.mts +628 -0
- package/dist/client-CygJhqeB.mjs +29 -0
- package/dist/client-WiN43tAS.mjs +17 -0
- package/dist/client-aExCkfwm.mjs +30 -0
- package/dist/cookies/index.d.mts +7 -0
- package/dist/cookies/index.mjs +7 -0
- package/dist/cookies-cJObLwn1.mjs +597 -0
- package/dist/crypto/index.d.mts +44 -0
- package/dist/crypto/index.mjs +4 -0
- package/dist/crypto-Bb42eMrH.mjs +70 -0
- package/dist/custom-session-L3t7ecsd.mjs +67 -0
- package/dist/date-Cx2yCiC4.mjs +115 -0
- package/dist/db/index.d.mts +7 -0
- package/dist/db/index.mjs +15 -0
- package/dist/db-BrstmDhc.mjs +1124 -0
- package/dist/device-authorization-V4s3h4Mj.mjs +557 -0
- package/dist/dialect-CeddeGHf.mjs +72 -0
- package/dist/email-otp-BtDHSw14.mjs +592 -0
- package/dist/esm-C-QicDNz.mjs +4090 -0
- package/dist/generic-oauth-CL5X27ZI.mjs +445 -0
- package/dist/get-request-ip-DSjrEpGo.mjs +27 -0
- package/dist/get-tables-BQP7YW9c.mjs +249 -0
- package/dist/has-permission-BpAr7uCn.mjs +14 -0
- package/dist/haveibeenpwned-cMpJvmzI.mjs +43 -0
- package/dist/helper-tmxW3BHj.d.mts +21 -0
- package/dist/index-34ONrP8l.d.mts +503 -0
- package/dist/index-65G5U5DB-DSdjzreF.d.mts +2543 -0
- package/dist/index-B-XKqFvY.d.mts +30 -0
- package/dist/index-B3n8e37d.d.mts +165 -0
- package/dist/index-BBm8nQ9Q.d.mts +42 -0
- package/dist/index-BHoQlf7a.d.mts +7699 -0
- package/dist/index-BYMI9r_d.d.mts +257 -0
- package/dist/index-BqhKCbPH.d.mts +36 -0
- package/dist/index-Buhn3hkR.d.mts +433 -0
- package/dist/index-C-u1h_WX.d.mts +174 -0
- package/dist/index-C7fQuk-V.d.mts +41 -0
- package/dist/index-CM-CFWwr.d.mts +1919 -0
- package/dist/index-CuFzhoS6.d.mts +359 -0
- package/dist/index-Cxi7TbLE.d.mts +11347 -0
- package/dist/index-DB7t8whN.d.mts +1 -0
- package/dist/index-DKNNV1kb.d.mts +626 -0
- package/dist/index-DR0xXno9.d.mts +113 -0
- package/dist/index-D_k662QG.d.mts +833 -0
- package/dist/index-DaBcikv9.d.mts +118 -0
- package/dist/index-DlaMq1nb.d.mts +955 -0
- package/dist/index-DoXZYQpq.d.mts +290 -0
- package/dist/index-G6V0Z_Mn.d.mts +125 -0
- package/dist/index-z0KSvE5i.d.mts +246 -0
- package/dist/index-zjjNBRY2.d.mts +95 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +33 -0
- package/dist/integrations/next-js.d.mts +21 -0
- package/dist/integrations/next-js.mjs +62 -0
- package/dist/integrations/node.d.mts +15 -0
- package/dist/integrations/node.mjs +15 -0
- package/dist/integrations/react-start.d.mts +15 -0
- package/dist/integrations/react-start.mjs +46 -0
- package/dist/json-D0TBLy4q.mjs +24 -0
- package/dist/jwt-CmxZAGe2.mjs +94 -0
- package/dist/jwt-lHV4QHpD.mjs +387 -0
- package/dist/kysely-adapter-DpzYO8Yf.mjs +181 -0
- package/dist/magic-link-Bk-ueorR.mjs +176 -0
- package/dist/misc-beA1w3XV.mjs +7 -0
- package/dist/multi-session-DRrLKrg9.mjs +144 -0
- package/dist/node-sqlite-dialect-BcKxBQnm.mjs +155 -0
- package/dist/oauth-proxy-D1sWh9B_.mjs +133 -0
- package/dist/oauth2/index.d.mts +60 -0
- package/dist/oauth2/index.mjs +19 -0
- package/dist/one-tap-DMswkTEc.mjs +113 -0
- package/dist/organization-BArHO_5v.mjs +3857 -0
- package/dist/parser-DcrIEuXE.mjs +73 -0
- package/dist/passkey-CcD4CnhM.mjs +558 -0
- package/dist/password-sVC4nePO.mjs +25 -0
- package/dist/permission-DLYUF3cW.mjs +15 -0
- package/dist/phone-number-rHDIlh-2.mjs +485 -0
- package/dist/plugin-helper-4L-lzsjZ.mjs +16 -0
- package/dist/plugins/access/index.d.mts +3 -0
- package/dist/plugins/access/index.mjs +3 -0
- package/dist/plugins/admin/access/index.d.mts +116 -0
- package/dist/plugins/admin/access/index.mjs +4 -0
- package/dist/plugins/admin/index.d.mts +9 -0
- package/dist/plugins/admin/index.mjs +22 -0
- package/dist/plugins/anonymous/index.d.mts +7 -0
- package/dist/plugins/anonymous/index.mjs +18 -0
- package/dist/plugins/bearer/index.d.mts +2 -0
- package/dist/plugins/bearer/index.mjs +8 -0
- package/dist/plugins/captcha/index.d.mts +2 -0
- package/dist/plugins/captcha/index.mjs +4 -0
- package/dist/plugins/custom-session/index.d.mts +7 -0
- package/dist/plugins/custom-session/index.mjs +19 -0
- package/dist/plugins/device-authorization/index.d.mts +4 -0
- package/dist/plugins/device-authorization/index.mjs +18 -0
- package/dist/plugins/email-otp/index.d.mts +3 -0
- package/dist/plugins/email-otp/index.mjs +19 -0
- package/dist/plugins/generic-oauth/index.d.mts +7 -0
- package/dist/plugins/generic-oauth/index.mjs +18 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +2 -0
- package/dist/plugins/haveibeenpwned/index.mjs +18 -0
- package/dist/plugins/index.d.mts +139 -0
- package/dist/plugins/index.mjs +47 -0
- package/dist/plugins/jwt/index.d.mts +7 -0
- package/dist/plugins/jwt/index.mjs +18 -0
- package/dist/plugins/magic-link/index.d.mts +2 -0
- package/dist/plugins/magic-link/index.mjs +18 -0
- package/dist/plugins/multi-session/index.d.mts +3 -0
- package/dist/plugins/multi-session/index.mjs +18 -0
- package/dist/plugins/oauth-proxy/index.d.mts +2 -0
- package/dist/plugins/oauth-proxy/index.mjs +18 -0
- package/dist/plugins/one-tap/index.d.mts +2 -0
- package/dist/plugins/one-tap/index.mjs +18 -0
- package/dist/plugins/one-time-token/index.d.mts +7 -0
- package/dist/plugins/one-time-token/index.mjs +47 -0
- package/dist/plugins/organization/access/index.d.mts +4 -0
- package/dist/plugins/organization/access/index.mjs +4 -0
- package/dist/plugins/organization/index.d.mts +9 -0
- package/dist/plugins/organization/index.mjs +22 -0
- package/dist/plugins/passkey/index.d.mts +7 -0
- package/dist/plugins/passkey/index.mjs +18 -0
- package/dist/plugins/phone-number/index.d.mts +7 -0
- package/dist/plugins/phone-number/index.mjs +18 -0
- package/dist/plugins/two-factor/index.d.mts +7 -0
- package/dist/plugins/two-factor/index.mjs +20 -0
- package/dist/plugins/username/index.d.mts +4 -0
- package/dist/plugins/username/index.mjs +18 -0
- package/dist/plugins-3jfNste3.mjs +1544 -0
- package/dist/plugins-hFZT3hmK.d.mts +14 -0
- package/dist/promise-8rrEHRXd.mjs +23154 -0
- package/dist/proxy-CL9PZXJA.mjs +441 -0
- package/dist/session-Dgp133Yt.mjs +413 -0
- package/dist/social-providers/index.d.mts +1 -0
- package/dist/social-providers/index.mjs +3 -0
- package/dist/src/adapters/adapter-factory/index.d.ts +10 -0
- package/dist/src/adapters/adapter-factory/types.d.ts +124 -0
- package/dist/src/adapters/create-test-suite.d.ts +97 -0
- package/dist/src/adapters/drizzle-adapter/drizzle-adapter.d.ts +43 -0
- package/dist/src/adapters/drizzle-adapter/index.d.ts +1 -0
- package/dist/src/adapters/drizzle-adapter/test/generate-schema.d.ts +12 -0
- package/dist/src/adapters/index.d.ts +21 -0
- package/dist/src/adapters/kysely-adapter/bun-sqlite-dialect.d.ts +58 -0
- package/dist/src/adapters/kysely-adapter/dialect.d.ts +13 -0
- package/dist/src/adapters/kysely-adapter/index.d.ts +3 -0
- package/dist/src/adapters/kysely-adapter/kysely-adapter.d.ts +32 -0
- package/dist/src/adapters/kysely-adapter/node-sqlite-dialect.d.ts +58 -0
- package/dist/src/adapters/kysely-adapter/types.d.ts +1 -0
- package/dist/src/adapters/memory-adapter/index.d.ts +1 -0
- package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +9 -0
- package/dist/src/adapters/mongodb-adapter/index.d.ts +1 -0
- package/dist/src/adapters/mongodb-adapter/mongodb-adapter.d.ts +31 -0
- package/dist/src/adapters/prisma-adapter/index.d.ts +1 -0
- package/dist/src/adapters/prisma-adapter/prisma-adapter.d.ts +32 -0
- package/dist/src/adapters/prisma-adapter/test/auth.d.ts +3 -0
- package/dist/src/adapters/prisma-adapter/test/generate-auth-config.d.ts +2 -0
- package/dist/src/adapters/prisma-adapter/test/generate-prisma-schema.d.ts +3 -0
- package/dist/src/adapters/prisma-adapter/test/get-prisma-client.d.ts +7 -0
- package/dist/src/adapters/prisma-adapter/test/push-prisma-schema.d.ts +1 -0
- package/dist/src/adapters/test-adapter.d.ts +61 -0
- package/dist/src/adapters/test.d.ts +78 -0
- package/dist/src/adapters/tests/auth-flow.d.ts +22 -0
- package/dist/src/adapters/tests/index.d.ts +5 -0
- package/dist/src/adapters/tests/normal.d.ts +87 -0
- package/dist/src/adapters/tests/number-id.d.ts +17 -0
- package/dist/src/adapters/tests/performance.d.ts +24 -0
- package/dist/src/adapters/tests/transactions.d.ts +20 -0
- package/dist/src/adapters/utils.d.ts +3 -0
- package/dist/src/api/index.d.ts +7150 -0
- package/dist/src/api/middlewares/index.d.ts +2 -0
- package/dist/src/api/middlewares/oauth.d.ts +15 -0
- package/dist/src/api/middlewares/origin-check.d.ts +8 -0
- package/dist/src/api/rate-limiter/index.d.ts +13 -0
- package/dist/src/api/routes/account.d.ts +623 -0
- package/dist/src/api/routes/callback.d.ts +68 -0
- package/dist/src/api/routes/email-verification.d.ts +266 -0
- package/dist/src/api/routes/error.d.ts +51 -0
- package/dist/src/api/routes/index.d.ts +11 -0
- package/dist/src/api/routes/ok.d.ts +61 -0
- package/dist/src/api/routes/reset-password.d.ts +203 -0
- package/dist/src/api/routes/session.d.ts +586 -0
- package/dist/src/api/routes/sign-in.d.ts +298 -0
- package/dist/src/api/routes/sign-out.d.ts +59 -0
- package/dist/src/api/routes/sign-up.d.ts +625 -0
- package/dist/src/api/routes/update-user.d.ts +862 -0
- package/dist/src/api/to-auth-endpoints.d.ts +3 -0
- package/dist/src/auth.d.ts +25 -0
- package/dist/src/client/broadcast-channel.d.ts +12 -0
- package/dist/src/client/config.d.ts +85 -0
- package/dist/src/client/fetch-plugins.d.ts +14 -0
- package/dist/src/client/index.d.ts +15 -0
- package/dist/src/client/parser.d.ts +12 -0
- package/dist/src/client/path-to-object.d.ts +63 -0
- package/dist/src/client/plugins/index.d.ts +21 -0
- package/dist/src/client/plugins/infer-plugin.d.ts +11 -0
- package/dist/src/client/proxy.d.ts +8 -0
- package/dist/src/client/query.d.ts +16 -0
- package/dist/src/client/react/index.d.ts +130 -0
- package/dist/src/client/react/react-store.d.ts +43 -0
- package/dist/src/client/session-atom.d.ts +18 -0
- package/dist/src/client/session-refresh.d.ts +17 -0
- package/dist/src/client/test-plugin.d.ts +147 -0
- package/dist/src/client/types.d.ts +49 -0
- package/dist/src/client/vanilla.d.ts +124 -0
- package/dist/src/cookies/check-cookies.d.ts +4 -0
- package/dist/src/cookies/cookie-utils.d.ts +16 -0
- package/dist/src/cookies/index.d.ts +56 -0
- package/dist/src/cookies/session-store.d.ts +43 -0
- package/dist/src/crypto/buffer.d.ts +4 -0
- package/dist/src/crypto/index.d.ts +14 -0
- package/dist/src/crypto/jwt.d.ts +4 -0
- package/dist/src/crypto/password.d.ts +5 -0
- package/dist/src/crypto/random.d.ts +1 -0
- package/dist/src/db/field.d.ts +97 -0
- package/dist/src/db/get-migration.d.ts +18 -0
- package/dist/src/db/get-schema.d.ts +6 -0
- package/dist/src/db/get-tables.d.ts +3 -0
- package/dist/src/db/index.d.ts +10 -0
- package/dist/src/db/internal-adapter.d.ts +9 -0
- package/dist/src/db/schema.d.ts +76 -0
- package/dist/src/db/to-zod.d.ts +31 -0
- package/dist/src/db/utils.d.ts +6 -0
- package/dist/src/db/with-hooks.d.ts +27 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/init.d.ts +2 -0
- package/dist/src/integrations/next-js.d.ts +15 -0
- package/dist/src/integrations/node.d.ts +6 -0
- package/dist/src/integrations/react-start.d.ts +9 -0
- package/dist/src/oauth2/index.d.ts +4 -0
- package/dist/src/oauth2/link-account.d.ts +41 -0
- package/dist/src/oauth2/state.d.ts +21 -0
- package/dist/src/oauth2/utils.d.ts +3 -0
- package/dist/src/plugins/access/access.d.ts +25 -0
- package/dist/src/plugins/access/index.d.ts +2 -0
- package/dist/src/plugins/access/types.d.ts +14 -0
- package/dist/src/plugins/additional-fields/client.d.ts +91 -0
- package/dist/src/plugins/admin/access/index.d.ts +1 -0
- package/dist/src/plugins/admin/access/statement.d.ts +110 -0
- package/dist/src/plugins/admin/admin.d.ts +1570 -0
- package/dist/src/plugins/admin/client.d.ts +62 -0
- package/dist/src/plugins/admin/error-codes.d.ts +21 -0
- package/dist/src/plugins/admin/has-permission.d.ts +21 -0
- package/dist/src/plugins/admin/index.d.ts +2 -0
- package/dist/src/plugins/admin/schema.d.ts +36 -0
- package/dist/src/plugins/admin/types.d.ts +77 -0
- package/dist/src/plugins/anonymous/client.d.ts +8 -0
- package/dist/src/plugins/anonymous/index.d.ts +159 -0
- package/dist/src/plugins/api-key/client.d.ts +11 -0
- package/dist/src/plugins/api-key/index.d.ts +1431 -0
- package/dist/src/plugins/api-key/rate-limit.d.ts +20 -0
- package/dist/src/plugins/api-key/routes/create-api-key.d.ts +244 -0
- package/dist/src/plugins/api-key/routes/delete-all-expired-api-keys.d.ts +45 -0
- package/dist/src/plugins/api-key/routes/delete-api-key.d.ts +112 -0
- package/dist/src/plugins/api-key/routes/get-api-key.d.ts +234 -0
- package/dist/src/plugins/api-key/routes/index.d.ts +1136 -0
- package/dist/src/plugins/api-key/routes/list-api-keys.d.ts +231 -0
- package/dist/src/plugins/api-key/routes/update-api-key.d.ts +235 -0
- package/dist/src/plugins/api-key/routes/verify-api-key.d.ts +80 -0
- package/dist/src/plugins/api-key/schema.d.ts +188 -0
- package/dist/src/plugins/api-key/types.d.ts +285 -0
- package/dist/src/plugins/bearer/index.d.ts +31 -0
- package/dist/src/plugins/captcha/constants.d.ts +9 -0
- package/dist/src/plugins/captcha/error-codes.d.ts +9 -0
- package/dist/src/plugins/captcha/index.d.ts +7 -0
- package/dist/src/plugins/captcha/types.d.ts +23 -0
- package/dist/src/plugins/captcha/utils.d.ts +1 -0
- package/dist/src/plugins/captcha/verify-handlers/captchafox.d.ts +11 -0
- package/dist/src/plugins/captcha/verify-handlers/cloudflare-turnstile.d.ts +10 -0
- package/dist/src/plugins/captcha/verify-handlers/google-recaptcha.d.ts +11 -0
- package/dist/src/plugins/captcha/verify-handlers/h-captcha.d.ts +11 -0
- package/dist/src/plugins/captcha/verify-handlers/index.d.ts +4 -0
- package/dist/src/plugins/custom-session/client.d.ts +12 -0
- package/dist/src/plugins/custom-session/index.d.ts +89 -0
- package/dist/src/plugins/device-authorization/client.d.ts +12 -0
- package/dist/src/plugins/device-authorization/index.d.ts +568 -0
- package/dist/src/plugins/device-authorization/schema.d.ts +56 -0
- package/dist/src/plugins/email-otp/client.d.ts +9 -0
- package/dist/src/plugins/email-otp/index.d.ts +826 -0
- package/dist/src/plugins/email-otp/utils.d.ts +2 -0
- package/dist/src/plugins/generic-oauth/client.d.ts +5 -0
- package/dist/src/plugins/generic-oauth/index.d.ts +428 -0
- package/dist/src/plugins/haveibeenpwned/index.d.ts +25 -0
- package/dist/src/plugins/index.d.ts +28 -0
- package/dist/src/plugins/jwt/adapter.d.ts +8 -0
- package/dist/src/plugins/jwt/client.d.ts +5 -0
- package/dist/src/plugins/jwt/index.d.ts +276 -0
- package/dist/src/plugins/jwt/schema.d.ts +18 -0
- package/dist/src/plugins/jwt/sign.d.ts +8 -0
- package/dist/src/plugins/jwt/types.d.ts +175 -0
- package/dist/src/plugins/jwt/utils.d.ts +46 -0
- package/dist/src/plugins/last-login-method/client.d.ts +34 -0
- package/dist/src/plugins/last-login-method/index.d.ts +103 -0
- package/dist/src/plugins/magic-link/client.d.ts +5 -0
- package/dist/src/plugins/magic-link/index.d.ts +253 -0
- package/dist/src/plugins/magic-link/utils.d.ts +1 -0
- package/dist/src/plugins/multi-session/client.d.ts +9 -0
- package/dist/src/plugins/multi-session/index.d.ts +284 -0
- package/dist/src/plugins/oauth-proxy/index.d.ts +119 -0
- package/dist/src/plugins/one-tap/client.d.ts +81 -0
- package/dist/src/plugins/one-tap/index.d.ts +114 -0
- package/dist/src/plugins/one-time-token/client.d.ts +5 -0
- package/dist/src/plugins/one-time-token/index.d.ts +170 -0
- package/dist/src/plugins/one-time-token/utils.d.ts +1 -0
- package/dist/src/plugins/organization/access/index.d.ts +1 -0
- package/dist/src/plugins/organization/access/statement.d.ts +241 -0
- package/dist/src/plugins/organization/adapter.d.ts +685 -0
- package/dist/src/plugins/organization/call.d.ts +55 -0
- package/dist/src/plugins/organization/client.d.ts +344 -0
- package/dist/src/plugins/organization/error-codes.d.ts +58 -0
- package/dist/src/plugins/organization/has-permission.d.ts +13 -0
- package/dist/src/plugins/organization/index.d.ts +4 -0
- package/dist/src/plugins/organization/organization.d.ts +412 -0
- package/dist/src/plugins/organization/permission.d.ts +27 -0
- package/dist/src/plugins/organization/routes/crud-access-control.d.ts +701 -0
- package/dist/src/plugins/organization/routes/crud-invites.d.ts +1522 -0
- package/dist/src/plugins/organization/routes/crud-members.d.ts +1220 -0
- package/dist/src/plugins/organization/routes/crud-org.d.ts +1399 -0
- package/dist/src/plugins/organization/routes/crud-team.d.ts +1323 -0
- package/dist/src/plugins/organization/schema.d.ts +366 -0
- package/dist/src/plugins/organization/types.d.ts +737 -0
- package/dist/src/plugins/passkey/client.d.ts +190 -0
- package/dist/src/plugins/passkey/error-codes.d.ts +9 -0
- package/dist/src/plugins/passkey/index.d.ts +838 -0
- package/dist/src/plugins/passkey/schema.d.ts +50 -0
- package/dist/src/plugins/passkey/types.d.ts +69 -0
- package/dist/src/plugins/passkey/utils.d.ts +2 -0
- package/dist/src/plugins/phone-number/client.d.ts +9 -0
- package/dist/src/plugins/phone-number/index.d.ts +622 -0
- package/dist/src/plugins/phone-number/phone-number-error.d.ts +10 -0
- package/dist/src/plugins/two-factor/backup-codes/index.d.ts +387 -0
- package/dist/src/plugins/two-factor/client.d.ts +28 -0
- package/dist/src/plugins/two-factor/constant.d.ts +2 -0
- package/dist/src/plugins/two-factor/error-code.d.ts +11 -0
- package/dist/src/plugins/two-factor/index.d.ts +1014 -0
- package/dist/src/plugins/two-factor/otp/index.d.ts +282 -0
- package/dist/src/plugins/two-factor/schema.d.ts +35 -0
- package/dist/src/plugins/two-factor/totp/index.d.ts +298 -0
- package/dist/src/plugins/two-factor/types.d.ts +50 -0
- package/dist/src/plugins/two-factor/utils.d.ts +1 -0
- package/dist/src/plugins/two-factor/verify-two-factor.d.ts +59 -0
- package/dist/src/plugins/username/client.d.ts +5 -0
- package/dist/src/plugins/username/error-codes.d.ts +10 -0
- package/dist/src/plugins/username/index.d.ts +313 -0
- package/dist/src/plugins/username/schema.d.ts +27 -0
- package/dist/src/social-providers/index.d.ts +1 -0
- package/dist/src/test-utils/headers.d.ts +5 -0
- package/dist/src/test-utils/index.d.ts +2 -0
- package/dist/src/test-utils/test-instance.d.ts +17849 -0
- package/dist/src/types/adapter.d.ts +21 -0
- package/dist/src/types/api.d.ts +29 -0
- package/dist/src/types/helper.d.ts +32 -0
- package/dist/src/types/index.d.ts +7 -0
- package/dist/src/types/models.d.ts +13 -0
- package/dist/src/types/plugins.d.ts +14 -0
- package/dist/src/utils/await-object.d.ts +3 -0
- package/dist/src/utils/boolean.d.ts +1 -0
- package/dist/src/utils/clone.d.ts +1 -0
- package/dist/src/utils/constants.d.ts +1 -0
- package/dist/src/utils/date.d.ts +1 -0
- package/dist/src/utils/ensure-utc.d.ts +1 -0
- package/dist/src/utils/get-request-ip.d.ts +2 -0
- package/dist/src/utils/hashing.d.ts +6 -0
- package/dist/src/utils/hide-metadata.d.ts +3 -0
- package/dist/src/utils/id.d.ts +1 -0
- package/dist/src/utils/import-util.d.ts +1 -0
- package/dist/src/utils/index.d.ts +5 -0
- package/dist/src/utils/is-atom.d.ts +2 -0
- package/dist/src/utils/is-promise.d.ts +1 -0
- package/dist/src/utils/json.d.ts +1 -0
- package/dist/src/utils/merger.d.ts +1 -0
- package/dist/src/utils/middleware-response.d.ts +8 -0
- package/dist/src/utils/misc.d.ts +1 -0
- package/dist/src/utils/password.d.ts +6 -0
- package/dist/src/utils/plugin-helper.d.ts +5 -0
- package/dist/src/utils/shim.d.ts +3 -0
- package/dist/src/utils/time.d.ts +4 -0
- package/dist/src/utils/url.d.ts +4 -0
- package/dist/src/utils/wildcard.d.ts +45 -0
- package/dist/test-utils/index.d.mts +17870 -0
- package/dist/test-utils/index.mjs +272 -0
- package/dist/two-factor-ClUXxom2.mjs +914 -0
- package/dist/types/index.d.mts +6 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types-B1OL7hyf.d.mts +4 -0
- package/dist/types-Bjn15Uy6.mjs +1 -0
- package/dist/url-VB2gAbTI.mjs +59 -0
- package/dist/username-DiGklOGl.mjs +278 -0
- package/dist/utils-SOMB4Px5.mjs +132 -0
- package/package.json +447 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { a as __toDynamicImportESM } from "../chunk-BK_LfMhE.mjs";
|
|
2
|
+
import "../utils-SOMB4Px5.mjs";
|
|
3
|
+
import { t as getBaseURL } from "../url-VB2gAbTI.mjs";
|
|
4
|
+
import "../api-0pR_I-Nx.mjs";
|
|
5
|
+
import "../get-request-ip-DSjrEpGo.mjs";
|
|
6
|
+
import "../json-D0TBLy4q.mjs";
|
|
7
|
+
import "../crypto-Bb42eMrH.mjs";
|
|
8
|
+
import "../jwt-CmxZAGe2.mjs";
|
|
9
|
+
import { l as parseSetCookieHeader, u as setCookieToHeader } from "../cookies-cJObLwn1.mjs";
|
|
10
|
+
import "../date-Cx2yCiC4.mjs";
|
|
11
|
+
import { r as getAdapter, s as getMigrations } from "../db-BrstmDhc.mjs";
|
|
12
|
+
import "../dialect-CeddeGHf.mjs";
|
|
13
|
+
import "../get-tables-BQP7YW9c.mjs";
|
|
14
|
+
import "../types-Bjn15Uy6.mjs";
|
|
15
|
+
import "../misc-beA1w3XV.mjs";
|
|
16
|
+
import "../session-Dgp133Yt.mjs";
|
|
17
|
+
import "../adapter-factory-BZ2Qiqpn.mjs";
|
|
18
|
+
import "../kysely-adapter-DpzYO8Yf.mjs";
|
|
19
|
+
import { t as payvoAuth } from "../auth-CBUoBX6o.mjs";
|
|
20
|
+
import "../password-sVC4nePO.mjs";
|
|
21
|
+
import "../proxy-CL9PZXJA.mjs";
|
|
22
|
+
import "../parser-DcrIEuXE.mjs";
|
|
23
|
+
import { r as createAuthClient } from "../client-aExCkfwm.mjs";
|
|
24
|
+
import "../plugin-helper-4L-lzsjZ.mjs";
|
|
25
|
+
import "../access-BO2g7QVe.mjs";
|
|
26
|
+
import "../access-DT1f6l5k.mjs";
|
|
27
|
+
import "../admin-Bcq53Nwj.mjs";
|
|
28
|
+
import "../has-permission-BpAr7uCn.mjs";
|
|
29
|
+
import "../anonymous-CRt1imBW.mjs";
|
|
30
|
+
import "../plugins-3jfNste3.mjs";
|
|
31
|
+
import { t as bearer } from "../bearer-Djf_awfo.mjs";
|
|
32
|
+
import "../captcha-BqaMxlKC.mjs";
|
|
33
|
+
import "../custom-session-L3t7ecsd.mjs";
|
|
34
|
+
import "../device-authorization-V4s3h4Mj.mjs";
|
|
35
|
+
import "../client-WiN43tAS.mjs";
|
|
36
|
+
import "../email-otp-BtDHSw14.mjs";
|
|
37
|
+
import "../generic-oauth-CL5X27ZI.mjs";
|
|
38
|
+
import "../haveibeenpwned-cMpJvmzI.mjs";
|
|
39
|
+
import "../jwt-lHV4QHpD.mjs";
|
|
40
|
+
import "../magic-link-Bk-ueorR.mjs";
|
|
41
|
+
import "../multi-session-DRrLKrg9.mjs";
|
|
42
|
+
import "../oauth-proxy-D1sWh9B_.mjs";
|
|
43
|
+
import "../one-tap-DMswkTEc.mjs";
|
|
44
|
+
import "../organization-BArHO_5v.mjs";
|
|
45
|
+
import "../access-C6O_osEz.mjs";
|
|
46
|
+
import "../permission-DLYUF3cW.mjs";
|
|
47
|
+
import "../phone-number-rHDIlh-2.mjs";
|
|
48
|
+
import "../two-factor-ClUXxom2.mjs";
|
|
49
|
+
import "../client-CygJhqeB.mjs";
|
|
50
|
+
import "../passkey-CcD4CnhM.mjs";
|
|
51
|
+
import "../username-DiGklOGl.mjs";
|
|
52
|
+
import { sql } from "kysely";
|
|
53
|
+
import { afterAll } from "vitest";
|
|
54
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
55
|
+
|
|
56
|
+
//#region src/test-utils/headers.ts
|
|
57
|
+
/**
|
|
58
|
+
* converts set cookie containing headers to
|
|
59
|
+
* cookie containing headers
|
|
60
|
+
*/
|
|
61
|
+
function convertSetCookieToCookie(headers) {
|
|
62
|
+
const setCookieHeaders = [];
|
|
63
|
+
headers.forEach((value, name) => {
|
|
64
|
+
if (name.toLowerCase() === "set-cookie") setCookieHeaders.push(value);
|
|
65
|
+
});
|
|
66
|
+
if (setCookieHeaders.length === 0) return headers;
|
|
67
|
+
const existingCookies = headers.get("cookie") || "";
|
|
68
|
+
const cookies = existingCookies ? existingCookies.split("; ") : [];
|
|
69
|
+
setCookieHeaders.forEach((setCookie) => {
|
|
70
|
+
const cookiePair = setCookie.split(";")[0];
|
|
71
|
+
cookies.push(cookiePair.trim());
|
|
72
|
+
});
|
|
73
|
+
headers.set("cookie", cookies.join("; "));
|
|
74
|
+
return headers;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/test-utils/test-instance.ts
|
|
79
|
+
const cleanupSet = /* @__PURE__ */ new Set();
|
|
80
|
+
const currentUserContextStorage = new AsyncLocalStorage();
|
|
81
|
+
afterAll(async () => {
|
|
82
|
+
for (const cleanup of cleanupSet) {
|
|
83
|
+
await cleanup();
|
|
84
|
+
cleanupSet.delete(cleanup);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
async function getTestInstance(options, config) {
|
|
88
|
+
const testWith = config?.testWith || "sqlite";
|
|
89
|
+
async function getPostgres() {
|
|
90
|
+
const { Kysely: Kysely$1, PostgresDialect: PostgresDialect$1 } = await import("kysely");
|
|
91
|
+
const { Pool } = await import("../esm-C-QicDNz.mjs");
|
|
92
|
+
return new Kysely$1({ dialect: new PostgresDialect$1({ pool: new Pool({ connectionString: "postgres://user:password@localhost:5432/payvo_auth" }) }) });
|
|
93
|
+
}
|
|
94
|
+
async function getSqlite() {
|
|
95
|
+
const { default: Database } = await import("better-sqlite3");
|
|
96
|
+
return new Database(":memory:");
|
|
97
|
+
}
|
|
98
|
+
async function getMysql() {
|
|
99
|
+
const { Kysely: Kysely$1, MysqlDialect: MysqlDialect$1 } = await import("kysely");
|
|
100
|
+
const { createPool } = await import("../promise-8rrEHRXd.mjs").then(__toDynamicImportESM(1));
|
|
101
|
+
return new Kysely$1({ dialect: new MysqlDialect$1(createPool("mysql://user:password@localhost:3306/payvo_auth")) });
|
|
102
|
+
}
|
|
103
|
+
async function mongodbClient() {
|
|
104
|
+
const { MongoClient } = await import("mongodb");
|
|
105
|
+
const dbClient = async (connectionString, dbName) => {
|
|
106
|
+
const client$1 = new MongoClient(connectionString);
|
|
107
|
+
await client$1.connect();
|
|
108
|
+
return client$1.db(dbName);
|
|
109
|
+
};
|
|
110
|
+
return await dbClient("mongodb://127.0.0.1:27017", "payvo-auth");
|
|
111
|
+
}
|
|
112
|
+
const opts = {
|
|
113
|
+
socialProviders: {
|
|
114
|
+
github: {
|
|
115
|
+
clientId: "test",
|
|
116
|
+
clientSecret: "test"
|
|
117
|
+
},
|
|
118
|
+
google: {
|
|
119
|
+
clientId: "test",
|
|
120
|
+
clientSecret: "test"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
secret: "payvo-auth.secret",
|
|
124
|
+
database: testWith === "postgres" ? {
|
|
125
|
+
db: await getPostgres(),
|
|
126
|
+
type: "postgres"
|
|
127
|
+
} : testWith === "mongodb" ? await Promise.all([mongodbClient(), await import("../adapters/mongodb-adapter/index.mjs")]).then(([db, { mongodbAdapter }]) => mongodbAdapter(db)) : testWith === "mysql" ? {
|
|
128
|
+
db: await getMysql(),
|
|
129
|
+
type: "mysql"
|
|
130
|
+
} : await getSqlite(),
|
|
131
|
+
emailAndPassword: { enabled: true },
|
|
132
|
+
rateLimit: { enabled: false },
|
|
133
|
+
advanced: { cookies: {} },
|
|
134
|
+
logger: { level: "debug" }
|
|
135
|
+
};
|
|
136
|
+
const auth = payvoAuth({
|
|
137
|
+
baseURL: "http://localhost:" + (config?.port || 3e3),
|
|
138
|
+
...opts,
|
|
139
|
+
...options,
|
|
140
|
+
plugins: [bearer(), ...options?.plugins || []]
|
|
141
|
+
});
|
|
142
|
+
const testUser = {
|
|
143
|
+
email: "test@test.com",
|
|
144
|
+
password: "test123456",
|
|
145
|
+
name: "test user",
|
|
146
|
+
...config?.testUser
|
|
147
|
+
};
|
|
148
|
+
async function createTestUser() {
|
|
149
|
+
if (config?.disableTestUser) return;
|
|
150
|
+
await auth.api.signUpEmail({ body: testUser });
|
|
151
|
+
}
|
|
152
|
+
if (testWith !== "mongodb") {
|
|
153
|
+
const { runMigrations } = await getMigrations({
|
|
154
|
+
...auth.options,
|
|
155
|
+
database: opts.database
|
|
156
|
+
});
|
|
157
|
+
await runMigrations();
|
|
158
|
+
}
|
|
159
|
+
await createTestUser();
|
|
160
|
+
const cleanup = async () => {
|
|
161
|
+
if (testWith === "mongodb") {
|
|
162
|
+
await (await mongodbClient()).dropDatabase();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (testWith === "postgres") {
|
|
166
|
+
const postgres = await getPostgres();
|
|
167
|
+
await sql`DROP SCHEMA public CASCADE; CREATE SCHEMA public;`.execute(postgres);
|
|
168
|
+
await postgres.destroy();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (testWith === "mysql") {
|
|
172
|
+
const mysql = await getMysql();
|
|
173
|
+
await sql`SET FOREIGN_KEY_CHECKS = 0;`.execute(mysql);
|
|
174
|
+
const tables = await mysql.introspection.getTables();
|
|
175
|
+
for (const table of tables) await mysql.deleteFrom(table.name).execute();
|
|
176
|
+
await sql`SET FOREIGN_KEY_CHECKS = 1;`.execute(mysql);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (testWith === "sqlite") {
|
|
180
|
+
(await getSqlite()).close();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
cleanupSet.add(cleanup);
|
|
185
|
+
const customFetchImpl = async (url, init) => {
|
|
186
|
+
const headers = init?.headers || {};
|
|
187
|
+
const storageHeaders = currentUserContextStorage.getStore()?.headers;
|
|
188
|
+
return auth.handler(new Request(url, init ? {
|
|
189
|
+
...init,
|
|
190
|
+
headers: new Headers({
|
|
191
|
+
...storageHeaders ? Object.fromEntries(storageHeaders.entries()) : {},
|
|
192
|
+
...headers instanceof Headers ? Object.fromEntries(headers.entries()) : typeof headers === "object" ? headers : {}
|
|
193
|
+
})
|
|
194
|
+
} : { headers }));
|
|
195
|
+
};
|
|
196
|
+
const client = createAuthClient({
|
|
197
|
+
...config?.clientOptions,
|
|
198
|
+
baseURL: getBaseURL(options?.baseURL || "http://localhost:" + (config?.port || 3e3), options?.basePath || "/api/auth"),
|
|
199
|
+
fetchOptions: { customFetchImpl }
|
|
200
|
+
});
|
|
201
|
+
async function signInWithTestUser() {
|
|
202
|
+
if (config?.disableTestUser) throw new Error("Test user is disabled");
|
|
203
|
+
let headers = new Headers();
|
|
204
|
+
const setCookie = (name, value) => {
|
|
205
|
+
const current = headers.get("cookie");
|
|
206
|
+
headers.set("cookie", `${current || ""}; ${name}=${value}`);
|
|
207
|
+
};
|
|
208
|
+
const { data, error } = await client.signIn.email({
|
|
209
|
+
email: testUser.email,
|
|
210
|
+
password: testUser.password,
|
|
211
|
+
fetchOptions: { onSuccess(context) {
|
|
212
|
+
const signedCookie = parseSetCookieHeader(context.response.headers.get("set-cookie") || "").get("payvo-auth.session_token")?.value;
|
|
213
|
+
headers.set("cookie", `payvo-auth.session_token=${signedCookie}`);
|
|
214
|
+
} }
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
session: data.session,
|
|
218
|
+
user: data.user,
|
|
219
|
+
headers,
|
|
220
|
+
setCookie,
|
|
221
|
+
runWithUser: async (fn) => {
|
|
222
|
+
return currentUserContextStorage.run({ headers }, async () => {
|
|
223
|
+
await fn(headers);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async function signInWithUser(email, password) {
|
|
229
|
+
const headers = new Headers();
|
|
230
|
+
const { data } = await client.signIn.email({
|
|
231
|
+
email,
|
|
232
|
+
password,
|
|
233
|
+
fetchOptions: { onSuccess(context) {
|
|
234
|
+
const signedCookie = parseSetCookieHeader(context.response.headers.get("set-cookie") || "").get("payvo-auth.session_token")?.value;
|
|
235
|
+
headers.set("cookie", `payvo-auth.session_token=${signedCookie}`);
|
|
236
|
+
} }
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
res: data,
|
|
240
|
+
headers
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function sessionSetter(headers) {
|
|
244
|
+
return (context) => {
|
|
245
|
+
const header = context.response.headers.get("set-cookie");
|
|
246
|
+
if (header) {
|
|
247
|
+
const signedCookie = parseSetCookieHeader(header || "").get("payvo-auth.session_token")?.value;
|
|
248
|
+
headers.set("cookie", `payvo-auth.session_token=${signedCookie}`);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
auth,
|
|
254
|
+
client,
|
|
255
|
+
testUser,
|
|
256
|
+
signInWithTestUser,
|
|
257
|
+
signInWithUser,
|
|
258
|
+
cookieSetter: setCookieToHeader,
|
|
259
|
+
customFetchImpl,
|
|
260
|
+
sessionSetter,
|
|
261
|
+
db: await getAdapter(auth.options),
|
|
262
|
+
runWithUser: async (email, password, fn) => {
|
|
263
|
+
const { headers } = await signInWithUser(email, password);
|
|
264
|
+
return currentUserContextStorage.run({ headers }, async () => {
|
|
265
|
+
await fn(headers);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
//#endregion
|
|
272
|
+
export { convertSetCookieToCookie, getTestInstance };
|