From 413535b9c6d76f57e17bec50131e3144be421c05 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 20 Sep 2025 17:39:49 -0700 Subject: Add temporary logging --- roseh.moe.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'roseh.moe.go') diff --git a/roseh.moe.go b/roseh.moe.go index da88003..8c5a967 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -149,26 +149,33 @@ func attachCookie(w http.ResponseWriter) error { func checkCookie(w http.ResponseWriter, r *http.Request) bool { cookie, err := r.Cookie("auth") if err != nil { + fmt.Println("no cookie") return false } bytes, err := base64.RawStdEncoding.DecodeString(cookie.Value) if err != nil { + fmt.Printf("bad base64: %s\n", err) return false } if len(bytes) < ed25519.SignatureSize { + fmt.Printf("too small\n") return false } msg, sig := bytes[:len(bytes)-ed25519.SignatureSize], bytes[len(bytes)-ed25519.SignatureSize:] if !ed25519.Verify(publicKey, msg, sig) { + fmt.Printf("bad sig\n") return false } var t time.Time if err := t.UnmarshalBinary(msg); err != nil { + fmt.Printf("bad time.Time\n") return false } if time.Since(t) > cookieExpiration { + fmt.Printf("expired\n") return false } + fmt.Printf("verified\n") attachCookie(w) return true } -- cgit v1.3.1