filepath-crypto 0.0.0.3 → 0.1.0.0
raw patch · 4 files changed
+45/−7 lines, 4 filesdep +cryptoids-classdep ~basedep ~binarydep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependencies added: cryptoids-class
Dependency ranges changed: base, binary, bytestring, case-insensitive, cryptoids, cryptoids-types, exceptions, filepath, sandi, template-haskell
API changes (from Hackage documentation)
- System.FilePath.Cryptographic: AlgorithmError :: CryptoError -> CryptoIDError
- System.FilePath.Cryptographic: CiphertextConversionFailed :: ByteString -> CryptoIDError
- System.FilePath.Cryptographic: CryptoID :: a -> CryptoID a
- System.FilePath.Cryptographic: DeserializationError :: CryptoIDError
- System.FilePath.Cryptographic: InvalidNamespaceDetected :: CryptoIDError
- System.FilePath.Cryptographic: NamespaceHashIsWrongLength :: ByteString -> CryptoIDError
- System.FilePath.Cryptographic: PlaintextIsWrongLength :: Int -> CryptoIDError
- System.FilePath.Cryptographic: [ciphertext] :: CryptoID a -> a
- System.FilePath.Cryptographic: data CryptoIDError :: *
- System.FilePath.Cryptographic: newtype CryptoID (namespace :: Symbol) a :: Symbol -> * -> *
+ System.FilePath.Cryptographic: instance (Data.CryptoID.Class.MonadCrypto m, Data.CryptoID.Class.MonadCryptoKey m ~ Data.CryptoID.ByteString.CryptoIDKey, GHC.TypeLits.KnownSymbol namespace, Data.Binary.Class.Binary a, Data.Binary.SerializationLength.Class.HasFixedSerializationLength a) => Data.CryptoID.Class.HasCryptoID namespace (Data.CaseInsensitive.Internal.CI GHC.IO.FilePath) a m
+ System.FilePath.Cryptographic: type HasCryptoFileName (namespace :: Symbol) = HasCryptoID namespace (CI FilePath)
+ System.FilePath.Cryptographic.ImplicitNamespace: type CryptoFileName plaintext = CryptoID (CI FilePath) plaintext
+ System.FilePath.Cryptographic.ImplicitNamespace: type HasCryptoFileName plaintext = HasCryptoID (CI FilePath) plaintext
Files
- changes.md +3/−0
- filepath-crypto.cabal +6/−3
- src/System/FilePath/Cryptographic.hs +16/−4
- src/System/FilePath/Cryptographic/ImplicitNamespace.hs +20/−0
changes.md view
@@ -1,3 +1,6 @@+# 0.1.0.0+ - Add support for 'cryptoids-class'+ # 0.0.0.3 - Got rid of `encoding`
filepath-crypto.cabal view
@@ -1,5 +1,5 @@ name: filepath-crypto-version: 0.0.0.3+version: 0.1.0.0 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -18,6 +18,7 @@ library exposed-modules: System.FilePath.Cryptographic+ System.FilePath.Cryptographic.ImplicitNamespace Data.Binary.SerializationLength Data.Binary.SerializationLength.TH build-depends:@@ -25,7 +26,8 @@ binary >=0.8.5.1 && <0.9, bytestring >=0.10.8.2 && <0.11, case-insensitive >=1.2.0.10 && <1.3,- cryptoids >=0.4.0.0 && <0.5,+ cryptoids >=0.5.0.0 && <0.6,+ cryptoids-class >=0.0.0 && <0.1, cryptoids-types >=0.0.0 && <0.1, exceptions >=0.8.3 && <0.9, filepath >=1.4.1.2 && <1.5,@@ -34,7 +36,8 @@ default-language: Haskell2010 default-extensions: KindSignatures ViewPatterns FlexibleContexts GeneralizedNewtypeDeriving PatternGuards RecordWildCards DataKinds- DeriveDataTypeable DeriveGeneric+ DeriveDataTypeable DeriveGeneric FlexibleInstances+ MultiParamTypeClasses TypeFamilies ConstraintKinds other-extensions: ScopedTypeVariables hs-source-dirs: src other-modules:
src/System/FilePath/Cryptographic.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-}+{-# OPTIONS_GHC -fno-warn-orphans #-} {-| Description: Reversably generate filepaths from arbitrary serializable types in a secure fashion@@ -28,18 +29,19 @@ ciphertext block (both in bits). -} module System.FilePath.Cryptographic- ( CryptoID(..)- , CryptoFileName+ ( CryptoFileName+ , HasCryptoFileName , module Data.Binary.SerializationLength , encrypt , decrypt- , CryptoIDError(..)+ , module Data.CryptoID.Poly ) where -import Data.CryptoID import Data.CryptoID.Poly hiding (encrypt, decrypt) import Data.CryptoID.ByteString (cipherBlockSize) import qualified Data.CryptoID.Poly as Poly (encrypt, decrypt)+import Data.CryptoID.Class (HasCryptoID)+import qualified Data.CryptoID.Class as Class (HasCryptoID(..)) import System.FilePath (FilePath) import qualified Codec.Binary.Base32 as Base32@@ -63,6 +65,7 @@ type CryptoFileName (namespace :: Symbol) = CryptoID namespace (CI FilePath)+type HasCryptoFileName (namespace :: Symbol) = HasCryptoID namespace (CI FilePath) paddedLength :: Integral a => a -> a@@ -107,3 +110,12 @@ where l' = paddedLength l paddingTable = [0, 6, 4, 3, 1]++instance ( MonadCrypto m+ , MonadCryptoKey m ~ CryptoIDKey+ , KnownSymbol namespace+ , Binary a+ , HasFixedSerializationLength a+ ) => HasCryptoID namespace (CI FilePath) a m where+ encrypt = cryptoIDKey . flip encrypt+ decrypt = cryptoIDKey . flip decrypt
+ src/System/FilePath/Cryptographic/ImplicitNamespace.hs view
@@ -0,0 +1,20 @@+{-|+Description: Reversably generate filepaths from arbitrary serializable types with implicit type level nonces+License: BSD3+-}+module System.FilePath.Cryptographic.ImplicitNamespace+ ( CryptoFileName+ , HasCryptoFileName+ , module System.FilePath.Cryptographic+ , module Data.CryptoID.Class.ImplicitNamespace+ ) where++import Data.CryptoID.Class.ImplicitNamespace++import System.FilePath.Cryptographic hiding (encrypt, decrypt, CryptoID, HasCryptoID, CryptoFileName, HasCryptoFileName)++import System.FilePath (FilePath)+import Data.CaseInsensitive (CI)++type CryptoFileName plaintext = CryptoID (CI FilePath) plaintext+type HasCryptoFileName plaintext = HasCryptoID (CI FilePath) plaintext