Module Web.Session

val find : ?⁠cookie_key:string -> ?⁠secret:string -> string -> Opium.Request.t -> string option

find ?cookie_key ?secret key request returns the value that is associated to the key in the current session of the request.

cookie_key is the name of the session cookie. By default, the value is _session.

secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.

val set : ?⁠cookie_key:string -> ?⁠secret:string -> (string * string) list -> Opium.Response.t -> Opium.Response.t

set ?cookie_key ?secret data response returns a response that has data associated to the current session by setting the session cookie of the response. set replaces the current session.

cookie_key is the name of the session cookie. By default, the value is _session. If there is a session cookie already present it gets replaced.

secret is the secret used to sign the session cookie. By default, SIHL_SECRET is used.