clientsession-0.0.0: Store session data in a cookie.Source codeContentsIndex
MaintainerMichael Snoyman <>
Automatic key generation
Actual encryption/decryption
Stores session data in a client cookie.
getKey :: FilePath -> IO Word256
getDefaultKey :: IO Word256
encrypt :: (IsByteString b, AESKey k) => k -> b -> String
decrypt :: (AESKey k, Monad m, IsByteString b) => k -> String -> m b
class IsByteString a where
toByteString :: a -> ByteString
fromByteString :: ByteString -> a
Automatic key generation
:: FilePathFile name where key is stored.
-> IO Word256The actual 256-bit key.
Get a 256-bit key from the given text file. If the file does not exist, or did not contain enough bits, a random key will be generated and stored in that file.
getDefaultKey :: IO Word256Source
Simply calls getKey "client_session_key.aes"
Actual encryption/decryption
:: (IsByteString b, AESKey k)
=> kThe data to encrypt.
-> bEncrypted and encoded data.
-> String
Encrypt with the given key and base-64 encode. A hash is stored inside the encrypted key so that, upon decryption, integrity can be guaranteed.
:: (AESKey k, Monad m, IsByteString b)
=> kData to decrypt.
-> StringThe decrypted data, if possible.
-> m b
Base-64 decode and decrypt with the given key, if possible. If either the original string is not a valid base-64 encoded string, or the hash at the beginning of the decrypted string does not match, this function fails.
class IsByteString a whereSource
A class for anything which can become a Data.ByteString. The String instance uses UTF8 encoding.
toByteString :: a -> ByteStringSource
fromByteString :: ByteString -> aSource
show/hide Instances
Produced by Haddock version 2.6.0