@gatwech/auth 1.0.0-beta.18 → 1.0.0-beta.19
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 +8 -14
- package/dist/{access-C6O_osEz.mjs → access-CrwEFPHE.mjs} +1 -1
- package/dist/{access-DT1f6l5k.mjs → access-bhklJd7m.mjs} +1 -1
- package/dist/{adapter-factory-BZ2Qiqpn.mjs → adapter-factory-xbLUJt85.mjs} +2 -2
- package/dist/adapters/drizzle-adapter/index.mjs +6 -5
- package/dist/adapters/index.d.mts +5 -5
- package/dist/adapters/index.mjs +6 -5
- package/dist/adapters/kysely-adapter/index.d.mts +1 -1
- package/dist/adapters/kysely-adapter/index.mjs +8 -7
- package/dist/adapters/memory-adapter/index.d.mts +1 -1
- package/dist/adapters/memory-adapter/index.mjs +6 -5
- package/dist/adapters/mongodb-adapter/index.mjs +6 -5
- package/dist/adapters/prisma-adapter/index.mjs +6 -5
- package/dist/adapters/test.mjs +4 -3
- package/dist/{admin-Bcq53Nwj.mjs → admin-BzUJL6tr.mjs} +6 -6
- package/dist/{anonymous-CRt1imBW.mjs → anonymous-BjlTk4gl.mjs} +5 -5
- package/dist/api/index.d.mts +5 -5
- package/dist/api/index.mjs +12 -11
- package/dist/{api-0pR_I-Nx.mjs → api-Dk8Yj_J5.mjs} +15 -5
- package/dist/audit-log-DKsUWR8O.mjs +772 -0
- package/dist/{auth-CBUoBX6o.mjs → auth-vfCyIIeV.mjs} +8 -8
- package/dist/{bearer-Djf_awfo.mjs → bearer-DvQLM00l.mjs} +2 -2
- package/dist/client/index.d.mts +21 -21
- package/dist/client/index.mjs +4 -4
- package/dist/client/plugins/index.d.mts +53 -45
- package/dist/client/plugins/index.mjs +16 -12
- package/dist/client/react/index.d.mts +19 -19
- package/dist/client/react/index.mjs +2 -2
- package/dist/client-4QEb0rUr.mjs +95 -0
- package/dist/client-CSOs1YN7.d.mts +14 -0
- package/dist/client-DZHNfxuR.d.mts +75 -0
- package/dist/client-DzOqXJUm.mjs +15 -0
- package/dist/{client-aExCkfwm.mjs → client-xga7yFIX.mjs} +2 -2
- package/dist/cookies/index.d.mts +6 -6
- package/dist/cookies/index.mjs +2 -2
- package/dist/{cookies-cJObLwn1.mjs → cookies-BuvlgcA-.mjs} +1 -1
- package/dist/crypto/index.mjs +2 -1
- package/dist/{crypto-Bb42eMrH.mjs → crypto-CCyta8xj.mjs} +1 -6
- package/dist/{custom-session-L3t7ecsd.mjs → custom-session-DN_-pfi_.mjs} +2 -2
- package/dist/db/index.d.mts +5 -5
- package/dist/db/index.mjs +9 -8
- package/dist/{db-BrstmDhc.mjs → db-7vHnL1XA.mjs} +15 -9
- package/dist/{device-authorization-V4s3h4Mj.mjs → device-authorization-BKnNhlsz.mjs} +4 -4
- package/dist/{dialect-CeddeGHf.mjs → dialect-HsWUfpYY.mjs} +2 -2
- package/dist/{email-otp-BtDHSw14.mjs → email-otp-Dw0DypjQ.mjs} +7 -6
- package/dist/{generic-oauth-CL5X27ZI.mjs → generic-oauth-DFj27JY8.mjs} +4 -4
- package/dist/{has-permission-BpAr7uCn.mjs → has-permission-Bvg8de8g.mjs} +1 -1
- package/dist/{haveibeenpwned-cMpJvmzI.mjs → haveibeenpwned-CzNda7Tn.mjs} +28 -15
- package/dist/{client-CNY0tn9g.d.mts → index-BAVzFqII.d.mts} +21 -21
- package/dist/{index-DaBcikv9.d.mts → index-BNDRYfTF.d.mts} +2 -2
- package/dist/{index-Cxi7TbLE.d.mts → index-BNhJglHC.d.mts} +122 -122
- package/dist/{index-BYMI9r_d.d.mts → index-Blmhq6eA.d.mts} +4 -4
- package/dist/{index-BHoQlf7a.d.mts → index-CKnPAS5n.d.mts} +178 -178
- package/dist/{index-34ONrP8l.d.mts → index-COGe8UJx.d.mts} +11 -11
- package/dist/{index-Buhn3hkR.d.mts → index-CP3FNbOZ.d.mts} +8 -8
- package/dist/{index-D_k662QG.d.mts → index-CUknVRZp.d.mts} +14 -14
- package/dist/{index-DKNNV1kb.d.mts → index-CaqpCfE5.d.mts} +8 -8
- package/dist/{index-BBm8nQ9Q.d.mts → index-CgeC2eGC.d.mts} +2 -2
- package/dist/{index-DR0xXno9.d.mts → index-CsxtcAO0.d.mts} +1 -1
- package/dist/{index-CuFzhoS6.d.mts → index-Cv9iMevV.d.mts} +10 -10
- package/dist/{index-C7fQuk-V.d.mts → index-CxlWnL9c.d.mts} +1 -1
- package/dist/{index-zjjNBRY2.d.mts → index-DG-X1PK5.d.mts} +6 -6
- package/dist/index-DRM35ir1.d.mts +3769 -0
- package/dist/{index-BqhKCbPH.d.mts → index-DS-R7st3.d.mts} +6 -6
- package/dist/{index-C-u1h_WX.d.mts → index-DXVU0HGr.d.mts} +5 -5
- package/dist/{index-DoXZYQpq.d.mts → index-Db8jqUq2.d.mts} +10 -10
- package/dist/{index-65G5U5DB-DSdjzreF.d.mts → index-Df0KhQRf-BEa5tdwJ.d.mts} +3 -2
- package/dist/{index-B-XKqFvY.d.mts → index-Df4SvZaE.d.mts} +11 -4
- package/dist/{index-G6V0Z_Mn.d.mts → index-DyH_CgmX.d.mts} +10 -10
- package/dist/{admin-DtfO1PLg.d.mts → index-EABwA_BH.d.mts} +36 -36
- package/dist/{index-z0KSvE5i.d.mts → index-QmocqGM-.d.mts} +1 -1
- package/dist/{index-DlaMq1nb.d.mts → index-mxEUX2Gs.d.mts} +14 -14
- package/dist/{client-BOX93C3d.d.mts → index-xoYsoOiR.d.mts} +52 -52
- package/dist/{index-B3n8e37d.d.mts → index-zBdYQGaS.d.mts} +7 -7
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +16 -15
- package/dist/integrations/next-js.mjs +2 -2
- package/dist/integrations/node.d.mts +5 -5
- package/dist/integrations/react-start.d.mts +4 -4
- package/dist/integrations/react-start.mjs +2 -2
- package/dist/{jwt-lHV4QHpD.mjs → jwt-DBN2mu0r.mjs} +4 -4
- package/dist/{kysely-adapter-DpzYO8Yf.mjs → kysely-adapter-Bkm1liPW.mjs} +1 -1
- package/dist/{magic-link-Bk-ueorR.mjs → magic-link-D9Em1aOR.mjs} +3 -3
- package/dist/{multi-session-DRrLKrg9.mjs → multi-session-Dno_8DxC.mjs} +5 -5
- package/dist/{oauth-proxy-D1sWh9B_.mjs → oauth-proxy-DW-zt8wv.mjs} +2 -2
- package/dist/oauth2/index.d.mts +5 -5
- package/dist/oauth2/index.mjs +12 -11
- package/dist/{one-tap-DMswkTEc.mjs → one-tap-CodeyQb8.mjs} +2 -2
- package/dist/{organization-BArHO_5v.mjs → organization-CkTKs7bx.mjs} +9 -9
- package/dist/{passkey-CcD4CnhM.mjs → passkey-JNQTz5a0.mjs} +5 -5
- package/dist/{phone-number-rHDIlh-2.mjs → phone-number-Dqz8aeyF.mjs} +4 -4
- package/dist/plugins/access/index.d.mts +2 -2
- package/dist/plugins/access/index.mjs +1 -1
- package/dist/plugins/admin/access/index.d.mts +2 -2
- package/dist/plugins/admin/access/index.mjs +2 -2
- package/dist/plugins/admin/index.d.mts +7 -8
- package/dist/plugins/admin/index.mjs +17 -16
- package/dist/plugins/anonymous/index.d.mts +6 -6
- package/dist/plugins/anonymous/index.mjs +13 -12
- package/dist/plugins/audit-log/client.d.mts +30 -0
- package/dist/plugins/audit-log/client.mjs +3 -0
- package/dist/plugins/audit-log/index.d.mts +29 -0
- package/dist/plugins/audit-log/index.mjs +20 -0
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/captcha/index.mjs +1 -1
- package/dist/plugins/custom-session/index.d.mts +6 -6
- package/dist/plugins/custom-session/index.mjs +14 -13
- package/dist/plugins/device-authorization/index.d.mts +3 -3
- package/dist/plugins/device-authorization/index.mjs +13 -12
- package/dist/plugins/email-otp/index.d.mts +2 -2
- package/dist/plugins/email-otp/index.mjs +14 -13
- package/dist/plugins/generic-oauth/index.d.mts +6 -6
- package/dist/plugins/generic-oauth/index.mjs +13 -12
- package/dist/plugins/haveibeenpwned/index.d.mts +2 -2
- package/dist/plugins/haveibeenpwned/index.mjs +14 -13
- package/dist/plugins/index.d.mts +29 -139
- package/dist/plugins/index.mjs +47 -42
- package/dist/plugins/jwt/index.d.mts +6 -6
- package/dist/plugins/jwt/index.mjs +13 -12
- package/dist/plugins/magic-link/index.d.mts +1 -1
- package/dist/plugins/magic-link/index.mjs +13 -12
- package/dist/plugins/multi-session/index.d.mts +2 -2
- package/dist/plugins/multi-session/index.mjs +13 -12
- package/dist/plugins/oauth-proxy/index.d.mts +1 -1
- package/dist/plugins/oauth-proxy/index.mjs +13 -12
- package/dist/plugins/one-tap/index.d.mts +1 -1
- package/dist/plugins/one-tap/index.mjs +13 -12
- package/dist/plugins/one-time-token/index.d.mts +6 -6
- package/dist/plugins/one-time-token/index.mjs +46 -41
- package/dist/plugins/organization/access/index.d.mts +3 -3
- package/dist/plugins/organization/access/index.mjs +2 -2
- package/dist/plugins/organization/index.d.mts +8 -8
- package/dist/plugins/organization/index.mjs +17 -16
- package/dist/plugins/passkey/index.d.mts +6 -6
- package/dist/plugins/passkey/index.mjs +13 -12
- package/dist/plugins/phone-number/index.d.mts +6 -6
- package/dist/plugins/phone-number/index.mjs +13 -12
- package/dist/plugins/sentinel/client.d.mts +30 -0
- package/dist/plugins/sentinel/client.mjs +5 -0
- package/dist/plugins/sentinel/index.d.mts +29 -0
- package/dist/plugins/sentinel/index.mjs +22 -0
- package/dist/plugins/two-factor/index.d.mts +6 -6
- package/dist/plugins/two-factor/index.mjs +15 -14
- package/dist/plugins/username/index.d.mts +3 -3
- package/dist/plugins/username/index.mjs +13 -12
- package/dist/{plugins-hFZT3hmK.d.mts → plugins-Dy_FrD4Y.d.mts} +1 -1
- package/dist/{plugins-3jfNste3.mjs → plugins-yF8CFUDR.mjs} +11 -8
- package/dist/pow-OK01yPG3.mjs +61 -0
- package/dist/{proxy-CL9PZXJA.mjs → proxy-C_KXfOhk.mjs} +1 -1
- package/dist/random-32E3cU5o.mjs +7 -0
- package/dist/registry-CqG_3Qnx.mjs +194 -0
- package/dist/sentinel-C-D1IHJo.mjs +1395 -0
- package/dist/{session-Dgp133Yt.mjs → session-BB3oqApE.mjs} +2 -2
- package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +1 -1
- package/dist/src/adapters/prisma-adapter/test/auth.d.ts +1 -1
- package/dist/src/adapters/tests/auth-flow.d.ts +3 -3
- package/dist/src/adapters/tests/normal.d.ts +1 -1
- package/dist/src/adapters/tests/number-id.d.ts +3 -3
- package/dist/src/adapters/tests/performance.d.ts +3 -3
- package/dist/src/adapters/tests/transactions.d.ts +3 -3
- package/dist/src/api/index.d.ts +8 -8
- package/dist/src/client/plugins/index.d.ts +2 -0
- package/dist/src/plugins/admin/admin.d.ts +2 -2
- package/dist/src/plugins/api-key/index.d.ts +2 -2
- package/dist/src/plugins/audit-log/client.d.ts +10 -0
- package/dist/src/plugins/audit-log/events.d.ts +90 -0
- package/dist/src/plugins/audit-log/index.d.ts +614 -0
- package/dist/src/plugins/audit-log/registry.d.ts +13 -0
- package/dist/src/plugins/audit-log/remote.d.ts +34 -0
- package/dist/src/plugins/audit-log/schema.d.ts +50 -0
- package/dist/src/plugins/audit-log/types.d.ts +117 -0
- package/dist/src/plugins/email-otp/index.d.ts +1 -1
- package/dist/src/plugins/haveibeenpwned/index.d.ts +6 -0
- package/dist/src/plugins/index.d.ts +2 -0
- package/dist/src/plugins/multi-session/index.d.ts +8 -8
- package/dist/src/plugins/organization/organization.d.ts +5 -5
- package/dist/src/plugins/organization/routes/crud-access-control.d.ts +8 -8
- package/dist/src/plugins/organization/routes/crud-invites.d.ts +46 -46
- package/dist/src/plugins/organization/routes/crud-members.d.ts +40 -40
- package/dist/src/plugins/organization/routes/crud-org.d.ts +36 -36
- package/dist/src/plugins/organization/routes/crud-team.d.ts +50 -50
- package/dist/src/plugins/sentinel/actions.d.ts +64 -0
- package/dist/src/plugins/sentinel/client.d.ts +67 -0
- package/dist/src/plugins/sentinel/email.d.ts +22 -0
- package/dist/src/plugins/sentinel/geo.d.ts +22 -0
- package/dist/src/plugins/sentinel/index.d.ts +326 -0
- package/dist/src/plugins/sentinel/intel.d.ts +45 -0
- package/dist/src/plugins/sentinel/pow.d.ts +21 -0
- package/dist/src/plugins/sentinel/schema.d.ts +110 -0
- package/dist/src/plugins/sentinel/store.d.ts +37 -0
- package/dist/src/plugins/sentinel/types.d.ts +412 -0
- package/dist/src/test-utils/memory-secondary-storage.d.ts +16 -0
- package/dist/src/test-utils/password.d.ts +12 -0
- package/dist/src/test-utils/test-instance.d.ts +25 -25
- package/dist/test-utils/index.d.mts +1048 -1048
- package/dist/test-utils/index.mjs +53 -48
- package/dist/{two-factor-ClUXxom2.mjs → two-factor-CDVjxx4f.mjs} +6 -5
- package/dist/types/index.d.mts +5 -5
- package/dist/types/index.mjs +1 -1
- package/dist/{username-DiGklOGl.mjs → username-BHNvcvsY.mjs} +3 -3
- package/dist/{utils-SOMB4Px5.mjs → utils-B03WRaGi.mjs} +2 -1
- package/package.json +36 -3
- package/dist/index-CM-CFWwr.d.mts +0 -1919
- package/dist/index-DB7t8whN.d.mts +0 -1
- /package/dist/{access-BO2g7QVe.mjs → access-BM6jSA5j.mjs} +0 -0
- /package/dist/{bun-sqlite-dialect-CeNvMaZz.mjs → bun-sqlite-dialect-CDGusFqF.mjs} +0 -0
- /package/dist/{captcha-BqaMxlKC.mjs → captcha-DGP9lCRe.mjs} +0 -0
- /package/dist/{client-CygJhqeB.mjs → client-BuveH3MN.mjs} +0 -0
- /package/dist/{client-WiN43tAS.mjs → client-cBiytuOL.mjs} +0 -0
- /package/dist/{date-Cx2yCiC4.mjs → date-CMr04reD.mjs} +0 -0
- /package/dist/{esm-C-QicDNz.mjs → esm-BbvI87Z2.mjs} +0 -0
- /package/dist/{get-tables-BQP7YW9c.mjs → get-tables-CKvSyDST.mjs} +0 -0
- /package/dist/{helper-tmxW3BHj.d.mts → helper-BgOIGHsu.d.mts} +0 -0
- /package/dist/{misc-beA1w3XV.mjs → misc-fKH4d5XQ.mjs} +0 -0
- /package/dist/{node-sqlite-dialect-BcKxBQnm.mjs → node-sqlite-dialect-CIOjcg31.mjs} +0 -0
- /package/dist/{parser-DcrIEuXE.mjs → parser-D7EkhAjZ.mjs} +0 -0
- /package/dist/{password-sVC4nePO.mjs → password-5CdcAVaH.mjs} +0 -0
- /package/dist/{permission-DLYUF3cW.mjs → permission-CDDWgA_O.mjs} +0 -0
- /package/dist/{plugin-helper-4L-lzsjZ.mjs → plugin-helper-RJJBTOba.mjs} +0 -0
- /package/dist/{promise-8rrEHRXd.mjs → promise-D7Oo6_cY.mjs} +0 -0
- /package/dist/{types-Bjn15Uy6.mjs → types-DCPpFKUB.mjs} +0 -0
- /package/dist/{types-B1OL7hyf.d.mts → types-DNQ9XQrB.d.mts} +0 -0
|
@@ -0,0 +1,3769 @@
|
|
|
1
|
+
import { g as User$1 } from "./index-BNhJglHC.mjs";
|
|
2
|
+
import { n as DBPrimitive } from "./index-Df0KhQRf-BEa5tdwJ.mjs";
|
|
3
|
+
import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
|
|
4
|
+
import { o as Statements } from "./index-CxlWnL9c.mjs";
|
|
5
|
+
import * as _gatwech_core61 from "@gatwech/core";
|
|
6
|
+
import { AuthContext, GenericEndpointContext, HookEndpointContext } from "@gatwech/core";
|
|
7
|
+
import * as better_call636 from "better-call";
|
|
8
|
+
import { AuthEndpoint, AuthMiddleware, createAuthEndpoint as createAuthEndpoint$1, createAuthMiddleware as createAuthMiddleware$1, optionsMiddleware } from "@gatwech/core/api";
|
|
9
|
+
import * as zod1419 from "zod";
|
|
10
|
+
import * as _gatwech_core_db14 from "@gatwech/core/db";
|
|
11
|
+
import * as zod_v4_core207 from "zod/v4/core";
|
|
12
|
+
|
|
13
|
+
//#region src/plugins/api-key/schema.d.ts
|
|
14
|
+
declare const apiKeySchema: ({
|
|
15
|
+
timeWindow,
|
|
16
|
+
rateLimitMax
|
|
17
|
+
}: {
|
|
18
|
+
timeWindow: number;
|
|
19
|
+
rateLimitMax: number;
|
|
20
|
+
}) => {
|
|
21
|
+
apikey: {
|
|
22
|
+
fields: {
|
|
23
|
+
/**
|
|
24
|
+
* The name of the key.
|
|
25
|
+
*/
|
|
26
|
+
name: {
|
|
27
|
+
type: "string";
|
|
28
|
+
required: false;
|
|
29
|
+
input: false;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Shows the first few characters of the API key
|
|
33
|
+
* This allows you to show those few characters in the UI to make it easier for users to identify the API key.
|
|
34
|
+
*/
|
|
35
|
+
start: {
|
|
36
|
+
type: "string";
|
|
37
|
+
required: false;
|
|
38
|
+
input: false;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The prefix of the key.
|
|
42
|
+
*/
|
|
43
|
+
prefix: {
|
|
44
|
+
type: "string";
|
|
45
|
+
required: false;
|
|
46
|
+
input: false;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The hashed key value.
|
|
50
|
+
*/
|
|
51
|
+
key: {
|
|
52
|
+
type: "string";
|
|
53
|
+
required: true;
|
|
54
|
+
input: false;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The user id of the user who created the key.
|
|
58
|
+
*/
|
|
59
|
+
userId: {
|
|
60
|
+
type: "string";
|
|
61
|
+
references: {
|
|
62
|
+
model: string;
|
|
63
|
+
field: string;
|
|
64
|
+
onDelete: "cascade";
|
|
65
|
+
};
|
|
66
|
+
required: true;
|
|
67
|
+
input: false;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The interval to refill the key in milliseconds.
|
|
71
|
+
*/
|
|
72
|
+
refillInterval: {
|
|
73
|
+
type: "number";
|
|
74
|
+
required: false;
|
|
75
|
+
input: false;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The amount to refill the remaining count of the key.
|
|
79
|
+
*/
|
|
80
|
+
refillAmount: {
|
|
81
|
+
type: "number";
|
|
82
|
+
required: false;
|
|
83
|
+
input: false;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The date and time when the key was last refilled.
|
|
87
|
+
*/
|
|
88
|
+
lastRefillAt: {
|
|
89
|
+
type: "date";
|
|
90
|
+
required: false;
|
|
91
|
+
input: false;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Whether the key is enabled.
|
|
95
|
+
*/
|
|
96
|
+
enabled: {
|
|
97
|
+
type: "boolean";
|
|
98
|
+
required: false;
|
|
99
|
+
input: false;
|
|
100
|
+
defaultValue: true;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Whether the key has rate limiting enabled.
|
|
104
|
+
*/
|
|
105
|
+
rateLimitEnabled: {
|
|
106
|
+
type: "boolean";
|
|
107
|
+
required: false;
|
|
108
|
+
input: false;
|
|
109
|
+
defaultValue: true;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The time window in milliseconds for the rate limit.
|
|
113
|
+
*/
|
|
114
|
+
rateLimitTimeWindow: {
|
|
115
|
+
type: "number";
|
|
116
|
+
required: false;
|
|
117
|
+
input: false;
|
|
118
|
+
defaultValue: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The maximum number of requests allowed within the `rateLimitTimeWindow`.
|
|
122
|
+
*/
|
|
123
|
+
rateLimitMax: {
|
|
124
|
+
type: "number";
|
|
125
|
+
required: false;
|
|
126
|
+
input: false;
|
|
127
|
+
defaultValue: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The number of requests made within the rate limit time window
|
|
131
|
+
*/
|
|
132
|
+
requestCount: {
|
|
133
|
+
type: "number";
|
|
134
|
+
required: false;
|
|
135
|
+
input: false;
|
|
136
|
+
defaultValue: number;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The remaining number of requests before the key is revoked.
|
|
140
|
+
*
|
|
141
|
+
* If this is null, then the key is not revoked.
|
|
142
|
+
*
|
|
143
|
+
* If `refillInterval` & `refillAmount` are provided, than this will refill accordingly.
|
|
144
|
+
*/
|
|
145
|
+
remaining: {
|
|
146
|
+
type: "number";
|
|
147
|
+
required: false;
|
|
148
|
+
input: false;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* The date and time of the last request made to the key.
|
|
152
|
+
*/
|
|
153
|
+
lastRequest: {
|
|
154
|
+
type: "date";
|
|
155
|
+
required: false;
|
|
156
|
+
input: false;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* The date and time when the key will expire.
|
|
160
|
+
*/
|
|
161
|
+
expiresAt: {
|
|
162
|
+
type: "date";
|
|
163
|
+
required: false;
|
|
164
|
+
input: false;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* The date and time when the key was created.
|
|
168
|
+
*/
|
|
169
|
+
createdAt: {
|
|
170
|
+
type: "date";
|
|
171
|
+
required: true;
|
|
172
|
+
input: false;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* The date and time when the key was last updated.
|
|
176
|
+
*/
|
|
177
|
+
updatedAt: {
|
|
178
|
+
type: "date";
|
|
179
|
+
required: true;
|
|
180
|
+
input: false;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* The permissions of the key.
|
|
184
|
+
*/
|
|
185
|
+
permissions: {
|
|
186
|
+
type: "string";
|
|
187
|
+
required: false;
|
|
188
|
+
input: false;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Any additional metadata you want to store with the key.
|
|
192
|
+
*/
|
|
193
|
+
metadata: {
|
|
194
|
+
type: "string";
|
|
195
|
+
required: false;
|
|
196
|
+
input: true;
|
|
197
|
+
transform: {
|
|
198
|
+
input(value: _gatwech_core_db14.DBPrimitive): string;
|
|
199
|
+
output(value: _gatwech_core_db14.DBPrimitive): any;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/plugins/api-key/types.d.ts
|
|
207
|
+
interface ApiKeyOptions {
|
|
208
|
+
/**
|
|
209
|
+
* The header name to check for API key
|
|
210
|
+
* @default "x-api-key"
|
|
211
|
+
*/
|
|
212
|
+
apiKeyHeaders?: (string | string[]) | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Disable hashing of the API key.
|
|
215
|
+
*
|
|
216
|
+
* ⚠️ Security Warning: It's strongly recommended to not disable hashing.
|
|
217
|
+
* Storing API keys in plaintext makes them vulnerable to database breaches, potentially exposing all your users' API keys.
|
|
218
|
+
*
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
disableKeyHashing?: boolean | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* The function to get the API key from the context
|
|
224
|
+
*/
|
|
225
|
+
customAPIKeyGetter?: ((ctx: HookEndpointContext) => string | null) | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* A custom function to validate the API key
|
|
228
|
+
*/
|
|
229
|
+
customAPIKeyValidator?: ((options: {
|
|
230
|
+
ctx: GenericEndpointContext;
|
|
231
|
+
key: string;
|
|
232
|
+
}) => boolean | Promise<boolean>) | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* custom key generation function
|
|
235
|
+
*/
|
|
236
|
+
customKeyGenerator?: (options: {
|
|
237
|
+
/**
|
|
238
|
+
* The length of the API key to generate
|
|
239
|
+
*/
|
|
240
|
+
length: number;
|
|
241
|
+
/**
|
|
242
|
+
* The prefix of the API key to generate
|
|
243
|
+
*/
|
|
244
|
+
prefix: string | undefined;
|
|
245
|
+
}) => string | Promise<string>;
|
|
246
|
+
/**
|
|
247
|
+
* The configuration for storing the starting characters of the API key in the database.
|
|
248
|
+
*
|
|
249
|
+
* Useful if you want to display the starting characters of an API key in the UI.
|
|
250
|
+
*/
|
|
251
|
+
startingCharactersConfig?: {
|
|
252
|
+
/**
|
|
253
|
+
* Whether to store the starting characters in the database. If false, we will set `start` to `null`.
|
|
254
|
+
*
|
|
255
|
+
* @default true
|
|
256
|
+
*/
|
|
257
|
+
shouldStore?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* The length of the starting characters to store in the database.
|
|
260
|
+
*
|
|
261
|
+
* This includes the prefix length.
|
|
262
|
+
*
|
|
263
|
+
* @default 6
|
|
264
|
+
*/
|
|
265
|
+
charactersLength?: number;
|
|
266
|
+
} | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* The length of the API key. Longer is better. Default is 64. (Doesn't include the prefix length)
|
|
269
|
+
* @default 64
|
|
270
|
+
*/
|
|
271
|
+
defaultKeyLength?: number | undefined;
|
|
272
|
+
/**
|
|
273
|
+
* The prefix of the API key.
|
|
274
|
+
*
|
|
275
|
+
* Note: We recommend you append an underscore to the prefix to make the prefix more identifiable. (eg `hello_`)
|
|
276
|
+
*/
|
|
277
|
+
defaultPrefix?: string | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* The maximum length of the prefix.
|
|
280
|
+
*
|
|
281
|
+
* @default 32
|
|
282
|
+
*/
|
|
283
|
+
maximumPrefixLength?: number | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* Whether to require a name for the API key.
|
|
286
|
+
*
|
|
287
|
+
* @default false
|
|
288
|
+
*/
|
|
289
|
+
requireName?: boolean | undefined;
|
|
290
|
+
/**
|
|
291
|
+
* The minimum length of the prefix.
|
|
292
|
+
*
|
|
293
|
+
* @default 1
|
|
294
|
+
*/
|
|
295
|
+
minimumPrefixLength?: number | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* The maximum length of the name.
|
|
298
|
+
*
|
|
299
|
+
* @default 32
|
|
300
|
+
*/
|
|
301
|
+
maximumNameLength?: number | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* The minimum length of the name.
|
|
304
|
+
*
|
|
305
|
+
* @default 1
|
|
306
|
+
*/
|
|
307
|
+
minimumNameLength?: number | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* Whether to enable metadata for an API key.
|
|
310
|
+
*
|
|
311
|
+
* @default false
|
|
312
|
+
*/
|
|
313
|
+
enableMetadata?: boolean | undefined;
|
|
314
|
+
/**
|
|
315
|
+
* Customize the key expiration.
|
|
316
|
+
*/
|
|
317
|
+
keyExpiration?: {
|
|
318
|
+
/**
|
|
319
|
+
* The default expires time in milliseconds.
|
|
320
|
+
*
|
|
321
|
+
* If `null`, then there will be no expiration time.
|
|
322
|
+
*
|
|
323
|
+
* @default null
|
|
324
|
+
*/
|
|
325
|
+
defaultExpiresIn?: number | null;
|
|
326
|
+
/**
|
|
327
|
+
* Whether to disable the expires time passed from the client.
|
|
328
|
+
*
|
|
329
|
+
* If `true`, the expires time will be based on the default values.
|
|
330
|
+
*
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
disableCustomExpiresTime?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* The minimum expiresIn value allowed to be set from the client. in days.
|
|
336
|
+
*
|
|
337
|
+
* @default 1
|
|
338
|
+
*/
|
|
339
|
+
minExpiresIn?: number;
|
|
340
|
+
/**
|
|
341
|
+
* The maximum expiresIn value allowed to be set from the client. in days.
|
|
342
|
+
*
|
|
343
|
+
* @default 365
|
|
344
|
+
*/
|
|
345
|
+
maxExpiresIn?: number;
|
|
346
|
+
} | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* Default rate limiting options.
|
|
349
|
+
*/
|
|
350
|
+
rateLimit?: {
|
|
351
|
+
/**
|
|
352
|
+
* Whether to enable rate limiting.
|
|
353
|
+
*
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
enabled?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* The duration in milliseconds where each request is counted.
|
|
359
|
+
*
|
|
360
|
+
* Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset.
|
|
361
|
+
*
|
|
362
|
+
* @default 1000 * 60 * 60 * 24 // 1 day
|
|
363
|
+
*/
|
|
364
|
+
timeWindow?: number;
|
|
365
|
+
/**
|
|
366
|
+
* Maximum amount of requests allowed within a window
|
|
367
|
+
*
|
|
368
|
+
* Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset.
|
|
369
|
+
*
|
|
370
|
+
* @default 10 // 10 requests per day
|
|
371
|
+
*/
|
|
372
|
+
maxRequests?: number;
|
|
373
|
+
} | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* custom schema for the API key plugin
|
|
376
|
+
*/
|
|
377
|
+
schema?: InferOptionSchema<ReturnType<typeof apiKeySchema>> | undefined;
|
|
378
|
+
/**
|
|
379
|
+
* An API Key can represent a valid session, so we automatically mock a session for the user if we find a valid API key in the request headers.
|
|
380
|
+
*
|
|
381
|
+
* ⚠︎ This is not recommended for production use, as it can lead to security issues.
|
|
382
|
+
* @default false
|
|
383
|
+
*/
|
|
384
|
+
enableSessionForAPIKeys?: boolean | undefined;
|
|
385
|
+
/**
|
|
386
|
+
* Permissions for the API key.
|
|
387
|
+
*/
|
|
388
|
+
permissions?: {
|
|
389
|
+
/**
|
|
390
|
+
* The default permissions for the API key.
|
|
391
|
+
*/
|
|
392
|
+
defaultPermissions?: Statements | ((userId: string, ctx: GenericEndpointContext) => Statements | Promise<Statements>);
|
|
393
|
+
} | undefined;
|
|
394
|
+
}
|
|
395
|
+
type ApiKey = {
|
|
396
|
+
/**
|
|
397
|
+
* ID
|
|
398
|
+
*/
|
|
399
|
+
id: string;
|
|
400
|
+
/**
|
|
401
|
+
* The name of the key
|
|
402
|
+
*/
|
|
403
|
+
name: string | null;
|
|
404
|
+
/**
|
|
405
|
+
* Shows the first few characters of the API key, including the prefix.
|
|
406
|
+
* This allows you to show those few characters in the UI to make it easier for users to identify the API key.
|
|
407
|
+
*/
|
|
408
|
+
start: string | null;
|
|
409
|
+
/**
|
|
410
|
+
* The API Key prefix. Stored as plain text.
|
|
411
|
+
*/
|
|
412
|
+
prefix: string | null;
|
|
413
|
+
/**
|
|
414
|
+
* The hashed API key value
|
|
415
|
+
*/
|
|
416
|
+
key: string;
|
|
417
|
+
/**
|
|
418
|
+
* The owner of the user id
|
|
419
|
+
*/
|
|
420
|
+
userId: string;
|
|
421
|
+
/**
|
|
422
|
+
* The interval in milliseconds between refills of the `remaining` count
|
|
423
|
+
*
|
|
424
|
+
* @example 3600000 // refill every hour (3600000ms = 1h)
|
|
425
|
+
*/
|
|
426
|
+
refillInterval: number | null;
|
|
427
|
+
/**
|
|
428
|
+
* The amount to refill
|
|
429
|
+
*/
|
|
430
|
+
refillAmount: number | null;
|
|
431
|
+
/**
|
|
432
|
+
* The last refill date
|
|
433
|
+
*/
|
|
434
|
+
lastRefillAt: Date | null;
|
|
435
|
+
/**
|
|
436
|
+
* Sets if key is enabled or disabled
|
|
437
|
+
*
|
|
438
|
+
* @default true
|
|
439
|
+
*/
|
|
440
|
+
enabled: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Whether the key has rate limiting enabled.
|
|
443
|
+
*/
|
|
444
|
+
rateLimitEnabled: boolean;
|
|
445
|
+
/**
|
|
446
|
+
* The duration in milliseconds
|
|
447
|
+
*/
|
|
448
|
+
rateLimitTimeWindow: number | null;
|
|
449
|
+
/**
|
|
450
|
+
* Maximum amount of requests allowed within a window
|
|
451
|
+
*/
|
|
452
|
+
rateLimitMax: number | null;
|
|
453
|
+
/**
|
|
454
|
+
* The number of requests made within the rate limit time window
|
|
455
|
+
*/
|
|
456
|
+
requestCount: number;
|
|
457
|
+
/**
|
|
458
|
+
* Remaining requests (every time API key is used this should updated and should be updated on refill as well)
|
|
459
|
+
*/
|
|
460
|
+
remaining: number | null;
|
|
461
|
+
/**
|
|
462
|
+
* When last request occurred
|
|
463
|
+
*/
|
|
464
|
+
lastRequest: Date | null;
|
|
465
|
+
/**
|
|
466
|
+
* Expiry date of a key
|
|
467
|
+
*/
|
|
468
|
+
expiresAt: Date | null;
|
|
469
|
+
/**
|
|
470
|
+
* created at
|
|
471
|
+
*/
|
|
472
|
+
createdAt: Date;
|
|
473
|
+
/**
|
|
474
|
+
* updated at
|
|
475
|
+
*/
|
|
476
|
+
updatedAt: Date;
|
|
477
|
+
/**
|
|
478
|
+
* Extra metadata about the apiKey
|
|
479
|
+
*/
|
|
480
|
+
metadata: Record<string, any> | null;
|
|
481
|
+
/**
|
|
482
|
+
* Permissions for the API key
|
|
483
|
+
*/
|
|
484
|
+
permissions?: ({
|
|
485
|
+
[key: string]: string[];
|
|
486
|
+
} | null) | undefined;
|
|
487
|
+
};
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/plugins/api-key/index.d.ts
|
|
490
|
+
declare const defaultKeyHasher: (key: string) => Promise<string>;
|
|
491
|
+
declare const ERROR_CODES: {
|
|
492
|
+
readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
|
|
493
|
+
readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
|
|
494
|
+
readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
|
|
495
|
+
readonly USER_BANNED: "User is banned";
|
|
496
|
+
readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
|
|
497
|
+
readonly KEY_NOT_FOUND: "API Key not found";
|
|
498
|
+
readonly KEY_DISABLED: "API Key is disabled";
|
|
499
|
+
readonly KEY_EXPIRED: "API Key has expired";
|
|
500
|
+
readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
|
|
501
|
+
readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
|
|
502
|
+
readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
|
|
503
|
+
readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
|
|
504
|
+
readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
|
|
505
|
+
readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
|
|
506
|
+
readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
|
|
507
|
+
readonly METADATA_DISABLED: "Metadata is disabled.";
|
|
508
|
+
readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
|
|
509
|
+
readonly NO_VALUES_TO_UPDATE: "No values to update.";
|
|
510
|
+
readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
|
|
511
|
+
readonly INVALID_API_KEY: "Invalid API key.";
|
|
512
|
+
readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
|
|
513
|
+
readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
|
|
514
|
+
readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
|
|
515
|
+
readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
|
|
516
|
+
readonly NAME_REQUIRED: "API Key name is required.";
|
|
517
|
+
};
|
|
518
|
+
declare const API_KEY_TABLE_NAME = "apikey";
|
|
519
|
+
declare const apiKey: (options?: ApiKeyOptions | undefined) => {
|
|
520
|
+
id: "api-key";
|
|
521
|
+
$ERROR_CODES: {
|
|
522
|
+
readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
|
|
523
|
+
readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
|
|
524
|
+
readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
|
|
525
|
+
readonly USER_BANNED: "User is banned";
|
|
526
|
+
readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
|
|
527
|
+
readonly KEY_NOT_FOUND: "API Key not found";
|
|
528
|
+
readonly KEY_DISABLED: "API Key is disabled";
|
|
529
|
+
readonly KEY_EXPIRED: "API Key has expired";
|
|
530
|
+
readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
|
|
531
|
+
readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
|
|
532
|
+
readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
|
|
533
|
+
readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
|
|
534
|
+
readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
|
|
535
|
+
readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
|
|
536
|
+
readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
|
|
537
|
+
readonly METADATA_DISABLED: "Metadata is disabled.";
|
|
538
|
+
readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
|
|
539
|
+
readonly NO_VALUES_TO_UPDATE: "No values to update.";
|
|
540
|
+
readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
|
|
541
|
+
readonly INVALID_API_KEY: "Invalid API key.";
|
|
542
|
+
readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
|
|
543
|
+
readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
|
|
544
|
+
readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
|
|
545
|
+
readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
|
|
546
|
+
readonly NAME_REQUIRED: "API Key name is required.";
|
|
547
|
+
};
|
|
548
|
+
hooks: {
|
|
549
|
+
before: {
|
|
550
|
+
matcher: (ctx: _gatwech_core61.HookEndpointContext) => boolean;
|
|
551
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
552
|
+
user: {
|
|
553
|
+
id: string;
|
|
554
|
+
createdAt: Date;
|
|
555
|
+
updatedAt: Date;
|
|
556
|
+
email: string;
|
|
557
|
+
emailVerified: boolean;
|
|
558
|
+
name: string;
|
|
559
|
+
image?: string | null | undefined;
|
|
560
|
+
};
|
|
561
|
+
session: {
|
|
562
|
+
id: string;
|
|
563
|
+
token: string;
|
|
564
|
+
userId: string;
|
|
565
|
+
userAgent: string | null;
|
|
566
|
+
ipAddress: string | null;
|
|
567
|
+
createdAt: Date;
|
|
568
|
+
updatedAt: Date;
|
|
569
|
+
expiresAt: Date;
|
|
570
|
+
};
|
|
571
|
+
} | {
|
|
572
|
+
context: better_call636.MiddlewareContext<better_call636.MiddlewareOptions, _gatwech_core61.AuthContext<_gatwech_core61.PayvoAuthOptions> & {
|
|
573
|
+
returned?: unknown | undefined;
|
|
574
|
+
responseHeaders?: Headers | undefined;
|
|
575
|
+
}>;
|
|
576
|
+
}>;
|
|
577
|
+
}[];
|
|
578
|
+
};
|
|
579
|
+
endpoints: {
|
|
580
|
+
/**
|
|
581
|
+
* ### Endpoint
|
|
582
|
+
*
|
|
583
|
+
* POST `/api-key/create`
|
|
584
|
+
*
|
|
585
|
+
* ### API Methods
|
|
586
|
+
*
|
|
587
|
+
* **server:**
|
|
588
|
+
* `auth.api.createApiKey`
|
|
589
|
+
*
|
|
590
|
+
* **client:**
|
|
591
|
+
* `authClient.apiKey.create`
|
|
592
|
+
*
|
|
593
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-create)
|
|
594
|
+
*/
|
|
595
|
+
createApiKey: {
|
|
596
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
597
|
+
body: {
|
|
598
|
+
name?: string | undefined;
|
|
599
|
+
expiresIn?: number | null | undefined;
|
|
600
|
+
userId?: unknown;
|
|
601
|
+
prefix?: string | undefined;
|
|
602
|
+
remaining?: number | null | undefined;
|
|
603
|
+
metadata?: any;
|
|
604
|
+
refillAmount?: number | undefined;
|
|
605
|
+
refillInterval?: number | undefined;
|
|
606
|
+
rateLimitTimeWindow?: number | undefined;
|
|
607
|
+
rateLimitMax?: number | undefined;
|
|
608
|
+
rateLimitEnabled?: boolean | undefined;
|
|
609
|
+
permissions?: Record<string, string[]> | undefined;
|
|
610
|
+
};
|
|
611
|
+
} & {
|
|
612
|
+
method?: "POST" | undefined;
|
|
613
|
+
} & {
|
|
614
|
+
query?: Record<string, any> | undefined;
|
|
615
|
+
} & {
|
|
616
|
+
params?: Record<string, any>;
|
|
617
|
+
} & {
|
|
618
|
+
request?: Request;
|
|
619
|
+
} & {
|
|
620
|
+
headers?: HeadersInit;
|
|
621
|
+
} & {
|
|
622
|
+
asResponse?: boolean;
|
|
623
|
+
returnHeaders?: boolean;
|
|
624
|
+
use?: better_call636.Middleware[];
|
|
625
|
+
path?: string;
|
|
626
|
+
} & {
|
|
627
|
+
asResponse?: AsResponse | undefined;
|
|
628
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
629
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
630
|
+
headers: Headers;
|
|
631
|
+
response: {
|
|
632
|
+
key: string;
|
|
633
|
+
metadata: any;
|
|
634
|
+
permissions: any;
|
|
635
|
+
id: string;
|
|
636
|
+
name: string | null;
|
|
637
|
+
start: string | null;
|
|
638
|
+
prefix: string | null;
|
|
639
|
+
userId: string;
|
|
640
|
+
refillInterval: number | null;
|
|
641
|
+
refillAmount: number | null;
|
|
642
|
+
lastRefillAt: Date | null;
|
|
643
|
+
enabled: boolean;
|
|
644
|
+
rateLimitEnabled: boolean;
|
|
645
|
+
rateLimitTimeWindow: number | null;
|
|
646
|
+
rateLimitMax: number | null;
|
|
647
|
+
requestCount: number;
|
|
648
|
+
remaining: number | null;
|
|
649
|
+
lastRequest: Date | null;
|
|
650
|
+
expiresAt: Date | null;
|
|
651
|
+
createdAt: Date;
|
|
652
|
+
updatedAt: Date;
|
|
653
|
+
};
|
|
654
|
+
} : {
|
|
655
|
+
key: string;
|
|
656
|
+
metadata: any;
|
|
657
|
+
permissions: any;
|
|
658
|
+
id: string;
|
|
659
|
+
name: string | null;
|
|
660
|
+
start: string | null;
|
|
661
|
+
prefix: string | null;
|
|
662
|
+
userId: string;
|
|
663
|
+
refillInterval: number | null;
|
|
664
|
+
refillAmount: number | null;
|
|
665
|
+
lastRefillAt: Date | null;
|
|
666
|
+
enabled: boolean;
|
|
667
|
+
rateLimitEnabled: boolean;
|
|
668
|
+
rateLimitTimeWindow: number | null;
|
|
669
|
+
rateLimitMax: number | null;
|
|
670
|
+
requestCount: number;
|
|
671
|
+
remaining: number | null;
|
|
672
|
+
lastRequest: Date | null;
|
|
673
|
+
expiresAt: Date | null;
|
|
674
|
+
createdAt: Date;
|
|
675
|
+
updatedAt: Date;
|
|
676
|
+
}>;
|
|
677
|
+
options: {
|
|
678
|
+
method: "POST";
|
|
679
|
+
body: zod1419.ZodObject<{
|
|
680
|
+
name: zod1419.ZodOptional<zod1419.ZodString>;
|
|
681
|
+
expiresIn: zod1419.ZodDefault<zod1419.ZodNullable<zod1419.ZodOptional<zod1419.ZodNumber>>>;
|
|
682
|
+
userId: zod1419.ZodOptional<zod1419.ZodCoercedString<unknown>>;
|
|
683
|
+
prefix: zod1419.ZodOptional<zod1419.ZodString>;
|
|
684
|
+
remaining: zod1419.ZodDefault<zod1419.ZodNullable<zod1419.ZodOptional<zod1419.ZodNumber>>>;
|
|
685
|
+
metadata: zod1419.ZodOptional<zod1419.ZodAny>;
|
|
686
|
+
refillAmount: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
687
|
+
refillInterval: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
688
|
+
rateLimitTimeWindow: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
689
|
+
rateLimitMax: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
690
|
+
rateLimitEnabled: zod1419.ZodOptional<zod1419.ZodBoolean>;
|
|
691
|
+
permissions: zod1419.ZodOptional<zod1419.ZodRecord<zod1419.ZodString, zod1419.ZodArray<zod1419.ZodString>>>;
|
|
692
|
+
}, zod_v4_core207.$strip>;
|
|
693
|
+
metadata: {
|
|
694
|
+
openapi: {
|
|
695
|
+
description: string;
|
|
696
|
+
responses: {
|
|
697
|
+
"200": {
|
|
698
|
+
description: string;
|
|
699
|
+
content: {
|
|
700
|
+
"application/json": {
|
|
701
|
+
schema: {
|
|
702
|
+
type: "object";
|
|
703
|
+
properties: {
|
|
704
|
+
id: {
|
|
705
|
+
type: string;
|
|
706
|
+
description: string;
|
|
707
|
+
};
|
|
708
|
+
createdAt: {
|
|
709
|
+
type: string;
|
|
710
|
+
format: string;
|
|
711
|
+
description: string;
|
|
712
|
+
};
|
|
713
|
+
updatedAt: {
|
|
714
|
+
type: string;
|
|
715
|
+
format: string;
|
|
716
|
+
description: string;
|
|
717
|
+
};
|
|
718
|
+
name: {
|
|
719
|
+
type: string;
|
|
720
|
+
nullable: boolean;
|
|
721
|
+
description: string;
|
|
722
|
+
};
|
|
723
|
+
prefix: {
|
|
724
|
+
type: string;
|
|
725
|
+
nullable: boolean;
|
|
726
|
+
description: string;
|
|
727
|
+
};
|
|
728
|
+
start: {
|
|
729
|
+
type: string;
|
|
730
|
+
nullable: boolean;
|
|
731
|
+
description: string;
|
|
732
|
+
};
|
|
733
|
+
key: {
|
|
734
|
+
type: string;
|
|
735
|
+
description: string;
|
|
736
|
+
};
|
|
737
|
+
enabled: {
|
|
738
|
+
type: string;
|
|
739
|
+
description: string;
|
|
740
|
+
};
|
|
741
|
+
expiresAt: {
|
|
742
|
+
type: string;
|
|
743
|
+
format: string;
|
|
744
|
+
nullable: boolean;
|
|
745
|
+
description: string;
|
|
746
|
+
};
|
|
747
|
+
userId: {
|
|
748
|
+
type: string;
|
|
749
|
+
description: string;
|
|
750
|
+
};
|
|
751
|
+
lastRefillAt: {
|
|
752
|
+
type: string;
|
|
753
|
+
format: string;
|
|
754
|
+
nullable: boolean;
|
|
755
|
+
description: string;
|
|
756
|
+
};
|
|
757
|
+
lastRequest: {
|
|
758
|
+
type: string;
|
|
759
|
+
format: string;
|
|
760
|
+
nullable: boolean;
|
|
761
|
+
description: string;
|
|
762
|
+
};
|
|
763
|
+
metadata: {
|
|
764
|
+
type: string;
|
|
765
|
+
nullable: boolean;
|
|
766
|
+
additionalProperties: boolean;
|
|
767
|
+
description: string;
|
|
768
|
+
};
|
|
769
|
+
rateLimitMax: {
|
|
770
|
+
type: string;
|
|
771
|
+
nullable: boolean;
|
|
772
|
+
description: string;
|
|
773
|
+
};
|
|
774
|
+
rateLimitTimeWindow: {
|
|
775
|
+
type: string;
|
|
776
|
+
nullable: boolean;
|
|
777
|
+
description: string;
|
|
778
|
+
};
|
|
779
|
+
remaining: {
|
|
780
|
+
type: string;
|
|
781
|
+
nullable: boolean;
|
|
782
|
+
description: string;
|
|
783
|
+
};
|
|
784
|
+
refillAmount: {
|
|
785
|
+
type: string;
|
|
786
|
+
nullable: boolean;
|
|
787
|
+
description: string;
|
|
788
|
+
};
|
|
789
|
+
refillInterval: {
|
|
790
|
+
type: string;
|
|
791
|
+
nullable: boolean;
|
|
792
|
+
description: string;
|
|
793
|
+
};
|
|
794
|
+
rateLimitEnabled: {
|
|
795
|
+
type: string;
|
|
796
|
+
description: string;
|
|
797
|
+
};
|
|
798
|
+
requestCount: {
|
|
799
|
+
type: string;
|
|
800
|
+
description: string;
|
|
801
|
+
};
|
|
802
|
+
permissions: {
|
|
803
|
+
type: string;
|
|
804
|
+
nullable: boolean;
|
|
805
|
+
additionalProperties: {
|
|
806
|
+
type: string;
|
|
807
|
+
items: {
|
|
808
|
+
type: string;
|
|
809
|
+
};
|
|
810
|
+
};
|
|
811
|
+
description: string;
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
required: string[];
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
} & {
|
|
823
|
+
use: any[];
|
|
824
|
+
};
|
|
825
|
+
path: "/api-key/create";
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* ### Endpoint
|
|
829
|
+
*
|
|
830
|
+
* POST `/api-key/verify`
|
|
831
|
+
*
|
|
832
|
+
* ### API Methods
|
|
833
|
+
*
|
|
834
|
+
* **server:**
|
|
835
|
+
* `auth.api.verifyApiKey`
|
|
836
|
+
*
|
|
837
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-verify)
|
|
838
|
+
*/
|
|
839
|
+
verifyApiKey: {
|
|
840
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
841
|
+
body: {
|
|
842
|
+
key: string;
|
|
843
|
+
permissions?: Record<string, string[]> | undefined;
|
|
844
|
+
};
|
|
845
|
+
} & {
|
|
846
|
+
method?: "POST" | undefined;
|
|
847
|
+
} & {
|
|
848
|
+
query?: Record<string, any> | undefined;
|
|
849
|
+
} & {
|
|
850
|
+
params?: Record<string, any>;
|
|
851
|
+
} & {
|
|
852
|
+
request?: Request;
|
|
853
|
+
} & {
|
|
854
|
+
headers?: HeadersInit;
|
|
855
|
+
} & {
|
|
856
|
+
asResponse?: boolean;
|
|
857
|
+
returnHeaders?: boolean;
|
|
858
|
+
use?: better_call636.Middleware[];
|
|
859
|
+
path?: string;
|
|
860
|
+
} & {
|
|
861
|
+
asResponse?: AsResponse | undefined;
|
|
862
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
863
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
864
|
+
headers: Headers;
|
|
865
|
+
response: {
|
|
866
|
+
valid: boolean;
|
|
867
|
+
error: {
|
|
868
|
+
message: string | undefined;
|
|
869
|
+
code: string;
|
|
870
|
+
};
|
|
871
|
+
key: null;
|
|
872
|
+
} | {
|
|
873
|
+
valid: boolean;
|
|
874
|
+
error: null;
|
|
875
|
+
key: Omit<ApiKey, "key"> | null;
|
|
876
|
+
};
|
|
877
|
+
} : {
|
|
878
|
+
valid: boolean;
|
|
879
|
+
error: {
|
|
880
|
+
message: string | undefined;
|
|
881
|
+
code: string;
|
|
882
|
+
};
|
|
883
|
+
key: null;
|
|
884
|
+
} | {
|
|
885
|
+
valid: boolean;
|
|
886
|
+
error: null;
|
|
887
|
+
key: Omit<ApiKey, "key"> | null;
|
|
888
|
+
}>;
|
|
889
|
+
options: {
|
|
890
|
+
method: "POST";
|
|
891
|
+
body: zod1419.ZodObject<{
|
|
892
|
+
key: zod1419.ZodString;
|
|
893
|
+
permissions: zod1419.ZodOptional<zod1419.ZodRecord<zod1419.ZodString, zod1419.ZodArray<zod1419.ZodString>>>;
|
|
894
|
+
}, zod_v4_core207.$strip>;
|
|
895
|
+
metadata: {
|
|
896
|
+
SERVER_ONLY: true;
|
|
897
|
+
};
|
|
898
|
+
} & {
|
|
899
|
+
use: any[];
|
|
900
|
+
};
|
|
901
|
+
path: "/api-key/verify";
|
|
902
|
+
};
|
|
903
|
+
/**
|
|
904
|
+
* ### Endpoint
|
|
905
|
+
*
|
|
906
|
+
* GET `/api-key/get`
|
|
907
|
+
*
|
|
908
|
+
* ### API Methods
|
|
909
|
+
*
|
|
910
|
+
* **server:**
|
|
911
|
+
* `auth.api.getApiKey`
|
|
912
|
+
*
|
|
913
|
+
* **client:**
|
|
914
|
+
* `authClient.apiKey.get`
|
|
915
|
+
*
|
|
916
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-get)
|
|
917
|
+
*/
|
|
918
|
+
getApiKey: {
|
|
919
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
920
|
+
body?: undefined;
|
|
921
|
+
} & {
|
|
922
|
+
method?: "GET" | undefined;
|
|
923
|
+
} & {
|
|
924
|
+
query: {
|
|
925
|
+
id: string;
|
|
926
|
+
};
|
|
927
|
+
} & {
|
|
928
|
+
params?: Record<string, any>;
|
|
929
|
+
} & {
|
|
930
|
+
request?: Request;
|
|
931
|
+
} & {
|
|
932
|
+
headers?: HeadersInit;
|
|
933
|
+
} & {
|
|
934
|
+
asResponse?: boolean;
|
|
935
|
+
returnHeaders?: boolean;
|
|
936
|
+
use?: better_call636.Middleware[];
|
|
937
|
+
path?: string;
|
|
938
|
+
} & {
|
|
939
|
+
asResponse?: AsResponse | undefined;
|
|
940
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
941
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
942
|
+
headers: Headers;
|
|
943
|
+
response: {
|
|
944
|
+
permissions: {
|
|
945
|
+
[key: string]: string[];
|
|
946
|
+
} | null;
|
|
947
|
+
id: string;
|
|
948
|
+
name: string | null;
|
|
949
|
+
start: string | null;
|
|
950
|
+
prefix: string | null;
|
|
951
|
+
userId: string;
|
|
952
|
+
refillInterval: number | null;
|
|
953
|
+
refillAmount: number | null;
|
|
954
|
+
lastRefillAt: Date | null;
|
|
955
|
+
enabled: boolean;
|
|
956
|
+
rateLimitEnabled: boolean;
|
|
957
|
+
rateLimitTimeWindow: number | null;
|
|
958
|
+
rateLimitMax: number | null;
|
|
959
|
+
requestCount: number;
|
|
960
|
+
remaining: number | null;
|
|
961
|
+
lastRequest: Date | null;
|
|
962
|
+
expiresAt: Date | null;
|
|
963
|
+
createdAt: Date;
|
|
964
|
+
updatedAt: Date;
|
|
965
|
+
metadata: Record<string, any> | null;
|
|
966
|
+
};
|
|
967
|
+
} : {
|
|
968
|
+
permissions: {
|
|
969
|
+
[key: string]: string[];
|
|
970
|
+
} | null;
|
|
971
|
+
id: string;
|
|
972
|
+
name: string | null;
|
|
973
|
+
start: string | null;
|
|
974
|
+
prefix: string | null;
|
|
975
|
+
userId: string;
|
|
976
|
+
refillInterval: number | null;
|
|
977
|
+
refillAmount: number | null;
|
|
978
|
+
lastRefillAt: Date | null;
|
|
979
|
+
enabled: boolean;
|
|
980
|
+
rateLimitEnabled: boolean;
|
|
981
|
+
rateLimitTimeWindow: number | null;
|
|
982
|
+
rateLimitMax: number | null;
|
|
983
|
+
requestCount: number;
|
|
984
|
+
remaining: number | null;
|
|
985
|
+
lastRequest: Date | null;
|
|
986
|
+
expiresAt: Date | null;
|
|
987
|
+
createdAt: Date;
|
|
988
|
+
updatedAt: Date;
|
|
989
|
+
metadata: Record<string, any> | null;
|
|
990
|
+
}>;
|
|
991
|
+
options: {
|
|
992
|
+
method: "GET";
|
|
993
|
+
query: zod1419.ZodObject<{
|
|
994
|
+
id: zod1419.ZodString;
|
|
995
|
+
}, zod_v4_core207.$strip>;
|
|
996
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
997
|
+
session: {
|
|
998
|
+
session: Record<string, any> & {
|
|
999
|
+
id: string;
|
|
1000
|
+
createdAt: Date;
|
|
1001
|
+
updatedAt: Date;
|
|
1002
|
+
userId: string;
|
|
1003
|
+
expiresAt: Date;
|
|
1004
|
+
token: string;
|
|
1005
|
+
ipAddress?: string | null | undefined;
|
|
1006
|
+
userAgent?: string | null | undefined;
|
|
1007
|
+
};
|
|
1008
|
+
user: Record<string, any> & {
|
|
1009
|
+
id: string;
|
|
1010
|
+
createdAt: Date;
|
|
1011
|
+
updatedAt: Date;
|
|
1012
|
+
email: string;
|
|
1013
|
+
emailVerified: boolean;
|
|
1014
|
+
name: string;
|
|
1015
|
+
image?: string | null | undefined;
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
}>)[];
|
|
1019
|
+
metadata: {
|
|
1020
|
+
openapi: {
|
|
1021
|
+
description: string;
|
|
1022
|
+
responses: {
|
|
1023
|
+
"200": {
|
|
1024
|
+
description: string;
|
|
1025
|
+
content: {
|
|
1026
|
+
"application/json": {
|
|
1027
|
+
schema: {
|
|
1028
|
+
type: "object";
|
|
1029
|
+
properties: {
|
|
1030
|
+
id: {
|
|
1031
|
+
type: string;
|
|
1032
|
+
description: string;
|
|
1033
|
+
};
|
|
1034
|
+
name: {
|
|
1035
|
+
type: string;
|
|
1036
|
+
nullable: boolean;
|
|
1037
|
+
description: string;
|
|
1038
|
+
};
|
|
1039
|
+
start: {
|
|
1040
|
+
type: string;
|
|
1041
|
+
nullable: boolean;
|
|
1042
|
+
description: string;
|
|
1043
|
+
};
|
|
1044
|
+
prefix: {
|
|
1045
|
+
type: string;
|
|
1046
|
+
nullable: boolean;
|
|
1047
|
+
description: string;
|
|
1048
|
+
};
|
|
1049
|
+
userId: {
|
|
1050
|
+
type: string;
|
|
1051
|
+
description: string;
|
|
1052
|
+
};
|
|
1053
|
+
refillInterval: {
|
|
1054
|
+
type: string;
|
|
1055
|
+
nullable: boolean;
|
|
1056
|
+
description: string;
|
|
1057
|
+
};
|
|
1058
|
+
refillAmount: {
|
|
1059
|
+
type: string;
|
|
1060
|
+
nullable: boolean;
|
|
1061
|
+
description: string;
|
|
1062
|
+
};
|
|
1063
|
+
lastRefillAt: {
|
|
1064
|
+
type: string;
|
|
1065
|
+
format: string;
|
|
1066
|
+
nullable: boolean;
|
|
1067
|
+
description: string;
|
|
1068
|
+
};
|
|
1069
|
+
enabled: {
|
|
1070
|
+
type: string;
|
|
1071
|
+
description: string;
|
|
1072
|
+
default: boolean;
|
|
1073
|
+
};
|
|
1074
|
+
rateLimitEnabled: {
|
|
1075
|
+
type: string;
|
|
1076
|
+
description: string;
|
|
1077
|
+
};
|
|
1078
|
+
rateLimitTimeWindow: {
|
|
1079
|
+
type: string;
|
|
1080
|
+
nullable: boolean;
|
|
1081
|
+
description: string;
|
|
1082
|
+
};
|
|
1083
|
+
rateLimitMax: {
|
|
1084
|
+
type: string;
|
|
1085
|
+
nullable: boolean;
|
|
1086
|
+
description: string;
|
|
1087
|
+
};
|
|
1088
|
+
requestCount: {
|
|
1089
|
+
type: string;
|
|
1090
|
+
description: string;
|
|
1091
|
+
};
|
|
1092
|
+
remaining: {
|
|
1093
|
+
type: string;
|
|
1094
|
+
nullable: boolean;
|
|
1095
|
+
description: string;
|
|
1096
|
+
};
|
|
1097
|
+
lastRequest: {
|
|
1098
|
+
type: string;
|
|
1099
|
+
format: string;
|
|
1100
|
+
nullable: boolean;
|
|
1101
|
+
description: string;
|
|
1102
|
+
};
|
|
1103
|
+
expiresAt: {
|
|
1104
|
+
type: string;
|
|
1105
|
+
format: string;
|
|
1106
|
+
nullable: boolean;
|
|
1107
|
+
description: string;
|
|
1108
|
+
};
|
|
1109
|
+
createdAt: {
|
|
1110
|
+
type: string;
|
|
1111
|
+
format: string;
|
|
1112
|
+
description: string;
|
|
1113
|
+
};
|
|
1114
|
+
updatedAt: {
|
|
1115
|
+
type: string;
|
|
1116
|
+
format: string;
|
|
1117
|
+
description: string;
|
|
1118
|
+
};
|
|
1119
|
+
metadata: {
|
|
1120
|
+
type: string;
|
|
1121
|
+
nullable: boolean;
|
|
1122
|
+
additionalProperties: boolean;
|
|
1123
|
+
description: string;
|
|
1124
|
+
};
|
|
1125
|
+
permissions: {
|
|
1126
|
+
type: string;
|
|
1127
|
+
nullable: boolean;
|
|
1128
|
+
description: string;
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
required: string[];
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
};
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
};
|
|
1138
|
+
};
|
|
1139
|
+
} & {
|
|
1140
|
+
use: any[];
|
|
1141
|
+
};
|
|
1142
|
+
path: "/api-key/get";
|
|
1143
|
+
};
|
|
1144
|
+
/**
|
|
1145
|
+
* ### Endpoint
|
|
1146
|
+
*
|
|
1147
|
+
* POST `/api-key/update`
|
|
1148
|
+
*
|
|
1149
|
+
* ### API Methods
|
|
1150
|
+
*
|
|
1151
|
+
* **server:**
|
|
1152
|
+
* `auth.api.updateApiKey`
|
|
1153
|
+
*
|
|
1154
|
+
* **client:**
|
|
1155
|
+
* `authClient.apiKey.update`
|
|
1156
|
+
*
|
|
1157
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-update)
|
|
1158
|
+
*/
|
|
1159
|
+
updateApiKey: {
|
|
1160
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
1161
|
+
body: {
|
|
1162
|
+
keyId: string;
|
|
1163
|
+
userId?: unknown;
|
|
1164
|
+
name?: string | undefined;
|
|
1165
|
+
enabled?: boolean | undefined;
|
|
1166
|
+
remaining?: number | undefined;
|
|
1167
|
+
refillAmount?: number | undefined;
|
|
1168
|
+
refillInterval?: number | undefined;
|
|
1169
|
+
metadata?: any;
|
|
1170
|
+
expiresIn?: number | null | undefined;
|
|
1171
|
+
rateLimitEnabled?: boolean | undefined;
|
|
1172
|
+
rateLimitTimeWindow?: number | undefined;
|
|
1173
|
+
rateLimitMax?: number | undefined;
|
|
1174
|
+
permissions?: Record<string, string[]> | null | undefined;
|
|
1175
|
+
};
|
|
1176
|
+
} & {
|
|
1177
|
+
method?: "POST" | undefined;
|
|
1178
|
+
} & {
|
|
1179
|
+
query?: Record<string, any> | undefined;
|
|
1180
|
+
} & {
|
|
1181
|
+
params?: Record<string, any>;
|
|
1182
|
+
} & {
|
|
1183
|
+
request?: Request;
|
|
1184
|
+
} & {
|
|
1185
|
+
headers?: HeadersInit;
|
|
1186
|
+
} & {
|
|
1187
|
+
asResponse?: boolean;
|
|
1188
|
+
returnHeaders?: boolean;
|
|
1189
|
+
use?: better_call636.Middleware[];
|
|
1190
|
+
path?: string;
|
|
1191
|
+
} & {
|
|
1192
|
+
asResponse?: AsResponse | undefined;
|
|
1193
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1194
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1195
|
+
headers: Headers;
|
|
1196
|
+
response: {
|
|
1197
|
+
permissions: {
|
|
1198
|
+
[key: string]: string[];
|
|
1199
|
+
} | null;
|
|
1200
|
+
id: string;
|
|
1201
|
+
name: string | null;
|
|
1202
|
+
start: string | null;
|
|
1203
|
+
prefix: string | null;
|
|
1204
|
+
userId: string;
|
|
1205
|
+
refillInterval: number | null;
|
|
1206
|
+
refillAmount: number | null;
|
|
1207
|
+
lastRefillAt: Date | null;
|
|
1208
|
+
enabled: boolean;
|
|
1209
|
+
rateLimitEnabled: boolean;
|
|
1210
|
+
rateLimitTimeWindow: number | null;
|
|
1211
|
+
rateLimitMax: number | null;
|
|
1212
|
+
requestCount: number;
|
|
1213
|
+
remaining: number | null;
|
|
1214
|
+
lastRequest: Date | null;
|
|
1215
|
+
expiresAt: Date | null;
|
|
1216
|
+
createdAt: Date;
|
|
1217
|
+
updatedAt: Date;
|
|
1218
|
+
metadata: Record<string, any> | null;
|
|
1219
|
+
};
|
|
1220
|
+
} : {
|
|
1221
|
+
permissions: {
|
|
1222
|
+
[key: string]: string[];
|
|
1223
|
+
} | null;
|
|
1224
|
+
id: string;
|
|
1225
|
+
name: string | null;
|
|
1226
|
+
start: string | null;
|
|
1227
|
+
prefix: string | null;
|
|
1228
|
+
userId: string;
|
|
1229
|
+
refillInterval: number | null;
|
|
1230
|
+
refillAmount: number | null;
|
|
1231
|
+
lastRefillAt: Date | null;
|
|
1232
|
+
enabled: boolean;
|
|
1233
|
+
rateLimitEnabled: boolean;
|
|
1234
|
+
rateLimitTimeWindow: number | null;
|
|
1235
|
+
rateLimitMax: number | null;
|
|
1236
|
+
requestCount: number;
|
|
1237
|
+
remaining: number | null;
|
|
1238
|
+
lastRequest: Date | null;
|
|
1239
|
+
expiresAt: Date | null;
|
|
1240
|
+
createdAt: Date;
|
|
1241
|
+
updatedAt: Date;
|
|
1242
|
+
metadata: Record<string, any> | null;
|
|
1243
|
+
}>;
|
|
1244
|
+
options: {
|
|
1245
|
+
method: "POST";
|
|
1246
|
+
body: zod1419.ZodObject<{
|
|
1247
|
+
keyId: zod1419.ZodString;
|
|
1248
|
+
userId: zod1419.ZodOptional<zod1419.ZodCoercedString<unknown>>;
|
|
1249
|
+
name: zod1419.ZodOptional<zod1419.ZodString>;
|
|
1250
|
+
enabled: zod1419.ZodOptional<zod1419.ZodBoolean>;
|
|
1251
|
+
remaining: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
1252
|
+
refillAmount: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
1253
|
+
refillInterval: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
1254
|
+
metadata: zod1419.ZodOptional<zod1419.ZodAny>;
|
|
1255
|
+
expiresIn: zod1419.ZodNullable<zod1419.ZodOptional<zod1419.ZodNumber>>;
|
|
1256
|
+
rateLimitEnabled: zod1419.ZodOptional<zod1419.ZodBoolean>;
|
|
1257
|
+
rateLimitTimeWindow: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
1258
|
+
rateLimitMax: zod1419.ZodOptional<zod1419.ZodNumber>;
|
|
1259
|
+
permissions: zod1419.ZodNullable<zod1419.ZodOptional<zod1419.ZodRecord<zod1419.ZodString, zod1419.ZodArray<zod1419.ZodString>>>>;
|
|
1260
|
+
}, zod_v4_core207.$strip>;
|
|
1261
|
+
metadata: {
|
|
1262
|
+
openapi: {
|
|
1263
|
+
description: string;
|
|
1264
|
+
responses: {
|
|
1265
|
+
"200": {
|
|
1266
|
+
description: string;
|
|
1267
|
+
content: {
|
|
1268
|
+
"application/json": {
|
|
1269
|
+
schema: {
|
|
1270
|
+
type: "object";
|
|
1271
|
+
properties: {
|
|
1272
|
+
id: {
|
|
1273
|
+
type: string;
|
|
1274
|
+
description: string;
|
|
1275
|
+
};
|
|
1276
|
+
name: {
|
|
1277
|
+
type: string;
|
|
1278
|
+
nullable: boolean;
|
|
1279
|
+
description: string;
|
|
1280
|
+
};
|
|
1281
|
+
start: {
|
|
1282
|
+
type: string;
|
|
1283
|
+
nullable: boolean;
|
|
1284
|
+
description: string;
|
|
1285
|
+
};
|
|
1286
|
+
prefix: {
|
|
1287
|
+
type: string;
|
|
1288
|
+
nullable: boolean;
|
|
1289
|
+
description: string;
|
|
1290
|
+
};
|
|
1291
|
+
userId: {
|
|
1292
|
+
type: string;
|
|
1293
|
+
description: string;
|
|
1294
|
+
};
|
|
1295
|
+
refillInterval: {
|
|
1296
|
+
type: string;
|
|
1297
|
+
nullable: boolean;
|
|
1298
|
+
description: string;
|
|
1299
|
+
};
|
|
1300
|
+
refillAmount: {
|
|
1301
|
+
type: string;
|
|
1302
|
+
nullable: boolean;
|
|
1303
|
+
description: string;
|
|
1304
|
+
};
|
|
1305
|
+
lastRefillAt: {
|
|
1306
|
+
type: string;
|
|
1307
|
+
format: string;
|
|
1308
|
+
nullable: boolean;
|
|
1309
|
+
description: string;
|
|
1310
|
+
};
|
|
1311
|
+
enabled: {
|
|
1312
|
+
type: string;
|
|
1313
|
+
description: string;
|
|
1314
|
+
default: boolean;
|
|
1315
|
+
};
|
|
1316
|
+
rateLimitEnabled: {
|
|
1317
|
+
type: string;
|
|
1318
|
+
description: string;
|
|
1319
|
+
};
|
|
1320
|
+
rateLimitTimeWindow: {
|
|
1321
|
+
type: string;
|
|
1322
|
+
nullable: boolean;
|
|
1323
|
+
description: string;
|
|
1324
|
+
};
|
|
1325
|
+
rateLimitMax: {
|
|
1326
|
+
type: string;
|
|
1327
|
+
nullable: boolean;
|
|
1328
|
+
description: string;
|
|
1329
|
+
};
|
|
1330
|
+
requestCount: {
|
|
1331
|
+
type: string;
|
|
1332
|
+
description: string;
|
|
1333
|
+
};
|
|
1334
|
+
remaining: {
|
|
1335
|
+
type: string;
|
|
1336
|
+
nullable: boolean;
|
|
1337
|
+
description: string;
|
|
1338
|
+
};
|
|
1339
|
+
lastRequest: {
|
|
1340
|
+
type: string;
|
|
1341
|
+
format: string;
|
|
1342
|
+
nullable: boolean;
|
|
1343
|
+
description: string;
|
|
1344
|
+
};
|
|
1345
|
+
expiresAt: {
|
|
1346
|
+
type: string;
|
|
1347
|
+
format: string;
|
|
1348
|
+
nullable: boolean;
|
|
1349
|
+
description: string;
|
|
1350
|
+
};
|
|
1351
|
+
createdAt: {
|
|
1352
|
+
type: string;
|
|
1353
|
+
format: string;
|
|
1354
|
+
description: string;
|
|
1355
|
+
};
|
|
1356
|
+
updatedAt: {
|
|
1357
|
+
type: string;
|
|
1358
|
+
format: string;
|
|
1359
|
+
description: string;
|
|
1360
|
+
};
|
|
1361
|
+
metadata: {
|
|
1362
|
+
type: string;
|
|
1363
|
+
nullable: boolean;
|
|
1364
|
+
additionalProperties: boolean;
|
|
1365
|
+
description: string;
|
|
1366
|
+
};
|
|
1367
|
+
permissions: {
|
|
1368
|
+
type: string;
|
|
1369
|
+
nullable: boolean;
|
|
1370
|
+
description: string;
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
required: string[];
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
};
|
|
1379
|
+
};
|
|
1380
|
+
};
|
|
1381
|
+
} & {
|
|
1382
|
+
use: any[];
|
|
1383
|
+
};
|
|
1384
|
+
path: "/api-key/update";
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* ### Endpoint
|
|
1388
|
+
*
|
|
1389
|
+
* POST `/api-key/delete`
|
|
1390
|
+
*
|
|
1391
|
+
* ### API Methods
|
|
1392
|
+
*
|
|
1393
|
+
* **server:**
|
|
1394
|
+
* `auth.api.deleteApiKey`
|
|
1395
|
+
*
|
|
1396
|
+
* **client:**
|
|
1397
|
+
* `authClient.apiKey.delete`
|
|
1398
|
+
*
|
|
1399
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-delete)
|
|
1400
|
+
*/
|
|
1401
|
+
deleteApiKey: {
|
|
1402
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
1403
|
+
body: {
|
|
1404
|
+
keyId: string;
|
|
1405
|
+
};
|
|
1406
|
+
} & {
|
|
1407
|
+
method?: "POST" | undefined;
|
|
1408
|
+
} & {
|
|
1409
|
+
query?: Record<string, any> | undefined;
|
|
1410
|
+
} & {
|
|
1411
|
+
params?: Record<string, any>;
|
|
1412
|
+
} & {
|
|
1413
|
+
request?: Request;
|
|
1414
|
+
} & {
|
|
1415
|
+
headers?: HeadersInit;
|
|
1416
|
+
} & {
|
|
1417
|
+
asResponse?: boolean;
|
|
1418
|
+
returnHeaders?: boolean;
|
|
1419
|
+
use?: better_call636.Middleware[];
|
|
1420
|
+
path?: string;
|
|
1421
|
+
} & {
|
|
1422
|
+
asResponse?: AsResponse | undefined;
|
|
1423
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1424
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1425
|
+
headers: Headers;
|
|
1426
|
+
response: {
|
|
1427
|
+
success: boolean;
|
|
1428
|
+
};
|
|
1429
|
+
} : {
|
|
1430
|
+
success: boolean;
|
|
1431
|
+
}>;
|
|
1432
|
+
options: {
|
|
1433
|
+
method: "POST";
|
|
1434
|
+
body: zod1419.ZodObject<{
|
|
1435
|
+
keyId: zod1419.ZodString;
|
|
1436
|
+
}, zod_v4_core207.$strip>;
|
|
1437
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
1438
|
+
session: {
|
|
1439
|
+
session: Record<string, any> & {
|
|
1440
|
+
id: string;
|
|
1441
|
+
createdAt: Date;
|
|
1442
|
+
updatedAt: Date;
|
|
1443
|
+
userId: string;
|
|
1444
|
+
expiresAt: Date;
|
|
1445
|
+
token: string;
|
|
1446
|
+
ipAddress?: string | null | undefined;
|
|
1447
|
+
userAgent?: string | null | undefined;
|
|
1448
|
+
};
|
|
1449
|
+
user: Record<string, any> & {
|
|
1450
|
+
id: string;
|
|
1451
|
+
createdAt: Date;
|
|
1452
|
+
updatedAt: Date;
|
|
1453
|
+
email: string;
|
|
1454
|
+
emailVerified: boolean;
|
|
1455
|
+
name: string;
|
|
1456
|
+
image?: string | null | undefined;
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
}>)[];
|
|
1460
|
+
metadata: {
|
|
1461
|
+
openapi: {
|
|
1462
|
+
description: string;
|
|
1463
|
+
requestBody: {
|
|
1464
|
+
content: {
|
|
1465
|
+
"application/json": {
|
|
1466
|
+
schema: {
|
|
1467
|
+
type: "object";
|
|
1468
|
+
properties: {
|
|
1469
|
+
keyId: {
|
|
1470
|
+
type: string;
|
|
1471
|
+
description: string;
|
|
1472
|
+
};
|
|
1473
|
+
};
|
|
1474
|
+
required: string[];
|
|
1475
|
+
};
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1478
|
+
};
|
|
1479
|
+
responses: {
|
|
1480
|
+
"200": {
|
|
1481
|
+
description: string;
|
|
1482
|
+
content: {
|
|
1483
|
+
"application/json": {
|
|
1484
|
+
schema: {
|
|
1485
|
+
type: "object";
|
|
1486
|
+
properties: {
|
|
1487
|
+
success: {
|
|
1488
|
+
type: string;
|
|
1489
|
+
description: string;
|
|
1490
|
+
};
|
|
1491
|
+
};
|
|
1492
|
+
required: string[];
|
|
1493
|
+
};
|
|
1494
|
+
};
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1500
|
+
} & {
|
|
1501
|
+
use: any[];
|
|
1502
|
+
};
|
|
1503
|
+
path: "/api-key/delete";
|
|
1504
|
+
};
|
|
1505
|
+
/**
|
|
1506
|
+
* ### Endpoint
|
|
1507
|
+
*
|
|
1508
|
+
* GET `/api-key/list`
|
|
1509
|
+
*
|
|
1510
|
+
* ### API Methods
|
|
1511
|
+
*
|
|
1512
|
+
* **server:**
|
|
1513
|
+
* `auth.api.listApiKeys`
|
|
1514
|
+
*
|
|
1515
|
+
* **client:**
|
|
1516
|
+
* `authClient.apiKey.list`
|
|
1517
|
+
*
|
|
1518
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-list)
|
|
1519
|
+
*/
|
|
1520
|
+
listApiKeys: {
|
|
1521
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
1522
|
+
body?: undefined;
|
|
1523
|
+
} & {
|
|
1524
|
+
method?: "GET" | undefined;
|
|
1525
|
+
} & {
|
|
1526
|
+
query?: Record<string, any> | undefined;
|
|
1527
|
+
} & {
|
|
1528
|
+
params?: Record<string, any>;
|
|
1529
|
+
} & {
|
|
1530
|
+
request?: Request;
|
|
1531
|
+
} & {
|
|
1532
|
+
headers?: HeadersInit;
|
|
1533
|
+
} & {
|
|
1534
|
+
asResponse?: boolean;
|
|
1535
|
+
returnHeaders?: boolean;
|
|
1536
|
+
use?: better_call636.Middleware[];
|
|
1537
|
+
path?: string;
|
|
1538
|
+
} & {
|
|
1539
|
+
asResponse?: AsResponse | undefined;
|
|
1540
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1541
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1542
|
+
headers: Headers;
|
|
1543
|
+
response: {
|
|
1544
|
+
permissions: {
|
|
1545
|
+
[key: string]: string[];
|
|
1546
|
+
} | null;
|
|
1547
|
+
id: string;
|
|
1548
|
+
name: string | null;
|
|
1549
|
+
start: string | null;
|
|
1550
|
+
prefix: string | null;
|
|
1551
|
+
userId: string;
|
|
1552
|
+
refillInterval: number | null;
|
|
1553
|
+
refillAmount: number | null;
|
|
1554
|
+
lastRefillAt: Date | null;
|
|
1555
|
+
enabled: boolean;
|
|
1556
|
+
rateLimitEnabled: boolean;
|
|
1557
|
+
rateLimitTimeWindow: number | null;
|
|
1558
|
+
rateLimitMax: number | null;
|
|
1559
|
+
requestCount: number;
|
|
1560
|
+
remaining: number | null;
|
|
1561
|
+
lastRequest: Date | null;
|
|
1562
|
+
expiresAt: Date | null;
|
|
1563
|
+
createdAt: Date;
|
|
1564
|
+
updatedAt: Date;
|
|
1565
|
+
metadata: Record<string, any> | null;
|
|
1566
|
+
}[];
|
|
1567
|
+
} : {
|
|
1568
|
+
permissions: {
|
|
1569
|
+
[key: string]: string[];
|
|
1570
|
+
} | null;
|
|
1571
|
+
id: string;
|
|
1572
|
+
name: string | null;
|
|
1573
|
+
start: string | null;
|
|
1574
|
+
prefix: string | null;
|
|
1575
|
+
userId: string;
|
|
1576
|
+
refillInterval: number | null;
|
|
1577
|
+
refillAmount: number | null;
|
|
1578
|
+
lastRefillAt: Date | null;
|
|
1579
|
+
enabled: boolean;
|
|
1580
|
+
rateLimitEnabled: boolean;
|
|
1581
|
+
rateLimitTimeWindow: number | null;
|
|
1582
|
+
rateLimitMax: number | null;
|
|
1583
|
+
requestCount: number;
|
|
1584
|
+
remaining: number | null;
|
|
1585
|
+
lastRequest: Date | null;
|
|
1586
|
+
expiresAt: Date | null;
|
|
1587
|
+
createdAt: Date;
|
|
1588
|
+
updatedAt: Date;
|
|
1589
|
+
metadata: Record<string, any> | null;
|
|
1590
|
+
}[]>;
|
|
1591
|
+
options: {
|
|
1592
|
+
method: "GET";
|
|
1593
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
1594
|
+
session: {
|
|
1595
|
+
session: Record<string, any> & {
|
|
1596
|
+
id: string;
|
|
1597
|
+
createdAt: Date;
|
|
1598
|
+
updatedAt: Date;
|
|
1599
|
+
userId: string;
|
|
1600
|
+
expiresAt: Date;
|
|
1601
|
+
token: string;
|
|
1602
|
+
ipAddress?: string | null | undefined;
|
|
1603
|
+
userAgent?: string | null | undefined;
|
|
1604
|
+
};
|
|
1605
|
+
user: Record<string, any> & {
|
|
1606
|
+
id: string;
|
|
1607
|
+
createdAt: Date;
|
|
1608
|
+
updatedAt: Date;
|
|
1609
|
+
email: string;
|
|
1610
|
+
emailVerified: boolean;
|
|
1611
|
+
name: string;
|
|
1612
|
+
image?: string | null | undefined;
|
|
1613
|
+
};
|
|
1614
|
+
};
|
|
1615
|
+
}>)[];
|
|
1616
|
+
metadata: {
|
|
1617
|
+
openapi: {
|
|
1618
|
+
description: string;
|
|
1619
|
+
responses: {
|
|
1620
|
+
"200": {
|
|
1621
|
+
description: string;
|
|
1622
|
+
content: {
|
|
1623
|
+
"application/json": {
|
|
1624
|
+
schema: {
|
|
1625
|
+
type: "array";
|
|
1626
|
+
items: {
|
|
1627
|
+
type: string;
|
|
1628
|
+
properties: {
|
|
1629
|
+
id: {
|
|
1630
|
+
type: string;
|
|
1631
|
+
description: string;
|
|
1632
|
+
};
|
|
1633
|
+
name: {
|
|
1634
|
+
type: string;
|
|
1635
|
+
nullable: boolean;
|
|
1636
|
+
description: string;
|
|
1637
|
+
};
|
|
1638
|
+
start: {
|
|
1639
|
+
type: string;
|
|
1640
|
+
nullable: boolean;
|
|
1641
|
+
description: string;
|
|
1642
|
+
};
|
|
1643
|
+
prefix: {
|
|
1644
|
+
type: string;
|
|
1645
|
+
nullable: boolean;
|
|
1646
|
+
description: string;
|
|
1647
|
+
};
|
|
1648
|
+
userId: {
|
|
1649
|
+
type: string;
|
|
1650
|
+
description: string;
|
|
1651
|
+
};
|
|
1652
|
+
refillInterval: {
|
|
1653
|
+
type: string;
|
|
1654
|
+
nullable: boolean;
|
|
1655
|
+
description: string;
|
|
1656
|
+
};
|
|
1657
|
+
refillAmount: {
|
|
1658
|
+
type: string;
|
|
1659
|
+
nullable: boolean;
|
|
1660
|
+
description: string;
|
|
1661
|
+
};
|
|
1662
|
+
lastRefillAt: {
|
|
1663
|
+
type: string;
|
|
1664
|
+
format: string;
|
|
1665
|
+
nullable: boolean;
|
|
1666
|
+
description: string;
|
|
1667
|
+
};
|
|
1668
|
+
enabled: {
|
|
1669
|
+
type: string;
|
|
1670
|
+
description: string;
|
|
1671
|
+
default: boolean;
|
|
1672
|
+
};
|
|
1673
|
+
rateLimitEnabled: {
|
|
1674
|
+
type: string;
|
|
1675
|
+
description: string;
|
|
1676
|
+
};
|
|
1677
|
+
rateLimitTimeWindow: {
|
|
1678
|
+
type: string;
|
|
1679
|
+
nullable: boolean;
|
|
1680
|
+
description: string;
|
|
1681
|
+
};
|
|
1682
|
+
rateLimitMax: {
|
|
1683
|
+
type: string;
|
|
1684
|
+
nullable: boolean;
|
|
1685
|
+
description: string;
|
|
1686
|
+
};
|
|
1687
|
+
requestCount: {
|
|
1688
|
+
type: string;
|
|
1689
|
+
description: string;
|
|
1690
|
+
};
|
|
1691
|
+
remaining: {
|
|
1692
|
+
type: string;
|
|
1693
|
+
nullable: boolean;
|
|
1694
|
+
description: string;
|
|
1695
|
+
};
|
|
1696
|
+
lastRequest: {
|
|
1697
|
+
type: string;
|
|
1698
|
+
format: string;
|
|
1699
|
+
nullable: boolean;
|
|
1700
|
+
description: string;
|
|
1701
|
+
};
|
|
1702
|
+
expiresAt: {
|
|
1703
|
+
type: string;
|
|
1704
|
+
format: string;
|
|
1705
|
+
nullable: boolean;
|
|
1706
|
+
description: string;
|
|
1707
|
+
};
|
|
1708
|
+
createdAt: {
|
|
1709
|
+
type: string;
|
|
1710
|
+
format: string;
|
|
1711
|
+
description: string;
|
|
1712
|
+
};
|
|
1713
|
+
updatedAt: {
|
|
1714
|
+
type: string;
|
|
1715
|
+
format: string;
|
|
1716
|
+
description: string;
|
|
1717
|
+
};
|
|
1718
|
+
metadata: {
|
|
1719
|
+
type: string;
|
|
1720
|
+
nullable: boolean;
|
|
1721
|
+
additionalProperties: boolean;
|
|
1722
|
+
description: string;
|
|
1723
|
+
};
|
|
1724
|
+
permissions: {
|
|
1725
|
+
type: string;
|
|
1726
|
+
nullable: boolean;
|
|
1727
|
+
description: string;
|
|
1728
|
+
};
|
|
1729
|
+
};
|
|
1730
|
+
required: string[];
|
|
1731
|
+
};
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
};
|
|
1735
|
+
};
|
|
1736
|
+
};
|
|
1737
|
+
};
|
|
1738
|
+
};
|
|
1739
|
+
} & {
|
|
1740
|
+
use: any[];
|
|
1741
|
+
};
|
|
1742
|
+
path: "/api-key/list";
|
|
1743
|
+
};
|
|
1744
|
+
/**
|
|
1745
|
+
* ### Endpoint
|
|
1746
|
+
*
|
|
1747
|
+
* POST `/api-key/delete-all-expired-api-keys`
|
|
1748
|
+
*
|
|
1749
|
+
* ### API Methods
|
|
1750
|
+
*
|
|
1751
|
+
* **server:**
|
|
1752
|
+
* `auth.api.deleteAllExpiredApiKeys`
|
|
1753
|
+
*
|
|
1754
|
+
* @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-delete-all-expired-api-keys)
|
|
1755
|
+
*/
|
|
1756
|
+
deleteAllExpiredApiKeys: {
|
|
1757
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
1758
|
+
body?: undefined;
|
|
1759
|
+
} & {
|
|
1760
|
+
method?: "POST" | undefined;
|
|
1761
|
+
} & {
|
|
1762
|
+
query?: Record<string, any> | undefined;
|
|
1763
|
+
} & {
|
|
1764
|
+
params?: Record<string, any>;
|
|
1765
|
+
} & {
|
|
1766
|
+
request?: Request;
|
|
1767
|
+
} & {
|
|
1768
|
+
headers?: HeadersInit;
|
|
1769
|
+
} & {
|
|
1770
|
+
asResponse?: boolean;
|
|
1771
|
+
returnHeaders?: boolean;
|
|
1772
|
+
use?: better_call636.Middleware[];
|
|
1773
|
+
path?: string;
|
|
1774
|
+
} & {
|
|
1775
|
+
asResponse?: AsResponse | undefined;
|
|
1776
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
1777
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
1778
|
+
headers: Headers;
|
|
1779
|
+
response: {
|
|
1780
|
+
success: boolean;
|
|
1781
|
+
error: unknown;
|
|
1782
|
+
};
|
|
1783
|
+
} : {
|
|
1784
|
+
success: boolean;
|
|
1785
|
+
error: unknown;
|
|
1786
|
+
}>;
|
|
1787
|
+
options: {
|
|
1788
|
+
method: "POST";
|
|
1789
|
+
metadata: {
|
|
1790
|
+
SERVER_ONLY: true;
|
|
1791
|
+
client: boolean;
|
|
1792
|
+
};
|
|
1793
|
+
} & {
|
|
1794
|
+
use: any[];
|
|
1795
|
+
};
|
|
1796
|
+
path: "/api-key/delete-all-expired-api-keys";
|
|
1797
|
+
};
|
|
1798
|
+
};
|
|
1799
|
+
schema: {
|
|
1800
|
+
apikey: {
|
|
1801
|
+
fields: {
|
|
1802
|
+
name: {
|
|
1803
|
+
type: "string";
|
|
1804
|
+
required: false;
|
|
1805
|
+
input: false;
|
|
1806
|
+
};
|
|
1807
|
+
start: {
|
|
1808
|
+
type: "string";
|
|
1809
|
+
required: false;
|
|
1810
|
+
input: false;
|
|
1811
|
+
};
|
|
1812
|
+
prefix: {
|
|
1813
|
+
type: "string";
|
|
1814
|
+
required: false;
|
|
1815
|
+
input: false;
|
|
1816
|
+
};
|
|
1817
|
+
key: {
|
|
1818
|
+
type: "string";
|
|
1819
|
+
required: true;
|
|
1820
|
+
input: false;
|
|
1821
|
+
};
|
|
1822
|
+
userId: {
|
|
1823
|
+
type: "string";
|
|
1824
|
+
references: {
|
|
1825
|
+
model: string;
|
|
1826
|
+
field: string;
|
|
1827
|
+
onDelete: "cascade";
|
|
1828
|
+
};
|
|
1829
|
+
required: true;
|
|
1830
|
+
input: false;
|
|
1831
|
+
};
|
|
1832
|
+
refillInterval: {
|
|
1833
|
+
type: "number";
|
|
1834
|
+
required: false;
|
|
1835
|
+
input: false;
|
|
1836
|
+
};
|
|
1837
|
+
refillAmount: {
|
|
1838
|
+
type: "number";
|
|
1839
|
+
required: false;
|
|
1840
|
+
input: false;
|
|
1841
|
+
};
|
|
1842
|
+
lastRefillAt: {
|
|
1843
|
+
type: "date";
|
|
1844
|
+
required: false;
|
|
1845
|
+
input: false;
|
|
1846
|
+
};
|
|
1847
|
+
enabled: {
|
|
1848
|
+
type: "boolean";
|
|
1849
|
+
required: false;
|
|
1850
|
+
input: false;
|
|
1851
|
+
defaultValue: true;
|
|
1852
|
+
};
|
|
1853
|
+
rateLimitEnabled: {
|
|
1854
|
+
type: "boolean";
|
|
1855
|
+
required: false;
|
|
1856
|
+
input: false;
|
|
1857
|
+
defaultValue: true;
|
|
1858
|
+
};
|
|
1859
|
+
rateLimitTimeWindow: {
|
|
1860
|
+
type: "number";
|
|
1861
|
+
required: false;
|
|
1862
|
+
input: false;
|
|
1863
|
+
defaultValue: number;
|
|
1864
|
+
};
|
|
1865
|
+
rateLimitMax: {
|
|
1866
|
+
type: "number";
|
|
1867
|
+
required: false;
|
|
1868
|
+
input: false;
|
|
1869
|
+
defaultValue: number;
|
|
1870
|
+
};
|
|
1871
|
+
requestCount: {
|
|
1872
|
+
type: "number";
|
|
1873
|
+
required: false;
|
|
1874
|
+
input: false;
|
|
1875
|
+
defaultValue: number;
|
|
1876
|
+
};
|
|
1877
|
+
remaining: {
|
|
1878
|
+
type: "number";
|
|
1879
|
+
required: false;
|
|
1880
|
+
input: false;
|
|
1881
|
+
};
|
|
1882
|
+
lastRequest: {
|
|
1883
|
+
type: "date";
|
|
1884
|
+
required: false;
|
|
1885
|
+
input: false;
|
|
1886
|
+
};
|
|
1887
|
+
expiresAt: {
|
|
1888
|
+
type: "date";
|
|
1889
|
+
required: false;
|
|
1890
|
+
input: false;
|
|
1891
|
+
};
|
|
1892
|
+
createdAt: {
|
|
1893
|
+
type: "date";
|
|
1894
|
+
required: true;
|
|
1895
|
+
input: false;
|
|
1896
|
+
};
|
|
1897
|
+
updatedAt: {
|
|
1898
|
+
type: "date";
|
|
1899
|
+
required: true;
|
|
1900
|
+
input: false;
|
|
1901
|
+
};
|
|
1902
|
+
permissions: {
|
|
1903
|
+
type: "string";
|
|
1904
|
+
required: false;
|
|
1905
|
+
input: false;
|
|
1906
|
+
};
|
|
1907
|
+
metadata: {
|
|
1908
|
+
type: "string";
|
|
1909
|
+
required: false;
|
|
1910
|
+
input: true;
|
|
1911
|
+
transform: {
|
|
1912
|
+
input(value: DBPrimitive): string;
|
|
1913
|
+
output(value: DBPrimitive): any;
|
|
1914
|
+
};
|
|
1915
|
+
};
|
|
1916
|
+
};
|
|
1917
|
+
};
|
|
1918
|
+
};
|
|
1919
|
+
};
|
|
1920
|
+
//#endregion
|
|
1921
|
+
//#region src/plugins/last-login-method/index.d.ts
|
|
1922
|
+
/**
|
|
1923
|
+
* Configuration for tracking different authentication methods
|
|
1924
|
+
*/
|
|
1925
|
+
interface LastLoginMethodOptions {
|
|
1926
|
+
/**
|
|
1927
|
+
* Name of the cookie to store the last login method
|
|
1928
|
+
* @default "payvo-auth.last_used_login_method"
|
|
1929
|
+
*/
|
|
1930
|
+
cookieName?: string | undefined;
|
|
1931
|
+
/**
|
|
1932
|
+
* Cookie expiration time in seconds
|
|
1933
|
+
* @default 2592000 (30 days)
|
|
1934
|
+
*/
|
|
1935
|
+
maxAge?: number | undefined;
|
|
1936
|
+
/**
|
|
1937
|
+
* Custom method to resolve the last login method
|
|
1938
|
+
* @param ctx - The context from the hook
|
|
1939
|
+
* @returns The last login method
|
|
1940
|
+
*/
|
|
1941
|
+
customResolveMethod?: ((ctx: GenericEndpointContext) => string | null) | undefined;
|
|
1942
|
+
/**
|
|
1943
|
+
* Store the last login method in the database. This will create a new field in the user table.
|
|
1944
|
+
* @default false
|
|
1945
|
+
*/
|
|
1946
|
+
storeInDatabase?: boolean | undefined;
|
|
1947
|
+
/**
|
|
1948
|
+
* Custom schema for the plugin
|
|
1949
|
+
* @default undefined
|
|
1950
|
+
*/
|
|
1951
|
+
schema?: {
|
|
1952
|
+
user?: {
|
|
1953
|
+
lastLoginMethod?: string;
|
|
1954
|
+
};
|
|
1955
|
+
} | undefined;
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Plugin to track the last used login method
|
|
1959
|
+
*/
|
|
1960
|
+
declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O | undefined) => {
|
|
1961
|
+
id: "last-login-method";
|
|
1962
|
+
init(ctx: _gatwech_core61.AuthContext<_gatwech_core61.PayvoAuthOptions>): {
|
|
1963
|
+
options: {
|
|
1964
|
+
databaseHooks: {
|
|
1965
|
+
user: {
|
|
1966
|
+
create: {
|
|
1967
|
+
before(user: {
|
|
1968
|
+
id: string;
|
|
1969
|
+
createdAt: Date;
|
|
1970
|
+
updatedAt: Date;
|
|
1971
|
+
email: string;
|
|
1972
|
+
emailVerified: boolean;
|
|
1973
|
+
name: string;
|
|
1974
|
+
image?: string | null | undefined;
|
|
1975
|
+
} & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<{
|
|
1976
|
+
data: {
|
|
1977
|
+
lastLoginMethod: any;
|
|
1978
|
+
id: string;
|
|
1979
|
+
createdAt: Date;
|
|
1980
|
+
updatedAt: Date;
|
|
1981
|
+
email: string;
|
|
1982
|
+
emailVerified: boolean;
|
|
1983
|
+
name: string;
|
|
1984
|
+
image?: string | null | undefined;
|
|
1985
|
+
};
|
|
1986
|
+
} | undefined>;
|
|
1987
|
+
};
|
|
1988
|
+
};
|
|
1989
|
+
session: {
|
|
1990
|
+
create: {
|
|
1991
|
+
after(session: {
|
|
1992
|
+
id: string;
|
|
1993
|
+
createdAt: Date;
|
|
1994
|
+
updatedAt: Date;
|
|
1995
|
+
userId: string;
|
|
1996
|
+
expiresAt: Date;
|
|
1997
|
+
token: string;
|
|
1998
|
+
ipAddress?: string | null | undefined;
|
|
1999
|
+
userAgent?: string | null | undefined;
|
|
2000
|
+
} & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
2001
|
+
};
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
2006
|
+
hooks: {
|
|
2007
|
+
after: {
|
|
2008
|
+
matcher(): true;
|
|
2009
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<void>;
|
|
2010
|
+
}[];
|
|
2011
|
+
};
|
|
2012
|
+
schema: O["storeInDatabase"] extends true ? {
|
|
2013
|
+
user: {
|
|
2014
|
+
fields: {
|
|
2015
|
+
lastLoginMethod: {
|
|
2016
|
+
type: "string";
|
|
2017
|
+
required: false;
|
|
2018
|
+
input: false;
|
|
2019
|
+
};
|
|
2020
|
+
};
|
|
2021
|
+
};
|
|
2022
|
+
} : undefined;
|
|
2023
|
+
};
|
|
2024
|
+
//#endregion
|
|
2025
|
+
//#region src/plugins/audit-log/events.d.ts
|
|
2026
|
+
/**
|
|
2027
|
+
* Audit event types recorded by the audit log plugin
|
|
2028
|
+
*/
|
|
2029
|
+
declare const AUDIT_EVENT_TYPES: {
|
|
2030
|
+
readonly USER_SIGNED_UP: "user_signed_up";
|
|
2031
|
+
readonly USER_PROFILE_UPDATED: "user_profile_updated";
|
|
2032
|
+
readonly USER_PROFILE_IMAGE_UPDATED: "user_profile_image_updated";
|
|
2033
|
+
readonly USER_EMAIL_VERIFIED: "user_email_verified";
|
|
2034
|
+
readonly USER_BANNED: "user_banned";
|
|
2035
|
+
readonly USER_UNBANNED: "user_unbanned";
|
|
2036
|
+
readonly USER_DELETED: "user_deleted";
|
|
2037
|
+
readonly USER_ROLE_UPDATED: "user_role_updated";
|
|
2038
|
+
readonly USER_EMAIL_CHANGED: "user_email_changed";
|
|
2039
|
+
readonly USER_PHONE_NUMBER_CHANGED: "user_phone_number_changed";
|
|
2040
|
+
readonly USER_SIGNED_IN: "user_signed_in";
|
|
2041
|
+
readonly USER_SIGNED_OUT: "user_signed_out";
|
|
2042
|
+
readonly SESSION_CREATED: "session_created";
|
|
2043
|
+
readonly SESSION_REVOKED: "session_revoked";
|
|
2044
|
+
readonly SESSIONS_REVOKED_ALL: "sessions_revoked_all";
|
|
2045
|
+
readonly USER_IMPERSONATED: "user_impersonated";
|
|
2046
|
+
readonly USER_IMPERSONATION_STOPPED: "user_impersonation_stopped";
|
|
2047
|
+
readonly DEVICE_AUTHORIZATION_APPROVED: "device_authorization_approved";
|
|
2048
|
+
readonly DEVICE_AUTHORIZATION_DENIED: "device_authorization_denied";
|
|
2049
|
+
readonly ACCOUNT_LINKED: "account_linked";
|
|
2050
|
+
readonly ACCOUNT_UNLINKED: "account_unlinked";
|
|
2051
|
+
readonly PASSWORD_CHANGED: "password_changed";
|
|
2052
|
+
readonly TWO_FACTOR_ENABLED: "two_factor_enabled";
|
|
2053
|
+
readonly TWO_FACTOR_DISABLED: "two_factor_disabled";
|
|
2054
|
+
readonly BACKUP_CODES_GENERATED: "two_factor_backup_codes_generated";
|
|
2055
|
+
readonly PASSKEY_ADDED: "passkey_added";
|
|
2056
|
+
readonly PASSKEY_REMOVED: "passkey_removed";
|
|
2057
|
+
readonly API_KEY_CREATED: "api_key_created";
|
|
2058
|
+
readonly API_KEY_UPDATED: "api_key_updated";
|
|
2059
|
+
readonly API_KEY_DELETED: "api_key_deleted";
|
|
2060
|
+
readonly PASSWORD_RESET_REQUESTED: "password_reset_requested";
|
|
2061
|
+
readonly PASSWORD_RESET_COMPLETED: "password_reset_completed";
|
|
2062
|
+
readonly EMAIL_VERIFICATION_SENT: "email_verification_sent";
|
|
2063
|
+
readonly ORGANIZATION_CREATED: "organization_created";
|
|
2064
|
+
readonly ORGANIZATION_UPDATED: "organization_updated";
|
|
2065
|
+
readonly ORGANIZATION_DELETED: "organization_deleted";
|
|
2066
|
+
readonly ORGANIZATION_ROLE_CREATED: "organization_role_created";
|
|
2067
|
+
readonly ORGANIZATION_ROLE_UPDATED: "organization_role_updated";
|
|
2068
|
+
readonly ORGANIZATION_ROLE_DELETED: "organization_role_deleted";
|
|
2069
|
+
readonly MEMBER_ADDED: "member_added";
|
|
2070
|
+
readonly MEMBER_REMOVED: "member_removed";
|
|
2071
|
+
readonly MEMBER_ROLE_UPDATED: "member_role_updated";
|
|
2072
|
+
readonly MEMBER_INVITED: "member_invited";
|
|
2073
|
+
readonly INVITE_ACCEPTED: "invite_accepted";
|
|
2074
|
+
readonly INVITE_REJECTED: "invite_rejected";
|
|
2075
|
+
readonly INVITE_CANCELLED: "invite_cancelled";
|
|
2076
|
+
readonly TEAM_CREATED: "team_created";
|
|
2077
|
+
readonly TEAM_UPDATED: "team_updated";
|
|
2078
|
+
readonly TEAM_DELETED: "team_deleted";
|
|
2079
|
+
readonly TEAM_MEMBER_ADDED: "team_member_added";
|
|
2080
|
+
readonly TEAM_MEMBER_REMOVED: "team_member_removed";
|
|
2081
|
+
readonly USER_SIGN_IN_FAILED: "user_sign_in_failed";
|
|
2082
|
+
readonly VERIFICATION_FAILED: "verification_failed";
|
|
2083
|
+
};
|
|
2084
|
+
/**
|
|
2085
|
+
* Security event types recorded by the sentinel plugin
|
|
2086
|
+
*
|
|
2087
|
+
* Declared here so both plugins share the same event types
|
|
2088
|
+
*/
|
|
2089
|
+
declare const SECURITY_EVENT_TYPES: {
|
|
2090
|
+
readonly BLOCKED: "security_blocked";
|
|
2091
|
+
readonly ALLOWED_AFTER_CHALLENGE: "security_allowed";
|
|
2092
|
+
readonly CREDENTIAL_STUFFING: "security_credential_stuffing";
|
|
2093
|
+
readonly IMPOSSIBLE_TRAVEL: "security_impossible_travel";
|
|
2094
|
+
readonly GEO_BLOCKED: "security_geo_blocked";
|
|
2095
|
+
readonly BOT_BLOCKED: "security_bot_blocked";
|
|
2096
|
+
readonly SUSPICIOUS_IP: "security_suspicious_ip";
|
|
2097
|
+
readonly VELOCITY_EXCEEDED: "security_velocity_exceeded";
|
|
2098
|
+
readonly FREE_TRIAL_ABUSE: "security_free_trial_abuse";
|
|
2099
|
+
readonly COMPROMISED_PASSWORD: "security_compromised_password";
|
|
2100
|
+
readonly STALE_ACCOUNT: "security_stale_account";
|
|
2101
|
+
readonly INVALID_EMAIL: "security_invalid_email";
|
|
2102
|
+
};
|
|
2103
|
+
type AuditEventType = (typeof AUDIT_EVENT_TYPES)[keyof typeof AUDIT_EVENT_TYPES] | (typeof SECURITY_EVENT_TYPES)[keyof typeof SECURITY_EVENT_TYPES];
|
|
2104
|
+
declare const ALL_EVENT_TYPES: AuditEventType[];
|
|
2105
|
+
/** Endpoints that complete a sign-in by creating a session */
|
|
2106
|
+
declare const SIGN_IN_PATHS: string[];
|
|
2107
|
+
/** Sign-in endpoints that check credentials, so a failure is a failed attempt */
|
|
2108
|
+
declare const CREDENTIAL_SIGN_IN_PATHS: string[];
|
|
2109
|
+
/**
|
|
2110
|
+
* Endpoints that check a one-time code or token outside a sign-in, so a
|
|
2111
|
+
* failure is a failed attempt
|
|
2112
|
+
*/
|
|
2113
|
+
declare const VERIFICATION_PATHS: string[];
|
|
2114
|
+
/** Endpoints whose successful response maps to a single event */
|
|
2115
|
+
declare const PATH_EVENTS: Record<string, AuditEventType>;
|
|
2116
|
+
//#endregion
|
|
2117
|
+
//#region src/plugins/audit-log/schema.d.ts
|
|
2118
|
+
declare const schema: {
|
|
2119
|
+
auditLog: {
|
|
2120
|
+
fields: {
|
|
2121
|
+
eventType: {
|
|
2122
|
+
type: "string";
|
|
2123
|
+
required: true;
|
|
2124
|
+
};
|
|
2125
|
+
userId: {
|
|
2126
|
+
type: "string";
|
|
2127
|
+
required: false;
|
|
2128
|
+
};
|
|
2129
|
+
identifier: {
|
|
2130
|
+
type: "string";
|
|
2131
|
+
required: false;
|
|
2132
|
+
};
|
|
2133
|
+
organizationId: {
|
|
2134
|
+
type: "string";
|
|
2135
|
+
required: false;
|
|
2136
|
+
};
|
|
2137
|
+
status: {
|
|
2138
|
+
type: "string";
|
|
2139
|
+
required: true;
|
|
2140
|
+
};
|
|
2141
|
+
path: {
|
|
2142
|
+
type: "string";
|
|
2143
|
+
required: false;
|
|
2144
|
+
};
|
|
2145
|
+
ipAddress: {
|
|
2146
|
+
type: "string";
|
|
2147
|
+
required: false;
|
|
2148
|
+
};
|
|
2149
|
+
userAgent: {
|
|
2150
|
+
type: "string";
|
|
2151
|
+
required: false;
|
|
2152
|
+
};
|
|
2153
|
+
visitorId: {
|
|
2154
|
+
type: "string";
|
|
2155
|
+
required: false;
|
|
2156
|
+
};
|
|
2157
|
+
eventData: {
|
|
2158
|
+
type: "json";
|
|
2159
|
+
required: false;
|
|
2160
|
+
};
|
|
2161
|
+
createdAt: {
|
|
2162
|
+
type: "date";
|
|
2163
|
+
required: true;
|
|
2164
|
+
};
|
|
2165
|
+
};
|
|
2166
|
+
};
|
|
2167
|
+
};
|
|
2168
|
+
//#endregion
|
|
2169
|
+
//#region src/plugins/audit-log/types.d.ts
|
|
2170
|
+
interface AuditEvent {
|
|
2171
|
+
id: string;
|
|
2172
|
+
eventType: AuditEventType;
|
|
2173
|
+
status: "success" | "failure" | "blocked" | "challenged";
|
|
2174
|
+
/**
|
|
2175
|
+
* The user who performed the action
|
|
2176
|
+
*
|
|
2177
|
+
* Null when the actor is unknown, e.g. a failed sign-in
|
|
2178
|
+
*/
|
|
2179
|
+
userId: string | null;
|
|
2180
|
+
/**
|
|
2181
|
+
* The actor's identity, such as an email, username or phone number
|
|
2182
|
+
*/
|
|
2183
|
+
identifier: string | null;
|
|
2184
|
+
organizationId: string | null;
|
|
2185
|
+
/**
|
|
2186
|
+
* The endpoint that triggered the event
|
|
2187
|
+
*/
|
|
2188
|
+
path: string | null;
|
|
2189
|
+
ipAddress: string | null;
|
|
2190
|
+
userAgent: string | null;
|
|
2191
|
+
visitorId: string | null;
|
|
2192
|
+
/**
|
|
2193
|
+
* Additional details about the event
|
|
2194
|
+
*
|
|
2195
|
+
* Never contains passwords, tokens or OTPs
|
|
2196
|
+
*/
|
|
2197
|
+
eventData: Record<string, unknown> | null;
|
|
2198
|
+
createdAt: Date;
|
|
2199
|
+
}
|
|
2200
|
+
interface AuditLogOptions {
|
|
2201
|
+
/**
|
|
2202
|
+
* Send events to the hosted backend
|
|
2203
|
+
*
|
|
2204
|
+
* Enabled when an API key and URL are configured, either here or through
|
|
2205
|
+
* `PAYVO_INFRA_API_KEY` and `PAYVO_INFRA_API_URL`. Set to `false` to
|
|
2206
|
+
* disable it.
|
|
2207
|
+
*/
|
|
2208
|
+
remote?: {
|
|
2209
|
+
/**
|
|
2210
|
+
* The hosted backend API URL
|
|
2211
|
+
*
|
|
2212
|
+
* @default process.env.PAYVO_INFRA_API_URL
|
|
2213
|
+
*/
|
|
2214
|
+
apiUrl?: string | undefined;
|
|
2215
|
+
/**
|
|
2216
|
+
* The hosted backend API key
|
|
2217
|
+
*
|
|
2218
|
+
* @default process.env.PAYVO_INFRA_API_KEY
|
|
2219
|
+
*/
|
|
2220
|
+
apiKey?: string | undefined;
|
|
2221
|
+
/**
|
|
2222
|
+
* Request timeout in milliseconds
|
|
2223
|
+
*
|
|
2224
|
+
* @default 3000
|
|
2225
|
+
*/
|
|
2226
|
+
timeout?: number | undefined;
|
|
2227
|
+
/**
|
|
2228
|
+
* Additional headers sent with every request
|
|
2229
|
+
*/
|
|
2230
|
+
headers?: Record<string, string> | undefined;
|
|
2231
|
+
/**
|
|
2232
|
+
* Configure how events are batched before they are sent
|
|
2233
|
+
*/
|
|
2234
|
+
batch?: {
|
|
2235
|
+
/**
|
|
2236
|
+
* Send buffered events once this many are queued
|
|
2237
|
+
*
|
|
2238
|
+
* @default 25
|
|
2239
|
+
*/
|
|
2240
|
+
maxSize?: number | undefined;
|
|
2241
|
+
/**
|
|
2242
|
+
* Send buffered events after this many milliseconds
|
|
2243
|
+
*
|
|
2244
|
+
* @default 2000
|
|
2245
|
+
*/
|
|
2246
|
+
flushIntervalMs?: number | undefined;
|
|
2247
|
+
} | undefined;
|
|
2248
|
+
} | false | undefined;
|
|
2249
|
+
/**
|
|
2250
|
+
* Write events to the `auditLog` table
|
|
2251
|
+
*
|
|
2252
|
+
* @default true
|
|
2253
|
+
*/
|
|
2254
|
+
database?: boolean | undefined;
|
|
2255
|
+
/**
|
|
2256
|
+
* Called for every recorded event, e.g. to publish it to a message broker
|
|
2257
|
+
*
|
|
2258
|
+
* Errors are logged and ignored
|
|
2259
|
+
*/
|
|
2260
|
+
onEvent?: ((event: AuditEvent) => void | Promise<void>) | undefined;
|
|
2261
|
+
/**
|
|
2262
|
+
* Event types that should not be recorded
|
|
2263
|
+
*/
|
|
2264
|
+
exclude?: AuditEventType[] | undefined;
|
|
2265
|
+
/**
|
|
2266
|
+
* Record `user_sign_in_failed` events for failed sign-in attempts, and
|
|
2267
|
+
* `verification_failed` events for wrong one-time codes and tokens
|
|
2268
|
+
*
|
|
2269
|
+
* @default true
|
|
2270
|
+
*/
|
|
2271
|
+
trackFailedSignIns?: boolean | undefined;
|
|
2272
|
+
/**
|
|
2273
|
+
* Roles allowed to read every audit event through
|
|
2274
|
+
* `/audit-log/get-all-audit-logs`
|
|
2275
|
+
*
|
|
2276
|
+
* @default ["admin"]
|
|
2277
|
+
*/
|
|
2278
|
+
adminRoles?: string[] | undefined;
|
|
2279
|
+
/**
|
|
2280
|
+
* Custom schema for the audit log plugin
|
|
2281
|
+
*/
|
|
2282
|
+
schema?: InferOptionSchema<typeof schema> | undefined;
|
|
2283
|
+
}
|
|
2284
|
+
//#endregion
|
|
2285
|
+
//#region src/plugins/sentinel/schema.d.ts
|
|
2286
|
+
declare const schema$1: {
|
|
2287
|
+
sentinelCounter: {
|
|
2288
|
+
fields: {
|
|
2289
|
+
key: {
|
|
2290
|
+
type: "string";
|
|
2291
|
+
required: true;
|
|
2292
|
+
unique: true;
|
|
2293
|
+
};
|
|
2294
|
+
count: {
|
|
2295
|
+
type: "number";
|
|
2296
|
+
required: true;
|
|
2297
|
+
};
|
|
2298
|
+
expiresAt: {
|
|
2299
|
+
type: "date";
|
|
2300
|
+
required: true;
|
|
2301
|
+
};
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
sentinelSignIn: {
|
|
2305
|
+
fields: {
|
|
2306
|
+
userId: {
|
|
2307
|
+
type: "string";
|
|
2308
|
+
required: true;
|
|
2309
|
+
references: {
|
|
2310
|
+
model: string;
|
|
2311
|
+
field: string;
|
|
2312
|
+
onDelete: "cascade";
|
|
2313
|
+
};
|
|
2314
|
+
};
|
|
2315
|
+
ipAddress: {
|
|
2316
|
+
type: "string";
|
|
2317
|
+
required: false;
|
|
2318
|
+
};
|
|
2319
|
+
visitorId: {
|
|
2320
|
+
type: "string";
|
|
2321
|
+
required: false;
|
|
2322
|
+
};
|
|
2323
|
+
userAgent: {
|
|
2324
|
+
type: "string";
|
|
2325
|
+
required: false;
|
|
2326
|
+
};
|
|
2327
|
+
country: {
|
|
2328
|
+
type: "string";
|
|
2329
|
+
required: false;
|
|
2330
|
+
};
|
|
2331
|
+
city: {
|
|
2332
|
+
type: "string";
|
|
2333
|
+
required: false;
|
|
2334
|
+
};
|
|
2335
|
+
latitude: {
|
|
2336
|
+
type: "number";
|
|
2337
|
+
required: false;
|
|
2338
|
+
};
|
|
2339
|
+
longitude: {
|
|
2340
|
+
type: "number";
|
|
2341
|
+
required: false;
|
|
2342
|
+
};
|
|
2343
|
+
createdAt: {
|
|
2344
|
+
type: "date";
|
|
2345
|
+
required: true;
|
|
2346
|
+
};
|
|
2347
|
+
};
|
|
2348
|
+
};
|
|
2349
|
+
powChallenge: {
|
|
2350
|
+
fields: {
|
|
2351
|
+
nonce: {
|
|
2352
|
+
type: "string";
|
|
2353
|
+
required: true;
|
|
2354
|
+
unique: true;
|
|
2355
|
+
};
|
|
2356
|
+
difficulty: {
|
|
2357
|
+
type: "number";
|
|
2358
|
+
required: true;
|
|
2359
|
+
};
|
|
2360
|
+
reason: {
|
|
2361
|
+
type: "string";
|
|
2362
|
+
required: true;
|
|
2363
|
+
};
|
|
2364
|
+
ipAddress: {
|
|
2365
|
+
type: "string";
|
|
2366
|
+
required: false;
|
|
2367
|
+
};
|
|
2368
|
+
visitorId: {
|
|
2369
|
+
type: "string";
|
|
2370
|
+
required: false;
|
|
2371
|
+
};
|
|
2372
|
+
expiresAt: {
|
|
2373
|
+
type: "date";
|
|
2374
|
+
required: true;
|
|
2375
|
+
};
|
|
2376
|
+
createdAt: {
|
|
2377
|
+
type: "date";
|
|
2378
|
+
required: true;
|
|
2379
|
+
};
|
|
2380
|
+
};
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
//#endregion
|
|
2384
|
+
//#region src/plugins/sentinel/types.d.ts
|
|
2385
|
+
/**
|
|
2386
|
+
* The action to take when a security check fails
|
|
2387
|
+
*
|
|
2388
|
+
* - `log`: record the event and let the request through
|
|
2389
|
+
* - `challenge`: respond with `423` and a proof-of-work challenge
|
|
2390
|
+
* - `block`: respond with `403`
|
|
2391
|
+
*/
|
|
2392
|
+
type SecurityAction = "log" | "challenge" | "block";
|
|
2393
|
+
type GeoLocation = {
|
|
2394
|
+
/**
|
|
2395
|
+
* ISO 3166-1 alpha-2 country code, e.g. "US"
|
|
2396
|
+
*/
|
|
2397
|
+
country: string | null;
|
|
2398
|
+
city?: string | null | undefined;
|
|
2399
|
+
latitude?: number | null | undefined;
|
|
2400
|
+
longitude?: number | null | undefined;
|
|
2401
|
+
};
|
|
2402
|
+
interface SentinelOptions {
|
|
2403
|
+
/**
|
|
2404
|
+
* The hosted backend API URL
|
|
2405
|
+
*
|
|
2406
|
+
* @default process.env.PAYVO_INFRA_API_URL
|
|
2407
|
+
*/
|
|
2408
|
+
apiUrl?: string | undefined;
|
|
2409
|
+
/**
|
|
2410
|
+
* The hosted backend API key
|
|
2411
|
+
*
|
|
2412
|
+
* @default process.env.PAYVO_INFRA_API_KEY
|
|
2413
|
+
*/
|
|
2414
|
+
apiKey?: string | undefined;
|
|
2415
|
+
/**
|
|
2416
|
+
* The hosted identification service URL, used to check that visitor ids
|
|
2417
|
+
* sent by clients are genuine
|
|
2418
|
+
*
|
|
2419
|
+
* @default process.env.PAYVO_INFRA_KV_URL
|
|
2420
|
+
*/
|
|
2421
|
+
kvUrl?: string | undefined;
|
|
2422
|
+
/**
|
|
2423
|
+
* Identification service HTTP options
|
|
2424
|
+
*/
|
|
2425
|
+
kvOptions?: {
|
|
2426
|
+
/**
|
|
2427
|
+
* Request timeout in milliseconds
|
|
2428
|
+
*
|
|
2429
|
+
* @default 1000
|
|
2430
|
+
*/
|
|
2431
|
+
timeout?: number | undefined;
|
|
2432
|
+
/**
|
|
2433
|
+
* Retries after a failed request, with exponential backoff
|
|
2434
|
+
*
|
|
2435
|
+
* @default { attempts: 2, baseDelay: 400, maxDelay: 600 }
|
|
2436
|
+
*/
|
|
2437
|
+
retry?: {
|
|
2438
|
+
attempts?: number | undefined;
|
|
2439
|
+
baseDelay?: number | undefined;
|
|
2440
|
+
maxDelay?: number | undefined;
|
|
2441
|
+
} | undefined;
|
|
2442
|
+
/**
|
|
2443
|
+
* Additional headers sent with every request
|
|
2444
|
+
*/
|
|
2445
|
+
headers?: Record<string, string> | undefined;
|
|
2446
|
+
} | undefined;
|
|
2447
|
+
/**
|
|
2448
|
+
* Hosted backend HTTP options
|
|
2449
|
+
*/
|
|
2450
|
+
apiOptions?: {
|
|
2451
|
+
/**
|
|
2452
|
+
* Request timeout in milliseconds
|
|
2453
|
+
*
|
|
2454
|
+
* @default 3000
|
|
2455
|
+
*/
|
|
2456
|
+
timeout?: number | undefined;
|
|
2457
|
+
/**
|
|
2458
|
+
* Additional headers sent with every request
|
|
2459
|
+
*/
|
|
2460
|
+
headers?: Record<string, string> | undefined;
|
|
2461
|
+
} | undefined;
|
|
2462
|
+
/**
|
|
2463
|
+
* Allow requests through when a check can't complete, e.g. the hosted
|
|
2464
|
+
* backend or secondary storage is unavailable
|
|
2465
|
+
*
|
|
2466
|
+
* @default true
|
|
2467
|
+
*/
|
|
2468
|
+
failOpen?: boolean | undefined;
|
|
2469
|
+
/**
|
|
2470
|
+
* Local providers that replace the hosted backend
|
|
2471
|
+
*/
|
|
2472
|
+
providers?: {
|
|
2473
|
+
/**
|
|
2474
|
+
* Resolve the client IP of a request
|
|
2475
|
+
*
|
|
2476
|
+
* By default the IP is read from the configured IP address headers
|
|
2477
|
+
*/
|
|
2478
|
+
getClientIp?: ((request: Request | Headers) => string | null) | undefined;
|
|
2479
|
+
/**
|
|
2480
|
+
* Whether an IP address is known to be malicious
|
|
2481
|
+
*/
|
|
2482
|
+
isSuspiciousIp?: ((ip: string) => boolean | Promise<boolean>) | undefined;
|
|
2483
|
+
/**
|
|
2484
|
+
* Whether a request comes from an automated client
|
|
2485
|
+
*/
|
|
2486
|
+
isBot?: ((request: Request) => boolean | Promise<boolean>) | undefined;
|
|
2487
|
+
/**
|
|
2488
|
+
* Resolve the location of an IP address
|
|
2489
|
+
*/
|
|
2490
|
+
resolveGeo?: ((ip: string) => GeoLocation | null | Promise<GeoLocation | null>) | undefined;
|
|
2491
|
+
} | undefined;
|
|
2492
|
+
/**
|
|
2493
|
+
* Send a security notification, e.g. by email. Required for
|
|
2494
|
+
* `unknownDeviceNotification` and the stale account notifications.
|
|
2495
|
+
*/
|
|
2496
|
+
sendNotification?: ((notification: {
|
|
2497
|
+
type: "unknown-device" | "stale-account";
|
|
2498
|
+
/**
|
|
2499
|
+
* Who the notification is for
|
|
2500
|
+
*/
|
|
2501
|
+
recipient: "user" | "admin";
|
|
2502
|
+
/**
|
|
2503
|
+
* The address to send the notification to
|
|
2504
|
+
*/
|
|
2505
|
+
email: string;
|
|
2506
|
+
user: User$1;
|
|
2507
|
+
signIn: {
|
|
2508
|
+
at: Date;
|
|
2509
|
+
ipAddress: string | null;
|
|
2510
|
+
userAgent: string | null;
|
|
2511
|
+
/**
|
|
2512
|
+
* City and country, when known, e.g. "Berlin, DE"
|
|
2513
|
+
*/
|
|
2514
|
+
location: string | null;
|
|
2515
|
+
};
|
|
2516
|
+
/**
|
|
2517
|
+
* Days since the account was last active, for stale accounts
|
|
2518
|
+
*/
|
|
2519
|
+
daysInactive?: number | undefined;
|
|
2520
|
+
}) => void | Promise<void>) | undefined;
|
|
2521
|
+
security?: {
|
|
2522
|
+
/**
|
|
2523
|
+
* Detect credential stuffing by tracking failed sign-in attempts per
|
|
2524
|
+
* visitor, falling back to the IP address
|
|
2525
|
+
*/
|
|
2526
|
+
credentialStuffing?: {
|
|
2527
|
+
enabled: boolean;
|
|
2528
|
+
/**
|
|
2529
|
+
* Set to `log` to only record attempts. Otherwise the thresholds
|
|
2530
|
+
* decide between a challenge and a block.
|
|
2531
|
+
*
|
|
2532
|
+
* @default "challenge"
|
|
2533
|
+
*/
|
|
2534
|
+
action?: SecurityAction | undefined;
|
|
2535
|
+
/**
|
|
2536
|
+
* Number of failed attempts before a challenge or a block
|
|
2537
|
+
*
|
|
2538
|
+
* @default { challenge: 3, block: 5 }
|
|
2539
|
+
*/
|
|
2540
|
+
thresholds?: {
|
|
2541
|
+
challenge: number;
|
|
2542
|
+
block: number;
|
|
2543
|
+
} | undefined;
|
|
2544
|
+
/**
|
|
2545
|
+
* Window in seconds in which failed attempts are counted
|
|
2546
|
+
*
|
|
2547
|
+
* @default 3600
|
|
2548
|
+
*/
|
|
2549
|
+
windowSeconds?: number | undefined;
|
|
2550
|
+
/**
|
|
2551
|
+
* Seconds a visitor stays blocked after reaching the block
|
|
2552
|
+
* threshold
|
|
2553
|
+
*
|
|
2554
|
+
* @default 900
|
|
2555
|
+
*/
|
|
2556
|
+
cooldownSeconds?: number | undefined;
|
|
2557
|
+
} | undefined;
|
|
2558
|
+
/**
|
|
2559
|
+
* Limit how often authentication operations can be performed
|
|
2560
|
+
*/
|
|
2561
|
+
velocity?: {
|
|
2562
|
+
enabled: boolean;
|
|
2563
|
+
/**
|
|
2564
|
+
* Number of authentication requests per visitor in the window
|
|
2565
|
+
* before a challenge or a block
|
|
2566
|
+
*
|
|
2567
|
+
* @default { challenge: 10, block: 20 }
|
|
2568
|
+
*/
|
|
2569
|
+
thresholds?: {
|
|
2570
|
+
challenge: number;
|
|
2571
|
+
block: number;
|
|
2572
|
+
} | undefined;
|
|
2573
|
+
/**
|
|
2574
|
+
* Maximum sign-ups per visitor in the window
|
|
2575
|
+
*
|
|
2576
|
+
* @default 5
|
|
2577
|
+
*/
|
|
2578
|
+
maxSignupsPerVisitor?: number | undefined;
|
|
2579
|
+
/**
|
|
2580
|
+
* Maximum password reset requests per IP address in the window
|
|
2581
|
+
*
|
|
2582
|
+
* @default 10
|
|
2583
|
+
*/
|
|
2584
|
+
maxPasswordResetsPerIp?: number | undefined;
|
|
2585
|
+
/**
|
|
2586
|
+
* Maximum sign-in attempts per IP address in the window
|
|
2587
|
+
*
|
|
2588
|
+
* @default 50
|
|
2589
|
+
*/
|
|
2590
|
+
maxSignInsPerIp?: number | undefined;
|
|
2591
|
+
/**
|
|
2592
|
+
* Window in seconds
|
|
2593
|
+
*
|
|
2594
|
+
* @default 3600
|
|
2595
|
+
*/
|
|
2596
|
+
windowSeconds?: number | undefined;
|
|
2597
|
+
/**
|
|
2598
|
+
* Action when a `max*` limit is exceeded
|
|
2599
|
+
*
|
|
2600
|
+
* @default "challenge"
|
|
2601
|
+
*/
|
|
2602
|
+
action?: SecurityAction | undefined;
|
|
2603
|
+
} | undefined;
|
|
2604
|
+
/**
|
|
2605
|
+
* Limit how many accounts a visitor can create
|
|
2606
|
+
*/
|
|
2607
|
+
freeTrialAbuse?: {
|
|
2608
|
+
enabled: boolean;
|
|
2609
|
+
/**
|
|
2610
|
+
* Number of accounts a visitor already created before a
|
|
2611
|
+
* challenge or a block. Takes precedence over
|
|
2612
|
+
* `maxAccountsPerVisitor`.
|
|
2613
|
+
*/
|
|
2614
|
+
thresholds?: {
|
|
2615
|
+
challenge: number;
|
|
2616
|
+
block: number;
|
|
2617
|
+
} | undefined;
|
|
2618
|
+
/**
|
|
2619
|
+
* Maximum accounts per visitor
|
|
2620
|
+
*
|
|
2621
|
+
* @default 3
|
|
2622
|
+
*/
|
|
2623
|
+
maxAccountsPerVisitor?: number | undefined;
|
|
2624
|
+
/**
|
|
2625
|
+
* How long sign-ups are remembered per visitor, in seconds.
|
|
2626
|
+
* Clamped to between 1 and 365 days.
|
|
2627
|
+
*
|
|
2628
|
+
* @default 7776000 (90 days)
|
|
2629
|
+
*/
|
|
2630
|
+
retentionSeconds?: number | undefined;
|
|
2631
|
+
/**
|
|
2632
|
+
* Action when `maxAccountsPerVisitor` is reached
|
|
2633
|
+
*
|
|
2634
|
+
* @default "block"
|
|
2635
|
+
*/
|
|
2636
|
+
action?: SecurityAction | undefined;
|
|
2637
|
+
} | undefined;
|
|
2638
|
+
/**
|
|
2639
|
+
* Detect automated clients. `true` challenges them.
|
|
2640
|
+
*/
|
|
2641
|
+
botBlocking?: (boolean | {
|
|
2642
|
+
action: SecurityAction;
|
|
2643
|
+
}) | undefined;
|
|
2644
|
+
/**
|
|
2645
|
+
* Detect requests from IP addresses known to be malicious. `true`
|
|
2646
|
+
* blocks them.
|
|
2647
|
+
*/
|
|
2648
|
+
suspiciousIpBlocking?: (boolean | {
|
|
2649
|
+
action: SecurityAction;
|
|
2650
|
+
}) | undefined;
|
|
2651
|
+
/**
|
|
2652
|
+
* Proof-of-work difficulty, in leading zero bits of the solution hash
|
|
2653
|
+
*
|
|
2654
|
+
* @default 18
|
|
2655
|
+
*/
|
|
2656
|
+
/**
|
|
2657
|
+
* Notify users when they sign in from a device they haven't used
|
|
2658
|
+
* before, identified by the visitor id
|
|
2659
|
+
*
|
|
2660
|
+
* @default false
|
|
2661
|
+
*/
|
|
2662
|
+
unknownDeviceNotification?: boolean | undefined;
|
|
2663
|
+
/**
|
|
2664
|
+
* Detect sign-ins from locations too far apart to travel between in
|
|
2665
|
+
* the time since the previous sign-in. Checked once the credentials
|
|
2666
|
+
* are verified; a challenge blocks sign-ins that can't be repeated,
|
|
2667
|
+
* like magic links and one-time codes.
|
|
2668
|
+
*/
|
|
2669
|
+
impossibleTravel?: {
|
|
2670
|
+
enabled: boolean;
|
|
2671
|
+
/**
|
|
2672
|
+
* Fastest realistic travel speed, in km/h
|
|
2673
|
+
*
|
|
2674
|
+
* @default 1000
|
|
2675
|
+
*/
|
|
2676
|
+
maxSpeedKmh?: number | undefined;
|
|
2677
|
+
/**
|
|
2678
|
+
* @default "challenge"
|
|
2679
|
+
*/
|
|
2680
|
+
action?: SecurityAction | undefined;
|
|
2681
|
+
} | undefined;
|
|
2682
|
+
/**
|
|
2683
|
+
* Challenge or block requests by country. Use either `allowList`
|
|
2684
|
+
* or `denyList`.
|
|
2685
|
+
*/
|
|
2686
|
+
geoBlocking?: {
|
|
2687
|
+
/**
|
|
2688
|
+
* Only allow these countries (ISO 3166-1 alpha-2)
|
|
2689
|
+
*/
|
|
2690
|
+
allowList?: string[] | undefined;
|
|
2691
|
+
/**
|
|
2692
|
+
* Block these countries (ISO 3166-1 alpha-2)
|
|
2693
|
+
*/
|
|
2694
|
+
denyList?: string[] | undefined;
|
|
2695
|
+
/**
|
|
2696
|
+
* @default "block"
|
|
2697
|
+
*/
|
|
2698
|
+
action?: Exclude<SecurityAction, "log"> | undefined;
|
|
2699
|
+
} | undefined;
|
|
2700
|
+
/**
|
|
2701
|
+
* Check new passwords against known breaches. Only the first 5
|
|
2702
|
+
* characters of the password's SHA-1 hash are sent.
|
|
2703
|
+
*/
|
|
2704
|
+
compromisedPassword?: {
|
|
2705
|
+
enabled: boolean;
|
|
2706
|
+
/**
|
|
2707
|
+
* @default "block"
|
|
2708
|
+
*/
|
|
2709
|
+
action?: SecurityAction | undefined;
|
|
2710
|
+
/**
|
|
2711
|
+
* Minimum number of breaches a password must appear in
|
|
2712
|
+
*
|
|
2713
|
+
* @default 1
|
|
2714
|
+
*/
|
|
2715
|
+
minBreachCount?: number | undefined;
|
|
2716
|
+
} | undefined;
|
|
2717
|
+
/**
|
|
2718
|
+
* Reject disposable email addresses and invalid email domains on
|
|
2719
|
+
* sign-up and email changes
|
|
2720
|
+
*/
|
|
2721
|
+
emailValidation?: {
|
|
2722
|
+
enabled: boolean;
|
|
2723
|
+
/**
|
|
2724
|
+
* - `low`: block known disposable domains
|
|
2725
|
+
* - `medium`: also require MX records
|
|
2726
|
+
* - `high`: also reject addresses that look generated
|
|
2727
|
+
*
|
|
2728
|
+
* @default "medium"
|
|
2729
|
+
*/
|
|
2730
|
+
strictness?: ("low" | "medium" | "high") | undefined;
|
|
2731
|
+
/**
|
|
2732
|
+
* @default "block"
|
|
2733
|
+
*/
|
|
2734
|
+
action?: SecurityAction | undefined;
|
|
2735
|
+
/**
|
|
2736
|
+
* Domains that skip every check (exact match)
|
|
2737
|
+
*/
|
|
2738
|
+
domainAllowlist?: string[] | undefined;
|
|
2739
|
+
} | undefined;
|
|
2740
|
+
/**
|
|
2741
|
+
* Match aliases of the same mailbox, e.g. `j.doe+news@gmail.com` and
|
|
2742
|
+
* `jdoe@gmail.com`. Addresses are kept as typed; an alias of an
|
|
2743
|
+
* existing account signs in to it and can't be used for a new one.
|
|
2744
|
+
* Adds a `normalizedEmail` field to users, set for existing users on
|
|
2745
|
+
* their next sign-in.
|
|
2746
|
+
*/
|
|
2747
|
+
emailNormalization?: {
|
|
2748
|
+
/**
|
|
2749
|
+
* @default false
|
|
2750
|
+
*/
|
|
2751
|
+
enabled?: boolean | undefined;
|
|
2752
|
+
} | undefined;
|
|
2753
|
+
/**
|
|
2754
|
+
* Detect sign-ins to accounts that haven't been used for a long time.
|
|
2755
|
+
* Checked once the credentials are verified. Accounts are tracked
|
|
2756
|
+
* from their first sign-in after sentinel is enabled.
|
|
2757
|
+
*/
|
|
2758
|
+
staleUsers?: {
|
|
2759
|
+
enabled: boolean;
|
|
2760
|
+
/**
|
|
2761
|
+
* Days of inactivity after which an account is stale
|
|
2762
|
+
*
|
|
2763
|
+
* @default 90
|
|
2764
|
+
*/
|
|
2765
|
+
staleDays?: number | undefined;
|
|
2766
|
+
/**
|
|
2767
|
+
* @default "log"
|
|
2768
|
+
*/
|
|
2769
|
+
action?: SecurityAction | undefined;
|
|
2770
|
+
/**
|
|
2771
|
+
* Notify the user through `sendNotification`
|
|
2772
|
+
*
|
|
2773
|
+
* @default false
|
|
2774
|
+
*/
|
|
2775
|
+
notifyUser?: boolean | undefined;
|
|
2776
|
+
/**
|
|
2777
|
+
* Notify `adminEmail` through `sendNotification`
|
|
2778
|
+
*
|
|
2779
|
+
* @default false
|
|
2780
|
+
*/
|
|
2781
|
+
notifyAdmin?: boolean | undefined;
|
|
2782
|
+
/**
|
|
2783
|
+
* Required when `notifyAdmin` is true
|
|
2784
|
+
*/
|
|
2785
|
+
adminEmail?: string | undefined;
|
|
2786
|
+
} | undefined;
|
|
2787
|
+
challengeDifficulty?: number | undefined;
|
|
2788
|
+
} | undefined;
|
|
2789
|
+
/**
|
|
2790
|
+
* Custom schema for the sentinel plugin
|
|
2791
|
+
*/
|
|
2792
|
+
schema?: InferOptionSchema<typeof schema$1> | undefined;
|
|
2793
|
+
}
|
|
2794
|
+
//#endregion
|
|
2795
|
+
//#region src/plugins/sentinel/actions.d.ts
|
|
2796
|
+
declare const SENTINEL_ERROR_CODES: {
|
|
2797
|
+
readonly POW_CHALLENGE_REQUIRED: "Challenge required";
|
|
2798
|
+
readonly SECURITY_BLOCKED: "Request blocked for security reasons";
|
|
2799
|
+
};
|
|
2800
|
+
//#endregion
|
|
2801
|
+
//#region src/plugins/sentinel/email.d.ts
|
|
2802
|
+
/**
|
|
2803
|
+
* Normalizes an email address so aliases of the same mailbox match:
|
|
2804
|
+
* lowercases it, maps `googlemail.com` to `gmail.com`, removes dots in Gmail
|
|
2805
|
+
* addresses and strips plus-address tags on providers that support them
|
|
2806
|
+
*/
|
|
2807
|
+
declare function normalizeEmail(email: string): string;
|
|
2808
|
+
//#endregion
|
|
2809
|
+
//#region src/plugins/sentinel/geo.d.ts
|
|
2810
|
+
/** Great-circle distance between two coordinates, in kilometres */
|
|
2811
|
+
declare function haversineDistanceKm(from: {
|
|
2812
|
+
latitude: number;
|
|
2813
|
+
longitude: number;
|
|
2814
|
+
}, to: {
|
|
2815
|
+
latitude: number;
|
|
2816
|
+
longitude: number;
|
|
2817
|
+
}): number;
|
|
2818
|
+
//#endregion
|
|
2819
|
+
//#region src/plugins/sentinel/pow.d.ts
|
|
2820
|
+
declare const POW_CHALLENGE_HEADER = "x-pow-challenge";
|
|
2821
|
+
declare const POW_REASON_HEADER = "x-pow-reason";
|
|
2822
|
+
declare const POW_SOLUTION_HEADER = "x-pow-solution";
|
|
2823
|
+
declare function createNonce(): string;
|
|
2824
|
+
/** Whether a hash starts with at least `difficulty` zero bits */
|
|
2825
|
+
declare function hasLeadingZeroBits(hash: Uint8Array, difficulty: number): boolean;
|
|
2826
|
+
/**
|
|
2827
|
+
* Whether `sha256("<nonce>:<solution>")` has at least `difficulty` leading
|
|
2828
|
+
* zero bits
|
|
2829
|
+
*/
|
|
2830
|
+
declare function verifySolution(nonce: string, solution: string, difficulty: number): Promise<boolean>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Find a solution for a challenge by trying incrementing counters. Yields to
|
|
2833
|
+
* the event loop between batches, so solving doesn't block the page.
|
|
2834
|
+
*/
|
|
2835
|
+
declare function solveChallenge(nonce: string, difficulty: number): Promise<string>;
|
|
2836
|
+
/** Parses `<nonce>:<value>` header values */
|
|
2837
|
+
declare function parsePowHeader(value: string | null | undefined): {
|
|
2838
|
+
nonce: string;
|
|
2839
|
+
value: string;
|
|
2840
|
+
} | null;
|
|
2841
|
+
//#endregion
|
|
2842
|
+
//#region src/plugins/sentinel/index.d.ts
|
|
2843
|
+
declare const sentinel: (options?: SentinelOptions | undefined) => {
|
|
2844
|
+
id: "sentinel";
|
|
2845
|
+
init(ctx: AuthContext<_gatwech_core61.PayvoAuthOptions>): {
|
|
2846
|
+
options: {
|
|
2847
|
+
databaseHooks: {
|
|
2848
|
+
user: {
|
|
2849
|
+
create: {
|
|
2850
|
+
before(user: {
|
|
2851
|
+
id: string;
|
|
2852
|
+
createdAt: Date;
|
|
2853
|
+
updatedAt: Date;
|
|
2854
|
+
email: string;
|
|
2855
|
+
emailVerified: boolean;
|
|
2856
|
+
name: string;
|
|
2857
|
+
image?: string | null | undefined;
|
|
2858
|
+
} & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<{
|
|
2859
|
+
data: {
|
|
2860
|
+
normalizedEmail: string;
|
|
2861
|
+
id: string;
|
|
2862
|
+
createdAt: Date;
|
|
2863
|
+
updatedAt: Date;
|
|
2864
|
+
email: string;
|
|
2865
|
+
emailVerified: boolean;
|
|
2866
|
+
name: string;
|
|
2867
|
+
image?: string | null | undefined;
|
|
2868
|
+
};
|
|
2869
|
+
} | undefined>;
|
|
2870
|
+
after(user: {
|
|
2871
|
+
id: string;
|
|
2872
|
+
createdAt: Date;
|
|
2873
|
+
updatedAt: Date;
|
|
2874
|
+
email: string;
|
|
2875
|
+
emailVerified: boolean;
|
|
2876
|
+
name: string;
|
|
2877
|
+
image?: string | null | undefined;
|
|
2878
|
+
} & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
2879
|
+
};
|
|
2880
|
+
update: {
|
|
2881
|
+
before(data: Partial<{
|
|
2882
|
+
id: string;
|
|
2883
|
+
createdAt: Date;
|
|
2884
|
+
updatedAt: Date;
|
|
2885
|
+
email: string;
|
|
2886
|
+
emailVerified: boolean;
|
|
2887
|
+
name: string;
|
|
2888
|
+
image?: string | null | undefined;
|
|
2889
|
+
}> & Record<string, unknown>): Promise<{
|
|
2890
|
+
data: {
|
|
2891
|
+
normalizedEmail: string;
|
|
2892
|
+
id?: string | undefined;
|
|
2893
|
+
createdAt?: Date | undefined;
|
|
2894
|
+
updatedAt?: Date | undefined;
|
|
2895
|
+
email?: string | undefined;
|
|
2896
|
+
emailVerified?: boolean | undefined;
|
|
2897
|
+
name?: string | undefined;
|
|
2898
|
+
image?: string | null | undefined;
|
|
2899
|
+
};
|
|
2900
|
+
} | undefined>;
|
|
2901
|
+
};
|
|
2902
|
+
};
|
|
2903
|
+
};
|
|
2904
|
+
};
|
|
2905
|
+
} | undefined;
|
|
2906
|
+
onRequest(request: Request, ctx: AuthContext<_gatwech_core61.PayvoAuthOptions>): Promise<{
|
|
2907
|
+
response: Response;
|
|
2908
|
+
} | undefined>;
|
|
2909
|
+
hooks: {
|
|
2910
|
+
before: ({
|
|
2911
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
2912
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
2913
|
+
context: {
|
|
2914
|
+
body: any;
|
|
2915
|
+
};
|
|
2916
|
+
} | undefined>;
|
|
2917
|
+
} | {
|
|
2918
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
2919
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<void>;
|
|
2920
|
+
})[];
|
|
2921
|
+
after: ({
|
|
2922
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
2923
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<void>;
|
|
2924
|
+
} | {
|
|
2925
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
2926
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<({
|
|
2927
|
+
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_call636.Status;
|
|
2928
|
+
body: ({
|
|
2929
|
+
message?: string;
|
|
2930
|
+
code?: string;
|
|
2931
|
+
cause?: unknown;
|
|
2932
|
+
} & Record<string, any>) | undefined;
|
|
2933
|
+
headers: HeadersInit;
|
|
2934
|
+
statusCode: number;
|
|
2935
|
+
name: string;
|
|
2936
|
+
message: string;
|
|
2937
|
+
stack?: string;
|
|
2938
|
+
cause?: unknown;
|
|
2939
|
+
} & {
|
|
2940
|
+
errorStack: string | undefined;
|
|
2941
|
+
}) | undefined>;
|
|
2942
|
+
})[];
|
|
2943
|
+
};
|
|
2944
|
+
schema: {
|
|
2945
|
+
sentinelCounter: {
|
|
2946
|
+
fields: {
|
|
2947
|
+
key: {
|
|
2948
|
+
type: "string";
|
|
2949
|
+
required: true;
|
|
2950
|
+
unique: true;
|
|
2951
|
+
};
|
|
2952
|
+
count: {
|
|
2953
|
+
type: "number";
|
|
2954
|
+
required: true;
|
|
2955
|
+
};
|
|
2956
|
+
expiresAt: {
|
|
2957
|
+
type: "date";
|
|
2958
|
+
required: true;
|
|
2959
|
+
};
|
|
2960
|
+
};
|
|
2961
|
+
};
|
|
2962
|
+
sentinelSignIn: {
|
|
2963
|
+
fields: {
|
|
2964
|
+
userId: {
|
|
2965
|
+
type: "string";
|
|
2966
|
+
required: true;
|
|
2967
|
+
references: {
|
|
2968
|
+
model: string;
|
|
2969
|
+
field: string;
|
|
2970
|
+
onDelete: "cascade";
|
|
2971
|
+
};
|
|
2972
|
+
};
|
|
2973
|
+
ipAddress: {
|
|
2974
|
+
type: "string";
|
|
2975
|
+
required: false;
|
|
2976
|
+
};
|
|
2977
|
+
visitorId: {
|
|
2978
|
+
type: "string";
|
|
2979
|
+
required: false;
|
|
2980
|
+
};
|
|
2981
|
+
userAgent: {
|
|
2982
|
+
type: "string";
|
|
2983
|
+
required: false;
|
|
2984
|
+
};
|
|
2985
|
+
country: {
|
|
2986
|
+
type: "string";
|
|
2987
|
+
required: false;
|
|
2988
|
+
};
|
|
2989
|
+
city: {
|
|
2990
|
+
type: "string";
|
|
2991
|
+
required: false;
|
|
2992
|
+
};
|
|
2993
|
+
latitude: {
|
|
2994
|
+
type: "number";
|
|
2995
|
+
required: false;
|
|
2996
|
+
};
|
|
2997
|
+
longitude: {
|
|
2998
|
+
type: "number";
|
|
2999
|
+
required: false;
|
|
3000
|
+
};
|
|
3001
|
+
createdAt: {
|
|
3002
|
+
type: "date";
|
|
3003
|
+
required: true;
|
|
3004
|
+
};
|
|
3005
|
+
};
|
|
3006
|
+
};
|
|
3007
|
+
powChallenge: {
|
|
3008
|
+
fields: {
|
|
3009
|
+
nonce: {
|
|
3010
|
+
type: "string";
|
|
3011
|
+
required: true;
|
|
3012
|
+
unique: true;
|
|
3013
|
+
};
|
|
3014
|
+
difficulty: {
|
|
3015
|
+
type: "number";
|
|
3016
|
+
required: true;
|
|
3017
|
+
};
|
|
3018
|
+
reason: {
|
|
3019
|
+
type: "string";
|
|
3020
|
+
required: true;
|
|
3021
|
+
};
|
|
3022
|
+
ipAddress: {
|
|
3023
|
+
type: "string";
|
|
3024
|
+
required: false;
|
|
3025
|
+
};
|
|
3026
|
+
visitorId: {
|
|
3027
|
+
type: "string";
|
|
3028
|
+
required: false;
|
|
3029
|
+
};
|
|
3030
|
+
expiresAt: {
|
|
3031
|
+
type: "date";
|
|
3032
|
+
required: true;
|
|
3033
|
+
};
|
|
3034
|
+
createdAt: {
|
|
3035
|
+
type: "date";
|
|
3036
|
+
required: true;
|
|
3037
|
+
};
|
|
3038
|
+
};
|
|
3039
|
+
};
|
|
3040
|
+
};
|
|
3041
|
+
$ERROR_CODES: {
|
|
3042
|
+
readonly POW_CHALLENGE_REQUIRED: "Challenge required";
|
|
3043
|
+
readonly SECURITY_BLOCKED: "Request blocked for security reasons";
|
|
3044
|
+
};
|
|
3045
|
+
options: {
|
|
3046
|
+
failOpen: boolean;
|
|
3047
|
+
apiUrl?: string | undefined;
|
|
3048
|
+
apiKey?: string | undefined;
|
|
3049
|
+
kvUrl?: string | undefined;
|
|
3050
|
+
kvOptions?: {
|
|
3051
|
+
timeout?: number | undefined;
|
|
3052
|
+
retry?: {
|
|
3053
|
+
attempts?: number | undefined;
|
|
3054
|
+
baseDelay?: number | undefined;
|
|
3055
|
+
maxDelay?: number | undefined;
|
|
3056
|
+
} | undefined;
|
|
3057
|
+
headers?: Record<string, string> | undefined;
|
|
3058
|
+
} | undefined;
|
|
3059
|
+
apiOptions?: {
|
|
3060
|
+
timeout?: number | undefined;
|
|
3061
|
+
headers?: Record<string, string> | undefined;
|
|
3062
|
+
} | undefined;
|
|
3063
|
+
providers?: {
|
|
3064
|
+
getClientIp?: ((request: Request | Headers) => string | null) | undefined;
|
|
3065
|
+
isSuspiciousIp?: ((ip: string) => boolean | Promise<boolean>) | undefined;
|
|
3066
|
+
isBot?: ((request: Request) => boolean | Promise<boolean>) | undefined;
|
|
3067
|
+
resolveGeo?: ((ip: string) => GeoLocation | null | Promise<GeoLocation | null>) | undefined;
|
|
3068
|
+
} | undefined;
|
|
3069
|
+
sendNotification?: ((notification: {
|
|
3070
|
+
type: "unknown-device" | "stale-account";
|
|
3071
|
+
recipient: "user" | "admin";
|
|
3072
|
+
email: string;
|
|
3073
|
+
user: User$1;
|
|
3074
|
+
signIn: {
|
|
3075
|
+
at: Date;
|
|
3076
|
+
ipAddress: string | null;
|
|
3077
|
+
userAgent: string | null;
|
|
3078
|
+
location: string | null;
|
|
3079
|
+
};
|
|
3080
|
+
daysInactive?: number | undefined;
|
|
3081
|
+
}) => void | Promise<void>) | undefined;
|
|
3082
|
+
security?: {
|
|
3083
|
+
credentialStuffing?: {
|
|
3084
|
+
enabled: boolean;
|
|
3085
|
+
action?: SecurityAction | undefined;
|
|
3086
|
+
thresholds?: {
|
|
3087
|
+
challenge: number;
|
|
3088
|
+
block: number;
|
|
3089
|
+
} | undefined;
|
|
3090
|
+
windowSeconds?: number | undefined;
|
|
3091
|
+
cooldownSeconds?: number | undefined;
|
|
3092
|
+
} | undefined;
|
|
3093
|
+
velocity?: {
|
|
3094
|
+
enabled: boolean;
|
|
3095
|
+
thresholds?: {
|
|
3096
|
+
challenge: number;
|
|
3097
|
+
block: number;
|
|
3098
|
+
} | undefined;
|
|
3099
|
+
maxSignupsPerVisitor?: number | undefined;
|
|
3100
|
+
maxPasswordResetsPerIp?: number | undefined;
|
|
3101
|
+
maxSignInsPerIp?: number | undefined;
|
|
3102
|
+
windowSeconds?: number | undefined;
|
|
3103
|
+
action?: SecurityAction | undefined;
|
|
3104
|
+
} | undefined;
|
|
3105
|
+
freeTrialAbuse?: {
|
|
3106
|
+
enabled: boolean;
|
|
3107
|
+
thresholds?: {
|
|
3108
|
+
challenge: number;
|
|
3109
|
+
block: number;
|
|
3110
|
+
} | undefined;
|
|
3111
|
+
maxAccountsPerVisitor?: number | undefined;
|
|
3112
|
+
retentionSeconds?: number | undefined;
|
|
3113
|
+
action?: SecurityAction | undefined;
|
|
3114
|
+
} | undefined;
|
|
3115
|
+
botBlocking?: (boolean | {
|
|
3116
|
+
action: SecurityAction;
|
|
3117
|
+
}) | undefined;
|
|
3118
|
+
suspiciousIpBlocking?: (boolean | {
|
|
3119
|
+
action: SecurityAction;
|
|
3120
|
+
}) | undefined;
|
|
3121
|
+
unknownDeviceNotification?: boolean | undefined;
|
|
3122
|
+
impossibleTravel?: {
|
|
3123
|
+
enabled: boolean;
|
|
3124
|
+
maxSpeedKmh?: number | undefined;
|
|
3125
|
+
action?: SecurityAction | undefined;
|
|
3126
|
+
} | undefined;
|
|
3127
|
+
geoBlocking?: {
|
|
3128
|
+
allowList?: string[] | undefined;
|
|
3129
|
+
denyList?: string[] | undefined;
|
|
3130
|
+
action?: Exclude<SecurityAction, "log"> | undefined;
|
|
3131
|
+
} | undefined;
|
|
3132
|
+
compromisedPassword?: {
|
|
3133
|
+
enabled: boolean;
|
|
3134
|
+
action?: SecurityAction | undefined;
|
|
3135
|
+
minBreachCount?: number | undefined;
|
|
3136
|
+
} | undefined;
|
|
3137
|
+
emailValidation?: {
|
|
3138
|
+
enabled: boolean;
|
|
3139
|
+
strictness?: ("low" | "medium" | "high") | undefined;
|
|
3140
|
+
action?: SecurityAction | undefined;
|
|
3141
|
+
domainAllowlist?: string[] | undefined;
|
|
3142
|
+
} | undefined;
|
|
3143
|
+
emailNormalization?: {
|
|
3144
|
+
enabled?: boolean | undefined;
|
|
3145
|
+
} | undefined;
|
|
3146
|
+
staleUsers?: {
|
|
3147
|
+
enabled: boolean;
|
|
3148
|
+
staleDays?: number | undefined;
|
|
3149
|
+
action?: SecurityAction | undefined;
|
|
3150
|
+
notifyUser?: boolean | undefined;
|
|
3151
|
+
notifyAdmin?: boolean | undefined;
|
|
3152
|
+
adminEmail?: string | undefined;
|
|
3153
|
+
} | undefined;
|
|
3154
|
+
challengeDifficulty?: number | undefined;
|
|
3155
|
+
} | undefined;
|
|
3156
|
+
schema?: InferOptionSchema<typeof schema$1> | undefined;
|
|
3157
|
+
};
|
|
3158
|
+
};
|
|
3159
|
+
//#endregion
|
|
3160
|
+
//#region src/plugins/audit-log/index.d.ts
|
|
3161
|
+
declare const AUDIT_LOG_ERROR_CODES: {
|
|
3162
|
+
readonly AUDIT_LOG_ACCESS_DENIED: "You don't have access to these audit logs";
|
|
3163
|
+
readonly AUDIT_LOG_UNAVAILABLE: "Audit logs are temporarily unavailable";
|
|
3164
|
+
};
|
|
3165
|
+
declare const auditLog: (options?: AuditLogOptions | undefined) => {
|
|
3166
|
+
id: "audit-log";
|
|
3167
|
+
init(ctx: AuthContext<_gatwech_core61.PayvoAuthOptions>): {
|
|
3168
|
+
options: {
|
|
3169
|
+
databaseHooks: {
|
|
3170
|
+
user: {
|
|
3171
|
+
create: {
|
|
3172
|
+
after(user: {
|
|
3173
|
+
id: string;
|
|
3174
|
+
createdAt: Date;
|
|
3175
|
+
updatedAt: Date;
|
|
3176
|
+
email: string;
|
|
3177
|
+
emailVerified: boolean;
|
|
3178
|
+
name: string;
|
|
3179
|
+
image?: string | null | undefined;
|
|
3180
|
+
} & Record<string, unknown>, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
3181
|
+
};
|
|
3182
|
+
update: {
|
|
3183
|
+
before(data: Partial<{
|
|
3184
|
+
id: string;
|
|
3185
|
+
createdAt: Date;
|
|
3186
|
+
updatedAt: Date;
|
|
3187
|
+
email: string;
|
|
3188
|
+
emailVerified: boolean;
|
|
3189
|
+
name: string;
|
|
3190
|
+
image?: string | null | undefined;
|
|
3191
|
+
}> & Record<string, unknown>, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<{
|
|
3192
|
+
data: Partial<{
|
|
3193
|
+
id: string;
|
|
3194
|
+
createdAt: Date;
|
|
3195
|
+
updatedAt: Date;
|
|
3196
|
+
email: string;
|
|
3197
|
+
emailVerified: boolean;
|
|
3198
|
+
name: string;
|
|
3199
|
+
image?: string | null | undefined;
|
|
3200
|
+
}> & Record<string, unknown>;
|
|
3201
|
+
}>;
|
|
3202
|
+
after(user: {
|
|
3203
|
+
id: string;
|
|
3204
|
+
createdAt: Date;
|
|
3205
|
+
updatedAt: Date;
|
|
3206
|
+
email: string;
|
|
3207
|
+
emailVerified: boolean;
|
|
3208
|
+
name: string;
|
|
3209
|
+
image?: string | null | undefined;
|
|
3210
|
+
} & Record<string, unknown>, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
3211
|
+
};
|
|
3212
|
+
delete: {
|
|
3213
|
+
after(user: {
|
|
3214
|
+
id: string;
|
|
3215
|
+
createdAt: Date;
|
|
3216
|
+
updatedAt: Date;
|
|
3217
|
+
email: string;
|
|
3218
|
+
emailVerified: boolean;
|
|
3219
|
+
name: string;
|
|
3220
|
+
image?: string | null | undefined;
|
|
3221
|
+
} & Record<string, unknown>, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
3222
|
+
};
|
|
3223
|
+
};
|
|
3224
|
+
session: {
|
|
3225
|
+
create: {
|
|
3226
|
+
after(session: {
|
|
3227
|
+
id: string;
|
|
3228
|
+
createdAt: Date;
|
|
3229
|
+
updatedAt: Date;
|
|
3230
|
+
userId: string;
|
|
3231
|
+
expiresAt: Date;
|
|
3232
|
+
token: string;
|
|
3233
|
+
ipAddress?: string | null | undefined;
|
|
3234
|
+
userAgent?: string | null | undefined;
|
|
3235
|
+
} & Record<string, unknown>, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
3236
|
+
};
|
|
3237
|
+
};
|
|
3238
|
+
account: {
|
|
3239
|
+
create: {
|
|
3240
|
+
after(account: {
|
|
3241
|
+
id: string;
|
|
3242
|
+
createdAt: Date;
|
|
3243
|
+
updatedAt: Date;
|
|
3244
|
+
providerId: string;
|
|
3245
|
+
accountId: string;
|
|
3246
|
+
userId: string;
|
|
3247
|
+
accessToken?: string | null | undefined;
|
|
3248
|
+
refreshToken?: string | null | undefined;
|
|
3249
|
+
idToken?: string | null | undefined;
|
|
3250
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
3251
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
3252
|
+
scope?: string | null | undefined;
|
|
3253
|
+
password?: string | null | undefined;
|
|
3254
|
+
}, context: _gatwech_core61.GenericEndpointContext<_gatwech_core61.PayvoAuthOptions> | undefined): Promise<void>;
|
|
3255
|
+
};
|
|
3256
|
+
};
|
|
3257
|
+
};
|
|
3258
|
+
};
|
|
3259
|
+
};
|
|
3260
|
+
hooks: {
|
|
3261
|
+
before: {
|
|
3262
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
3263
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<void>;
|
|
3264
|
+
}[];
|
|
3265
|
+
after: {
|
|
3266
|
+
matcher(context: _gatwech_core61.HookEndpointContext): boolean;
|
|
3267
|
+
handler: (inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<void>;
|
|
3268
|
+
}[];
|
|
3269
|
+
};
|
|
3270
|
+
endpoints: {
|
|
3271
|
+
getAuditLogs: {
|
|
3272
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
3273
|
+
body?: undefined;
|
|
3274
|
+
} & {
|
|
3275
|
+
method?: "GET" | undefined;
|
|
3276
|
+
} & {
|
|
3277
|
+
query?: {
|
|
3278
|
+
limit?: string | number | undefined;
|
|
3279
|
+
offset?: string | number | undefined;
|
|
3280
|
+
eventType?: string | undefined;
|
|
3281
|
+
identifier?: string | undefined;
|
|
3282
|
+
organizationId?: string | undefined;
|
|
3283
|
+
userId?: string | undefined;
|
|
3284
|
+
startDate?: string | undefined;
|
|
3285
|
+
endDate?: string | undefined;
|
|
3286
|
+
} | undefined;
|
|
3287
|
+
} & {
|
|
3288
|
+
params?: Record<string, any>;
|
|
3289
|
+
} & {
|
|
3290
|
+
request?: Request;
|
|
3291
|
+
} & {
|
|
3292
|
+
headers?: HeadersInit;
|
|
3293
|
+
} & {
|
|
3294
|
+
asResponse?: boolean;
|
|
3295
|
+
returnHeaders?: boolean;
|
|
3296
|
+
use?: better_call636.Middleware[];
|
|
3297
|
+
path?: string;
|
|
3298
|
+
} & {
|
|
3299
|
+
asResponse?: AsResponse | undefined;
|
|
3300
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
3301
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
3302
|
+
headers: Headers;
|
|
3303
|
+
response: {
|
|
3304
|
+
events: AuditEvent[];
|
|
3305
|
+
total: number;
|
|
3306
|
+
limit: number;
|
|
3307
|
+
offset: number;
|
|
3308
|
+
};
|
|
3309
|
+
} : {
|
|
3310
|
+
events: AuditEvent[];
|
|
3311
|
+
total: number;
|
|
3312
|
+
limit: number;
|
|
3313
|
+
offset: number;
|
|
3314
|
+
}>;
|
|
3315
|
+
options: {
|
|
3316
|
+
method: "GET";
|
|
3317
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
3318
|
+
session: {
|
|
3319
|
+
session: Record<string, any> & {
|
|
3320
|
+
id: string;
|
|
3321
|
+
createdAt: Date;
|
|
3322
|
+
updatedAt: Date;
|
|
3323
|
+
userId: string;
|
|
3324
|
+
expiresAt: Date;
|
|
3325
|
+
token: string;
|
|
3326
|
+
ipAddress?: string | null | undefined;
|
|
3327
|
+
userAgent?: string | null | undefined;
|
|
3328
|
+
};
|
|
3329
|
+
user: Record<string, any> & {
|
|
3330
|
+
id: string;
|
|
3331
|
+
createdAt: Date;
|
|
3332
|
+
updatedAt: Date;
|
|
3333
|
+
email: string;
|
|
3334
|
+
emailVerified: boolean;
|
|
3335
|
+
name: string;
|
|
3336
|
+
image?: string | null | undefined;
|
|
3337
|
+
};
|
|
3338
|
+
};
|
|
3339
|
+
}>)[];
|
|
3340
|
+
query: zod1419.ZodOptional<zod1419.ZodObject<{
|
|
3341
|
+
limit: zod1419.ZodOptional<zod1419.ZodUnion<[zod1419.ZodString, zod1419.ZodNumber]>>;
|
|
3342
|
+
offset: zod1419.ZodOptional<zod1419.ZodUnion<[zod1419.ZodString, zod1419.ZodNumber]>>;
|
|
3343
|
+
eventType: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3344
|
+
identifier: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3345
|
+
organizationId: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3346
|
+
userId: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3347
|
+
startDate: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3348
|
+
endDate: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3349
|
+
}, zod1419.core.$strip>>;
|
|
3350
|
+
metadata: {
|
|
3351
|
+
openapi: {
|
|
3352
|
+
operationId: string;
|
|
3353
|
+
summary: string;
|
|
3354
|
+
description: string;
|
|
3355
|
+
responses: {
|
|
3356
|
+
200: {
|
|
3357
|
+
description: string;
|
|
3358
|
+
content: {
|
|
3359
|
+
"application/json": {
|
|
3360
|
+
schema: {
|
|
3361
|
+
type: "object";
|
|
3362
|
+
properties: {
|
|
3363
|
+
events: {
|
|
3364
|
+
type: string;
|
|
3365
|
+
items: {
|
|
3366
|
+
type: string;
|
|
3367
|
+
properties: {
|
|
3368
|
+
id: {
|
|
3369
|
+
type: string;
|
|
3370
|
+
};
|
|
3371
|
+
eventType: {
|
|
3372
|
+
type: string;
|
|
3373
|
+
};
|
|
3374
|
+
status: {
|
|
3375
|
+
type: string;
|
|
3376
|
+
};
|
|
3377
|
+
userId: {
|
|
3378
|
+
type: string;
|
|
3379
|
+
nullable: boolean;
|
|
3380
|
+
};
|
|
3381
|
+
identifier: {
|
|
3382
|
+
type: string;
|
|
3383
|
+
nullable: boolean;
|
|
3384
|
+
};
|
|
3385
|
+
organizationId: {
|
|
3386
|
+
type: string;
|
|
3387
|
+
nullable: boolean;
|
|
3388
|
+
};
|
|
3389
|
+
path: {
|
|
3390
|
+
type: string;
|
|
3391
|
+
nullable: boolean;
|
|
3392
|
+
};
|
|
3393
|
+
ipAddress: {
|
|
3394
|
+
type: string;
|
|
3395
|
+
nullable: boolean;
|
|
3396
|
+
};
|
|
3397
|
+
userAgent: {
|
|
3398
|
+
type: string;
|
|
3399
|
+
nullable: boolean;
|
|
3400
|
+
};
|
|
3401
|
+
visitorId: {
|
|
3402
|
+
type: string;
|
|
3403
|
+
nullable: boolean;
|
|
3404
|
+
};
|
|
3405
|
+
eventData: {
|
|
3406
|
+
type: string;
|
|
3407
|
+
nullable: boolean;
|
|
3408
|
+
};
|
|
3409
|
+
createdAt: {
|
|
3410
|
+
type: string;
|
|
3411
|
+
format: string;
|
|
3412
|
+
};
|
|
3413
|
+
};
|
|
3414
|
+
};
|
|
3415
|
+
};
|
|
3416
|
+
total: {
|
|
3417
|
+
type: string;
|
|
3418
|
+
};
|
|
3419
|
+
limit: {
|
|
3420
|
+
type: string;
|
|
3421
|
+
};
|
|
3422
|
+
offset: {
|
|
3423
|
+
type: string;
|
|
3424
|
+
};
|
|
3425
|
+
};
|
|
3426
|
+
required: string[];
|
|
3427
|
+
};
|
|
3428
|
+
};
|
|
3429
|
+
};
|
|
3430
|
+
};
|
|
3431
|
+
};
|
|
3432
|
+
};
|
|
3433
|
+
};
|
|
3434
|
+
} & {
|
|
3435
|
+
use: any[];
|
|
3436
|
+
};
|
|
3437
|
+
path: "/audit-log/get-audit-logs";
|
|
3438
|
+
};
|
|
3439
|
+
getAllAuditLogs: {
|
|
3440
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
3441
|
+
body?: undefined;
|
|
3442
|
+
} & {
|
|
3443
|
+
method?: "GET" | undefined;
|
|
3444
|
+
} & {
|
|
3445
|
+
query?: {
|
|
3446
|
+
limit?: string | number | undefined;
|
|
3447
|
+
offset?: string | number | undefined;
|
|
3448
|
+
eventType?: string | undefined;
|
|
3449
|
+
identifier?: string | undefined;
|
|
3450
|
+
organizationId?: string | undefined;
|
|
3451
|
+
userId?: string | undefined;
|
|
3452
|
+
startDate?: string | undefined;
|
|
3453
|
+
endDate?: string | undefined;
|
|
3454
|
+
} | undefined;
|
|
3455
|
+
} & {
|
|
3456
|
+
params?: Record<string, any>;
|
|
3457
|
+
} & {
|
|
3458
|
+
request?: Request;
|
|
3459
|
+
} & {
|
|
3460
|
+
headers?: HeadersInit;
|
|
3461
|
+
} & {
|
|
3462
|
+
asResponse?: boolean;
|
|
3463
|
+
returnHeaders?: boolean;
|
|
3464
|
+
use?: better_call636.Middleware[];
|
|
3465
|
+
path?: string;
|
|
3466
|
+
} & {
|
|
3467
|
+
asResponse?: AsResponse | undefined;
|
|
3468
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
3469
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
3470
|
+
headers: Headers;
|
|
3471
|
+
response: {
|
|
3472
|
+
events: AuditEvent[];
|
|
3473
|
+
total: number;
|
|
3474
|
+
limit: number;
|
|
3475
|
+
offset: number;
|
|
3476
|
+
};
|
|
3477
|
+
} : {
|
|
3478
|
+
events: AuditEvent[];
|
|
3479
|
+
total: number;
|
|
3480
|
+
limit: number;
|
|
3481
|
+
offset: number;
|
|
3482
|
+
}>;
|
|
3483
|
+
options: {
|
|
3484
|
+
method: "GET";
|
|
3485
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
3486
|
+
session: {
|
|
3487
|
+
session: Record<string, any> & {
|
|
3488
|
+
id: string;
|
|
3489
|
+
createdAt: Date;
|
|
3490
|
+
updatedAt: Date;
|
|
3491
|
+
userId: string;
|
|
3492
|
+
expiresAt: Date;
|
|
3493
|
+
token: string;
|
|
3494
|
+
ipAddress?: string | null | undefined;
|
|
3495
|
+
userAgent?: string | null | undefined;
|
|
3496
|
+
};
|
|
3497
|
+
user: Record<string, any> & {
|
|
3498
|
+
id: string;
|
|
3499
|
+
createdAt: Date;
|
|
3500
|
+
updatedAt: Date;
|
|
3501
|
+
email: string;
|
|
3502
|
+
emailVerified: boolean;
|
|
3503
|
+
name: string;
|
|
3504
|
+
image?: string | null | undefined;
|
|
3505
|
+
};
|
|
3506
|
+
};
|
|
3507
|
+
}>)[];
|
|
3508
|
+
query: zod1419.ZodOptional<zod1419.ZodObject<{
|
|
3509
|
+
limit: zod1419.ZodOptional<zod1419.ZodUnion<[zod1419.ZodString, zod1419.ZodNumber]>>;
|
|
3510
|
+
offset: zod1419.ZodOptional<zod1419.ZodUnion<[zod1419.ZodString, zod1419.ZodNumber]>>;
|
|
3511
|
+
eventType: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3512
|
+
identifier: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3513
|
+
organizationId: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3514
|
+
userId: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3515
|
+
startDate: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3516
|
+
endDate: zod1419.ZodOptional<zod1419.ZodString>;
|
|
3517
|
+
}, zod1419.core.$strip>>;
|
|
3518
|
+
metadata: {
|
|
3519
|
+
openapi: {
|
|
3520
|
+
operationId: string;
|
|
3521
|
+
summary: string;
|
|
3522
|
+
description: string;
|
|
3523
|
+
responses: {
|
|
3524
|
+
200: {
|
|
3525
|
+
description: string;
|
|
3526
|
+
content: {
|
|
3527
|
+
"application/json": {
|
|
3528
|
+
schema: {
|
|
3529
|
+
type: "object";
|
|
3530
|
+
properties: {
|
|
3531
|
+
events: {
|
|
3532
|
+
type: string;
|
|
3533
|
+
items: {
|
|
3534
|
+
type: string;
|
|
3535
|
+
properties: {
|
|
3536
|
+
id: {
|
|
3537
|
+
type: string;
|
|
3538
|
+
};
|
|
3539
|
+
eventType: {
|
|
3540
|
+
type: string;
|
|
3541
|
+
};
|
|
3542
|
+
status: {
|
|
3543
|
+
type: string;
|
|
3544
|
+
};
|
|
3545
|
+
userId: {
|
|
3546
|
+
type: string;
|
|
3547
|
+
nullable: boolean;
|
|
3548
|
+
};
|
|
3549
|
+
identifier: {
|
|
3550
|
+
type: string;
|
|
3551
|
+
nullable: boolean;
|
|
3552
|
+
};
|
|
3553
|
+
organizationId: {
|
|
3554
|
+
type: string;
|
|
3555
|
+
nullable: boolean;
|
|
3556
|
+
};
|
|
3557
|
+
path: {
|
|
3558
|
+
type: string;
|
|
3559
|
+
nullable: boolean;
|
|
3560
|
+
};
|
|
3561
|
+
ipAddress: {
|
|
3562
|
+
type: string;
|
|
3563
|
+
nullable: boolean;
|
|
3564
|
+
};
|
|
3565
|
+
userAgent: {
|
|
3566
|
+
type: string;
|
|
3567
|
+
nullable: boolean;
|
|
3568
|
+
};
|
|
3569
|
+
visitorId: {
|
|
3570
|
+
type: string;
|
|
3571
|
+
nullable: boolean;
|
|
3572
|
+
};
|
|
3573
|
+
eventData: {
|
|
3574
|
+
type: string;
|
|
3575
|
+
nullable: boolean;
|
|
3576
|
+
};
|
|
3577
|
+
createdAt: {
|
|
3578
|
+
type: string;
|
|
3579
|
+
format: string;
|
|
3580
|
+
};
|
|
3581
|
+
};
|
|
3582
|
+
};
|
|
3583
|
+
};
|
|
3584
|
+
total: {
|
|
3585
|
+
type: string;
|
|
3586
|
+
};
|
|
3587
|
+
limit: {
|
|
3588
|
+
type: string;
|
|
3589
|
+
};
|
|
3590
|
+
offset: {
|
|
3591
|
+
type: string;
|
|
3592
|
+
};
|
|
3593
|
+
};
|
|
3594
|
+
required: string[];
|
|
3595
|
+
};
|
|
3596
|
+
};
|
|
3597
|
+
};
|
|
3598
|
+
};
|
|
3599
|
+
};
|
|
3600
|
+
};
|
|
3601
|
+
};
|
|
3602
|
+
} & {
|
|
3603
|
+
use: any[];
|
|
3604
|
+
};
|
|
3605
|
+
path: "/audit-log/get-all-audit-logs";
|
|
3606
|
+
};
|
|
3607
|
+
getEventTypes: {
|
|
3608
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
3609
|
+
body?: undefined;
|
|
3610
|
+
} & {
|
|
3611
|
+
method?: "GET" | undefined;
|
|
3612
|
+
} & {
|
|
3613
|
+
query?: Record<string, any> | undefined;
|
|
3614
|
+
} & {
|
|
3615
|
+
params?: Record<string, any>;
|
|
3616
|
+
} & {
|
|
3617
|
+
request?: Request;
|
|
3618
|
+
} & {
|
|
3619
|
+
headers?: HeadersInit;
|
|
3620
|
+
} & {
|
|
3621
|
+
asResponse?: boolean;
|
|
3622
|
+
returnHeaders?: boolean;
|
|
3623
|
+
use?: better_call636.Middleware[];
|
|
3624
|
+
path?: string;
|
|
3625
|
+
} & {
|
|
3626
|
+
asResponse?: AsResponse | undefined;
|
|
3627
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
3628
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
3629
|
+
headers: Headers;
|
|
3630
|
+
response: {
|
|
3631
|
+
types: AuditEventType[];
|
|
3632
|
+
};
|
|
3633
|
+
} : {
|
|
3634
|
+
types: AuditEventType[];
|
|
3635
|
+
}>;
|
|
3636
|
+
options: {
|
|
3637
|
+
method: "GET";
|
|
3638
|
+
use: ((inputContext: better_call636.MiddlewareInputContext<better_call636.MiddlewareOptions>) => Promise<{
|
|
3639
|
+
session: {
|
|
3640
|
+
session: Record<string, any> & {
|
|
3641
|
+
id: string;
|
|
3642
|
+
createdAt: Date;
|
|
3643
|
+
updatedAt: Date;
|
|
3644
|
+
userId: string;
|
|
3645
|
+
expiresAt: Date;
|
|
3646
|
+
token: string;
|
|
3647
|
+
ipAddress?: string | null | undefined;
|
|
3648
|
+
userAgent?: string | null | undefined;
|
|
3649
|
+
};
|
|
3650
|
+
user: Record<string, any> & {
|
|
3651
|
+
id: string;
|
|
3652
|
+
createdAt: Date;
|
|
3653
|
+
updatedAt: Date;
|
|
3654
|
+
email: string;
|
|
3655
|
+
emailVerified: boolean;
|
|
3656
|
+
name: string;
|
|
3657
|
+
image?: string | null | undefined;
|
|
3658
|
+
};
|
|
3659
|
+
};
|
|
3660
|
+
}>)[];
|
|
3661
|
+
metadata: {
|
|
3662
|
+
openapi: {
|
|
3663
|
+
operationId: string;
|
|
3664
|
+
summary: string;
|
|
3665
|
+
description: string;
|
|
3666
|
+
responses: {
|
|
3667
|
+
200: {
|
|
3668
|
+
description: string;
|
|
3669
|
+
content: {
|
|
3670
|
+
"application/json": {
|
|
3671
|
+
schema: {
|
|
3672
|
+
type: "object";
|
|
3673
|
+
properties: {
|
|
3674
|
+
types: {
|
|
3675
|
+
type: string;
|
|
3676
|
+
items: {
|
|
3677
|
+
type: string;
|
|
3678
|
+
};
|
|
3679
|
+
};
|
|
3680
|
+
};
|
|
3681
|
+
required: string[];
|
|
3682
|
+
};
|
|
3683
|
+
};
|
|
3684
|
+
};
|
|
3685
|
+
};
|
|
3686
|
+
};
|
|
3687
|
+
};
|
|
3688
|
+
};
|
|
3689
|
+
} & {
|
|
3690
|
+
use: any[];
|
|
3691
|
+
};
|
|
3692
|
+
path: "/audit-log/get-event-types";
|
|
3693
|
+
};
|
|
3694
|
+
};
|
|
3695
|
+
schema: {
|
|
3696
|
+
auditLog: {
|
|
3697
|
+
fields: {
|
|
3698
|
+
eventType: {
|
|
3699
|
+
type: "string";
|
|
3700
|
+
required: true;
|
|
3701
|
+
};
|
|
3702
|
+
userId: {
|
|
3703
|
+
type: "string";
|
|
3704
|
+
required: false;
|
|
3705
|
+
};
|
|
3706
|
+
identifier: {
|
|
3707
|
+
type: "string";
|
|
3708
|
+
required: false;
|
|
3709
|
+
};
|
|
3710
|
+
organizationId: {
|
|
3711
|
+
type: "string";
|
|
3712
|
+
required: false;
|
|
3713
|
+
};
|
|
3714
|
+
status: {
|
|
3715
|
+
type: "string";
|
|
3716
|
+
required: true;
|
|
3717
|
+
};
|
|
3718
|
+
path: {
|
|
3719
|
+
type: "string";
|
|
3720
|
+
required: false;
|
|
3721
|
+
};
|
|
3722
|
+
ipAddress: {
|
|
3723
|
+
type: "string";
|
|
3724
|
+
required: false;
|
|
3725
|
+
};
|
|
3726
|
+
userAgent: {
|
|
3727
|
+
type: "string";
|
|
3728
|
+
required: false;
|
|
3729
|
+
};
|
|
3730
|
+
visitorId: {
|
|
3731
|
+
type: "string";
|
|
3732
|
+
required: false;
|
|
3733
|
+
};
|
|
3734
|
+
eventData: {
|
|
3735
|
+
type: "json";
|
|
3736
|
+
required: false;
|
|
3737
|
+
};
|
|
3738
|
+
createdAt: {
|
|
3739
|
+
type: "date";
|
|
3740
|
+
required: true;
|
|
3741
|
+
};
|
|
3742
|
+
};
|
|
3743
|
+
};
|
|
3744
|
+
};
|
|
3745
|
+
$ERROR_CODES: {
|
|
3746
|
+
readonly AUDIT_LOG_ACCESS_DENIED: "You don't have access to these audit logs";
|
|
3747
|
+
readonly AUDIT_LOG_UNAVAILABLE: "Audit logs are temporarily unavailable";
|
|
3748
|
+
};
|
|
3749
|
+
options: {
|
|
3750
|
+
database: boolean;
|
|
3751
|
+
trackFailedSignIns: boolean;
|
|
3752
|
+
adminRoles: string[];
|
|
3753
|
+
remote?: {
|
|
3754
|
+
apiUrl?: string | undefined;
|
|
3755
|
+
apiKey?: string | undefined;
|
|
3756
|
+
timeout?: number | undefined;
|
|
3757
|
+
headers?: Record<string, string> | undefined;
|
|
3758
|
+
batch?: {
|
|
3759
|
+
maxSize?: number | undefined;
|
|
3760
|
+
flushIntervalMs?: number | undefined;
|
|
3761
|
+
} | undefined;
|
|
3762
|
+
} | false | undefined;
|
|
3763
|
+
onEvent?: ((event: AuditEvent) => void | Promise<void>) | undefined;
|
|
3764
|
+
exclude?: AuditEventType[] | undefined;
|
|
3765
|
+
schema?: InferOptionSchema<typeof schema> | undefined;
|
|
3766
|
+
};
|
|
3767
|
+
};
|
|
3768
|
+
//#endregion
|
|
3769
|
+
export { SECURITY_EVENT_TYPES as A, AuditEvent as C, AuditEventType as D, AUDIT_EVENT_TYPES as E, API_KEY_TABLE_NAME as F, ERROR_CODES as I, apiKey as L, VERIFICATION_PATHS as M, LastLoginMethodOptions as N, CREDENTIAL_SIGN_IN_PATHS as O, lastLoginMethod as P, defaultKeyHasher as R, SentinelOptions as S, ALL_EVENT_TYPES as T, haversineDistanceKm as _, createAuthEndpoint$1 as a, GeoLocation as b, sentinel as c, POW_SOLUTION_HEADER as d, createNonce as f, verifySolution as g, solveChallenge as h, AuthMiddleware as i, SIGN_IN_PATHS as j, PATH_EVENTS as k, POW_CHALLENGE_HEADER as l, parsePowHeader as m, auditLog as n, createAuthMiddleware$1 as o, hasLeadingZeroBits as p, AuthEndpoint as r, optionsMiddleware as s, AUDIT_LOG_ERROR_CODES as t, POW_REASON_HEADER as u, normalizeEmail as v, AuditLogOptions as w, SecurityAction as x, SENTINEL_ERROR_CODES as y };
|