umami/lib/auth.js
2020-08-04 22:45:05 -07:00

10 lines
277 B
JavaScript

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