Skip to content

Instantly share code, notes, and snippets.

View SheIITear's full-sized avatar
🏠
Working from home

ShellTear SheIITear

🏠
Working from home
View GitHub Profile
@SheIITear
SheIITear / cookieHandler.ts
Last active March 16, 2024 02:42
Just a piece of code you can use to handle user authentication (cookies and validating them) in memory. This is not made for anything more than testing / PoC. (ps written for a school project while getting drunk)
import { randomBytes, createHmac } from 'crypto'
interface UserData {
cookie: string
ttl: number
salt: string
}
export class Auth {
#storage: Map<string, UserData>