e-0.1.0.0: Express sensitive data inside text files in readable and compact way.

Safe HaskellNone
LanguageHaskell2010

E.Template

Contents

Description

A text file with sensitive data.

Tem could contain plain text, plain values PlainValue that would be encrypted, and references to already encrypted values ValRef.

PlainValue syntax

{{P|<variable name>|<encryption algorithm name>|<arguments>|<content>}}

E.g. {{P|username|gpgme|keyId = foobar|dmalikov}}.

ValRef syntax

{{E|<variable name>}}

E.g. {{E|username}}.

  • <variable name>. Name of the variable stored in Metadata which could be referenced in ValRef.
  • <encryption algorithm name>. AlgName provided by one of the algorithms Algs used for encryption/decryption.
  • <arguments>. Arguments that encryption algorithm Algs use during encryption/decryption.
  • <content>. Sensitive data to encrypt.

Synopsis

Template

data Tem Source #

Representation of encrypted and/or to-be-encrypted content.

Constructors

Nil

End of Tem.

!Text `Txt` !Tem

Chunk with text.

!PlainValue `Val` !Tem

Chunk with plain value (intended to be encrypted).

!ValRef `Ref` !Tem

Chunk with reference to already encrypted value.

Instances

Eq Tem Source # 

Methods

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

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

Show Tem Source # 

Methods

showsPrec :: Int -> Tem -> ShowS #

show :: Tem -> String #

showList :: [Tem] -> ShowS #

Semigroup Tem Source # 

Methods

(<>) :: Tem -> Tem -> Tem #

sconcat :: NonEmpty Tem -> Tem #

stimes :: Integral b => b -> Tem -> Tem #

Monoid Tem Source # 

Methods

mempty :: Tem #

mappend :: Tem -> Tem -> Tem #

mconcat :: [Tem] -> Tem #

Serialize Tem Source # 

txt :: Text -> Tem Source #

Convert Text to Tem.

val :: PlainValue -> Tem Source #

Convert PlainValue to Tem.

ref :: ValRef -> Tem Source #

Convert ValRef to Tem.

Value

data PlainValue Source #

Representation of plain value.

data ValRef Source #

Reference to an encrypted value.

Constructors

ValRef 

Fields

Instances

Encryption/decryption arguments

data Args Source #

Bunch of arguments that could be useful for encryption/decryption.

Constructors

Args 

Instances

Eq Args Source # 

Methods

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

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

Show Args Source # 

Methods

showsPrec :: Int -> Args -> ShowS #

show :: Args -> String #

showList :: [Args] -> ShowS #

Semigroup Args Source #

Semigroup over inner map.

Methods

(<>) :: Args -> Args -> Args #

sconcat :: NonEmpty Args -> Args #

stimes :: Integral b => b -> Args -> Args #

Monoid Args Source #

Monoid over inner map.

Methods

mempty :: Args #

mappend :: Args -> Args -> Args #

mconcat :: [Args] -> Args #

ToJSON Args Source # 
FromJSON Args Source # 
Serialize Args Source # 

data ArgName Source #

Typed key of Args hashmap.

Constructors

ArgName 

Fields

data ArgValue Source #

Typed value of Args hashmap.

Constructors

ArgValue 

Fields

newtype AlgName Source #

Encryption/decryption algorithm name. E.g. gpg.

Constructors

AlgName 

Fields

Args operations

arg :: ArgName -> ArgValue -> Args Source #

Args constructor.

lookupArg :: Text -> Args -> Maybe ArgValue Source #

Lookup arg.

Operations on Tem

normalize :: Tem -> Tem Source #

Normalize Tem squashing all neighboring Txt chunks.

Parsers

parseMaybe :: Parser a -> Text -> Maybe a Source #

Apply parser and maybe return result.

Serializing routines

class Serialize a where Source #

Bare minimum of serializing to and from Text with no information of deserializing failure reason.

Minimal complete definition

encode, decode

Methods

encode :: a -> Text Source #

decode :: Text -> Maybe a Source #