diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-20 17:39:49 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-09-20 17:39:49 -0700 |
| commit | 413535b9c6d76f57e17bec50131e3144be421c05 (patch) | |
| tree | e0ab9959bac0de6d39810e6287be8e628f873d89 | |
| parent | Add manual save (diff) | |
| download | roseh.moe-413535b9c6d76f57e17bec50131e3144be421c05.tar.zst | |
Add temporary logging
| -rw-r--r-- | roseh.moe.go | 7 |
1 files changed, 7 insertions, 0 deletions
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 } |
