credential-store-0.1.2: Library to access secure credential storage providers

Safe HaskellNone
LanguageHaskell2010

System.CredentialStore

Contents

Description

Cross-platform library to access system-specific credential store.

Uses Windows CredRead/CredWrite/CredDelete API on Windows, DBus Secret Store API with gnome-keyring or kwallet as backends on Unix. MacOS is not supported yet.

Example usage:

withCredentialStore $ \store -> do
    putCredential store credentialName credentialValue
    v <- getCredential store credentialName
    deleteCredential store credentialName

Synopsis

Types

data CredentialStore Source #

Abstract context for credential store communications.

Functions

getCredential :: ByteArray ba => CredentialStore -> String -> IO (Maybe ba) Source #

Read named credential from store. Returns Nothing if credential was not found.

putCredential :: ByteArray ba => CredentialStore -> String -> ba -> IO () Source #

Write named credential to store, overwriting existing one.

deleteCredential :: CredentialStore -> String -> IO () Source #

Delete named credential from store.

withCredentialStore :: (CredentialStore -> IO a) -> IO a Source #

Open credential store and execute function passing it as parameter. Store is closed even in presence of exceptions.