The signed-cookies package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Warnings:

Please see README.md


[Skip to ReadMe]

Properties

Version0.1.0.0
Change logNone available
Dependenciesattoparsec, base (>=2 && <5), base64-bytestring, bytestring, scotty, SHA, signed-cookies, text, wai [details]
LicenseBSD3
Copyright2017 Kyle Gwinnup
AuthorKyle Gwinnup
Maintainerkpgwinnup@gmail.com
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

[back to package description]

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