module Gnome.Keyring.Keyring
( KeyringName
, getDefaultKeyring
, setDefaultKeyring
, listKeyringNames
, create
, delete
, changePassword
, listItemIDs
, lock
, lockAll
, unlock
, KeyringInfo (..)
, KeyringInfoToken
, getInfo
, setInfo
) where
import Control.Exception (bracket)
import Data.Text.Lazy (Text)
import Gnome.Keyring.Item (findItems)
import Gnome.Keyring.ItemInfo
import Gnome.Keyring.KeyringInfo
import Gnome.Keyring.Internal.FFI
import Gnome.Keyring.Internal.Operation
import Gnome.Keyring.Internal.Types
getDefaultKeyring :: Operation (Maybe KeyringName)
getDefaultKeyring = maybeTextOperation
get_default_keyring
get_default_keyring_sync
get_default_keyring :: GetStringCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
get_default_keyring a1 a2 a3 =
let {a1' = id a1} in
let {a2' = id a2} in
let {a3' = id a3} in
get_default_keyring'_ a1' a2' a3' >>= \res ->
let {res' = CancellationKey res} in
return (res')
get_default_keyring_sync :: IO (Result, Maybe Text)
get_default_keyring_sync =
alloca $ \a1' ->
get_default_keyring_sync'_ a1' >>= \res ->
stealNullableTextPtr a1'>>= \a1'' ->
let {res' = result res} in
return (res', a1'')
stealNullableTextPtr :: Ptr CString -> IO (Maybe Text)
stealNullableTextPtr ptr = bracket (peek ptr) free peekNullableText
setDefaultKeyring :: KeyringName -> Operation ()
setDefaultKeyring k = voidOperation
(set_default_keyring k)
(set_default_keyring_sync k)
set_default_keyring :: Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
set_default_keyring a1 a2 a3 a4 =
withText a1 $ \a1' ->
let {a2' = id a2} in
let {a3' = id a3} in
let {a4' = id a4} in
set_default_keyring'_ a1' a2' a3' a4' >>= \res ->
let {res' = CancellationKey res} in
return (res')
set_default_keyring_sync :: Text -> IO ((Result, ()))
set_default_keyring_sync a1 =
withText a1 $ \a1' ->
set_default_keyring_sync'_ a1' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
listKeyringNames :: Operation [KeyringName]
listKeyringNames = textListOperation
list_keyring_names
list_keyring_names_sync
list_keyring_names :: GetListCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
list_keyring_names a1 a2 a3 =
let {a1' = id a1} in
let {a2' = id a2} in
let {a3' = id a3} in
list_keyring_names'_ a1' a2' a3' >>= \res ->
let {res' = CancellationKey res} in
return (res')
list_keyring_names_sync :: IO (Result, [Text])
list_keyring_names_sync =
alloca $ \a1' ->
list_keyring_names_sync'_ a1' >>= \res ->
stealTextList a1'>>= \a1'' ->
let {res' = result res} in
return (res', a1'')
stealTextList :: Ptr (Ptr ()) -> IO [Text]
stealTextList ptr = bracket (peek ptr)
gnome_keyring_string_list_free
(mapGList peekText)
create :: KeyringName -> Maybe Text -> Operation ()
create k p = voidOperation (c_create k p) (create_sync k p)
c_create :: Text -> Maybe Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
c_create a1 a2 a3 a4 a5 =
withText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
c_create'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
create_sync :: Text -> Maybe Text -> IO ((Result, ()))
create_sync a1 a2 =
withText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
create_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
delete :: KeyringName -> Operation ()
delete k = voidOperation (c_delete k) (delete_sync k)
c_delete :: Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
c_delete a1 a2 a3 a4 =
withText a1 $ \a1' ->
let {a2' = id a2} in
let {a3' = id a3} in
let {a4' = id a4} in
c_delete'_ a1' a2' a3' a4' >>= \res ->
let {res' = CancellationKey res} in
return (res')
delete_sync :: Text -> IO ((Result, ()))
delete_sync a1 =
withText a1 $ \a1' ->
delete_sync'_ a1' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
lock :: Maybe KeyringName -> Operation ()
lock k = voidOperation (c_lock k) (lock_sync k)
c_lock :: Maybe Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
c_lock a1 a2 a3 a4 =
withNullableText a1 $ \a1' ->
let {a2' = id a2} in
let {a3' = id a3} in
let {a4' = id a4} in
c_lock'_ a1' a2' a3' a4' >>= \res ->
let {res' = CancellationKey res} in
return (res')
lock_sync :: Maybe Text -> IO ((Result, ()))
lock_sync a1 =
withNullableText a1 $ \a1' ->
lock_sync'_ a1' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
lockAll :: Operation ()
lockAll = voidOperation lock_all lock_all_sync
lock_all :: DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
lock_all a1 a2 a3 =
let {a1' = id a1} in
let {a2' = id a2} in
let {a3' = id a3} in
lock_all'_ a1' a2' a3' >>= \res ->
let {res' = CancellationKey res} in
return (res')
lock_all_sync :: IO ((Result, ()))
lock_all_sync =
lock_all_sync'_ >>= \res ->
let {res' = resultAndTuple res} in
return (res')
unlock :: Maybe KeyringName -> Maybe Text -> Operation ()
unlock k p = voidOperation (c_unlock k p) (unlock_sync k p)
c_unlock :: Maybe Text -> Maybe Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
c_unlock a1 a2 a3 a4 a5 =
withNullableText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
c_unlock'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
unlock_sync :: Maybe Text -> Maybe Text -> IO ((Result, ()))
unlock_sync a1 a2 =
withNullableText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
unlock_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
getInfo :: Maybe KeyringName -> Operation KeyringInfo
getInfo k = keyringInfoOperation (get_info k) (get_info_sync k)
get_info :: Maybe Text -> GetKeyringInfoCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
get_info a1 a2 a3 a4 =
withNullableText a1 $ \a1' ->
let {a2' = id a2} in
let {a3' = id a3} in
let {a4' = id a4} in
get_info'_ a1' a2' a3' a4' >>= \res ->
let {res' = CancellationKey res} in
return (res')
get_info_sync :: Maybe Text -> IO (Result, KeyringInfo)
get_info_sync a1 =
withNullableText a1 $ \a1' ->
alloca $ \a2' ->
get_info_sync'_ a1' a2' >>= \res ->
stealKeyringInfoPtr a2'>>= \a2'' ->
let {res' = result res} in
return (res', a2'')
setInfo :: Maybe KeyringName -> KeyringInfo -> Operation ()
setInfo k info = voidOperation
(set_info k info)
(set_info_sync k info)
set_info :: Maybe Text -> KeyringInfo -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
set_info a1 a2 a3 a4 a5 =
withNullableText a1 $ \a1' ->
withKeyringInfo a2 $ \a2' ->
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
set_info'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
set_info_sync :: Maybe Text -> KeyringInfo -> IO ((Result, ()))
set_info_sync a1 a2 =
withNullableText a1 $ \a1' ->
withKeyringInfo a2 $ \a2' ->
set_info_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
changePassword :: KeyringName
-> Maybe Text
-> Maybe Text
-> Operation ()
changePassword k op np = voidOperation
(change_password k op np)
(change_password_sync k op np)
change_password :: Text -> Maybe Text -> Maybe Text -> DoneCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
change_password a1 a2 a3 a4 a5 a6 =
withText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
withNullableText a3 $ \a3' ->
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
change_password'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = CancellationKey res} in
return (res')
change_password_sync :: Text -> Maybe Text -> Maybe Text -> IO ((Result, ()))
change_password_sync a1 a2 a3 =
withText a1 $ \a1' ->
withNullableText a2 $ \a2' ->
withNullableText a3 $ \a3' ->
change_password_sync'_ a1' a2' a3' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
listItemIDs :: Maybe KeyringName -> Operation [ItemID]
listItemIDs name = itemIDListOperation
(list_item_ids name)
(list_item_ids_sync name)
list_item_ids :: Maybe Text -> GetListCallbackPtr -> Ptr () -> DestroyNotifyPtr -> IO (CancellationKey)
list_item_ids a1 a2 a3 a4 =
withNullableText a1 $ \a1' ->
let {a2' = id a2} in
let {a3' = id a3} in
let {a4' = id a4} in
list_item_ids'_ a1' a2' a3' a4' >>= \res ->
let {res' = CancellationKey res} in
return (res')
list_item_ids_sync :: Maybe Text -> IO (Result, [ItemID])
list_item_ids_sync a1 =
withNullableText a1 $ \a1' ->
alloca $ \a2' ->
list_item_ids_sync'_ a1' a2' >>= \res ->
stealItemIDList a2'>>= \a2'' ->
let {res' = result res} in
return (res', a2'')
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_get_default_keyring"
get_default_keyring'_ :: ((FunPtr (CInt -> ((Ptr CChar) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_get_default_keyring_sync"
get_default_keyring_sync'_ :: ((Ptr (Ptr CChar)) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_set_default_keyring"
set_default_keyring'_ :: ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_set_default_keyring_sync"
set_default_keyring_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_list_keyring_names"
list_keyring_names'_ :: ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_list_keyring_names_sync"
list_keyring_names_sync'_ :: ((Ptr (Ptr ())) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_string_list_free"
gnome_keyring_string_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_create"
c_create'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_create_sync"
create_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_delete"
c_delete'_ :: ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_delete_sync"
delete_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_lock"
c_lock'_ :: ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_lock_sync"
lock_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_lock_all"
lock_all'_ :: ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_lock_all_sync"
lock_all_sync'_ :: (IO CInt)
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_unlock"
c_unlock'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_unlock_sync"
unlock_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_get_info"
get_info'_ :: ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_get_info_sync"
get_info_sync'_ :: ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO CInt)))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_set_info"
set_info'_ :: ((Ptr CChar) -> ((Ptr ()) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_set_info_sync"
set_info_sync'_ :: ((Ptr CChar) -> ((Ptr ()) -> (IO CInt)))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_change_password"
change_password'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_change_password_sync"
change_password_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_list_item_ids"
list_item_ids'_ :: ((Ptr CChar) -> ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))
foreign import ccall safe "Gnome/Keyring/Keyring.chs.h gnome_keyring_list_item_ids_sync"
list_item_ids_sync'_ :: ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO CInt)))