Auth and session middleware.

This commit is contained in:
Mike Cao 2020-07-27 23:52:14 -07:00
parent 590a70c2ff
commit d81ee3932d
14 changed files with 142 additions and 73 deletions

8
lib/auth.js Normal file
View file

@ -0,0 +1,8 @@
import { parse } from 'cookie';
import { verifySecureToken } from './crypto';
export default async req => {
const token = parse(req.headers.cookie)['umami.auth'];
return verifySecureToken(token);
};