MCPcopy Create free account
hub / github.com/ShipSecAI/studio / createSessionToken

Function createSessionToken

backend/src/auth/session.utils.ts:26–33  ·  view source on GitHub ↗
(username: string)

Source from the content-addressed store, hash-verified

24 * Create a signed session token for local auth.
25 */
26export function createSessionToken(username: string): string {
27 const secret = getSessionSecret();
28 const payload = JSON.stringify({ username, ts: Date.now() });
29 const hmac = crypto.createHmac('sha256', secret);
30 hmac.update(payload);
31 const signature = hmac.digest('hex');
32 return Buffer.from(`${payload}.${signature}`).toString('base64');
33}
34
35/**
36 * Verify and decode a session token.

Callers 1

loginMethod · 0.90

Calls 3

getSessionSecretFunction · 0.85
fromMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected