feat: adding session hash

This commit is contained in:
Chubby Granny Chaser
2024-06-21 02:37:49 +01:00
parent 458acb0b70
commit 9ef6329799
7 changed files with 116 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
import jwt from "jsonwebtoken";
import { userAuthRepository } from "@main/repository";
import { registerEvent } from "../register-event";
const getSessionHash = async (_event: Electron.IpcMainInvokeEvent) => {
const auth = await userAuthRepository.findOne({ where: { id: 1 } });
if (!auth) return null;
const payload = jwt.decode(auth.accessToken) as jwt.JwtPayload;
return payload.sessionId;
};
registerEvent("getSessionHash", getSessionHash);