keyring 0.1.0.0 → 0.1.0.1
raw patch · 5 files changed
+20/−10 lines, 5 files
Files
- CHANGES.md +5/−0
- README.md +1/−1
- keyring.cabal +2/−2
- src/System/Keyring/Darwin.hsc +4/−4
- src/System/Keyring/Unix.hs +8/−3
CHANGES.md view
@@ -1,3 +1,8 @@+0.1.0.1 (Apr 2, 2014)+=====================++- Fix `IOError` if `$XDG_CURRENT_DESKTOP` is missing+ 0.1.0.0 (Apr 1, 2014) =====================
README.md view
@@ -1,7 +1,7 @@ haskell-keyring =============== -[![hackage][badge-hackage]][hackage] [![license][badge-license]]][license]+[![hackage][badge-hackage]][hackage] [![license][badge-license]][license] Haskell library to access the system's keyring to securely store passwords.
keyring.cabal view
@@ -1,5 +1,5 @@ name: keyring-version: 0.1.0.0+version: 0.1.0.1 synopsis: Keyring access description: keyring provides access to the system's keyring to securely store passwords.@@ -35,7 +35,7 @@ source-repository this type: git location: https://github.com/lunaryorn/haskell-keyring.git- tag: 0.1.0.0+ tag: 0.1.0.1 flag AllBackends description: Try to build as many backends as possible
src/System/Keyring/Darwin.hsc view
@@ -41,13 +41,13 @@ import Control.Exception (Exception(..),bracket,throwIO) import Control.Monad (liftM,when,void)-import Data.ByteString+import Data.ByteString (ByteString,useAsCStringLen,packCString,packCStringLen) import Data.Int (Int32, Int64) import Data.Typeable (Typeable,cast) import Data.Word (Word32)-import Foreign.C-import Foreign.Ptr-import Foreign.Storable+import Foreign.C (CString,CStringLen)+import Foreign.Ptr (Ptr,nullPtr)+import Foreign.Storable (peek) import Foreign.Marshal.Alloc (alloca,allocaBytes) import Text.Printf (printf)
src/System/Keyring/Unix.hs view
@@ -30,8 +30,10 @@ import System.Keyring.Types -import Control.Exception (throwIO)+import Control.Exception (throwIO,handleJust)+import Control.Monad (liftM) import System.Environment (getEnv)+import System.IO.Error (isDoesNotExistError) -- |The keyring provider to use. --@@ -40,10 +42,13 @@ provider :: IO (Service -> Username -> IO (Maybe Password) ,Service -> Username -> Password -> IO ()) provider = do- desktop <- getEnv "XDG_CURRENT_DESKTOP"+ desktop <- handleJust (toMaybe.isDoesNotExistError) (const $ return Nothing)+ (liftM Just (getEnv "XDG_CURRENT_DESKTOP")) case desktop of- "KDE" -> return (KDE.getPassword, KDE.setPassword)+ Just "KDE" -> return (KDE.getPassword, KDE.setPassword) _ -> throwIO KeyringMissingBackendError+ where toMaybe True = Just ()+ toMaybe False = Nothing -- |@'getPassword' service username@ gets a password from the current keyring. --