Safe Haskell | None |
---|---|
Language | Haskell2010 |
Crypto.Token
Description
Encrypted tokens/tickets to keep state in the client side.
For security reasons, Storable
data types MUST be fixed-size
when stored (i.e. serialized into the memory).
Synopsis
- data Config = Config {
- interval :: Int
- maxEntries :: Int
- defaultConfig :: Config
- data TokenManager
- spawnTokenManager :: Config -> IO TokenManager
- killTokenManager :: TokenManager -> IO ()
- encryptToken :: (Storable a, ByteArray ba) => TokenManager -> a -> IO ba
- decryptToken :: (Storable a, ByteArray ba) => TokenManager -> ba -> IO (Maybe a)
Configuration
Configuration for token manager.
Constructors
Config | |
Fields
|
defaultConfig :: Config Source #
Default configuration to update secrets in 30 minutes and keep them for 10 days.
Token manager
data TokenManager Source #
The abstract data type for token manager.
spawnTokenManager :: Config -> IO TokenManager Source #
Spawning a token manager.
killTokenManager :: TokenManager -> IO () Source #
Killing a token manager.
Encryption and decryption
encryptToken :: (Storable a, ByteArray ba) => TokenManager -> a -> IO ba Source #
Encrypting a target value to get a token.
decryptToken :: (Storable a, ByteArray ba) => TokenManager -> ba -> IO (Maybe a) Source #
Decrypting a token to get a target value.