module Crypto.Store.Error
( StoreError(..)
, fromCryptoFailable
) where
import Crypto.Error
import Crypto.PubKey.RSA.Types as RSA
import Data.ASN1.Error
data StoreError =
CryptoError CryptoError
| RSAError RSA.Error
| DecodingError ASN1Error
| ParseFailure String
| DecryptionFailed
| BadContentMAC
| BadChecksum
| DigestMismatch
| SignatureNotVerified
| InvalidInput String
| InvalidPassword String
| InvalidParameter String
| UnexpectedPublicKeyType
| UnexpectedPrivateKeyType
| RecipientTypeMismatch
| RecipientKeyNotFound
| NoRecipientInfoFound
| NoRecipientInfoMatched
| UnsupportedOriginatorFormat
| UnsupportedEllipticCurve
| NamedCurveRequired
deriving (Int -> StoreError -> ShowS
[StoreError] -> ShowS
StoreError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StoreError] -> ShowS
$cshowList :: [StoreError] -> ShowS
show :: StoreError -> String
$cshow :: StoreError -> String
showsPrec :: Int -> StoreError -> ShowS
$cshowsPrec :: Int -> StoreError -> ShowS
Show,StoreError -> StoreError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StoreError -> StoreError -> Bool
$c/= :: StoreError -> StoreError -> Bool
== :: StoreError -> StoreError -> Bool
$c== :: StoreError -> StoreError -> Bool
Eq)
fromCryptoFailable ::CryptoFailable a -> Either StoreError a
fromCryptoFailable :: forall a. CryptoFailable a -> Either StoreError a
fromCryptoFailable (CryptoPassed a
a) = forall a b. b -> Either a b
Right a
a
fromCryptoFailable (CryptoFailed CryptoError
e) = forall a b. a -> Either a b
Left (CryptoError -> StoreError
CryptoError CryptoError
e)