diff options
| -rw-r--r-- | roseh.moe.go | 7 |
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 } |
