Public
Versions
- Open: VersionChanges from v50 to v51+1-0⦚ 90 unchanged lines ⦚audience: HANDLER_NAME,}, (payload) => {
const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `@${author}/authId/id`;});⦚ 124 unchanged lines ⦚⦚ 90 unchanged lines ⦚audience: HANDLER_NAME,}, (payload) => {console.log(payload)const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `@${author}/authId/id`;});⦚ 124 unchanged lines ⦚ - Open: VersionChanges from v49 to v50+5-5⦚ 9 unchanged lines ⦚import { email } from "https://esm.town/v/std/email";
const { slug, httpEndpoint: ENDPOINT } = extractValInfo(import.meta.url);export const NAME = "@" + slug;export const COOKIE_NAME = "AUTH_ID_TOKEN";⦚ 77 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `@${author}/id`;});return Response.json(payload);⦚ 41 unchanged lines ⦚verifyToken(qs.get("token"), "signin");cookie = await createToken({scope: "auth",aud: NAME,});⦚ 69 unchanged lines ⦚"token",await createToken({aud: [name, "@postpostscript/callbackRequest"],scope: "id @postpostscript/callbackRequest",}),);return Response.redirect(redirectURL + "?" + redirectQS.toString());}⦚ 9 unchanged lines ⦚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";⦚ 77 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `@${author}/authId/id`;});return Response.json(payload);⦚ 41 unchanged lines ⦚verifyToken(qs.get("token"), "signin");cookie = await createToken({scope: `${NAME}/auth`,aud: NAME,});⦚ 69 unchanged lines ⦚"token",await createToken({aud: [name, `@${AUTHOR}/callback`],scope: `@${NAME}/id @${AUTHOR}/callback/request`,}),);return Response.redirect(redirectURL + "?" + redirectQS.toString());} - Open: VersionChanges from v48 to v49+1-1⦚ 91 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];
return `${author}/id`;});return Response.json(payload);⦚ 123 unchanged lines ⦚⦚ 91 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `@${author}/id`;});return Response.json(payload);⦚ 123 unchanged lines ⦚ - Open: VersionChanges from v47 to v48+3-3⦚ 91 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];
return `${author}/authId`});return Response.json(payload)} catch (e) {console.log("error while parsing token qs", e)}}⦚ 119 unchanged lines ⦚⦚ 91 unchanged lines ⦚}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `${author}/id`;});return Response.json(payload);} catch (e) {console.log("error while parsing token qs", e);}}⦚ 119 unchanged lines ⦚ - Open: VersionChanges from v46 to v47+11-4⦚ 86 unchanged lines ⦚if (qs.get("token")) {
const payload = await verifyThirdParty(qs.get("token"), {audience: HANDLER_NAME,}, "id");return Response.json(payload)}⦚ 118 unchanged lines ⦚⦚ 86 unchanged lines ⦚if (qs.get("token")) {try {const payload = await verifyThirdParty(qs.get("token"), {audience: HANDLER_NAME,}, (payload) => {const author = payload.iss?.match(/^@(\w+)\/\w+$/)?.[1];return `${author}/authId`});return Response.json(payload)} catch (e) {console.log("error while parsing token qs", e)}}⦚ 118 unchanged lines ⦚ - Open: VersionChanges from v45 to v46+1-0⦚ 89 unchanged lines ⦚audience: HANDLER_NAME,}, "id");
}// cookie ??= getAuthCookie(req);⦚ 117 unchanged lines ⦚⦚ 89 unchanged lines ⦚audience: HANDLER_NAME,}, "id");return Response.json(payload)}// cookie ??= getAuthCookie(req);⦚ 117 unchanged lines ⦚ - Open: VersionChanges from v44 to v45+14-13⦚ 89 unchanged lines ⦚audience: HANDLER_NAME,}, "id");
const token = await createToken({scope: "requestAuth",aud: [NAME, HANDLER_NAME],});const redirectQS = new URLSearchParams();redirectQS.set("redirect", HANDLER_NAME);redirectQS.set("requestToken", token);return Response.redirect(ENDPOINT + "/?" + redirectQS.toString());try {} catch (e) {console.log("signin token validation failed", e);}}cookie ??= getAuthCookie(req);};}⦚ 102 unchanged lines ⦚⦚ 89 unchanged lines ⦚audience: HANDLER_NAME,}, "id");}// cookie ??= getAuthCookie(req);// const token = await createToken({// scope: "requestAuth",// aud: [NAME, HANDLER_NAME],// });// const redirectQS = new URLSearchParams();// redirectQS.set("redirect", HANDLER_NAME);// redirectQS.set("requestToken", token);// return Response.redirect(ENDPOINT + "/?" + redirectQS.toString());// try {// } catch (e) {// console.log("signin token validation failed", e);// }};}⦚ 102 unchanged lines ⦚ - Open: VersionChanges from v43 to v44+1-1⦚ 91 unchanged lines ⦚const token = await createToken({scope: "requestAuth",
aud: NAME,});const redirectQS = new URLSearchParams();⦚ 114 unchanged lines ⦚⦚ 91 unchanged lines ⦚const token = await createToken({scope: "requestAuth",aud: [NAME, HANDLER_NAME],});const redirectQS = new URLSearchParams();⦚ 114 unchanged lines ⦚ - Open: Version+210-0import { getCookies, setCookie } from "https://deno.land/std/http/cookie.ts";import type { 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 { 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 { 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;scope: string;aud?: string | string[];nbf?: number;iat?: number;
postpostscript-authid.web.val.run
Updated: March 3, 2024