clientsession-0.2.1: Store session data in a cookie.Source codeContentsIndex
Web.ClientSession
Contents
Automatic key generation
Actual encryption/decryption
Key types and classes.
Exceptions
Synopsis
getKey :: FilePath -> IO Word256
defaultKeyFile :: String
getDefaultKey :: IO Word256
encrypt :: AESKey k => k -> ByteString -> String
decrypt :: (AESKey k, Monad m, Failure ClientSessionException m) => k -> String -> m ByteString
type Word256 = LargeKey Word64 Word192
class AESKeyIndirection a => AESKey a
data ClientSessionException
Automatic key generation
getKeySource
:: 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.
defaultKeyFile :: StringSource
The default key file.
getDefaultKey :: IO Word256Source
Simply calls getKey "client_session_key.aes"
Actual encryption/decryption
encryptSource
:: AESKey k
=> kThe key used for encryption.
-> ByteStringThe data to encrypt.
-> StringEncrypted and encoded data.
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.
decryptSource
:: (AESKey k, Monad m, Failure ClientSessionException m)
=> kThe key used for encryption.
-> StringData to decrypt.
-> m ByteStringThe decrypted data, if possible.
Base-64 decode and decrypt with the given key, if possible. Calls failure 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.
Key types and classes.
type Word256 = LargeKey Word64 Word192Source
class AESKeyIndirection a => AESKey a Source
show/hide Instances
Exceptions
data ClientSessionException Source
show/hide Instances
Produced by Haddock version 2.6.1