The signed-cookies package

[maintain]
Warnings:

Please see README.md


[Skip to ReadMe]

Properties

Version0.1.0.0
Dependenciesattoparsec, base (>=2 && <5), base64-bytestring, bytestring, scotty, SHA, signed-cookies, text, wai [details]
LicenseBSD3
Copyright2017 Kyle Gwinnup
AuthorKyle Gwinnup
Maintainerkpgwinnup@gmail.com
Stabilityexperimental
CategoryWeb
Home pagehttps://github.com/kgwinnup/signed-cookies
Bug trackerhttps://github.com/kgwinnup/signed-cookies/issues
Source repositoryhead: git clone https://github.com/kgwinnup/signed-cookies
Executablessigned-cookies-exe
UploadedSat Feb 4 16:23:09 UTC 2017 by kgwinnup

Modules

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for signed-cookies-0.1.0.0

Signed Cookies for Scotty Web Framework

The signed-cookies package exports two functions setCookie and getCookie. Besure to use the same signing key.

Example

{-# LANGUAGE OverloadedStrings #-}

module Main where

import Web.Scotty
import Web.Scotty.Internal.Types (ActionError(Next))
import Data.Text.Lazy (fromStrict, Text, pack, toStrict)

import Web.Scotty.SignedCookies

singleCookie = do
  setCookie "secret" "key" "value"
  setCookie "secret" "key2" "value2"
  text "single cookie"

readCookies = do
  cs <- header "Cookie"
  h <- getCookie "secret" "key"
  text $ pack . show $ h

main :: IO ()
main = scotty 3000 $ do
  get "/" singleCookie
  get "/read" readCookies