Public
Back
Version 85
3/2/2024
import { getCookies, setCookie } from "https://deno.land/std/http/cookie.ts";
import type { JWTPayload, JWTVerifyOptions } from "https://deno.land/x/jose@v5.2.2/index.ts";
import { rootValRef } from "https://esm.town/v/andreterron/rootValRef";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { html, htmlResponse, Layout } from "https://esm.town/v/postpostscript/htmlComponentLibrary";
import { generate, verify, verifyThirdParty } from "https://esm.town/v/postpostscript/jwks";
import {
getValEndpointFromName,
getValEndpointFromUrl,
getValUrlFromName,
} from "https://esm.town/v/postpostscript/meta";
import { format } from "https://esm.town/v/postpostscript/multiFormat";
import type { MaybePromise } from "https://esm.town/v/postpostscript/typeUtils";
import { email } from "https://esm.town/v/std/email";
const { author: AUTHOR, slug, httpEndpoint: ENDPOINT } = extractValInfo(import.meta.url);
export const NAME = "@" + slug;
export const COOKIE_NAME = "AUTH_ID_TOKEN";
export function setAuthCookie(res: Response, token: string) {
setCookie(res.headers, {
name: COOKIE_NAME,
value: token,
httpOnly: true,
secure: true,
sameSite: "Lax",
});
}
export function getAuthCookie(req: Request) {
return getCookies(req.headers)[COOKIE_NAME];
}
export function createToken(
payload: {
sub?: string;
postpostscript-authid.web.val.run
Updated: March 3, 2024