better-auth 1.2.6-beta.7 → 1.2.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/drizzle-adapter/index.cjs +186 -249
- package/dist/adapters/drizzle-adapter/index.d.cts +11 -49
- package/dist/adapters/drizzle-adapter/index.d.mts +11 -49
- package/dist/adapters/drizzle-adapter/index.d.ts +11 -49
- package/dist/adapters/drizzle-adapter/index.mjs +186 -249
- package/dist/adapters/index.cjs +26 -0
- package/dist/adapters/index.d.cts +17 -0
- package/dist/adapters/index.d.mts +17 -0
- package/dist/adapters/index.d.ts +17 -0
- package/dist/adapters/index.mjs +20 -0
- package/dist/adapters/kysely-adapter/index.cjs +7 -7
- package/dist/adapters/kysely-adapter/index.d.cts +17 -49
- package/dist/adapters/kysely-adapter/index.d.mts +17 -49
- package/dist/adapters/kysely-adapter/index.d.ts +17 -49
- package/dist/adapters/kysely-adapter/index.mjs +8 -8
- package/dist/adapters/memory-adapter/index.cjs +7 -8
- package/dist/adapters/memory-adapter/index.d.cts +9 -49
- package/dist/adapters/memory-adapter/index.d.mts +9 -49
- package/dist/adapters/memory-adapter/index.d.ts +9 -49
- package/dist/adapters/memory-adapter/index.mjs +8 -9
- package/dist/adapters/mongodb-adapter/index.cjs +2 -2
- package/dist/adapters/mongodb-adapter/index.d.cts +4 -4
- package/dist/adapters/mongodb-adapter/index.d.mts +4 -4
- package/dist/adapters/mongodb-adapter/index.d.ts +4 -4
- package/dist/adapters/mongodb-adapter/index.mjs +3 -3
- package/dist/adapters/prisma-adapter/index.cjs +130 -203
- package/dist/adapters/prisma-adapter/index.d.cts +17 -49
- package/dist/adapters/prisma-adapter/index.d.mts +17 -49
- package/dist/adapters/prisma-adapter/index.d.ts +17 -49
- package/dist/adapters/prisma-adapter/index.mjs +131 -204
- package/dist/adapters/test.cjs +710 -377
- package/dist/adapters/test.d.cts +64 -5
- package/dist/adapters/test.d.mts +64 -5
- package/dist/adapters/test.d.ts +64 -5
- package/dist/adapters/test.mjs +712 -380
- package/dist/api/index.cjs +61 -25
- package/dist/api/index.d.cts +3 -3
- package/dist/api/index.d.mts +3 -3
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.mjs +63 -27
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/plugins/index.cjs +13 -15
- package/dist/client/plugins/index.d.cts +80 -19
- package/dist/client/plugins/index.d.mts +80 -19
- package/dist/client/plugins/index.d.ts +80 -19
- package/dist/client/plugins/index.mjs +13 -16
- package/dist/client/react/index.cjs +4 -4
- package/dist/client/react/index.d.cts +3 -3
- package/dist/client/react/index.d.mts +3 -3
- package/dist/client/react/index.d.ts +3 -3
- package/dist/client/solid/index.d.cts +3 -3
- package/dist/client/solid/index.d.mts +3 -3
- package/dist/client/solid/index.d.ts +3 -3
- package/dist/client/svelte/index.d.cts +3 -3
- package/dist/client/svelte/index.d.mts +3 -3
- package/dist/client/svelte/index.d.ts +3 -3
- package/dist/client/vue/index.d.cts +3 -3
- package/dist/client/vue/index.d.mts +3 -3
- package/dist/client/vue/index.d.ts +3 -3
- package/dist/cookies/index.cjs +13 -2
- package/dist/cookies/index.d.cts +3 -3
- package/dist/cookies/index.d.mts +3 -3
- package/dist/cookies/index.d.ts +3 -3
- package/dist/cookies/index.mjs +13 -2
- package/dist/db/index.cjs +6 -5
- package/dist/db/index.d.cts +4 -4
- package/dist/db/index.d.mts +4 -4
- package/dist/db/index.d.ts +4 -4
- package/dist/db/index.mjs +7 -6
- package/dist/index.cjs +11 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +14 -10
- package/dist/integrations/next-js.cjs +4 -5
- package/dist/integrations/next-js.d.cts +3 -3
- package/dist/integrations/next-js.d.mts +3 -3
- package/dist/integrations/next-js.d.ts +3 -3
- package/dist/integrations/next-js.mjs +5 -6
- package/dist/integrations/node.d.cts +3 -3
- package/dist/integrations/node.d.mts +3 -3
- package/dist/integrations/node.d.ts +3 -3
- package/dist/integrations/react-start.cjs +5 -6
- package/dist/integrations/react-start.d.cts +3 -3
- package/dist/integrations/react-start.d.mts +3 -3
- package/dist/integrations/react-start.d.ts +3 -3
- package/dist/integrations/react-start.mjs +6 -7
- package/dist/integrations/svelte-kit.d.cts +3 -3
- package/dist/integrations/svelte-kit.d.mts +3 -3
- package/dist/integrations/svelte-kit.d.ts +3 -3
- package/dist/oauth2/index.d.cts +5 -5
- package/dist/oauth2/index.d.mts +5 -5
- package/dist/oauth2/index.d.ts +5 -5
- package/dist/plugins/access/index.d.cts +1 -1
- package/dist/plugins/access/index.d.mts +1 -1
- package/dist/plugins/access/index.d.ts +1 -1
- package/dist/plugins/admin/access/index.d.cts +1 -1
- package/dist/plugins/admin/access/index.d.mts +1 -1
- package/dist/plugins/admin/access/index.d.ts +1 -1
- package/dist/plugins/admin/index.cjs +4 -4
- package/dist/plugins/admin/index.d.cts +74 -14
- package/dist/plugins/admin/index.d.mts +74 -14
- package/dist/plugins/admin/index.d.ts +74 -14
- package/dist/plugins/admin/index.mjs +5 -5
- package/dist/plugins/anonymous/index.cjs +4 -5
- package/dist/plugins/anonymous/index.d.cts +3 -3
- package/dist/plugins/anonymous/index.d.mts +3 -3
- package/dist/plugins/anonymous/index.d.ts +3 -3
- package/dist/plugins/anonymous/index.mjs +5 -6
- package/dist/plugins/bearer/index.cjs +2 -2
- package/dist/plugins/bearer/index.d.cts +3 -3
- package/dist/plugins/bearer/index.d.mts +3 -3
- package/dist/plugins/bearer/index.d.ts +3 -3
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.cjs +110 -45
- package/dist/plugins/captcha/index.d.cts +26 -6
- package/dist/plugins/captcha/index.d.mts +26 -6
- package/dist/plugins/captcha/index.d.ts +26 -6
- package/dist/plugins/captcha/index.mjs +110 -45
- package/dist/plugins/custom-session/index.cjs +24 -5
- package/dist/plugins/custom-session/index.d.cts +25 -6
- package/dist/plugins/custom-session/index.d.mts +25 -6
- package/dist/plugins/custom-session/index.d.ts +25 -6
- package/dist/plugins/custom-session/index.mjs +25 -6
- package/dist/plugins/email-otp/index.cjs +96 -30
- package/dist/plugins/email-otp/index.d.cts +33 -10
- package/dist/plugins/email-otp/index.d.mts +33 -10
- package/dist/plugins/email-otp/index.d.ts +33 -10
- package/dist/plugins/email-otp/index.mjs +97 -31
- package/dist/plugins/generic-oauth/index.cjs +81 -20
- package/dist/plugins/generic-oauth/index.d.cts +46 -3
- package/dist/plugins/generic-oauth/index.d.mts +46 -3
- package/dist/plugins/generic-oauth/index.d.ts +46 -3
- package/dist/plugins/generic-oauth/index.mjs +82 -21
- package/dist/plugins/haveibeenpwned/index.cjs +98 -0
- package/dist/plugins/haveibeenpwned/index.d.cts +36 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +36 -0
- package/dist/plugins/haveibeenpwned/index.d.ts +36 -0
- package/dist/plugins/haveibeenpwned/index.mjs +96 -0
- package/dist/plugins/index.cjs +583 -19
- package/dist/plugins/index.d.cts +7 -5
- package/dist/plugins/index.d.mts +7 -5
- package/dist/plugins/index.d.ts +7 -5
- package/dist/plugins/index.mjs +583 -21
- package/dist/plugins/jwt/index.cjs +45 -21
- package/dist/plugins/jwt/index.d.cts +52 -6
- package/dist/plugins/jwt/index.d.mts +52 -6
- package/dist/plugins/jwt/index.d.ts +52 -6
- package/dist/plugins/jwt/index.mjs +46 -22
- package/dist/plugins/magic-link/index.cjs +3 -3
- package/dist/plugins/magic-link/index.mjs +4 -4
- package/dist/plugins/multi-session/index.cjs +3 -3
- package/dist/plugins/multi-session/index.d.cts +3 -3
- package/dist/plugins/multi-session/index.d.mts +3 -3
- package/dist/plugins/multi-session/index.d.ts +3 -3
- package/dist/plugins/multi-session/index.mjs +4 -4
- package/dist/plugins/oauth-proxy/index.cjs +4 -4
- package/dist/plugins/oauth-proxy/index.d.cts +3 -3
- package/dist/plugins/oauth-proxy/index.d.mts +3 -3
- package/dist/plugins/oauth-proxy/index.d.ts +3 -3
- package/dist/plugins/oauth-proxy/index.mjs +5 -5
- package/dist/plugins/oidc-provider/index.cjs +227 -8
- package/dist/plugins/oidc-provider/index.d.cts +215 -3
- package/dist/plugins/oidc-provider/index.d.mts +215 -3
- package/dist/plugins/oidc-provider/index.d.ts +215 -3
- package/dist/plugins/oidc-provider/index.mjs +228 -9
- package/dist/plugins/one-tap/index.cjs +5 -5
- package/dist/plugins/one-tap/index.mjs +6 -6
- package/dist/plugins/one-time-token/index.cjs +119 -0
- package/dist/plugins/one-time-token/index.d.cts +134 -0
- package/dist/plugins/one-time-token/index.d.mts +134 -0
- package/dist/plugins/one-time-token/index.d.ts +134 -0
- package/dist/plugins/one-time-token/index.mjs +117 -0
- package/dist/plugins/open-api/index.cjs +3 -3
- package/dist/plugins/open-api/index.d.cts +3 -3
- package/dist/plugins/open-api/index.d.mts +3 -3
- package/dist/plugins/open-api/index.d.ts +3 -3
- package/dist/plugins/open-api/index.mjs +4 -4
- package/dist/plugins/organization/access/index.d.cts +1 -1
- package/dist/plugins/organization/access/index.d.mts +1 -1
- package/dist/plugins/organization/access/index.d.ts +1 -1
- package/dist/plugins/organization/index.cjs +4 -4
- package/dist/plugins/organization/index.d.cts +708 -55
- package/dist/plugins/organization/index.d.mts +708 -55
- package/dist/plugins/organization/index.d.ts +708 -55
- package/dist/plugins/organization/index.mjs +5 -5
- package/dist/plugins/passkey/index.cjs +82 -8
- package/dist/plugins/passkey/index.d.cts +72 -3
- package/dist/plugins/passkey/index.d.mts +72 -3
- package/dist/plugins/passkey/index.d.ts +72 -3
- package/dist/plugins/passkey/index.mjs +83 -9
- package/dist/plugins/phone-number/index.cjs +194 -26
- package/dist/plugins/phone-number/index.d.cts +132 -8
- package/dist/plugins/phone-number/index.d.mts +132 -8
- package/dist/plugins/phone-number/index.d.ts +132 -8
- package/dist/plugins/phone-number/index.mjs +195 -27
- package/dist/plugins/sso/index.cjs +190 -7
- package/dist/plugins/sso/index.d.cts +181 -15
- package/dist/plugins/sso/index.d.mts +181 -15
- package/dist/plugins/sso/index.d.ts +181 -15
- package/dist/plugins/sso/index.mjs +191 -8
- package/dist/plugins/two-factor/index.cjs +443 -92
- package/dist/plugins/two-factor/index.d.cts +230 -396
- package/dist/plugins/two-factor/index.d.mts +230 -396
- package/dist/plugins/two-factor/index.d.ts +230 -396
- package/dist/plugins/two-factor/index.mjs +431 -80
- package/dist/plugins/username/index.cjs +34 -31
- package/dist/plugins/username/index.d.cts +15 -12
- package/dist/plugins/username/index.d.mts +15 -12
- package/dist/plugins/username/index.d.ts +15 -12
- package/dist/plugins/username/index.mjs +35 -32
- package/dist/shared/better-auth.1DR6suCQ.mjs +307 -0
- package/dist/shared/{better-auth.BSsp73pg.cjs → better-auth.B7cZ2juS.cjs} +15 -14
- package/dist/shared/{better-auth.bKwabe3I.d.mts → better-auth.B88xucNq.d.mts} +529 -39
- package/dist/shared/{better-auth.CApEjVDP.cjs → better-auth.BW8BpneG.cjs} +4 -1
- package/dist/shared/{better-auth.BiQsvaIP.d.cts → better-auth.BcU1Kjyq.d.cts} +2051 -518
- package/dist/shared/better-auth.BfG24BjZ.cjs +118 -0
- package/dist/shared/{better-auth.A3TjrU8G.mjs → better-auth.Bk5IMdhM.mjs} +32 -12
- package/dist/shared/{better-auth.D9VnBkRI.mjs → better-auth.Bm9HxIzE.mjs} +47 -24
- package/dist/shared/{better-auth.BRf6Iynu.d.ts → better-auth.Bwc-6kOr.d.ts} +1 -1
- package/dist/shared/{better-auth.D-oLmHIj.d.mts → better-auth.CA2hFK4N.d.ts} +2051 -518
- package/dist/shared/{better-auth.Dmhe30iW.d.mts → better-auth.CGukGrxT.d.cts} +1 -1
- package/dist/shared/{better-auth.CsSpq0zL.cjs → better-auth.CHUzBidy.cjs} +46 -23
- package/dist/shared/{better-auth.DWRligF8.d.cts → better-auth.CT9J6rD-.d.cts} +539 -7
- package/dist/shared/better-auth.CVCo5Z2T.cjs +310 -0
- package/dist/shared/{better-auth.D4jH-sJA.mjs → better-auth.CWwVo_61.mjs} +458 -118
- package/dist/shared/{better-auth.Bi8FQwDD.d.cts → better-auth.CYegVoq1.d.cts} +1 -1
- package/dist/shared/{better-auth.Bi8FQwDD.d.mts → better-auth.CYegVoq1.d.mts} +1 -1
- package/dist/shared/{better-auth.Bi8FQwDD.d.ts → better-auth.CYegVoq1.d.ts} +1 -1
- package/dist/shared/{better-auth.CepcSj5H.mjs → better-auth.Cc72UxUH.mjs} +1 -2
- package/dist/shared/{better-auth.BWp5dztg.d.ts → better-auth.CmN4mlPh.d.ts} +539 -7
- package/dist/shared/{better-auth.DH3YjMQH.mjs → better-auth.Cqykj82J.mjs} +1 -1
- package/dist/shared/{better-auth.wcdMj2cT.d.mts → better-auth.DIt2e3lu.d.mts} +539 -7
- package/dist/shared/{better-auth.BANAxdkL.d.ts → better-auth.DNTAFSt1.d.ts} +529 -39
- package/dist/shared/{better-auth.DU2QNVc_.d.ts → better-auth.DQ7OSJbI.d.mts} +2051 -518
- package/dist/shared/{better-auth.DLTzKoOS.cjs → better-auth.DSVbLSt7.cjs} +4 -1
- package/dist/shared/{better-auth.B2Fw1vhH.d.cts → better-auth.DTiSPWEk.d.cts} +529 -39
- package/dist/shared/better-auth.DURsStt9.mjs +116 -0
- package/dist/shared/{better-auth.BIjcZ_vt.cjs → better-auth.DYoLD99C.cjs} +31 -11
- package/dist/shared/{better-auth.CV1L7TPV.cjs → better-auth.D_ZIX1O8.cjs} +317 -47
- package/dist/shared/{better-auth.C5H9XEzZ.cjs → better-auth.DcWKCjjf.cjs} +1 -2
- package/dist/shared/{better-auth.BDYXUcLv.cjs → better-auth.Dg0siV5C.cjs} +457 -117
- package/dist/shared/better-auth.DjryM8pE.cjs +760 -0
- package/dist/shared/{better-auth.DPBQN9Fs.mjs → better-auth.Dn_Ms1Uf.mjs} +318 -48
- package/dist/shared/{better-auth.DiG4KL2x.mjs → better-auth.OuYYTHC7.mjs} +4 -1
- package/dist/shared/{better-auth.DtC8i3pf.d.cts → better-auth.S1jimRbX.d.mts} +1 -1
- package/dist/shared/better-auth.SPmq4a4z.d.mts +344 -0
- package/dist/shared/{better-auth.cOCrlspr.mjs → better-auth.bkwPl2G4.mjs} +4 -1
- package/dist/shared/better-auth.cp2rC2iM.d.ts +344 -0
- package/dist/shared/better-auth.eVy4DZvP.d.cts +344 -0
- package/dist/shared/{better-auth.BrOpzmqo.mjs → better-auth.iKoUsdFE.mjs} +15 -14
- package/dist/shared/better-auth.rSYJCd3o.mjs +758 -0
- package/dist/social-providers/index.cjs +75 -3
- package/dist/social-providers/index.d.cts +2 -2
- package/dist/social-providers/index.d.mts +2 -2
- package/dist/social-providers/index.d.ts +2 -2
- package/dist/social-providers/index.mjs +77 -6
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/package.json +42 -5
- package/dist/chunks/server.cjs +0 -905
- package/dist/chunks/server.mjs +0 -895
- package/dist/shared/better-auth.BcoSd9tC.mjs +0 -10
- package/dist/shared/better-auth.BnRFp-t0.mjs +0 -405
- package/dist/shared/better-auth.C1-vpKly.cjs +0 -12
- package/dist/shared/better-auth.ClTSOgiD.mjs +0 -140
- package/dist/shared/better-auth.DC8JQbiE.mjs +0 -173
- package/dist/shared/better-auth.DWHWPllD.cjs +0 -175
- package/dist/shared/better-auth.DqLjzBlO.cjs +0 -408
- package/dist/shared/better-auth.m575EIBC.cjs +0 -144
package/dist/plugins/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const organization = require('../shared/better-auth.
|
|
3
|
+
const organization = require('../shared/better-auth.D_ZIX1O8.cjs');
|
|
4
4
|
const plugins_twoFactor_index = require('./two-factor/index.cjs');
|
|
5
5
|
const plugins_username_index = require('./username/index.cjs');
|
|
6
6
|
const plugins_bearer_index = require('./bearer/index.cjs');
|
|
7
|
-
const refreshToken = require('../shared/better-auth.
|
|
7
|
+
const refreshToken = require('../shared/better-auth.Dg0siV5C.cjs');
|
|
8
8
|
const plugins_magicLink_index = require('./magic-link/index.cjs');
|
|
9
9
|
const plugins_phoneNumber_index = require('./phone-number/index.cjs');
|
|
10
10
|
const plugins_anonymous_index = require('./anonymous/index.cjs');
|
|
11
|
-
const admin = require('../shared/better-auth.
|
|
11
|
+
const admin = require('../shared/better-auth.CHUzBidy.cjs');
|
|
12
12
|
const plugins_genericOauth_index = require('./generic-oauth/index.cjs');
|
|
13
13
|
const plugins_jwt_index = require('./jwt/index.cjs');
|
|
14
14
|
const plugins_multiSession_index = require('./multi-session/index.cjs');
|
|
@@ -26,9 +26,9 @@ const zod = require('zod');
|
|
|
26
26
|
const date = require('../shared/better-auth.C1hdVENX.cjs');
|
|
27
27
|
require('../shared/better-auth.DiSjtgs9.cjs');
|
|
28
28
|
require('@better-auth/utils/hmac');
|
|
29
|
-
const schema = require('../shared/better-auth.
|
|
29
|
+
const schema = require('../shared/better-auth.DcWKCjjf.cjs');
|
|
30
30
|
require('../shared/better-auth.GpOOav9x.cjs');
|
|
31
|
-
const getRequestIp = require('../shared/better-auth.
|
|
31
|
+
const getRequestIp = require('../shared/better-auth.B7cZ2juS.cjs');
|
|
32
32
|
require('defu');
|
|
33
33
|
require('@better-auth/utils/random');
|
|
34
34
|
require('@noble/ciphers/chacha');
|
|
@@ -43,19 +43,19 @@ require('../shared/better-auth.CYeOI8C-.cjs');
|
|
|
43
43
|
require('kysely');
|
|
44
44
|
const parser = require('../shared/better-auth.DhsGZ30Q.cjs');
|
|
45
45
|
const json = require('../shared/better-auth.D3mtHEZg.cjs');
|
|
46
|
-
const id = require('../shared/better-auth.Bg6iw3ig.cjs');
|
|
47
46
|
const plugins_access_index = require('./access/index.cjs');
|
|
48
|
-
const
|
|
47
|
+
const plugins_haveibeenpwned_index = require('./haveibeenpwned/index.cjs');
|
|
48
|
+
const plugins_oneTimeToken_index = require('./one-time-token/index.cjs');
|
|
49
49
|
const client = require('../shared/better-auth.DnER2-iT.cjs');
|
|
50
50
|
require('../shared/better-auth.ANpbi45u.cjs');
|
|
51
|
-
require('../shared/better-auth.
|
|
51
|
+
require('../shared/better-auth.DSVbLSt7.cjs');
|
|
52
52
|
require('./organization/access/index.cjs');
|
|
53
53
|
require('../cookies/index.cjs');
|
|
54
54
|
require('../shared/better-auth.C-R0J0n1.cjs');
|
|
55
|
+
require('../shared/better-auth.Bg6iw3ig.cjs');
|
|
55
56
|
require('../crypto/index.cjs');
|
|
56
57
|
require('../shared/better-auth.YUF6P-PB.cjs');
|
|
57
58
|
require('../shared/better-auth.BMYo0QR-.cjs');
|
|
58
|
-
require('../shared/better-auth.m575EIBC.cjs');
|
|
59
59
|
require('@better-auth/utils/otp');
|
|
60
60
|
require('../shared/better-auth.CDXNofOe.cjs');
|
|
61
61
|
require('../social-providers/index.cjs');
|
|
@@ -65,7 +65,7 @@ require('../shared/better-auth.QbbyHMYf.cjs');
|
|
|
65
65
|
require('jose/errors');
|
|
66
66
|
require('@better-auth/utils/binary');
|
|
67
67
|
require('../shared/better-auth.DNqtHmvg.cjs');
|
|
68
|
-
require('../shared/better-auth.
|
|
68
|
+
require('../shared/better-auth.BW8BpneG.cjs');
|
|
69
69
|
require('./admin/access/index.cjs');
|
|
70
70
|
require('../shared/better-auth.BG6vHVNT.cjs');
|
|
71
71
|
require('../api/index.cjs');
|
|
@@ -303,7 +303,143 @@ function createApiKey({
|
|
|
303
303
|
description: "Whether the key has rate limiting enabled. Server Only Property."
|
|
304
304
|
}).optional(),
|
|
305
305
|
permissions: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional()
|
|
306
|
-
})
|
|
306
|
+
}),
|
|
307
|
+
metadata: {
|
|
308
|
+
openapi: {
|
|
309
|
+
description: "Create a new API key for a user",
|
|
310
|
+
responses: {
|
|
311
|
+
"200": {
|
|
312
|
+
description: "API key created successfully",
|
|
313
|
+
content: {
|
|
314
|
+
"application/json": {
|
|
315
|
+
schema: {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: {
|
|
318
|
+
id: {
|
|
319
|
+
type: "string",
|
|
320
|
+
description: "Unique identifier of the API key"
|
|
321
|
+
},
|
|
322
|
+
createdAt: {
|
|
323
|
+
type: "string",
|
|
324
|
+
format: "date-time",
|
|
325
|
+
description: "Creation timestamp"
|
|
326
|
+
},
|
|
327
|
+
updatedAt: {
|
|
328
|
+
type: "string",
|
|
329
|
+
format: "date-time",
|
|
330
|
+
description: "Last update timestamp"
|
|
331
|
+
},
|
|
332
|
+
name: {
|
|
333
|
+
type: "string",
|
|
334
|
+
nullable: true,
|
|
335
|
+
description: "Name of the API key"
|
|
336
|
+
},
|
|
337
|
+
prefix: {
|
|
338
|
+
type: "string",
|
|
339
|
+
nullable: true,
|
|
340
|
+
description: "Prefix of the API key"
|
|
341
|
+
},
|
|
342
|
+
start: {
|
|
343
|
+
type: "string",
|
|
344
|
+
nullable: true,
|
|
345
|
+
description: "Starting characters of the key (if configured)"
|
|
346
|
+
},
|
|
347
|
+
key: {
|
|
348
|
+
type: "string",
|
|
349
|
+
description: "The full API key (only returned on creation)"
|
|
350
|
+
},
|
|
351
|
+
enabled: {
|
|
352
|
+
type: "boolean",
|
|
353
|
+
description: "Whether the key is enabled"
|
|
354
|
+
},
|
|
355
|
+
expiresAt: {
|
|
356
|
+
type: "string",
|
|
357
|
+
format: "date-time",
|
|
358
|
+
nullable: true,
|
|
359
|
+
description: "Expiration timestamp"
|
|
360
|
+
},
|
|
361
|
+
userId: {
|
|
362
|
+
type: "string",
|
|
363
|
+
description: "ID of the user owning the key"
|
|
364
|
+
},
|
|
365
|
+
lastRefillAt: {
|
|
366
|
+
type: "string",
|
|
367
|
+
format: "date-time",
|
|
368
|
+
nullable: true,
|
|
369
|
+
description: "Last refill timestamp"
|
|
370
|
+
},
|
|
371
|
+
lastRequest: {
|
|
372
|
+
type: "string",
|
|
373
|
+
format: "date-time",
|
|
374
|
+
nullable: true,
|
|
375
|
+
description: "Last request timestamp"
|
|
376
|
+
},
|
|
377
|
+
metadata: {
|
|
378
|
+
type: "object",
|
|
379
|
+
nullable: true,
|
|
380
|
+
additionalProperties: true,
|
|
381
|
+
description: "Metadata associated with the key"
|
|
382
|
+
},
|
|
383
|
+
rateLimitMax: {
|
|
384
|
+
type: "number",
|
|
385
|
+
nullable: true,
|
|
386
|
+
description: "Maximum requests in time window"
|
|
387
|
+
},
|
|
388
|
+
rateLimitTimeWindow: {
|
|
389
|
+
type: "number",
|
|
390
|
+
nullable: true,
|
|
391
|
+
description: "Rate limit time window in milliseconds"
|
|
392
|
+
},
|
|
393
|
+
remaining: {
|
|
394
|
+
type: "number",
|
|
395
|
+
nullable: true,
|
|
396
|
+
description: "Remaining requests"
|
|
397
|
+
},
|
|
398
|
+
refillAmount: {
|
|
399
|
+
type: "number",
|
|
400
|
+
nullable: true,
|
|
401
|
+
description: "Amount to refill"
|
|
402
|
+
},
|
|
403
|
+
refillInterval: {
|
|
404
|
+
type: "number",
|
|
405
|
+
nullable: true,
|
|
406
|
+
description: "Refill interval in milliseconds"
|
|
407
|
+
},
|
|
408
|
+
rateLimitEnabled: {
|
|
409
|
+
type: "boolean",
|
|
410
|
+
description: "Whether rate limiting is enabled"
|
|
411
|
+
},
|
|
412
|
+
requestCount: {
|
|
413
|
+
type: "number",
|
|
414
|
+
description: "Current request count in window"
|
|
415
|
+
},
|
|
416
|
+
permissions: {
|
|
417
|
+
type: "object",
|
|
418
|
+
nullable: true,
|
|
419
|
+
additionalProperties: {
|
|
420
|
+
type: "array",
|
|
421
|
+
items: { type: "string" }
|
|
422
|
+
},
|
|
423
|
+
description: "Permissions associated with the key"
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
required: [
|
|
427
|
+
"id",
|
|
428
|
+
"createdAt",
|
|
429
|
+
"updatedAt",
|
|
430
|
+
"key",
|
|
431
|
+
"enabled",
|
|
432
|
+
"userId",
|
|
433
|
+
"rateLimitEnabled",
|
|
434
|
+
"requestCount"
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
307
443
|
},
|
|
308
444
|
async (ctx) => {
|
|
309
445
|
const {
|
|
@@ -416,7 +552,6 @@ function createApiKey({
|
|
|
416
552
|
const defaultPermissions = opts.permissions?.defaultPermissions ? typeof opts.permissions.defaultPermissions === "function" ? await opts.permissions.defaultPermissions(user.id, ctx) : opts.permissions.defaultPermissions : void 0;
|
|
417
553
|
const permissionsToApply = permissions ? JSON.stringify(permissions) : defaultPermissions ? JSON.stringify(defaultPermissions) : void 0;
|
|
418
554
|
let data = {
|
|
419
|
-
id: id.generateId(),
|
|
420
555
|
createdAt: /* @__PURE__ */ new Date(),
|
|
421
556
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
422
557
|
name: name ?? null,
|
|
@@ -434,7 +569,7 @@ function createApiKey({
|
|
|
434
569
|
remaining: remaining || refillAmount || null,
|
|
435
570
|
refillAmount: refillAmount ?? null,
|
|
436
571
|
refillInterval: refillInterval ?? null,
|
|
437
|
-
rateLimitEnabled: rateLimitEnabled ?? true,
|
|
572
|
+
rateLimitEnabled: rateLimitEnabled ?? opts.rateLimit.enabled === void 0 ? true : opts.rateLimit.enabled,
|
|
438
573
|
requestCount: 0,
|
|
439
574
|
//@ts-ignore - we intentionally save the permissions as string on DB.
|
|
440
575
|
permissions: permissionsToApply
|
|
@@ -473,7 +608,47 @@ function deleteApiKey({
|
|
|
473
608
|
description: "The id of the Api Key"
|
|
474
609
|
})
|
|
475
610
|
}),
|
|
476
|
-
use: [refreshToken.sessionMiddleware]
|
|
611
|
+
use: [refreshToken.sessionMiddleware],
|
|
612
|
+
metadata: {
|
|
613
|
+
openapi: {
|
|
614
|
+
description: "Delete an existing API key",
|
|
615
|
+
requestBody: {
|
|
616
|
+
content: {
|
|
617
|
+
"application/json": {
|
|
618
|
+
schema: {
|
|
619
|
+
type: "object",
|
|
620
|
+
properties: {
|
|
621
|
+
keyId: {
|
|
622
|
+
type: "string",
|
|
623
|
+
description: "The id of the API key to delete"
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
required: ["keyId"]
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
responses: {
|
|
632
|
+
"200": {
|
|
633
|
+
description: "API key deleted successfully",
|
|
634
|
+
content: {
|
|
635
|
+
"application/json": {
|
|
636
|
+
schema: {
|
|
637
|
+
type: "object",
|
|
638
|
+
properties: {
|
|
639
|
+
success: {
|
|
640
|
+
type: "boolean",
|
|
641
|
+
description: "Indicates if the API key was successfully deleted"
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
required: ["success"]
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
477
652
|
},
|
|
478
653
|
async (ctx) => {
|
|
479
654
|
const { keyId } = ctx.body;
|
|
@@ -534,7 +709,135 @@ function getApiKey({
|
|
|
534
709
|
description: "The id of the Api Key"
|
|
535
710
|
})
|
|
536
711
|
}),
|
|
537
|
-
use: [refreshToken.sessionMiddleware]
|
|
712
|
+
use: [refreshToken.sessionMiddleware],
|
|
713
|
+
metadata: {
|
|
714
|
+
openapi: {
|
|
715
|
+
description: "Retrieve an existing API key by ID",
|
|
716
|
+
responses: {
|
|
717
|
+
"200": {
|
|
718
|
+
description: "API key retrieved successfully",
|
|
719
|
+
content: {
|
|
720
|
+
"application/json": {
|
|
721
|
+
schema: {
|
|
722
|
+
type: "object",
|
|
723
|
+
properties: {
|
|
724
|
+
id: {
|
|
725
|
+
type: "string",
|
|
726
|
+
description: "ID"
|
|
727
|
+
},
|
|
728
|
+
name: {
|
|
729
|
+
type: "string",
|
|
730
|
+
nullable: true,
|
|
731
|
+
description: "The name of the key"
|
|
732
|
+
},
|
|
733
|
+
start: {
|
|
734
|
+
type: "string",
|
|
735
|
+
nullable: true,
|
|
736
|
+
description: "Shows the first few characters of the API key, including the prefix. This allows you to show those few characters in the UI to make it easier for users to identify the API key."
|
|
737
|
+
},
|
|
738
|
+
prefix: {
|
|
739
|
+
type: "string",
|
|
740
|
+
nullable: true,
|
|
741
|
+
description: "The API Key prefix. Stored as plain text."
|
|
742
|
+
},
|
|
743
|
+
userId: {
|
|
744
|
+
type: "string",
|
|
745
|
+
description: "The owner of the user id"
|
|
746
|
+
},
|
|
747
|
+
refillInterval: {
|
|
748
|
+
type: "number",
|
|
749
|
+
nullable: true,
|
|
750
|
+
description: "The interval in which the `remaining` count is refilled by day. Example: 1 // every day"
|
|
751
|
+
},
|
|
752
|
+
refillAmount: {
|
|
753
|
+
type: "number",
|
|
754
|
+
nullable: true,
|
|
755
|
+
description: "The amount to refill"
|
|
756
|
+
},
|
|
757
|
+
lastRefillAt: {
|
|
758
|
+
type: "string",
|
|
759
|
+
format: "date-time",
|
|
760
|
+
nullable: true,
|
|
761
|
+
description: "The last refill date"
|
|
762
|
+
},
|
|
763
|
+
enabled: {
|
|
764
|
+
type: "boolean",
|
|
765
|
+
description: "Sets if key is enabled or disabled",
|
|
766
|
+
default: true
|
|
767
|
+
},
|
|
768
|
+
rateLimitEnabled: {
|
|
769
|
+
type: "boolean",
|
|
770
|
+
description: "Whether the key has rate limiting enabled"
|
|
771
|
+
},
|
|
772
|
+
rateLimitTimeWindow: {
|
|
773
|
+
type: "number",
|
|
774
|
+
nullable: true,
|
|
775
|
+
description: "The duration in milliseconds"
|
|
776
|
+
},
|
|
777
|
+
rateLimitMax: {
|
|
778
|
+
type: "number",
|
|
779
|
+
nullable: true,
|
|
780
|
+
description: "Maximum amount of requests allowed within a window"
|
|
781
|
+
},
|
|
782
|
+
requestCount: {
|
|
783
|
+
type: "number",
|
|
784
|
+
description: "The number of requests made within the rate limit time window"
|
|
785
|
+
},
|
|
786
|
+
remaining: {
|
|
787
|
+
type: "number",
|
|
788
|
+
nullable: true,
|
|
789
|
+
description: "Remaining requests (every time api key is used this should updated and should be updated on refill as well)"
|
|
790
|
+
},
|
|
791
|
+
lastRequest: {
|
|
792
|
+
type: "string",
|
|
793
|
+
format: "date-time",
|
|
794
|
+
nullable: true,
|
|
795
|
+
description: "When last request occurred"
|
|
796
|
+
},
|
|
797
|
+
expiresAt: {
|
|
798
|
+
type: "string",
|
|
799
|
+
format: "date-time",
|
|
800
|
+
nullable: true,
|
|
801
|
+
description: "Expiry date of a key"
|
|
802
|
+
},
|
|
803
|
+
createdAt: {
|
|
804
|
+
type: "string",
|
|
805
|
+
format: "date-time",
|
|
806
|
+
description: "created at"
|
|
807
|
+
},
|
|
808
|
+
updatedAt: {
|
|
809
|
+
type: "string",
|
|
810
|
+
format: "date-time",
|
|
811
|
+
description: "updated at"
|
|
812
|
+
},
|
|
813
|
+
metadata: {
|
|
814
|
+
type: "object",
|
|
815
|
+
nullable: true,
|
|
816
|
+
additionalProperties: true,
|
|
817
|
+
description: "Extra metadata about the apiKey"
|
|
818
|
+
},
|
|
819
|
+
permissions: {
|
|
820
|
+
type: "string",
|
|
821
|
+
nullable: true,
|
|
822
|
+
description: "Permissions for the api key (stored as JSON string)"
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
required: [
|
|
826
|
+
"id",
|
|
827
|
+
"userId",
|
|
828
|
+
"enabled",
|
|
829
|
+
"rateLimitEnabled",
|
|
830
|
+
"requestCount",
|
|
831
|
+
"createdAt",
|
|
832
|
+
"updatedAt"
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
538
841
|
},
|
|
539
842
|
async (ctx) => {
|
|
540
843
|
const { id } = ctx.query;
|
|
@@ -618,7 +921,135 @@ function updateApiKey({
|
|
|
618
921
|
description: "Maximum amount of requests allowed within a window. Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset."
|
|
619
922
|
}).optional(),
|
|
620
923
|
permissions: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional().nullable()
|
|
621
|
-
})
|
|
924
|
+
}),
|
|
925
|
+
metadata: {
|
|
926
|
+
openapi: {
|
|
927
|
+
description: "Retrieve an existing API key by ID",
|
|
928
|
+
responses: {
|
|
929
|
+
"200": {
|
|
930
|
+
description: "API key retrieved successfully",
|
|
931
|
+
content: {
|
|
932
|
+
"application/json": {
|
|
933
|
+
schema: {
|
|
934
|
+
type: "object",
|
|
935
|
+
properties: {
|
|
936
|
+
id: {
|
|
937
|
+
type: "string",
|
|
938
|
+
description: "ID"
|
|
939
|
+
},
|
|
940
|
+
name: {
|
|
941
|
+
type: "string",
|
|
942
|
+
nullable: true,
|
|
943
|
+
description: "The name of the key"
|
|
944
|
+
},
|
|
945
|
+
start: {
|
|
946
|
+
type: "string",
|
|
947
|
+
nullable: true,
|
|
948
|
+
description: "Shows the first few characters of the API key, including the prefix. This allows you to show those few characters in the UI to make it easier for users to identify the API key."
|
|
949
|
+
},
|
|
950
|
+
prefix: {
|
|
951
|
+
type: "string",
|
|
952
|
+
nullable: true,
|
|
953
|
+
description: "The API Key prefix. Stored as plain text."
|
|
954
|
+
},
|
|
955
|
+
userId: {
|
|
956
|
+
type: "string",
|
|
957
|
+
description: "The owner of the user id"
|
|
958
|
+
},
|
|
959
|
+
refillInterval: {
|
|
960
|
+
type: "number",
|
|
961
|
+
nullable: true,
|
|
962
|
+
description: "The interval in which the `remaining` count is refilled by day. Example: 1 // every day"
|
|
963
|
+
},
|
|
964
|
+
refillAmount: {
|
|
965
|
+
type: "number",
|
|
966
|
+
nullable: true,
|
|
967
|
+
description: "The amount to refill"
|
|
968
|
+
},
|
|
969
|
+
lastRefillAt: {
|
|
970
|
+
type: "string",
|
|
971
|
+
format: "date-time",
|
|
972
|
+
nullable: true,
|
|
973
|
+
description: "The last refill date"
|
|
974
|
+
},
|
|
975
|
+
enabled: {
|
|
976
|
+
type: "boolean",
|
|
977
|
+
description: "Sets if key is enabled or disabled",
|
|
978
|
+
default: true
|
|
979
|
+
},
|
|
980
|
+
rateLimitEnabled: {
|
|
981
|
+
type: "boolean",
|
|
982
|
+
description: "Whether the key has rate limiting enabled"
|
|
983
|
+
},
|
|
984
|
+
rateLimitTimeWindow: {
|
|
985
|
+
type: "number",
|
|
986
|
+
nullable: true,
|
|
987
|
+
description: "The duration in milliseconds"
|
|
988
|
+
},
|
|
989
|
+
rateLimitMax: {
|
|
990
|
+
type: "number",
|
|
991
|
+
nullable: true,
|
|
992
|
+
description: "Maximum amount of requests allowed within a window"
|
|
993
|
+
},
|
|
994
|
+
requestCount: {
|
|
995
|
+
type: "number",
|
|
996
|
+
description: "The number of requests made within the rate limit time window"
|
|
997
|
+
},
|
|
998
|
+
remaining: {
|
|
999
|
+
type: "number",
|
|
1000
|
+
nullable: true,
|
|
1001
|
+
description: "Remaining requests (every time api key is used this should updated and should be updated on refill as well)"
|
|
1002
|
+
},
|
|
1003
|
+
lastRequest: {
|
|
1004
|
+
type: "string",
|
|
1005
|
+
format: "date-time",
|
|
1006
|
+
nullable: true,
|
|
1007
|
+
description: "When last request occurred"
|
|
1008
|
+
},
|
|
1009
|
+
expiresAt: {
|
|
1010
|
+
type: "string",
|
|
1011
|
+
format: "date-time",
|
|
1012
|
+
nullable: true,
|
|
1013
|
+
description: "Expiry date of a key"
|
|
1014
|
+
},
|
|
1015
|
+
createdAt: {
|
|
1016
|
+
type: "string",
|
|
1017
|
+
format: "date-time",
|
|
1018
|
+
description: "created at"
|
|
1019
|
+
},
|
|
1020
|
+
updatedAt: {
|
|
1021
|
+
type: "string",
|
|
1022
|
+
format: "date-time",
|
|
1023
|
+
description: "updated at"
|
|
1024
|
+
},
|
|
1025
|
+
metadata: {
|
|
1026
|
+
type: "object",
|
|
1027
|
+
nullable: true,
|
|
1028
|
+
additionalProperties: true,
|
|
1029
|
+
description: "Extra metadata about the apiKey"
|
|
1030
|
+
},
|
|
1031
|
+
permissions: {
|
|
1032
|
+
type: "string",
|
|
1033
|
+
nullable: true,
|
|
1034
|
+
description: "Permissions for the api key (stored as JSON string)"
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
required: [
|
|
1038
|
+
"id",
|
|
1039
|
+
"userId",
|
|
1040
|
+
"enabled",
|
|
1041
|
+
"rateLimitEnabled",
|
|
1042
|
+
"requestCount",
|
|
1043
|
+
"createdAt",
|
|
1044
|
+
"updatedAt"
|
|
1045
|
+
]
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
622
1053
|
},
|
|
623
1054
|
async (ctx) => {
|
|
624
1055
|
const {
|
|
@@ -1096,7 +1527,138 @@ function listApiKeys({
|
|
|
1096
1527
|
"/api-key/list",
|
|
1097
1528
|
{
|
|
1098
1529
|
method: "GET",
|
|
1099
|
-
use: [refreshToken.sessionMiddleware]
|
|
1530
|
+
use: [refreshToken.sessionMiddleware],
|
|
1531
|
+
metadata: {
|
|
1532
|
+
openapi: {
|
|
1533
|
+
description: "List all API keys for the authenticated user",
|
|
1534
|
+
responses: {
|
|
1535
|
+
"200": {
|
|
1536
|
+
description: "API keys retrieved successfully",
|
|
1537
|
+
content: {
|
|
1538
|
+
"application/json": {
|
|
1539
|
+
schema: {
|
|
1540
|
+
type: "array",
|
|
1541
|
+
items: {
|
|
1542
|
+
type: "object",
|
|
1543
|
+
properties: {
|
|
1544
|
+
id: {
|
|
1545
|
+
type: "string",
|
|
1546
|
+
description: "ID"
|
|
1547
|
+
},
|
|
1548
|
+
name: {
|
|
1549
|
+
type: "string",
|
|
1550
|
+
nullable: true,
|
|
1551
|
+
description: "The name of the key"
|
|
1552
|
+
},
|
|
1553
|
+
start: {
|
|
1554
|
+
type: "string",
|
|
1555
|
+
nullable: true,
|
|
1556
|
+
description: "Shows the first few characters of the API key, including the prefix. This allows you to show those few characters in the UI to make it easier for users to identify the API key."
|
|
1557
|
+
},
|
|
1558
|
+
prefix: {
|
|
1559
|
+
type: "string",
|
|
1560
|
+
nullable: true,
|
|
1561
|
+
description: "The API Key prefix. Stored as plain text."
|
|
1562
|
+
},
|
|
1563
|
+
userId: {
|
|
1564
|
+
type: "string",
|
|
1565
|
+
description: "The owner of the user id"
|
|
1566
|
+
},
|
|
1567
|
+
refillInterval: {
|
|
1568
|
+
type: "number",
|
|
1569
|
+
nullable: true,
|
|
1570
|
+
description: "The interval in which the `remaining` count is refilled by day. Example: 1 // every day"
|
|
1571
|
+
},
|
|
1572
|
+
refillAmount: {
|
|
1573
|
+
type: "number",
|
|
1574
|
+
nullable: true,
|
|
1575
|
+
description: "The amount to refill"
|
|
1576
|
+
},
|
|
1577
|
+
lastRefillAt: {
|
|
1578
|
+
type: "string",
|
|
1579
|
+
format: "date-time",
|
|
1580
|
+
nullable: true,
|
|
1581
|
+
description: "The last refill date"
|
|
1582
|
+
},
|
|
1583
|
+
enabled: {
|
|
1584
|
+
type: "boolean",
|
|
1585
|
+
description: "Sets if key is enabled or disabled",
|
|
1586
|
+
default: true
|
|
1587
|
+
},
|
|
1588
|
+
rateLimitEnabled: {
|
|
1589
|
+
type: "boolean",
|
|
1590
|
+
description: "Whether the key has rate limiting enabled"
|
|
1591
|
+
},
|
|
1592
|
+
rateLimitTimeWindow: {
|
|
1593
|
+
type: "number",
|
|
1594
|
+
nullable: true,
|
|
1595
|
+
description: "The duration in milliseconds"
|
|
1596
|
+
},
|
|
1597
|
+
rateLimitMax: {
|
|
1598
|
+
type: "number",
|
|
1599
|
+
nullable: true,
|
|
1600
|
+
description: "Maximum amount of requests allowed within a window"
|
|
1601
|
+
},
|
|
1602
|
+
requestCount: {
|
|
1603
|
+
type: "number",
|
|
1604
|
+
description: "The number of requests made within the rate limit time window"
|
|
1605
|
+
},
|
|
1606
|
+
remaining: {
|
|
1607
|
+
type: "number",
|
|
1608
|
+
nullable: true,
|
|
1609
|
+
description: "Remaining requests (every time api key is used this should updated and should be updated on refill as well)"
|
|
1610
|
+
},
|
|
1611
|
+
lastRequest: {
|
|
1612
|
+
type: "string",
|
|
1613
|
+
format: "date-time",
|
|
1614
|
+
nullable: true,
|
|
1615
|
+
description: "When last request occurred"
|
|
1616
|
+
},
|
|
1617
|
+
expiresAt: {
|
|
1618
|
+
type: "string",
|
|
1619
|
+
format: "date-time",
|
|
1620
|
+
nullable: true,
|
|
1621
|
+
description: "Expiry date of a key"
|
|
1622
|
+
},
|
|
1623
|
+
createdAt: {
|
|
1624
|
+
type: "string",
|
|
1625
|
+
format: "date-time",
|
|
1626
|
+
description: "created at"
|
|
1627
|
+
},
|
|
1628
|
+
updatedAt: {
|
|
1629
|
+
type: "string",
|
|
1630
|
+
format: "date-time",
|
|
1631
|
+
description: "updated at"
|
|
1632
|
+
},
|
|
1633
|
+
metadata: {
|
|
1634
|
+
type: "object",
|
|
1635
|
+
nullable: true,
|
|
1636
|
+
additionalProperties: true,
|
|
1637
|
+
description: "Extra metadata about the apiKey"
|
|
1638
|
+
},
|
|
1639
|
+
permissions: {
|
|
1640
|
+
type: "string",
|
|
1641
|
+
nullable: true,
|
|
1642
|
+
description: "Permissions for the api key (stored as JSON string)"
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
required: [
|
|
1646
|
+
"id",
|
|
1647
|
+
"userId",
|
|
1648
|
+
"enabled",
|
|
1649
|
+
"rateLimitEnabled",
|
|
1650
|
+
"requestCount",
|
|
1651
|
+
"createdAt",
|
|
1652
|
+
"updatedAt"
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1100
1662
|
},
|
|
1101
1663
|
async (ctx) => {
|
|
1102
1664
|
const session = ctx.context.session;
|
|
@@ -1246,7 +1808,7 @@ const apiKey = (options) => {
|
|
|
1246
1808
|
minimumNameLength: options?.minimumNameLength ?? 1,
|
|
1247
1809
|
enableMetadata: options?.enableMetadata ?? false,
|
|
1248
1810
|
rateLimit: {
|
|
1249
|
-
enabled: options?.rateLimit?.enabled
|
|
1811
|
+
enabled: options?.rateLimit?.enabled === void 0 ? true : options?.rateLimit?.enabled,
|
|
1250
1812
|
timeWindow: options?.rateLimit?.timeWindow ?? 1e3 * 60 * 60 * 24,
|
|
1251
1813
|
maxRequests: options?.rateLimit?.maxRequests ?? 10
|
|
1252
1814
|
},
|
|
@@ -1392,6 +1954,7 @@ const apiKey = (options) => {
|
|
|
1392
1954
|
|
|
1393
1955
|
exports.organization = organization.organization;
|
|
1394
1956
|
exports.parseRoles = organization.parseRoles;
|
|
1957
|
+
exports.TWO_FACTOR_ERROR_CODES = plugins_twoFactor_index.TWO_FACTOR_ERROR_CODES;
|
|
1395
1958
|
exports.twoFactor = plugins_twoFactor_index.twoFactor;
|
|
1396
1959
|
exports.username = plugins_username_index.username;
|
|
1397
1960
|
exports.bearer = plugins_bearer_index.bearer;
|
|
@@ -1414,7 +1977,8 @@ exports.customSession = plugins_customSession_index.customSession;
|
|
|
1414
1977
|
exports.openAPI = plugins_openApi_index.openAPI;
|
|
1415
1978
|
exports.oidcProvider = plugins_oidcProvider_index.oidcProvider;
|
|
1416
1979
|
exports.captcha = plugins_captcha_index.captcha;
|
|
1417
|
-
exports.
|
|
1980
|
+
exports.haveIBeenPwned = plugins_haveibeenpwned_index.haveIBeenPwned;
|
|
1981
|
+
exports.oneTimeToken = plugins_oneTimeToken_index.oneTimeToken;
|
|
1418
1982
|
exports.twoFactorClient = client.twoFactorClient;
|
|
1419
1983
|
exports.ERROR_CODES = ERROR_CODES;
|
|
1420
1984
|
exports.apiKey = apiKey;
|