Files
moloapp/example/fw/Cookies.hpp
T

22 lines
849 B
C++
Raw Normal View History

#pragma once
// First-class cookies: sign and verify values for session cookies.
// Signing here is a keyed FNV-1a demonstration, NOT production crypto.
// Gap: real signing and encryption live in 03-security.md (AES-GCM or
// ChaCha20-Poly1305); this stub exists so the example compiles and runs.
#include <string>
namespace molo::example::fw {
std::string cookie_sign(const std::string& value, const std::string& secret);
bool cookie_verify(const std::string& signed_value, const std::string& secret,
std::string& out_value);
std::string make_set_cookie(const std::string& name, const std::string& value,
const std::string& path, bool http_only,
bool secure, const std::string& same_site,
long max_age);
} // namespace molo::example::fw