| License | BSD3 |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Data.CryptoID.Class
Description
Polymorphic functions to perform cryptographic operations on CryptoIDs in a monadic context
- class MonadThrow m => MonadCrypto (m :: * -> *) where
- type MonadCryptoKey m :: *
- class MonadCrypto m => HasCryptoID (namespace :: Symbol) (ciphertext :: *) (plaintext :: *) (m :: * -> *) where
Documentation
class MonadThrow m => MonadCrypto (m :: * -> *) where Source #
Class of monads granting reader access to a key and allowing for failure during cryptographic operations
This formulation is weaker than MonadReader key (from mtl) in that it does not require local.
Minimal complete definition
Associated Types
type MonadCryptoKey m :: * Source #
Methods
cryptoIDKey :: (MonadCryptoKey m -> m a) -> m a Source #
class MonadCrypto m => HasCryptoID (namespace :: Symbol) (ciphertext :: *) (plaintext :: *) (m :: * -> *) where Source #
Multiparameter typeclass of (namespace, ciphertext, plaintext, monad) tuples which allow for cryptographic operations on CryptoIDs with appropriate namespace, plaintext, and ciphertext, utilising the state of monad
Instances of this typeclass are usually universally quantified over (at least) namespace, and m
Methods
encrypt :: plaintext -> m (CryptoID namespace ciphertext) Source #
Encrypt a plaintext in a fashion dependent on the namespace and desired ciphertext-type retrieving the key from and throwing errors into m
decrypt :: CryptoID namespace ciphertext -> m plaintext Source #
Encrypt a ciphertext in a fashion dependent on the namespace and desired plaintext-type retrieving the key from and throwing errors into m