summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-09-20 18:03:36 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-09-20 18:03:36 -0700
commit3a272baf38e1fe8a50be0cb0c1e4d330e7c256d3 (patch)
tree9a612980950c7fd382c94c9921f974800203ea5b
parentb5ee6ac430a6592b9a3d916848379759aa091544 (diff)
downloadroseh.moe-3a272baf38e1fe8a50be0cb0c1e4d330e7c256d3.tar.zst
Revert "Add temporary logging"
This reverts commit 413535b9c6d76f57e17bec50131e3144be421c05.
-rw-r--r--roseh.moe.go7
1 files changed, 0 insertions, 7 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 8c5a967..da88003 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -149,33 +149,26 @@ 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
}