03568c88e3
- frontend/functions/core/format_datetime_short.md - frontend/functions/core/format_datetime_short.test.ts - frontend/functions/core/format_datetime_short.ts - frontend/functions/core/format_duration.md - frontend/functions/core/format_duration.test.ts - frontend/functions/core/format_duration.ts - frontend/functions/core/month_grid.md - frontend/functions/core/month_grid.test.ts - frontend/functions/core/month_grid.ts - frontend/functions/core/string_hash_palette.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
22 lines
560 B
Go
22 lines
560 B
Go
package infra
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
// SessionCookieSet writes a session cookie to the response.
|
|
// The cookie is HttpOnly, Path="/", SameSite=Lax and expires at the
|
|
// Unix timestamp expiresAt (seconds). It does not return an error
|
|
// because http.SetCookie never fails at runtime.
|
|
func SessionCookieSet(w http.ResponseWriter, name, token string, expiresAt int64) {
|
|
http.SetCookie(w, &http.Cookie{
|
|
Name: name,
|
|
Value: token,
|
|
Path: "/",
|
|
HttpOnly: true,
|
|
SameSite: http.SameSiteLaxMode,
|
|
Expires: time.Unix(expiresAt, 0),
|
|
})
|
|
}
|