better-auth
Version:
The most comprehensive authentication framework for TypeScript.
1 lines • 1.29 kB
Source Map (JSON)
{"version":3,"file":"delete-all-expired-api-keys.mjs","names":[],"sources":["../../../../src/plugins/api-key/routes/delete-all-expired-api-keys.ts"],"sourcesContent":["import type { AuthContext } from \"@better-auth/core\";\nimport { createAuthEndpoint } from \"@better-auth/core/api\";\n\nexport function deleteAllExpiredApiKeysEndpoint({\n\tdeleteAllExpiredApiKeys,\n}: {\n\tdeleteAllExpiredApiKeys(\n\t\tctx: AuthContext,\n\t\tbyPassLastCheckTime?: boolean | undefined,\n\t): Promise<void>;\n}) {\n\treturn createAuthEndpoint(\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t},\n\t\tasync (ctx) => {\n\t\t\ttry {\n\t\t\t\tawait deleteAllExpiredApiKeys(ctx.context, true);\n\t\t\t} catch (error) {\n\t\t\t\tctx.context.logger.error(\n\t\t\t\t\t\"[API KEY PLUGIN] Failed to delete expired API keys:\",\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\treturn ctx.json({\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: error,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn ctx.json({ success: true, error: null });\n\t\t},\n\t);\n}\n"],"mappings":";;;AAGA,SAAgB,gCAAgC,EAC/C,2BAME;AACF,QAAO,mBACN,EACC,QAAQ,QACR,EACD,OAAO,QAAQ;AACd,MAAI;AACH,SAAM,wBAAwB,IAAI,SAAS,KAAK;WACxC,OAAO;AACf,OAAI,QAAQ,OAAO,MAClB,uDACA,MACA;AACD,UAAO,IAAI,KAAK;IACf,SAAS;IACF;IACP,CAAC;;AAGH,SAAO,IAAI,KAAK;GAAE,SAAS;GAAM,OAAO;GAAM,CAAC;GAEhD"}