Revert uuid.

This commit is contained in:
Mike Cao 2023-07-28 17:21:34 -07:00
parent 1f2da530c9
commit bd9ff9a0df
15 changed files with 31 additions and 16 deletions

View file

@ -1,5 +1,6 @@
import { startOfMonth } from 'date-fns';
import { hash } from 'next-basics';
import { v4, v5, validate } from 'uuid';
export function secret() {
return hash(process.env.APP_SECRET || process.env.DATABASE_URL);
@ -10,3 +11,13 @@ export function salt() {
return hash(secret(), ROTATING_SALT);
}
export function uuid(...args) {
if (!args.length) return v4();
return v5(hash(...args), v5.DNS);
}
export function isUuid(value) {
return validate(value);
}