| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Crypto.File
Synopsis
- data CryptoFile = CryptoFile {
- filePath :: FilePath
- cryptoArgs :: Maybe CryptoFileArgs
- data CryptoFileArgs = CFArgs {}
- data CryptoFileHandle = CFHandle Handle (Maybe (TVar SbState))
- data FTCryptoError
- = FTCECryptoError CryptoError
- | FTCEInvalidHeader String
- | FTCEInvalidFileSize
- | FTCEInvalidAuthTag
- | FTCEFileIOError String
- readFile :: CryptoFile -> ExceptT FTCryptoError IO LazyByteString
- writeFile :: CryptoFile -> LazyByteString -> ExceptT FTCryptoError IO ()
- withFile :: CryptoFile -> IOMode -> (CryptoFileHandle -> ExceptT FTCryptoError IO a) -> ExceptT FTCryptoError IO a
- hPut :: CryptoFileHandle -> LazyByteString -> IO ()
- hPutTag :: CryptoFileHandle -> IO ()
- hGet :: CryptoFileHandle -> Int -> IO ByteString
- hGetTag :: CryptoFileHandle -> ExceptT FTCryptoError IO ()
- plain :: FilePath -> CryptoFile
- randomArgs :: TVar ChaChaDRG -> STM CryptoFileArgs
- getFileContentsSize :: CryptoFile -> IO Integer
Documentation
data CryptoFile Source #
Constructors
| CryptoFile | |
Fields
| |
Instances
| FromJSON CryptoFile Source # | |
Defined in Simplex.Messaging.Crypto.File Methods parseJSON :: Value -> Parser CryptoFile parseJSONList :: Value -> Parser [CryptoFile] omittedField :: Maybe CryptoFile | |
| ToJSON CryptoFile Source # | |
Defined in Simplex.Messaging.Crypto.File Methods toJSON :: CryptoFile -> Value toEncoding :: CryptoFile -> Encoding toJSONList :: [CryptoFile] -> Value toEncodingList :: [CryptoFile] -> Encoding omitField :: CryptoFile -> Bool | |
| Show CryptoFile Source # | |
Defined in Simplex.Messaging.Crypto.File Methods showsPrec :: Int -> CryptoFile -> ShowS show :: CryptoFile -> String showList :: [CryptoFile] -> ShowS | |
| Eq CryptoFile Source # | |
Defined in Simplex.Messaging.Crypto.File | |
data CryptoFileArgs Source #
Instances
| FromJSON CryptoFileArgs Source # | |
Defined in Simplex.Messaging.Crypto.File Methods parseJSON :: Value -> Parser CryptoFileArgs parseJSONList :: Value -> Parser [CryptoFileArgs] omittedField :: Maybe CryptoFileArgs | |
| ToJSON CryptoFileArgs Source # | |
Defined in Simplex.Messaging.Crypto.File Methods toJSON :: CryptoFileArgs -> Value toEncoding :: CryptoFileArgs -> Encoding toJSONList :: [CryptoFileArgs] -> Value toEncodingList :: [CryptoFileArgs] -> Encoding omitField :: CryptoFileArgs -> Bool | |
| Show CryptoFileArgs Source # | |
Defined in Simplex.Messaging.Crypto.File Methods showsPrec :: Int -> CryptoFileArgs -> ShowS show :: CryptoFileArgs -> String showList :: [CryptoFileArgs] -> ShowS | |
| Eq CryptoFileArgs Source # | |
Defined in Simplex.Messaging.Crypto.File Methods (==) :: CryptoFileArgs -> CryptoFileArgs -> Bool (/=) :: CryptoFileArgs -> CryptoFileArgs -> Bool | |
data CryptoFileHandle Source #
data FTCryptoError Source #
Constructors
| FTCECryptoError CryptoError | |
| FTCEInvalidHeader String | |
| FTCEInvalidFileSize | |
| FTCEInvalidAuthTag | |
| FTCEFileIOError String |
Instances
| Exception FTCryptoError Source # | |
Defined in Simplex.Messaging.Crypto.File Methods toException :: FTCryptoError -> SomeException fromException :: SomeException -> Maybe FTCryptoError displayException :: FTCryptoError -> String | |
| Show FTCryptoError Source # | |
Defined in Simplex.Messaging.Crypto.File Methods showsPrec :: Int -> FTCryptoError -> ShowS show :: FTCryptoError -> String showList :: [FTCryptoError] -> ShowS | |
| Eq FTCryptoError Source # | |
Defined in Simplex.Messaging.Crypto.File | |
readFile :: CryptoFile -> ExceptT FTCryptoError IO LazyByteString Source #
writeFile :: CryptoFile -> LazyByteString -> ExceptT FTCryptoError IO () Source #
withFile :: CryptoFile -> IOMode -> (CryptoFileHandle -> ExceptT FTCryptoError IO a) -> ExceptT FTCryptoError IO a Source #
hPut :: CryptoFileHandle -> LazyByteString -> IO () Source #
hPutTag :: CryptoFileHandle -> IO () Source #
hGet :: CryptoFileHandle -> Int -> IO ByteString Source #
hGetTag :: CryptoFileHandle -> ExceptT FTCryptoError IO () Source #
Read and validate the auth tag. This function should be called after reading the whole file, it assumes you know the file size and read only the needed bytes.
plain :: FilePath -> CryptoFile Source #
randomArgs :: TVar ChaChaDRG -> STM CryptoFileArgs Source #
getFileContentsSize :: CryptoFile -> IO Integer Source #