filepath-crypto 0.0.0.2 → 0.0.0.3
raw patch · 3 files changed
+47/−46 lines, 3 filesdep −encodingdep ~basedep ~binarydep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: encoding
Dependency ranges changed: base, binary, bytestring, cryptoids, cryptoids-types, filepath, template-haskell
API changes (from Hackage documentation)
- Data.Binary.SerializationLength: class KnownNat (SerializationLength a) => HasFixedSerializationLength a where type SerializationLength a :: Nat where {
+ Data.Binary.SerializationLength: class KnownNat (SerializationLength a) => HasFixedSerializationLength a where {
Files
- changes.md +3/−0
- filepath-crypto.cabal +41/−42
- src/System/FilePath/Cryptographic.hs +3/−4
changes.md view
@@ -1,3 +1,6 @@+# 0.0.0.3+ - Got rid of `encoding`+ # 0.0.0.2 - Improved documentation
filepath-crypto.cabal view
@@ -1,45 +1,44 @@-name: filepath-crypto-version: 0.0.0.2-synopsis: Reversable and secure encoding of object ids as filepaths-license: BSD3-license-file: LICENSE-author: Gregor Kleen-maintainer: aethoago@141.li-category: cryptography-build-type: Simple-cabal-version: >=1.10-extra-source-files: changes.md+name: filepath-crypto+version: 0.0.0.3+cabal-version: >=1.10+build-type: Simple+license: BSD3+license-file: LICENSE+maintainer: Gregor Kleen <aethoago@141.li>+synopsis: Reversable and secure encoding of object ids as filepaths+category: cryptography+author: Gregor Kleen <aethoago@141.li>+extra-source-files:+ changes.md+ source-repository head- type: git- location: https://git.rheperire.org/cryptoids- subdir: filepath-crypto+ type: git+ location: https://git.rheperire.org/cryptoids/filepath-crypto library- exposed-modules: System.FilePath.Cryptographic- , Data.Binary.SerializationLength- , Data.Binary.SerializationLength.TH- other-modules: Data.Binary.SerializationLength.Class- default-extensions: KindSignatures- , ViewPatterns- , FlexibleContexts- , GeneralizedNewtypeDeriving- , PatternGuards- , RecordWildCards- , DataKinds- , DeriveDataTypeable- , DeriveGeneric- other-extensions: ScopedTypeVariables- build-depends: base >=4.9 && <4.11- , cryptoids-types ==0.0.0- , cryptoids ==0.4.0.*- , filepath >=1.4.1.1 && <1.5- , sandi >=0.4.1 && <0.5- , case-insensitive >=1.2.0.10 && <1.3- , binary >=0.8.3.0 && <0.9- , bytestring >=0.10.8.1 && <0.11- , exceptions >=0.8.3 && <0.9- , encoding >=0.8.2 && <0.9- , template-haskell >=2.11.0.0 && <2.13- hs-source-dirs: src- default-language: Haskell2010- ghc-options: -Wall -fno-warn-name-shadowing+ exposed-modules:+ System.FilePath.Cryptographic+ Data.Binary.SerializationLength+ Data.Binary.SerializationLength.TH+ build-depends:+ base >=4.10.1.0 && <4.11,+ 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-types >=0.0.0 && <0.1,+ exceptions >=0.8.3 && <0.9,+ filepath >=1.4.1.2 && <1.5,+ sandi >=0.4.1 && <0.5,+ template-haskell >=2.12.0.0 && <2.13+ default-language: Haskell2010+ default-extensions: KindSignatures ViewPatterns FlexibleContexts+ GeneralizedNewtypeDeriving PatternGuards RecordWildCards DataKinds+ DeriveDataTypeable DeriveGeneric+ other-extensions: ScopedTypeVariables+ hs-source-dirs: src+ other-modules:+ Data.Binary.SerializationLength.Class+ Paths_filepath_crypto+ ghc-options: -Wall -fno-warn-name-shadowing+
src/System/FilePath/Cryptographic.hs view
@@ -47,14 +47,13 @@ import qualified Data.CaseInsensitive as CI import Data.Binary import Data.Binary.SerializationLength-import Data.Encoding.UTF8-import Data.Encoding (decodeStrictByteString, encodeStrictByteString) import Data.Char (toUpper) import Data.Ratio ((%)) import Data.List import qualified Data.ByteString as ByteString+import qualified Data.ByteString.Char8 as ByteString.Char8 import Control.Monad import Control.Monad.Catch@@ -88,7 +87,7 @@ unless (fromIntegral l == natVal (Proxy :: Proxy (SerializationLength a))) $ throwM $ CiphertextConversionFailed str return . Just $ paddedLength l- encode str = CI.mk . dropWhileEnd (== '=') . decodeStrictByteString UTF8 $ Base32.encode str+ encode str = CI.mk . dropWhileEnd (== '=') . ByteString.Char8.unpack $ Base32.encode str -- | Decrypt an arbitrary serializable value@@ -102,7 +101,7 @@ , MonadThrow m , HasFixedSerializationLength a ) => CryptoIDKey -> CryptoFileName namespace -> m a-decrypt = Poly.decrypt $ (\str -> either (const . throwM $ CiphertextConversionFailed str) return $ Base32.decode str) . encodeStrictByteString UTF8 . padding (natVal (Proxy :: Proxy (SerializationLength a))) . map toUpper . CI.original+decrypt = Poly.decrypt $ (\str -> either (const . throwM $ CiphertextConversionFailed str) return $ Base32.decode str) . ByteString.Char8.pack . padding (natVal (Proxy :: Proxy (SerializationLength a))) . map toUpper . CI.original where padding l str = str ++ replicate (genericIndex paddingTable $ l' `mod` 5) '=' where