A decentralized music tracking and discovery platform built on AT Protocol 🎵 forked from rocksky.app/rocksky
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829import type { AuthOutput } from "@atproto/xrpc-server";import type express from "express";import jwt from "jsonwebtoken";import { env } from "./env";
type ReqCtx = { req: express.Request;};
export default function authVerifier(ctx: ReqCtx): AuthOutput { if (!ctx.req.headers.authorization) { return {}; }
const bearer = (ctx.req.headers.authorization || "").split(" ")[1]?.trim();
if (bearer && bearer !== "null") { const credentials = jwt.verify(bearer, env.JWT_SECRET, { ignoreExpiration: true, });
return { credentials, }; }
return {};}