···1784178417851785/// Get a cookie from the request.
17861786///
17871787-/// If you wish to get multiple cookies you may want to use the `get_cookies`
17881788-/// function to avoid parsing the cookie headers multiple times.
17871787+/// If a cookie is missing, found to be malformed, or the signature is invalid
17881788+/// for a signed cookie, then `Error(Nil)` is returned.
17891789///
17901790/// ```gleam
17911791/// wisp.get_cookie(request, "group")
17921792/// // -> Ok("A")
17931793/// ```
17941794///
17951795-pub fn get_cookie(request: Request, name: String) -> Result(String, Nil) {
17951795+pub fn get_cookie(
17961796+ request: Request,
17971797+ name: String,
17981798+ security: Security,
17991799+) -> Result(String, Nil) {
17961800 use value <- result.try(
17971801 request
17981802 |> request.get_cookies
17991803 |> list.key_find(name),
18001804 )
18011801- case value {
18021802- "SFM1MTI." <> _ -> verify_signed_message(request, value)
18031803- _ -> base.decode64(value)
18051805+ case security {
18061806+ PlainText -> base.decode64(value)
18071807+ Signed -> verify_signed_message(request, value)
18041808 }
18051809 |> result.try(bit_string.to_string)
18061810}