After a user logs in by sending a POST to say /login, then passport will attach a session cookie, so that a persistent session is established. This is done via the serializeUser function. Then express-session will use this function to generate a hash (computed using HMAC) and sends it over.
On the next request, passport somehow manages to decrypt the hashed string using deserializeUser function and retrieve the user data from that. How is this possible if express-session really hashes the string? Aren't hashes one-way-only functions? And if express-session doesn't hash the string, then isn't that a security vulnerability?