logmein
Viewing readonly version: 160View latest version
Script
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Cookie, deleteCookie, getCookies, setCookie } from "https://deno.land/std/http/cookie.ts";
export const SESSION_COOKIE_NAME = "logmein_session";
function setSessionCookie(key: string): Cookie {
return {
name: "session",
value: key,
path: "/",
httpOnly: true,
secure: true,
sameSite: "Strict",
};
}
export function getSessionKey(headers: Headers): string | undefined {
return getCookies(headers)[SESSION_COOKIE_NAME];
}
export function setSession(key: string, headers: Headers) {
const cookie = setSessionCookie(key);
setCookie(headers, cookie);
}