-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | crypto tokens
--   
--   Encrypted tokens/tickets to keep state in the client side.
@package crypto-token
@version 0.1.2

-- | Encrypted tokens/tickets to keep state in the client side.
module Crypto.Token

-- | Configuration for token manager.
data Config

-- | Default configuration to update secrets in 30 minutes (1,800 seconds)
--   and token lifetime is 2 hours (7,200 seconds)
--   
--   
--   >>> defaultConfig
--   Config {interval = 1800, tokenLifetime = 7200}
--   
defaultConfig :: Config

-- | The interval to generate a new secret and remove the oldest one in
--   seconds.
interval :: Config -> Int

-- | The token lifetime, that is, tokens can be decrypted in this period.
tokenLifetime :: Config -> Int
threadName :: Config -> String

-- | The abstract data type for token manager.
data TokenManager

-- | Spawning a token manager.
spawnTokenManager :: Config -> IO TokenManager

-- | Killing a token manager.
killTokenManager :: TokenManager -> IO ()

-- | Encrypting a target value to get a token.
encryptToken :: TokenManager -> ByteString -> IO ByteString

-- | Decrypting a token to get a target value.
decryptToken :: TokenManager -> ByteString -> IO (Maybe ByteString)
instance GHC.Classes.Eq Crypto.Token.Config
instance GHC.Internal.Show.Show Crypto.Token.Config
