confcrypt-0.1.0.4

Copyright(c) 2018 Chris Coffey
(c) 2018 CollegeVine
LicenseMIT
MaintainerChris Coffey
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

ConfCrypt.Types

Contents

Description

Core types and some small helper functions used to construct ConfCrypt.

Synopsis

Core types

type ConfCryptM m ctx = ReaderT (ConfCryptFile, ctx) (ExceptT ConfCryptError (ResourceT m)) #

The core transformer stack for ConfCrypt. The most important parts are the ReaderT and ResourceT, as ExceptT can be replaced with explicit return type.

Errors

data ConfCryptError #

The possible errors produced during a confcrypt operation.

Instances
Eq ConfCryptError # 
Instance details

Defined in ConfCrypt.Types

Ord ConfCryptError # 
Instance details

Defined in ConfCrypt.Types

Show ConfCryptError # 
Instance details

Defined in ConfCrypt.Types

Generic ConfCryptError # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep ConfCryptError :: Type -> Type #

Monad m => Command NewConfCrypt (ConfCryptM m ()) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: NewConfCrypt -> ConfCryptM m () [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ValidateConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Monad m => Command DeleteConfCrypt (ConfCryptM m ()) # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command EditConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: EditConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command AddConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: AddConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command GetConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: GetConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: ReadConfCrypt -> ConfCryptM m key [Text] #

MonadRandom m => MonadRandom (ConfCryptM m k) # 
Instance details

Defined in ConfCrypt.Encryption

Methods

getRandomBytes :: ByteArray byteArray => Int -> ConfCryptM m k byteArray #

MonadEncrypt (ConfCryptM IO (RemoteKey AWSCtx)) (RemoteKey AWSCtx) # 
Instance details

Defined in ConfCrypt.Encryption

MonadDecrypt (ConfCryptM IO (RemoteKey AWSCtx)) (RemoteKey AWSCtx) # 
Instance details

Defined in ConfCrypt.Encryption

type Rep ConfCryptError # 
Instance details

Defined in ConfCrypt.Types

type Rep ConfCryptError = D1 (MetaData "ConfCryptError" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (((C1 (MetaCons "ParserError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: C1 (MetaCons "NonRSAKey" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "KeyUnpackingError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "DecryptionError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: C1 (MetaCons "AWSDecryptionError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))) :+: ((C1 (MetaCons "AWSEncryptionError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "EncryptionError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Error)) :+: C1 (MetaCons "MissingLine" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))) :+: (C1 (MetaCons "UnknownParameter" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "WrongFileAction" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: C1 (MetaCons "CleanupError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text))))))

Runtime Environment

data ConfCryptFile #

As indicated in the Readme, a ConfCrypt file

Instances
Show ConfCryptFile # 
Instance details

Defined in ConfCrypt.Types

Generic ConfCryptFile # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep ConfCryptFile :: Type -> Type #

NFData ConfCryptFile # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: ConfCryptFile -> () #

Monad m => Command NewConfCrypt (ConfCryptM m ()) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: NewConfCrypt -> ConfCryptM m () [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ValidateConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Monad m => Command DeleteConfCrypt (ConfCryptM m ()) # 
Instance details

Defined in ConfCrypt.Commands

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command EditConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: EditConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadRandom m, MonadEncrypt (ConfCryptM m key) key) => Command AddConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: AddConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command GetConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: GetConfCrypt -> ConfCryptM m key [Text] #

(Monad m, MonadDecrypt (ConfCryptM m key) key) => Command ReadConfCrypt (ConfCryptM m key) # 
Instance details

Defined in ConfCrypt.Commands

Methods

evaluate :: ReadConfCrypt -> ConfCryptM m key [Text] #

HasEnv (ConfCryptFile, AWSCtx) # 
Instance details

Defined in ConfCrypt.Providers.AWS

MonadRandom m => MonadRandom (ConfCryptM m k) # 
Instance details

Defined in ConfCrypt.Encryption

Methods

getRandomBytes :: ByteArray byteArray => Int -> ConfCryptM m k byteArray #

MonadEncrypt (ConfCryptM IO (RemoteKey AWSCtx)) (RemoteKey AWSCtx) # 
Instance details

Defined in ConfCrypt.Encryption

MonadDecrypt (ConfCryptM IO (RemoteKey AWSCtx)) (RemoteKey AWSCtx) # 
Instance details

Defined in ConfCrypt.Encryption

type Rep ConfCryptFile # 
Instance details

Defined in ConfCrypt.Types

type Rep ConfCryptFile = D1 (MetaData "ConfCryptFile" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (C1 (MetaCons "ConfCryptFile" PrefixI True) (S1 (MetaSel (Just "fileName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: (S1 (MetaSel (Just "fileContents") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ConfCryptElement LineNumber)) :*: S1 (MetaSel (Just "parameters") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Parameter]))))

data Parameter #

A parameter consists of both a ParamLine and Schema line from the confcr

Instances
Eq Parameter # 
Instance details

Defined in ConfCrypt.Types

Ord Parameter # 
Instance details

Defined in ConfCrypt.Types

Show Parameter # 
Instance details

Defined in ConfCrypt.Types

Generic Parameter # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep Parameter :: Type -> Type #

NFData Parameter # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: Parameter -> () #

type Rep Parameter # 
Instance details

Defined in ConfCrypt.Types

type Rep Parameter = D1 (MetaData "Parameter" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (C1 (MetaCons "Parameter" PrefixI True) (S1 (MetaSel (Just "paramName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: (S1 (MetaSel (Just "paramValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "paramType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe SchemaType)))))

File Format

data ConfCryptElement #

The syntax used to describe a confcrypt file. A line in a confcrypt file may be one of Schema, ParamLine, or comment. The grammar itself is described in the readme and Parser.

Instances
Eq ConfCryptElement #

this implementation means that there can only be a single parameter or schema with the same name. Attempting to add multiple with the same name is undefined behavior and will result in missing data.

Instance details

Defined in ConfCrypt.Types

Ord ConfCryptElement #

In order to

Instance details

Defined in ConfCrypt.Types

Show ConfCryptElement # 
Instance details

Defined in ConfCrypt.Types

Generic ConfCryptElement # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep ConfCryptElement :: Type -> Type #

NFData ConfCryptElement # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: ConfCryptElement -> () #

type Rep ConfCryptElement # 
Instance details

Defined in ConfCrypt.Types

newtype LineNumber #

Self explanitory

Constructors

LineNumber Int 
Instances
Eq LineNumber # 
Instance details

Defined in ConfCrypt.Types

Ord LineNumber # 
Instance details

Defined in ConfCrypt.Types

Show LineNumber # 
Instance details

Defined in ConfCrypt.Types

Generic LineNumber # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep LineNumber :: Type -> Type #

NFData LineNumber # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: LineNumber -> () #

type Rep LineNumber # 
Instance details

Defined in ConfCrypt.Types

type Rep LineNumber = D1 (MetaData "LineNumber" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" True) (C1 (MetaCons "LineNumber" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data SchemaType #

Indicates which types a

Constructors

CString

Maps to String

CInt

Maps to Int

CBoolean

Maps to Bool

Instances
Eq SchemaType # 
Instance details

Defined in ConfCrypt.Types

Ord SchemaType # 
Instance details

Defined in ConfCrypt.Types

Read SchemaType # 
Instance details

Defined in ConfCrypt.Types

Show SchemaType # 
Instance details

Defined in ConfCrypt.Types

Generic SchemaType # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep SchemaType :: Type -> Type #

NFData SchemaType # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: SchemaType -> () #

type Rep SchemaType # 
Instance details

Defined in ConfCrypt.Types

type Rep SchemaType = D1 (MetaData "SchemaType" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (C1 (MetaCons "CString" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "CInt" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "CBoolean" PrefixI False) (U1 :: Type -> Type)))

data ParamLine #

A parsed parameter line from a confcrypt file

Constructors

ParamLine 

Fields

Instances
Eq ParamLine # 
Instance details

Defined in ConfCrypt.Types

Ord ParamLine # 
Instance details

Defined in ConfCrypt.Types

Show ParamLine # 
Instance details

Defined in ConfCrypt.Types

Generic ParamLine # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep ParamLine :: Type -> Type #

NFData ParamLine # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: ParamLine -> () #

type Rep ParamLine # 
Instance details

Defined in ConfCrypt.Types

type Rep ParamLine = D1 (MetaData "ParamLine" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (C1 (MetaCons "ParamLine" PrefixI True) (S1 (MetaSel (Just "pName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "pValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Schema #

A parsed schema line from a confcrypt file

Constructors

Schema 

Fields

Instances
Eq Schema # 
Instance details

Defined in ConfCrypt.Types

Methods

(==) :: Schema -> Schema -> Bool #

(/=) :: Schema -> Schema -> Bool #

Ord Schema # 
Instance details

Defined in ConfCrypt.Types

Show Schema # 
Instance details

Defined in ConfCrypt.Types

Generic Schema # 
Instance details

Defined in ConfCrypt.Types

Associated Types

type Rep Schema :: Type -> Type #

Methods

from :: Schema -> Rep Schema x #

to :: Rep Schema x -> Schema #

NFData Schema # 
Instance details

Defined in ConfCrypt.Types

Methods

rnf :: Schema -> () #

type Rep Schema # 
Instance details

Defined in ConfCrypt.Types

type Rep Schema = D1 (MetaData "Schema" "ConfCrypt.Types" "confcrypt-0.1.0.4-DVHvSaFYzUh4p1s8F9TW6i" False) (C1 (MetaCons "Schema" PrefixI True) (S1 (MetaSel (Just "sName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "sType") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 SchemaType)))

Key constraints

class LocalKey key #

This constraint provides a type-level check that the wrapped key type is local to the current machine. For use with things like RSA keys.

Instances
LocalKey PublicKey # 
Instance details

Defined in ConfCrypt.Encryption

LocalKey PrivateKey # 
Instance details

Defined in ConfCrypt.Encryption

class KMSKey key #

This constraint provides a type-level check that the wrapped key type exists off-system inside an externally provided Key Management System (KMS). For use with AWS KMS or Azure KMS.

Instances
KMSKey AWSCtx # 
Instance details

Defined in ConfCrypt.Encryption

Helpers

unWrapSchema :: ConfCryptElement -> Maybe Schema #

Attempts to unwrap a line from a confcrypt file into a Schema

isParameter :: ConfCryptElement -> Bool #

Checks whether the provided line from a confcrypt file is a Parameter

typeToOutputString :: SchemaType -> Text #

A special purpose Show function for convert

parameterToLines :: Parameter -> (ParamLine, Maybe Schema) #

Convert a parameter into a ParameterLine and SchemaLine if possible.

Orphan instances

Ord Error # 
Instance details

Methods

compare :: Error -> Error -> Ordering #

(<) :: Error -> Error -> Bool #

(<=) :: Error -> Error -> Bool #

(>) :: Error -> Error -> Bool #

(>=) :: Error -> Error -> Bool #

max :: Error -> Error -> Error #

min :: Error -> Error -> Error #