@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,433 @@
|
|
|
1
|
+
import { g as User } from "./index-Cxi7TbLE.mjs";
|
|
2
|
+
import * as _gatwech_core15 from "@gatwech/core";
|
|
3
|
+
import { GenericEndpointContext } from "@gatwech/core";
|
|
4
|
+
import * as _gatwech_core_oauth20 from "@gatwech/core/oauth2";
|
|
5
|
+
import { OAuth2Tokens, OAuth2UserInfo, OAuthProvider } from "@gatwech/core/oauth2";
|
|
6
|
+
import * as better_call158 from "better-call";
|
|
7
|
+
import * as z$1 from "zod";
|
|
8
|
+
|
|
9
|
+
//#region src/plugins/generic-oauth/index.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Configuration interface for generic OAuth providers.
|
|
12
|
+
*/
|
|
13
|
+
interface GenericOAuthConfig {
|
|
14
|
+
/** Unique identifier for the OAuth provider */
|
|
15
|
+
providerId: string;
|
|
16
|
+
/**
|
|
17
|
+
* URL to fetch OAuth 2.0 configuration.
|
|
18
|
+
* If provided, the authorization and token endpoints will be fetched from this URL.
|
|
19
|
+
*/
|
|
20
|
+
discoveryUrl?: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* URL for the authorization endpoint.
|
|
23
|
+
* Optional if using discoveryUrl.
|
|
24
|
+
*/
|
|
25
|
+
authorizationUrl?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* URL for the token endpoint.
|
|
28
|
+
* Optional if using discoveryUrl.
|
|
29
|
+
*/
|
|
30
|
+
tokenUrl?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* URL for the user info endpoint.
|
|
33
|
+
* Optional if using discoveryUrl.
|
|
34
|
+
*/
|
|
35
|
+
userInfoUrl?: string | undefined;
|
|
36
|
+
/** OAuth client ID */
|
|
37
|
+
clientId: string;
|
|
38
|
+
/** OAuth client secret */
|
|
39
|
+
clientSecret?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Array of OAuth scopes to request.
|
|
42
|
+
* @default []
|
|
43
|
+
*/
|
|
44
|
+
scopes?: string[] | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Custom redirect URI.
|
|
47
|
+
* If not provided, a default URI will be constructed.
|
|
48
|
+
*/
|
|
49
|
+
redirectURI?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* OAuth response type.
|
|
52
|
+
* @default "code"
|
|
53
|
+
*/
|
|
54
|
+
responseType?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The response mode to use for the authorization code request.
|
|
57
|
+
*/
|
|
58
|
+
responseMode?: ("query" | "form_post") | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Prompt parameter for the authorization request.
|
|
61
|
+
* Controls the authentication experience for the user.
|
|
62
|
+
*/
|
|
63
|
+
prompt?: ("none" | "login" | "consent" | "select_account") | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to use PKCE (Proof Key for Code Exchange)
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
pkce?: boolean | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Access type for the authorization request.
|
|
71
|
+
* Use "offline" to request a refresh token.
|
|
72
|
+
*/
|
|
73
|
+
accessType?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Custom function to fetch user info.
|
|
76
|
+
* If provided, this function will be used instead of the default user info fetching logic.
|
|
77
|
+
* @param tokens - The OAuth tokens received after successful authentication
|
|
78
|
+
* @returns A promise that resolves to a User object or null
|
|
79
|
+
*/
|
|
80
|
+
getUserInfo?: ((tokens: OAuth2Tokens) => Promise<OAuth2UserInfo | null>) | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Custom function to map the user profile to a User object.
|
|
83
|
+
*/
|
|
84
|
+
mapProfileToUser?: ((profile: Record<string, any>) => Partial<Partial<User>> | Promise<Partial<User>>) | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Additional search-params to add to the authorizationUrl.
|
|
87
|
+
* Warning: Search-params added here overwrite any default params.
|
|
88
|
+
*/
|
|
89
|
+
authorizationUrlParams?: (Record<string, string> | ((ctx: GenericEndpointContext) => Record<string, string>)) | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Additional search-params to add to the tokenUrl.
|
|
92
|
+
* Warning: Search-params added here overwrite any default params.
|
|
93
|
+
*/
|
|
94
|
+
tokenUrlParams?: (Record<string, string> | ((ctx: GenericEndpointContext) => Record<string, string>)) | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Disable implicit sign up for new users. When set to true for the provider,
|
|
97
|
+
* sign-in need to be called with with requestSignUp as true to create new users.
|
|
98
|
+
*/
|
|
99
|
+
disableImplicitSignUp?: boolean | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Disable sign up for new users.
|
|
102
|
+
*/
|
|
103
|
+
disableSignUp?: boolean | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Authentication method for token requests.
|
|
106
|
+
* @default "post"
|
|
107
|
+
*/
|
|
108
|
+
authentication?: ("basic" | "post") | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Custom headers to include in the discovery request.
|
|
111
|
+
* Useful for providers like Epic that require specific headers (e.g., Epic-Client-ID).
|
|
112
|
+
*/
|
|
113
|
+
discoveryHeaders?: Record<string, string> | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Custom headers to include in the authorization request.
|
|
116
|
+
* Useful for providers like Qonto that require specific headers (e.g., X-Qonto-Staging-Token for local development).
|
|
117
|
+
*/
|
|
118
|
+
authorizationHeaders?: Record<string, string> | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Override user info with the provider info.
|
|
121
|
+
*
|
|
122
|
+
* This will update the user info with the provider info,
|
|
123
|
+
* when the user signs in with the provider.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
overrideUserInfo?: boolean | undefined;
|
|
127
|
+
}
|
|
128
|
+
interface GenericOAuthOptions {
|
|
129
|
+
/**
|
|
130
|
+
* Array of OAuth provider configurations.
|
|
131
|
+
*/
|
|
132
|
+
config: GenericOAuthConfig[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A generic OAuth plugin that can be used to add OAuth support to any provider
|
|
136
|
+
*/
|
|
137
|
+
declare const genericOAuth: (options: GenericOAuthOptions) => {
|
|
138
|
+
id: "generic-oauth";
|
|
139
|
+
init: (ctx: _gatwech_core15.AuthContext<_gatwech_core15.PayvoAuthOptions>) => {
|
|
140
|
+
context: {
|
|
141
|
+
socialProviders: OAuthProvider<Record<string, any>, Partial<_gatwech_core_oauth20.ProviderOptions<any>>>[];
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
endpoints: {
|
|
145
|
+
/**
|
|
146
|
+
* ### Endpoint
|
|
147
|
+
*
|
|
148
|
+
* POST `/sign-in/oauth2`
|
|
149
|
+
*
|
|
150
|
+
* ### API Methods
|
|
151
|
+
*
|
|
152
|
+
* **server:**
|
|
153
|
+
* `auth.api.signInWithOAuth2`
|
|
154
|
+
*
|
|
155
|
+
* **client:**
|
|
156
|
+
* `authClient.signIn.oauth2`
|
|
157
|
+
*
|
|
158
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/sign-in#api-method-sign-in-oauth2)
|
|
159
|
+
*/
|
|
160
|
+
signInWithOAuth2: {
|
|
161
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
162
|
+
body: {
|
|
163
|
+
providerId: string;
|
|
164
|
+
callbackURL?: string | undefined;
|
|
165
|
+
errorCallbackURL?: string | undefined;
|
|
166
|
+
newUserCallbackURL?: string | undefined;
|
|
167
|
+
disableRedirect?: boolean | undefined;
|
|
168
|
+
scopes?: string[] | undefined;
|
|
169
|
+
requestSignUp?: boolean | undefined;
|
|
170
|
+
additionalData?: Record<string, any> | undefined;
|
|
171
|
+
};
|
|
172
|
+
} & {
|
|
173
|
+
method?: "POST" | undefined;
|
|
174
|
+
} & {
|
|
175
|
+
query?: Record<string, any> | undefined;
|
|
176
|
+
} & {
|
|
177
|
+
params?: Record<string, any>;
|
|
178
|
+
} & {
|
|
179
|
+
request?: Request;
|
|
180
|
+
} & {
|
|
181
|
+
headers?: HeadersInit;
|
|
182
|
+
} & {
|
|
183
|
+
asResponse?: boolean;
|
|
184
|
+
returnHeaders?: boolean;
|
|
185
|
+
use?: better_call158.Middleware[];
|
|
186
|
+
path?: string;
|
|
187
|
+
} & {
|
|
188
|
+
asResponse?: AsResponse | undefined;
|
|
189
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
190
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
191
|
+
headers: Headers;
|
|
192
|
+
response: {
|
|
193
|
+
url: string;
|
|
194
|
+
redirect: boolean;
|
|
195
|
+
};
|
|
196
|
+
} : {
|
|
197
|
+
url: string;
|
|
198
|
+
redirect: boolean;
|
|
199
|
+
}>;
|
|
200
|
+
options: {
|
|
201
|
+
method: "POST";
|
|
202
|
+
body: z$1.ZodObject<{
|
|
203
|
+
providerId: z$1.ZodString;
|
|
204
|
+
callbackURL: z$1.ZodOptional<z$1.ZodString>;
|
|
205
|
+
errorCallbackURL: z$1.ZodOptional<z$1.ZodString>;
|
|
206
|
+
newUserCallbackURL: z$1.ZodOptional<z$1.ZodString>;
|
|
207
|
+
disableRedirect: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
208
|
+
scopes: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
209
|
+
requestSignUp: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
210
|
+
additionalData: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>>;
|
|
211
|
+
}, z$1.core.$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
|
+
url: {
|
|
224
|
+
type: string;
|
|
225
|
+
};
|
|
226
|
+
redirect: {
|
|
227
|
+
type: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
} & {
|
|
238
|
+
use: any[];
|
|
239
|
+
};
|
|
240
|
+
path: "/sign-in/oauth2";
|
|
241
|
+
};
|
|
242
|
+
oAuth2Callback: {
|
|
243
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
244
|
+
body?: undefined;
|
|
245
|
+
} & {
|
|
246
|
+
method?: "GET" | undefined;
|
|
247
|
+
} & {
|
|
248
|
+
query: {
|
|
249
|
+
code?: string | undefined;
|
|
250
|
+
error?: string | undefined;
|
|
251
|
+
error_description?: string | undefined;
|
|
252
|
+
state?: string | undefined;
|
|
253
|
+
};
|
|
254
|
+
} & {
|
|
255
|
+
params: {
|
|
256
|
+
providerId: string;
|
|
257
|
+
};
|
|
258
|
+
} & {
|
|
259
|
+
request?: Request;
|
|
260
|
+
} & {
|
|
261
|
+
headers?: HeadersInit;
|
|
262
|
+
} & {
|
|
263
|
+
asResponse?: boolean;
|
|
264
|
+
returnHeaders?: boolean;
|
|
265
|
+
use?: better_call158.Middleware[];
|
|
266
|
+
path?: string;
|
|
267
|
+
} & {
|
|
268
|
+
asResponse?: AsResponse | undefined;
|
|
269
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
270
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
271
|
+
headers: Headers;
|
|
272
|
+
response: void;
|
|
273
|
+
} : void>;
|
|
274
|
+
options: {
|
|
275
|
+
method: "GET";
|
|
276
|
+
query: z$1.ZodObject<{
|
|
277
|
+
code: z$1.ZodOptional<z$1.ZodString>;
|
|
278
|
+
error: z$1.ZodOptional<z$1.ZodString>;
|
|
279
|
+
error_description: z$1.ZodOptional<z$1.ZodString>;
|
|
280
|
+
state: z$1.ZodOptional<z$1.ZodString>;
|
|
281
|
+
}, z$1.core.$strip>;
|
|
282
|
+
metadata: {
|
|
283
|
+
client: boolean;
|
|
284
|
+
openapi: {
|
|
285
|
+
description: string;
|
|
286
|
+
responses: {
|
|
287
|
+
200: {
|
|
288
|
+
description: string;
|
|
289
|
+
content: {
|
|
290
|
+
"application/json": {
|
|
291
|
+
schema: {
|
|
292
|
+
type: "object";
|
|
293
|
+
properties: {
|
|
294
|
+
url: {
|
|
295
|
+
type: string;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
} & {
|
|
306
|
+
use: any[];
|
|
307
|
+
};
|
|
308
|
+
path: "/oauth2/callback/:providerId";
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* ### Endpoint
|
|
312
|
+
*
|
|
313
|
+
* POST `/oauth2/link`
|
|
314
|
+
*
|
|
315
|
+
* ### API Methods
|
|
316
|
+
*
|
|
317
|
+
* **server:**
|
|
318
|
+
* `auth.api.oAuth2LinkAccount`
|
|
319
|
+
*
|
|
320
|
+
* **client:**
|
|
321
|
+
* `authClient.oauth2.link`
|
|
322
|
+
*
|
|
323
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/generic-oauth#api-method-oauth2-link)
|
|
324
|
+
*/
|
|
325
|
+
oAuth2LinkAccount: {
|
|
326
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
327
|
+
body: {
|
|
328
|
+
providerId: string;
|
|
329
|
+
callbackURL: string;
|
|
330
|
+
scopes?: string[] | undefined;
|
|
331
|
+
errorCallbackURL?: string | undefined;
|
|
332
|
+
};
|
|
333
|
+
} & {
|
|
334
|
+
method?: "POST" | undefined;
|
|
335
|
+
} & {
|
|
336
|
+
query?: Record<string, any> | undefined;
|
|
337
|
+
} & {
|
|
338
|
+
params?: Record<string, any>;
|
|
339
|
+
} & {
|
|
340
|
+
request?: Request;
|
|
341
|
+
} & {
|
|
342
|
+
headers?: HeadersInit;
|
|
343
|
+
} & {
|
|
344
|
+
asResponse?: boolean;
|
|
345
|
+
returnHeaders?: boolean;
|
|
346
|
+
use?: better_call158.Middleware[];
|
|
347
|
+
path?: string;
|
|
348
|
+
} & {
|
|
349
|
+
asResponse?: AsResponse | undefined;
|
|
350
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
351
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
352
|
+
headers: Headers;
|
|
353
|
+
response: {
|
|
354
|
+
url: string;
|
|
355
|
+
redirect: boolean;
|
|
356
|
+
};
|
|
357
|
+
} : {
|
|
358
|
+
url: string;
|
|
359
|
+
redirect: boolean;
|
|
360
|
+
}>;
|
|
361
|
+
options: {
|
|
362
|
+
method: "POST";
|
|
363
|
+
body: z$1.ZodObject<{
|
|
364
|
+
providerId: z$1.ZodString;
|
|
365
|
+
callbackURL: z$1.ZodString;
|
|
366
|
+
scopes: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
367
|
+
errorCallbackURL: z$1.ZodOptional<z$1.ZodString>;
|
|
368
|
+
}, z$1.core.$strip>;
|
|
369
|
+
use: ((inputContext: better_call158.MiddlewareInputContext<better_call158.MiddlewareOptions>) => Promise<{
|
|
370
|
+
session: {
|
|
371
|
+
session: Record<string, any> & {
|
|
372
|
+
id: string;
|
|
373
|
+
createdAt: Date;
|
|
374
|
+
updatedAt: Date;
|
|
375
|
+
userId: string;
|
|
376
|
+
expiresAt: Date;
|
|
377
|
+
token: string;
|
|
378
|
+
ipAddress?: string | null | undefined;
|
|
379
|
+
userAgent?: string | null | undefined;
|
|
380
|
+
};
|
|
381
|
+
user: Record<string, any> & {
|
|
382
|
+
id: string;
|
|
383
|
+
createdAt: Date;
|
|
384
|
+
updatedAt: Date;
|
|
385
|
+
email: string;
|
|
386
|
+
emailVerified: boolean;
|
|
387
|
+
name: string;
|
|
388
|
+
image?: string | null | undefined;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
}>)[];
|
|
392
|
+
metadata: {
|
|
393
|
+
openapi: {
|
|
394
|
+
description: string;
|
|
395
|
+
responses: {
|
|
396
|
+
"200": {
|
|
397
|
+
description: string;
|
|
398
|
+
content: {
|
|
399
|
+
"application/json": {
|
|
400
|
+
schema: {
|
|
401
|
+
type: "object";
|
|
402
|
+
properties: {
|
|
403
|
+
url: {
|
|
404
|
+
type: string;
|
|
405
|
+
format: string;
|
|
406
|
+
description: string;
|
|
407
|
+
};
|
|
408
|
+
redirect: {
|
|
409
|
+
type: string;
|
|
410
|
+
description: string;
|
|
411
|
+
enum: boolean[];
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
required: string[];
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
} & {
|
|
423
|
+
use: any[];
|
|
424
|
+
};
|
|
425
|
+
path: "/oauth2/link";
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
$ERROR_CODES: {
|
|
429
|
+
readonly INVALID_OAUTH_CONFIGURATION: "Invalid OAuth configuration";
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
//#endregion
|
|
433
|
+
export { genericOAuth as n, GenericOAuthConfig as t };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { g as User, h as Session } from "./index-Cxi7TbLE.mjs";
|
|
2
|
+
import { GenericEndpointContext } from "@gatwech/core";
|
|
3
|
+
import * as better_call37 from "better-call";
|
|
4
|
+
import * as z$1 from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/one-time-token/index.d.ts
|
|
7
|
+
interface OneTimeTokenOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Expires in minutes
|
|
10
|
+
*
|
|
11
|
+
* @default 3
|
|
12
|
+
*/
|
|
13
|
+
expiresIn?: number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Only allow server initiated requests
|
|
16
|
+
*/
|
|
17
|
+
disableClientRequest?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a custom token
|
|
20
|
+
*/
|
|
21
|
+
generateToken?: ((session: {
|
|
22
|
+
user: User & Record<string, any>;
|
|
23
|
+
session: Session & Record<string, any>;
|
|
24
|
+
}, ctx: GenericEndpointContext) => Promise<string>) | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* This option allows you to configure how the token is stored in your database.
|
|
27
|
+
* Note: This will not affect the token that's sent, it will only affect the token stored in your database.
|
|
28
|
+
*
|
|
29
|
+
* @default "plain"
|
|
30
|
+
*/
|
|
31
|
+
storeToken?: ("plain" | "hashed" | {
|
|
32
|
+
type: "custom-hasher";
|
|
33
|
+
hash: (token: string) => Promise<string>;
|
|
34
|
+
}) | undefined;
|
|
35
|
+
}
|
|
36
|
+
declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
37
|
+
id: "one-time-token";
|
|
38
|
+
endpoints: {
|
|
39
|
+
/**
|
|
40
|
+
* ### Endpoint
|
|
41
|
+
*
|
|
42
|
+
* GET `/one-time-token/generate`
|
|
43
|
+
*
|
|
44
|
+
* ### API Methods
|
|
45
|
+
*
|
|
46
|
+
* **server:**
|
|
47
|
+
* `auth.api.generateOneTimeToken`
|
|
48
|
+
*
|
|
49
|
+
* **client:**
|
|
50
|
+
* `authClient.oneTimeToken.generate`
|
|
51
|
+
*
|
|
52
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/one-time-token#api-method-one-time-token-generate)
|
|
53
|
+
*/
|
|
54
|
+
generateOneTimeToken: {
|
|
55
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
56
|
+
body?: undefined;
|
|
57
|
+
} & {
|
|
58
|
+
method?: "GET" | undefined;
|
|
59
|
+
} & {
|
|
60
|
+
query?: Record<string, any> | undefined;
|
|
61
|
+
} & {
|
|
62
|
+
params?: Record<string, any>;
|
|
63
|
+
} & {
|
|
64
|
+
request?: Request;
|
|
65
|
+
} & {
|
|
66
|
+
headers?: HeadersInit;
|
|
67
|
+
} & {
|
|
68
|
+
asResponse?: boolean;
|
|
69
|
+
returnHeaders?: boolean;
|
|
70
|
+
use?: better_call37.Middleware[];
|
|
71
|
+
path?: string;
|
|
72
|
+
} & {
|
|
73
|
+
asResponse?: AsResponse | undefined;
|
|
74
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
75
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
76
|
+
headers: Headers;
|
|
77
|
+
response: {
|
|
78
|
+
token: string;
|
|
79
|
+
};
|
|
80
|
+
} : {
|
|
81
|
+
token: string;
|
|
82
|
+
}>;
|
|
83
|
+
options: {
|
|
84
|
+
method: "GET";
|
|
85
|
+
use: ((inputContext: better_call37.MiddlewareInputContext<better_call37.MiddlewareOptions>) => Promise<{
|
|
86
|
+
session: {
|
|
87
|
+
session: Record<string, any> & {
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: Date;
|
|
90
|
+
updatedAt: Date;
|
|
91
|
+
userId: string;
|
|
92
|
+
expiresAt: Date;
|
|
93
|
+
token: string;
|
|
94
|
+
ipAddress?: string | null | undefined;
|
|
95
|
+
userAgent?: string | null | undefined;
|
|
96
|
+
};
|
|
97
|
+
user: Record<string, any> & {
|
|
98
|
+
id: string;
|
|
99
|
+
createdAt: Date;
|
|
100
|
+
updatedAt: Date;
|
|
101
|
+
email: string;
|
|
102
|
+
emailVerified: boolean;
|
|
103
|
+
name: string;
|
|
104
|
+
image?: string | null | undefined;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}>)[];
|
|
108
|
+
} & {
|
|
109
|
+
use: any[];
|
|
110
|
+
};
|
|
111
|
+
path: "/one-time-token/generate";
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* ### Endpoint
|
|
115
|
+
*
|
|
116
|
+
* POST `/one-time-token/verify`
|
|
117
|
+
*
|
|
118
|
+
* ### API Methods
|
|
119
|
+
*
|
|
120
|
+
* **server:**
|
|
121
|
+
* `auth.api.verifyOneTimeToken`
|
|
122
|
+
*
|
|
123
|
+
* **client:**
|
|
124
|
+
* `authClient.oneTimeToken.verify`
|
|
125
|
+
*
|
|
126
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/one-time-token#api-method-one-time-token-verify)
|
|
127
|
+
*/
|
|
128
|
+
verifyOneTimeToken: {
|
|
129
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
130
|
+
body: {
|
|
131
|
+
token: string;
|
|
132
|
+
};
|
|
133
|
+
} & {
|
|
134
|
+
method?: "POST" | undefined;
|
|
135
|
+
} & {
|
|
136
|
+
query?: Record<string, any> | undefined;
|
|
137
|
+
} & {
|
|
138
|
+
params?: Record<string, any>;
|
|
139
|
+
} & {
|
|
140
|
+
request?: Request;
|
|
141
|
+
} & {
|
|
142
|
+
headers?: HeadersInit;
|
|
143
|
+
} & {
|
|
144
|
+
asResponse?: boolean;
|
|
145
|
+
returnHeaders?: boolean;
|
|
146
|
+
use?: better_call37.Middleware[];
|
|
147
|
+
path?: string;
|
|
148
|
+
} & {
|
|
149
|
+
asResponse?: AsResponse | undefined;
|
|
150
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
151
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
152
|
+
headers: Headers;
|
|
153
|
+
response: {
|
|
154
|
+
session: Session & Record<string, any>;
|
|
155
|
+
user: User & Record<string, any>;
|
|
156
|
+
};
|
|
157
|
+
} : {
|
|
158
|
+
session: Session & Record<string, any>;
|
|
159
|
+
user: User & Record<string, any>;
|
|
160
|
+
}>;
|
|
161
|
+
options: {
|
|
162
|
+
method: "POST";
|
|
163
|
+
body: z$1.ZodObject<{
|
|
164
|
+
token: z$1.ZodString;
|
|
165
|
+
}, z$1.core.$strip>;
|
|
166
|
+
} & {
|
|
167
|
+
use: any[];
|
|
168
|
+
};
|
|
169
|
+
path: "/one-time-token/verify";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
export { oneTimeToken as t };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { o as LiteralString } from "./helper-tmxW3BHj.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/access/types.d.ts
|
|
4
|
+
type SubArray<T$1 extends unknown[] | readonly unknown[] | any[]> = T$1[number][];
|
|
5
|
+
type Subset<K extends keyof R, R extends Record<string | LiteralString, readonly string[] | readonly LiteralString[]>> = { [P in K]: SubArray<R[P]> };
|
|
6
|
+
type Statements = {
|
|
7
|
+
readonly [resource: string]: readonly LiteralString[];
|
|
8
|
+
};
|
|
9
|
+
type AccessControl<TStatements extends Statements = Statements> = ReturnType<typeof createAccessControl<TStatements>>;
|
|
10
|
+
type Role<TStatements extends Statements = Record<string, any>> = {
|
|
11
|
+
authorize: (request: any, connector?: ("OR" | "AND") | undefined) => AuthorizeResponse;
|
|
12
|
+
statements: TStatements;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/plugins/access/access.d.ts
|
|
16
|
+
type AuthorizeResponse = {
|
|
17
|
+
success: false;
|
|
18
|
+
error: string;
|
|
19
|
+
} | {
|
|
20
|
+
success: true;
|
|
21
|
+
error?: never | undefined;
|
|
22
|
+
};
|
|
23
|
+
declare function role<TStatements extends Statements>(statements: TStatements): {
|
|
24
|
+
authorize<K extends keyof TStatements>(request: { [key in K]?: TStatements[key] | {
|
|
25
|
+
actions: TStatements[key];
|
|
26
|
+
connector: "OR" | "AND";
|
|
27
|
+
} }, connector?: "OR" | "AND"): AuthorizeResponse;
|
|
28
|
+
statements: TStatements;
|
|
29
|
+
};
|
|
30
|
+
declare function createAccessControl<const TStatements extends Statements>(s: TStatements): {
|
|
31
|
+
newRole<K extends keyof TStatements>(statements: Subset<K, TStatements>): {
|
|
32
|
+
authorize<K_1 extends K>(request: K_1 extends infer T extends keyof Subset<K, TStatements> ? { [key in T]?: Subset<K, TStatements>[key] | {
|
|
33
|
+
actions: Subset<K, TStatements>[key];
|
|
34
|
+
connector: "OR" | "AND";
|
|
35
|
+
} | undefined } : never, connector?: "OR" | "AND"): AuthorizeResponse;
|
|
36
|
+
statements: Subset<K, TStatements>;
|
|
37
|
+
};
|
|
38
|
+
statements: TStatements;
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Role as a, Subset as c, AccessControl as i, createAccessControl as n, Statements as o, role as r, SubArray as s, AuthorizeResponse as t };
|