⬆️ v3.0.0 (#704)

This commit is contained in:
Luke Vella 2023-06-19 17:17:00 +01:00 committed by GitHub
parent 735056f25f
commit c22b3abc4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
385 changed files with 19912 additions and 5250 deletions

View file

@ -1,8 +1,17 @@
import { TimeFormat } from "@rallly/database";
import { sealData, unsealData } from "iron-session";
import { sessionConfig } from "./session-config";
type UserSessionData = { id: string; isGuest: boolean };
type UserSessionData = {
id: string;
isGuest: boolean;
preferences?: {
timeZone?: string;
weekStart?: number;
timeFormat?: TimeFormat;
};
};
declare module "iron-session" {
export interface IronSessionData {
@ -16,6 +25,7 @@ export const decryptToken = async <P extends Record<string, unknown>>(
const payload = await unsealData(token, {
password: sessionConfig.password,
});
if (Object.keys(payload).length === 0) {
return null;
}