fix: salt issues

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-01-26 12:07:06 +01:00
parent 286f8e160b
commit db62919825
4 changed files with 165 additions and 55 deletions

View File

@@ -3,20 +3,6 @@ import { generateSalt } from '@openpanel/common/server';
import { cacheableLru } from '@openpanel/redis';
import { db } from '../prisma-client';
export async function getCurrentSalt() {
const salt = await db.salt.findFirst({
orderBy: {
createdAt: 'desc',
},
});
if (!salt) {
throw new Error('No salt found');
}
return salt.salt;
}
export const getSalts = cacheableLru(
'op:salt',
async () => {
@@ -31,13 +17,9 @@ export const getSalts = cacheableLru(
throw new Error('No salt found');
}
if (!prev) {
throw new Error('No salt found');
}
const salts = {
current: curr.salt,
previous: prev.salt,
previous: prev?.salt ?? curr.salt,
};
return salts;