update visitId hash and expiration logic
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { startOfMonth } from 'date-fns';
|
||||
import { startOfHour, startOfMonth } from 'date-fns';
|
||||
import { hash } from 'next-basics';
|
||||
import { v4, v5, validate } from 'uuid';
|
||||
|
||||
@@ -12,6 +12,12 @@ export function salt() {
|
||||
return hash(secret(), ROTATING_SALT);
|
||||
}
|
||||
|
||||
export function sessionSalt() {
|
||||
const ROTATING_SALT = hash(startOfHour(new Date()).toUTCString());
|
||||
|
||||
return hash(secret(), ROTATING_SALT);
|
||||
}
|
||||
|
||||
export function uuid(...args: any) {
|
||||
if (!args.length) return v4();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user