otp-authenticator-0.1.1.0: OTP Authenticator (a la google) command line client

Copyright(c) Justin Le 2017
LicenseMIT
Maintainerjustin@jle.im
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Encrypted

Description

Basically provides Enc a, which abstracts over an encrypted a. Can only be read by invoking GnuPG in IO, where the user needs to provide their key to decrypt.

One main advantage is that an Enc a can be seriealized and deserialized using its Binary instance, providing type-safe deserialization into encrypted values.

Might be pulled out to an external package some day.

Synopsis

Documentation

data Enc a Source #

An Enc a abstracts over a encrypted a.

Has a useful Binary instance, which allows type-safe deserialization into encrypted values.

Constructors

Enc 

Fields

Instances
Generic (Enc a) Source # 
Instance details

Defined in Encrypted

Associated Types

type Rep (Enc a) :: Type -> Type #

Methods

from :: Enc a -> Rep (Enc a) x #

to :: Rep (Enc a) x -> Enc a #

Binary (Enc a) Source # 
Instance details

Defined in Encrypted

Methods

put :: Enc a -> Put #

get :: Get (Enc a) #

putList :: [Enc a] -> Put #

type Rep (Enc a) Source # 
Instance details

Defined in Encrypted

type Rep (Enc a) = D1 (MetaData "Enc" "Encrypted" "otp-authenticator-0.1.1.0-inplace" False) (C1 (MetaCons "Enc" PrefixI True) (S1 (MetaSel (Just "encBytes") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Encrypted)))

mkEnc :: Binary a => Ctx -> Key -> a -> IO (Enc a) Source #

Wrap a value into an Enc, using a given GnuPG key.

overEnc :: Binary a => Ctx -> Key -> Enc a -> (a -> IO a) -> IO (Enc a) Source #

Modify an encrypted value with a given a -> IO a function, re-encrypting it with the given GnuPG key. The decrypted value never leaves the closure.

getEnc :: Binary a => Ctx -> Enc a -> IO a Source #

Extract a value from an Enc, using a compatible key in the GnuPG environment.

withEnc :: Binary a => Ctx -> Key -> Enc a -> (a -> IO (b, a)) -> IO (b, Enc a) Source #

A variation of overEnc that allows the user to also return a value produced from the decrypted value. Re-encrypts the changed value using the given GnuPG key.