jose-0.10: JSON Object Signing and Encryption (JOSE) and JSON Web Token (JWT) library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.JOSE.Error

Description

JOSE error types and helpers.

Synopsis

Running JOSE computations

runJOSE :: JOSE e m a -> m (Either e a) Source #

Run the JOSE computation. Result is an Either e a where e is the error type (typically Error or JWTError)

unwrapJOSE :: JOSE e m a -> ExceptT e m a Source #

Get the inner ExceptT value of the JOSE computation. Typically runJOSE would be preferred, unless you specifically need an ExceptT value.

newtype JOSE e m a Source #

Constructors

JOSE (ExceptT e m a) 

Instances

Instances details
Monad m => MonadError e (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

throwError :: e -> JOSE e m a #

catchError :: JOSE e m a -> (e -> JOSE e m a) -> JOSE e m a #

MonadTrans (JOSE e) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

lift :: Monad m => m a -> JOSE e m a #

MonadIO m => MonadIO (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

liftIO :: IO a -> JOSE e m a #

Monad m => Applicative (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

pure :: a -> JOSE e m a #

(<*>) :: JOSE e m (a -> b) -> JOSE e m a -> JOSE e m b #

liftA2 :: (a -> b -> c) -> JOSE e m a -> JOSE e m b -> JOSE e m c #

(*>) :: JOSE e m a -> JOSE e m b -> JOSE e m b #

(<*) :: JOSE e m a -> JOSE e m b -> JOSE e m a #

Functor m => Functor (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

fmap :: (a -> b) -> JOSE e m a -> JOSE e m b #

(<$) :: a -> JOSE e m b -> JOSE e m a #

Monad m => Monad (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

(>>=) :: JOSE e m a -> (a -> JOSE e m b) -> JOSE e m b #

(>>) :: JOSE e m a -> JOSE e m b -> JOSE e m b #

return :: a -> JOSE e m a #

MonadRandom m => MonadRandom (JOSE e m) Source # 
Instance details

Defined in Crypto.JOSE.Error

Methods

getRandomBytes :: ByteArray byteArray => Int -> JOSE e m byteArray #

Base error type and class

data Error Source #

All the errors that can occur.

Constructors

AlgorithmNotImplemented

A requested algorithm is not implemented

AlgorithmMismatch String

A requested algorithm cannot be used

KeyMismatch Text

Wrong type of key was given

KeySizeTooSmall

Key size is too small

OtherPrimesNotSupported

RSA private key with >2 primes not supported

RSAError Error

RSA encryption, decryption or signing error

CryptoError CryptoError

Various cryptonite library error cases

CompactDecodeError CompactDecodeError

Wrong number of parts in compact serialisation

JSONDecodeError String

JSON (Aeson) decoding error

NoUsableKeys

No usable keys were found in the key store

JWSCritUnprotected 
JWSNoValidSignatures

AnyValidated policy active, and no valid signature encountered

JWSInvalidSignature

AllValidated policy active, and invalid signature encountered

JWSNoSignatures

AllValidated policy active, and there were no signatures on object that matched the allowed algorithms

class AsError r where Source #

Minimal complete definition

_Error

Instances

Instances details
AsError Error Source # 
Instance details

Defined in Crypto.JOSE.Error

AsError JWTError Source # 
Instance details

Defined in Crypto.JWT

JOSE compact serialisation errors

data InvalidNumberOfParts Source #

The wrong number of parts were found when decoding a compact JOSE object.

Constructors

InvalidNumberOfParts Natural Natural

expected vs actual parts

expectedParts :: Getter InvalidNumberOfParts Natural Source #

Get the expected or actual number of parts.

actualParts :: Getter InvalidNumberOfParts Natural Source #

Get the expected or actual number of parts.

data CompactTextError Source #

Bad UTF-8 data in a compact object, at the specified index

data CompactDecodeError Source #

An error when decoding a JOSE compact object. JSON decoding errors that occur during compact object processing throw JSONDecodeError.