1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-22 09:13:37 +01:00
umami/lib/auth.js

10 lines
275 B
JavaScript

import { parse } from 'cookie';
import { parseSecureToken } from './crypto';
import { AUTH_COOKIE_NAME } from './constants';
export async function verifyAuthToken(req) {
const token = parse(req.headers.cookie || '')[AUTH_COOKIE_NAME];
return parseSecureToken(token);
}