package auth import ( "net/http" "time" ) func SigninSetup(w http.ResponseWriter, cookieName, cookieValue string, expiresAt time.Time, secure bool) { maxAge := expiresAt.Sub(time.Now().UTC()) http.SetCookie(w, &http.Cookie{ Name: cookieName, Value: cookieValue, Path: "/", HttpOnly: true, SameSite: http.SameSiteLaxMode, Secure: secure, MaxAge: int(maxAge.Seconds()), }) } func SignoutCleanup(w http.ResponseWriter, cookieName string, secure bool) { http.SetCookie(w, &http.Cookie{ Name: cookieName, Value: "", Path: "/", HttpOnly: true, Secure: secure, SameSite: http.SameSiteLaxMode, MaxAge: -1, }) }