signed-cookies: Secure cookie implementation for Scotty web framework

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] [Publish]

Warnings:

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.0
Change log None available
Dependencies attoparsec, base (>=2 && <5), base64-bytestring, bytestring, scotty, SHA, signed-cookies, text, wai [details]
License BSD-3-Clause
Copyright 2017 Kyle Gwinnup
Author Kyle Gwinnup
Maintainer kpgwinnup@gmail.com
Category Web
Home page https://github.com/kgwinnup/signed-cookies
Bug tracker https://github.com/kgwinnup/signed-cookies/issues
Source repo head: git clone https://github.com/kgwinnup/signed-cookies
Uploaded by kgwinnup at 2017-02-04T16:23:09Z

Modules

Downloads

Maintainer's Corner

Package maintainers

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