improve(api): cache salts

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-02-04 14:18:29 +01:00
parent 3a61276859
commit e3131ed72a
2 changed files with 14 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import { generateSalt } from '@openpanel/common/server';
import { db, getCurrentSalt } from '@openpanel/db';
import { getRedisCache } from '@openpanel/redis';
export async function salt() {
const oldSalt = await getCurrentSalt().catch(() => null);
@@ -18,5 +19,7 @@ export async function salt() {
},
});
await getRedisCache().del('op:salt');
return newSalt;
}