MCPcopy Create free account
hub / github.com/SOS-RS/backend / getSessionData

Function getSessionData

src/utils/utils.ts:39–54  ·  view source on GitHub ↗
(token?: string)

Source from the content-addressed store, hash-verified

37}
38
39function getSessionData(token?: string): { userId: string; sessionId: string } {
40 try {
41 if (token) {
42 const splited = token.split('.');
43 if (splited.length === 3) {
44 const { userId, sessionId } = JSON.parse(
45 Buffer.from(splited[1], 'base64').toString('utf-8'),
46 );
47 return { userId, sessionId };
48 }
49 }
50 } catch (err) {
51 Logger.error(`Error to get session data: ${err}`, getSessionData.name);
52 }
53 return { userId: '', sessionId: '' };
54}
55
56function deepMerge(target: Record<string, any>, source: Record<string, any>) {
57 if (Array.isArray(target) && Array.isArray(source)) {

Callers 2

useMethod · 0.90
handlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected