module Gnome.Keyring
(
available
, ItemID
, ItemType(..)
, createItem
, deleteItem
, listItemIDs
, Item
, getItem
, setItem
, itemType
, itemSecret
, itemDisplayName
, itemModified
, itemCreated
, Attribute (..)
, attributeName
, getItemAttributes
, setItemAttributes
, Access (..)
, AccessType (..)
, getItemAccess
, setItemAccess
, grantItemAccess
, FoundItem
, foundItemKeyring
, foundItemID
, foundItemAttributes
, foundItemSecret
, findItems
, Keyring
, defaultKeyring
, sessionKeyring
, keyring
, getDefaultKeyring
, setDefaultKeyring
, listKeyringNames
, createKeyring
, deleteKeyring
, changeKeyringPassword
, lockKeyring
, unlockKeyring
, lockAll
, KeyringInfo
, keyringLockOnIdle
, keyringLockTimeout
, keyringModified
, keyringCreated
, keyringIsLocked
, getKeyringInfo
, setKeyringInfo
, NetworkPassword
, networkPasswordKeyring
, networkPasswordSecret
, networkPasswordItemID
, networkPasswordNetwork
, Network
, network
, networkProtocol
, networkServer
, networkObject
, networkAuthType
, networkPort
, networkUser
, networkDomain
, findNetworkPassword
, setNetworkPassword
, Operation
, KeyringError
, keyringErrorMessage
, sync
, sync_
, async
, CancellationKey
, cancel
) where
import Control.Exception (Exception, bracket, throwIO)
import Control.Monad (join)
import Data.Time (UTCTime)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Data.Typeable (Typeable)
import Foreign hiding (unsafePerformIO)
import Foreign.C
import System.IO.Unsafe (unsafePerformIO)
import qualified Data.ByteString as ByteString
import qualified Data.Text
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf8, decodeUtf8)
available :: IO ((Bool))
available =
available'_ >>= \res ->
let {res' = toBool res} in
return (res')
newtype ItemID = ItemID CUInt
deriving (Show, Eq, Ord)
data ItemType
= ItemGenericSecret
| ItemNetworkPassword
| ItemNote
| ItemChainedKeyringPassword
| ItemEncryptionKeyPassword
| ItemPublicKeyStorage
| ItemApplicationSecret
deriving (Show, Eq)
data Item = Item
{
itemType :: ItemType
, itemSecret :: Maybe String
, itemDisplayName :: Maybe String
, itemMTime :: UTCTime
, itemCTime :: UTCTime
}
deriving (Show, Eq)
itemModified :: Item -> UTCTime
itemModified = itemMTime
itemCreated :: Item -> UTCTime
itemCreated = itemCTime
fromItemType :: ItemType -> CInt
fromItemType ItemGenericSecret = 0
fromItemType ItemNetworkPassword = 1
fromItemType ItemNote = 2
fromItemType ItemChainedKeyringPassword = 3
fromItemType ItemEncryptionKeyPassword = 4
fromItemType ItemPublicKeyStorage = 0x100
fromItemType ItemApplicationSecret = 0x01000000
toItemType :: CInt -> ItemType
toItemType 0 = ItemGenericSecret
toItemType 1 = ItemNetworkPassword
toItemType 2 = ItemNote
toItemType 3 = ItemChainedKeyringPassword
toItemType 4 = ItemEncryptionKeyPassword
toItemType 0x100 = ItemPublicKeyStorage
toItemType 0x01000000 = ItemApplicationSecret
toItemType _ = ItemGenericSecret
peekItemInfo :: Ptr () -> IO Item
peekItemInfo info = do
cType <- gnome_keyring_item_info_get_type info
secret <- stealNullableUtf8 =<< gnome_keyring_item_info_get_secret info
name <- stealNullableUtf8 =<< gnome_keyring_item_info_get_display_name info
mtime <- cToUTC `fmap` gnome_keyring_item_info_get_mtime info
ctime <- cToUTC `fmap` gnome_keyring_item_info_get_ctime info
return (Item (toItemType cType) secret name mtime ctime)
stealItemInfo :: Ptr (Ptr ()) -> IO Item
stealItemInfo ptr = bracket (peek ptr) freeItemInfo peekItemInfo
freeItemInfo :: Ptr () -> IO ()
freeItemInfo = gnome_keyring_item_info_free
foreign import ccall "gnome-keyring.h &gnome_keyring_item_info_free"
finalizeItemInfo :: FunPtr (Ptr a -> IO ())
withItemInfo :: Item -> (Ptr () -> IO a) -> IO a
withItemInfo info io = do
fptr <- newForeignPtr finalizeItemInfo =<< gnome_keyring_item_info_new
withForeignPtr fptr $ \ptr -> do
gnome_keyring_item_info_set_type ptr (fromItemType (itemType info))
withNullableUtf8 (itemSecret info) (gnome_keyring_item_info_set_secret ptr)
withNullableUtf8 (itemDisplayName info) (gnome_keyring_item_info_set_display_name ptr)
io ptr
type GetItemInfoCallback = CInt -> Ptr () -> Ptr () -> IO ()
type GetItemInfoCallbackPtr = FunPtr ((CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetItemInfoCallback :: GetItemInfoCallback -> IO GetItemInfoCallbackPtr
itemIDOperation :: OperationImpl GetIntCallback ItemID
itemIDOperation = operationImpl $ \checkResult ->
wrapGetIntCallback $ \cres cint _ ->
checkResult cres (return (ItemID cint))
itemInfoOperation :: OperationImpl GetItemInfoCallback Item
itemInfoOperation = operationImpl $ \checkResult ->
wrapGetItemInfoCallback $ \cres ptr _ ->
checkResult cres (peekItemInfo ptr)
peekItemID :: Ptr CUInt -> IO ItemID
peekItemID ptr = fmap ItemID (peek ptr)
cItemID :: ItemID -> CUInt
cItemID (ItemID x) = x
createItem :: Keyring
-> ItemType
-> String
-> [Attribute]
-> String
-> Bool
-> Operation ItemID
createItem k t dn as s u = itemIDOperation
(item_create k t dn as s u)
(item_create_sync k t dn as s u)
item_create :: (Keyring) -> (ItemType) -> (String) -> ([Attribute]) -> (String) -> (Bool) -> (GetIntCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_create a1 a2 a3 a4 a5 a6 a7 a8 a9 =
withKeyringName a1 $ \a1' ->
let {a2' = fromItemType a2} in
withUtf8 a3 $ \a3' ->
withAttributeList a4 $ \a4' ->
withUtf8 a5 $ \a5' ->
let {a6' = fromBool a6} in
let {a7' = id a7} in
let {a8' = id a8} in
let {a9' = id a9} in
item_create'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_create_sync :: (Keyring) -> (ItemType) -> (String) -> ([Attribute]) -> (String) -> (Bool) -> IO ((Result), (ItemID))
item_create_sync a1 a2 a3 a4 a5 a6 =
withKeyringName a1 $ \a1' ->
let {a2' = fromItemType a2} in
withUtf8 a3 $ \a3' ->
withAttributeList a4 $ \a4' ->
withUtf8 a5 $ \a5' ->
let {a6' = fromBool a6} in
alloca $ \a7' ->
item_create_sync'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
let {res' = Result res} in
peekItemID a7'>>= \a7'' ->
return (res', a7'')
deleteItem :: Keyring -> ItemID -> Operation ()
deleteItem k item = voidOperation
(item_delete k item)
(item_delete_sync k item)
item_delete :: (Keyring) -> (ItemID) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_delete a1 a2 a3 a4 a5 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
item_delete'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_delete_sync :: (Keyring) -> (ItemID) -> IO (((Result, ())))
item_delete_sync a1 a2 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
item_delete_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
listItemIDs :: Keyring -> Operation [ItemID]
listItemIDs name = itemIDListOperation
(list_item_ids name)
(list_item_ids_sync name)
list_item_ids :: (Keyring) -> (GetListCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
list_item_ids a1 a2 a3 a4 =
withKeyringName 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 :: (Keyring) -> IO ((Result), ([ItemID]))
list_item_ids_sync a1 =
withKeyringName a1 $ \a1' ->
alloca $ \a2' ->
list_item_ids_sync'_ a1' a2' >>= \res ->
let {res' = Result res} in
stealItemIDList a2'>>= \a2'' ->
return (res', a2'')
itemIDListOperation :: OperationImpl GetListCallback [ItemID]
itemIDListOperation = operationImpl $ \checkResult ->
wrapGetListCallback $ \cres ptr _ ->
checkResult cres (peekItemIDList ptr)
peekItemIDList :: Ptr () -> IO [ItemID]
peekItemIDList = mapGList (return . ItemID . fromIntegral . ptrToWordPtr)
stealItemIDList :: Ptr (Ptr ()) -> IO [ItemID]
stealItemIDList ptr = bracket (peek ptr) freeList peekItemIDList where
freeList = g_list_free
getItem :: Keyring
-> Bool
-> ItemID
-> Operation Item
getItem k includeSecret item = itemInfoOperation
(item_get_info_full k item includeSecret)
(item_get_info_full_sync k item includeSecret)
item_get_info_full :: (Keyring) -> (ItemID) -> (Bool) -> (GetItemInfoCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_get_info_full a1 a2 a3 a4 a5 a6 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
let {a3' = cItemInfoFlags a3} in
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
item_get_info_full'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_get_info_full_sync :: (Keyring) -> (ItemID) -> (Bool) -> IO ((Result), (Item))
item_get_info_full_sync a1 a2 a3 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
let {a3' = cItemInfoFlags a3} in
alloca $ \a4' ->
item_get_info_full_sync'_ a1' a2' a3' a4' >>= \res ->
let {res' = Result res} in
stealItemInfo a4'>>= \a4'' ->
return (res', a4'')
cItemInfoFlags :: Integral a => Bool -> a
cItemInfoFlags includeSecret = if includeSecret then 1 else 0
setItem :: Keyring -> ItemID -> Item -> Operation ()
setItem k item info = voidOperation
(item_set_info k item info)
(item_set_info_sync k item info)
item_set_info :: (Keyring) -> (ItemID) -> (Item) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_set_info a1 a2 a3 a4 a5 a6 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withItemInfo a3 $ \a3' ->
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
item_set_info'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_set_info_sync :: (Keyring) -> (ItemID) -> (Item) -> IO (((Result, ())))
item_set_info_sync a1 a2 a3 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withItemInfo a3 $ \a3' ->
item_set_info_sync'_ a1' a2' a3' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
data AttributeType = ATTRIBUTE_TYPE_STRING
| ATTRIBUTE_TYPE_UINT32
deriving (Enum)
data Attribute
= TextAttribute String String
| WordAttribute String Word32
deriving (Show, Eq)
attributeName :: Attribute -> String
attributeName (TextAttribute n _) = n
attributeName (WordAttribute n _) = n
withAttributeList :: [Attribute] -> (Ptr () -> IO a) -> IO a
withAttributeList attrs io = bracket newList freeAttributeList buildList where
newList = g_array_new 0 0 24
buildList list = mapM_ (append list) attrs >> io list
append list (TextAttribute n x) = appendString list n x
append list (WordAttribute n x) = appendUInt32 list n x
appendString :: (Ptr ()) -> (String) -> (String) -> IO ((()))
appendString a1 a2 a3 =
let {a1' = id a1} in
withUtf8 a2 $ \a2' ->
withUtf8 a3 $ \a3' ->
appendString'_ a1' a2' a3' >>= \res ->
let {res' = id res} in
return (res')
appendUInt32 :: Ptr () -> String -> Word32 -> IO ()
appendUInt32 list name val = withUtf8 name (\name_ptr -> c_append_uint32 list name_ptr val)
foreign import ccall unsafe "gnome_keyring_attribute_list_append_uint32"
c_append_uint32 :: Ptr () -> CString -> Word32 -> IO ()
peekAttribute :: Ptr () -> IO Attribute
peekAttribute attr = do
name <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr CChar)}) attr
cType <- (\ptr -> do {peekByteOff ptr 8 ::IO CInt}) attr
case cType of
0 -> do
value <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 16 ::IO (Ptr CChar)}) attr
return (TextAttribute name value)
1 -> do
cValue <- (\ptr -> do {peekByteOff ptr 16 ::IO CUInt}) attr
return (WordAttribute name (fromIntegral cValue))
_ -> undefined
peekAttributeList :: Ptr () -> IO [Attribute]
peekAttributeList = mapGArray peekAttribute 24
stealAttributeList :: Ptr (Ptr ()) -> IO [Attribute]
stealAttributeList ptr = bracket (peek ptr) freeAttributeList peekAttributeList
freeAttributeList :: Ptr () -> IO ()
freeAttributeList = gnome_keyring_attribute_list_free
type GetAttributesCallback = CInt -> Ptr () -> Ptr () -> IO ()
type GetAttributesCallbackPtr = FunPtr ((CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetAttributesCallback :: GetAttributesCallback -> IO GetAttributesCallbackPtr
attributeListOperation :: OperationImpl GetAttributesCallback [Attribute]
attributeListOperation = operationImpl $ \checkResult ->
wrapGetAttributesCallback $ \cres array _ ->
checkResult cres (peekAttributeList array)
getItemAttributes :: Keyring -> ItemID -> Operation [Attribute]
getItemAttributes k item = attributeListOperation
(item_get_attributes k item)
(item_get_attributes_sync k item)
item_get_attributes :: (Keyring) -> (ItemID) -> (GetAttributesCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_get_attributes a1 a2 a3 a4 a5 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
item_get_attributes'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_get_attributes_sync :: (Keyring) -> (ItemID) -> IO ((Result), ([Attribute]))
item_get_attributes_sync a1 a2 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
alloca $ \a3' ->
item_get_attributes_sync'_ a1' a2' a3' >>= \res ->
let {res' = Result res} in
stealAttributeList a3'>>= \a3'' ->
return (res', a3'')
setItemAttributes :: Keyring -> ItemID -> [Attribute] -> Operation ()
setItemAttributes k item as = voidOperation
(item_set_attributes k item as)
(item_set_attributes_sync k item as)
item_set_attributes :: (Keyring) -> (ItemID) -> ([Attribute]) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_set_attributes a1 a2 a3 a4 a5 a6 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withAttributeList a3 $ \a3' ->
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
item_set_attributes'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_set_attributes_sync :: (Keyring) -> (ItemID) -> ([Attribute]) -> IO (((Result, ())))
item_set_attributes_sync a1 a2 a3 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withAttributeList a3 $ \a3' ->
item_set_attributes_sync'_ a1' a2' a3' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
data AccessType
= AccessRead
| AccessWrite
| AccessRemove
deriving (Show, Eq, Ord)
data Access = Access
{ accessName :: Maybe String
, accessPath :: Maybe String
, accessType :: [AccessType]
}
deriving (Show, Eq)
peekAccessControl :: Ptr () -> IO Access
peekAccessControl ac = do
name <- stealNullableUtf8 =<< gnome_keyring_item_ac_get_display_name ac
path <- stealNullableUtf8 =<< gnome_keyring_item_ac_get_path_name ac
cType <- gnome_keyring_item_ac_get_access_type ac
return (Access name path (peekAccessType cType))
stealACL :: Ptr (Ptr ()) -> IO [Access]
stealACL ptr = bracket (peek ptr) freeACL (mapGList peekAccessControl)
withACL :: [Access] -> (Ptr () -> IO a) -> IO a
withACL acl = bracket (buildACL acl) freeACL
buildACL :: [Access] -> IO (Ptr ())
buildACL acs = bracket
gnome_keyring_application_ref_new
gnome_keyring_application_ref_free $ \appRef ->
buildACL' appRef acs nullPtr
buildACL' :: Ptr () -> [Access] -> Ptr () -> IO (Ptr ())
buildACL' _ [] list = return list
buildACL' appRef (ac:acs) list = buildAC appRef ac
>>= g_list_append list
>>= buildACL' appRef acs
buildAC :: Ptr () -> Access-> IO (Ptr ())
buildAC appRef ac = do
let cAllowed = cAccessTypes (accessType ac)
ptr <- gnome_keyring_access_control_new appRef cAllowed
withNullableUtf8 (accessName ac) (gnome_keyring_item_ac_set_display_name ptr)
withNullableUtf8 (accessPath ac) (gnome_keyring_item_ac_set_path_name ptr)
return ptr
freeACL :: Ptr () -> IO ()
freeACL = gnome_keyring_acl_free
cAccessTypes :: [AccessType] -> CInt
cAccessTypes = foldr (.|.) 0 . map fromAccessType where
fromAccessType :: AccessType -> CInt
fromAccessType AccessRead = 1
fromAccessType AccessWrite = 2
fromAccessType AccessRemove = 4
peekAccessType :: CInt -> [AccessType]
peekAccessType cint = concat
[ [AccessRead | (cint .&. 1) > 0]
, [AccessWrite | (cint .&. 2) > 0]
, [AccessRemove | (cint .&. 4) > 0]
]
accessControlListOperation :: OperationImpl GetListCallback [Access]
accessControlListOperation = operationImpl $ \checkResult ->
wrapGetListCallback $ \cres list _ ->
checkResult cres (mapGList peekAccessControl list)
getItemAccess :: Keyring -> ItemID -> Operation [Access]
getItemAccess k item = accessControlListOperation
(item_get_acl k item)
(item_get_acl_sync k item)
item_get_acl :: (Keyring) -> (ItemID) -> (GetListCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_get_acl a1 a2 a3 a4 a5 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
item_get_acl'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_get_acl_sync :: (Keyring) -> (ItemID) -> IO ((Result), ([Access]))
item_get_acl_sync a1 a2 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
alloca $ \a3' ->
item_get_acl_sync'_ a1' a2' a3' >>= \res ->
let {res' = Result res} in
stealACL a3'>>= \a3'' ->
return (res', a3'')
setItemAccess :: Keyring -> ItemID -> [Access] -> Operation ()
setItemAccess k item acl = voidOperation
(item_set_acl k item acl)
(item_set_acl_sync k item acl)
item_set_acl :: (Keyring) -> (ItemID) -> ([Access]) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_set_acl a1 a2 a3 a4 a5 a6 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withACL a3 $ \a3' ->
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
item_set_acl'_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_set_acl_sync :: (Keyring) -> (ItemID) -> ([Access]) -> IO (((Result, ())))
item_set_acl_sync a1 a2 a3 =
withKeyringName a1 $ \a1' ->
let {a2' = cItemID a2} in
withACL a3 $ \a3' ->
item_set_acl_sync'_ a1' a2' a3' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
grantItemAccess :: Keyring
-> String
-> String
-> ItemID
-> [AccessType]
-> Operation ()
grantItemAccess k d p item r = voidOperation
(item_grant_access_rights k d p item r)
(item_grant_access_rights_sync k d p item r)
item_grant_access_rights :: (Keyring) -> (String) -> (String) -> (ItemID) -> ([AccessType]) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
item_grant_access_rights a1 a2 a3 a4 a5 a6 a7 a8 =
withKeyringName a1 $ \a1' ->
withUtf8 a2 $ \a2' ->
withUtf8 a3 $ \a3' ->
let {a4' = cItemID a4} in
let {a5' = cAccessTypes a5} in
let {a6' = id a6} in
let {a7' = id a7} in
let {a8' = id a8} in
item_grant_access_rights'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
let {res' = CancellationKey res} in
return (res')
item_grant_access_rights_sync :: (Keyring) -> (String) -> (String) -> (ItemID) -> ([AccessType]) -> IO (((Result, ())))
item_grant_access_rights_sync a1 a2 a3 a4 a5 =
withKeyringName a1 $ \a1' ->
withUtf8 a2 $ \a2' ->
withUtf8 a3 $ \a3' ->
let {a4' = cItemID a4} in
let {a5' = cAccessTypes a5} in
item_grant_access_rights_sync'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
data FoundItem = FoundItem
{ foundItemKeyring_ :: Keyring
, foundItemID_ :: ItemID
, foundItemAttributes_ :: [Attribute]
, foundItemSecret_ :: String
}
deriving (Eq)
instance Show FoundItem where
showsPrec d x = showParen (d > 10) $
s "FoundItem " .
s " {foundItemKeyring = " . shows (foundItemKeyring_ x) .
s ", foundItemID = " . shows (foundItemID_ x) .
s ", foundItemAttributes_= " . shows (foundItemAttributes_ x) .
s ", foundItemSecret = " . shows (foundItemSecret_ x) .
s "}"
where s = showString
foundItemKeyring :: FoundItem -> Keyring
foundItemKeyring = foundItemKeyring_
foundItemID :: FoundItem -> ItemID
foundItemID = foundItemID_
foundItemAttributes :: FoundItem -> [Attribute]
foundItemAttributes = foundItemAttributes_
foundItemSecret :: FoundItem -> String
foundItemSecret = foundItemSecret_
peekFound :: Ptr () -> IO FoundItem
peekFound f = do
keyringName <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr CChar)}) f
itemID <- (\ptr -> do {peekByteOff ptr 8 ::IO CUInt}) f
attrs <- peekAttributeList =<< (\ptr -> do {peekByteOff ptr 16 ::IO (Ptr ())}) f
secret <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 24 ::IO (Ptr CChar)}) f
return (FoundItem (keyring keyringName) (ItemID itemID) attrs secret)
stealFoundList :: Ptr (Ptr ()) -> IO [FoundItem]
stealFoundList ptr = bracket (peek ptr)
gnome_keyring_found_list_free
(mapGList peekFound)
foundItemsOperation :: OperationImpl GetListCallback [FoundItem]
foundItemsOperation = operationImpl $ \checkResult ->
wrapGetListCallback $ \cres list _ -> if cres == 9
then checkResult 0 (return [])
else checkResult cres ((mapGList peekFound) list)
findItems :: ItemType -> [Attribute] -> Operation [FoundItem]
findItems t as = foundItemsOperation
(find_items t as)
(do
(rc, lst) <- find_items_sync t as
return $ if rc == Result 9
then (Result 0, [])
else (rc, lst))
find_items :: (ItemType) -> ([Attribute]) -> (GetListCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
find_items a1 a2 a3 a4 a5 =
let {a1' = fromItemType a1} in
withAttributeList a2 $ \a2' ->
let {a3' = id a3} in
let {a4' = id a4} in
let {a5' = id a5} in
find_items'_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = CancellationKey res} in
return (res')
find_items_sync :: (ItemType) -> ([Attribute]) -> IO ((Result), ([FoundItem]))
find_items_sync a1 a2 =
let {a1' = fromItemType a1} in
withAttributeList a2 $ \a2' ->
alloca $ \a3' ->
find_items_sync'_ a1' a2' a3' >>= \res ->
let {res' = Result res} in
stealFoundList a3'>>= \a3'' ->
return (res', a3'')
data Keyring
= DefaultKeyring
| NamedKeyring String
deriving (Eq, Show)
defaultKeyring :: Keyring
defaultKeyring = DefaultKeyring
sessionKeyring :: Keyring
sessionKeyring = keyring "session"
keyring :: String -> Keyring
keyring = NamedKeyring
getDefaultKeyring :: Operation (Maybe String)
getDefaultKeyring = maybeStringOperation
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 String))
get_default_keyring_sync =
alloca $ \a1' ->
get_default_keyring_sync'_ a1' >>= \res ->
let {res' = Result res} in
stealNullableUtf8Ptr a1'>>= \a1'' ->
return (res', a1'')
stealNullableUtf8Ptr :: Ptr CString -> IO (Maybe String)
stealNullableUtf8Ptr ptr = bracket (peek ptr) free peekNullableUtf8
setDefaultKeyring :: String -> Operation ()
setDefaultKeyring k = voidOperation
(set_default_keyring k)
(set_default_keyring_sync k)
set_default_keyring :: (String) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
set_default_keyring a1 a2 a3 a4 =
withUtf8 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 :: (String) -> IO (((Result, ())))
set_default_keyring_sync a1 =
withUtf8 a1 $ \a1' ->
set_default_keyring_sync'_ a1' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
listKeyringNames :: Operation [String]
listKeyringNames = stringListOperation
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), ([String]))
list_keyring_names_sync =
alloca $ \a1' ->
list_keyring_names_sync'_ a1' >>= \res ->
let {res' = Result res} in
stealUtf8List a1'>>= \a1'' ->
return (res', a1'')
stealUtf8List :: Ptr (Ptr ()) -> IO [String]
stealUtf8List ptr = bracket (peek ptr)
gnome_keyring_string_list_free
(mapGList peekUtf8)
createKeyring :: String
-> Maybe String
-> Operation ()
createKeyring k p = voidOperation (c_create k p) (create_sync k p)
c_create :: (String) -> (Maybe String) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
c_create a1 a2 a3 a4 a5 =
withUtf8 a1 $ \a1' ->
withNullableUtf8 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 :: (String) -> (Maybe String) -> IO (((Result, ())))
create_sync a1 a2 =
withUtf8 a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
create_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
deleteKeyring :: String -> Operation ()
deleteKeyring k = voidOperation (c_delete k) (delete_sync k)
c_delete :: (String) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
c_delete a1 a2 a3 a4 =
withUtf8 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 :: (String) -> IO (((Result, ())))
delete_sync a1 =
withUtf8 a1 $ \a1' ->
delete_sync'_ a1' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
lockKeyring :: Keyring -> Operation ()
lockKeyring k = voidOperation (c_lock k) (lock_sync k)
c_lock :: (Keyring) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
c_lock a1 a2 a3 a4 =
withKeyringName 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 :: (Keyring) -> IO (((Result, ())))
lock_sync a1 =
withKeyringName 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')
unlockKeyring :: Keyring -> Maybe String -> Operation ()
unlockKeyring k p = voidOperation (c_unlock k p) (unlock_sync k p)
c_unlock :: (Keyring ) -> (Maybe String) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
c_unlock a1 a2 a3 a4 a5 =
withKeyringName a1 $ \a1' ->
withNullableUtf8 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 :: (Keyring ) -> (Maybe String) -> IO (((Result, ())))
unlock_sync a1 a2 =
withKeyringName a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
unlock_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
getKeyringInfo :: Keyring -> Operation KeyringInfo
getKeyringInfo k = keyringInfoOperation (get_info k) (get_info_sync k)
get_info :: (Keyring) -> (GetKeyringInfoCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
get_info a1 a2 a3 a4 =
withKeyringName 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 :: (Keyring) -> IO ((Result), (KeyringInfo))
get_info_sync a1 =
withKeyringName a1 $ \a1' ->
alloca $ \a2' ->
get_info_sync'_ a1' a2' >>= \res ->
let {res' = Result res} in
stealKeyringInfoPtr a2'>>= \a2'' ->
return (res', a2'')
setKeyringInfo :: Keyring -> KeyringInfo -> Operation ()
setKeyringInfo k info = voidOperation
(set_info k info)
(set_info_sync k info)
set_info :: (Keyring) -> (KeyringInfo) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
set_info a1 a2 a3 a4 a5 =
withKeyringName 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 :: (Keyring) -> (KeyringInfo) -> IO (((Result, ())))
set_info_sync a1 a2 =
withKeyringName a1 $ \a1' ->
withKeyringInfo a2 $ \a2' ->
set_info_sync'_ a1' a2' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
changeKeyringPassword
:: String
-> Maybe String
-> Maybe String
-> Operation ()
changeKeyringPassword k op np = voidOperation
(change_password k op np)
(change_password_sync k op np)
change_password :: (String) -> (Maybe String) -> (Maybe String) -> (DoneCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
change_password a1 a2 a3 a4 a5 a6 =
withUtf8 a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 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 :: (String) -> (Maybe String) -> (Maybe String) -> IO (((Result, ())))
change_password_sync a1 a2 a3 =
withUtf8 a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 a3 $ \a3' ->
change_password_sync'_ a1' a2' a3' >>= \res ->
let {res' = resultAndTuple res} in
return (res')
data KeyringInfo = KeyringInfo
{
keyringLockOnIdle :: Bool
, keyringLockTimeout :: Word32
, keyringMTime :: UTCTime
, keyringCTime :: UTCTime
, keyringIsLocked_ :: Bool
, keyringInfoToken :: ForeignPtr ()
}
keyringModified :: KeyringInfo -> UTCTime
keyringModified = keyringMTime
keyringCreated :: KeyringInfo -> UTCTime
keyringCreated = keyringCTime
keyringIsLocked :: KeyringInfo -> Bool
keyringIsLocked = keyringIsLocked_
instance Show KeyringInfo where
showsPrec d info = showParen (d > 10) $
s "KeyringInfo" .
s " {keyringLockOnIdle = " . shows (keyringLockOnIdle info) .
s ", keyringLockTimeout = " . shows (keyringLockTimeout info) .
s ", keyringMTime = " . shows (keyringMTime info) .
s ", keyringCTime = " . shows (keyringCTime info) .
s ", keyringIsLocked = " . shows (keyringIsLocked info) .
s "}"
where s = showString
type GetKeyringInfoCallback = CInt -> Ptr () -> Ptr () -> IO ()
type GetKeyringInfoCallbackPtr = FunPtr ((CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetKeyringInfoCallback :: GetKeyringInfoCallback
-> IO GetKeyringInfoCallbackPtr
keyringInfoOperation :: OperationImpl GetKeyringInfoCallback KeyringInfo
keyringInfoOperation = operationImpl $ \checkResult ->
wrapGetKeyringInfoCallback $ \cres ptr _ ->
checkResult cres (peekKeyringInfo ptr)
copyInfo :: Ptr () -> IO (ForeignPtr ())
copyInfo = (newForeignPtr finalizeKeyringInfo =<<) . c_copy
peekKeyringInfo :: Ptr () -> IO KeyringInfo
peekKeyringInfo ptr = do
lockOnIdle <- toBool `fmap` gnome_keyring_info_get_lock_on_idle ptr
timeout <- fromIntegral `fmap` gnome_keyring_info_get_lock_timeout ptr
mtime <- cToUTC `fmap` gnome_keyring_info_get_mtime ptr
ctime <- cToUTC `fmap` gnome_keyring_info_get_ctime ptr
isLocked <- toBool `fmap` gnome_keyring_info_get_is_locked ptr
copy <- copyInfo ptr
return (KeyringInfo lockOnIdle timeout mtime ctime isLocked copy)
stealKeyringInfoPtr :: Ptr (Ptr ()) -> IO KeyringInfo
stealKeyringInfoPtr ptr = do
infoPtr <- newForeignPtr finalizeKeyringInfo =<< peek ptr
withForeignPtr infoPtr peekKeyringInfo
withKeyringInfo :: KeyringInfo -> (Ptr () -> IO a) -> IO a
withKeyringInfo info io = do
let infoPtr = keyringInfoToken info
copy <- withForeignPtr infoPtr copyInfo
withForeignPtr copy $ \ptr -> do
gnome_keyring_info_set_lock_on_idle ptr (fromBool (keyringLockOnIdle info))
gnome_keyring_info_set_lock_timeout ptr (fromIntegral (keyringLockTimeout info))
io ptr
foreign import ccall "gnome-keyring.h &gnome_keyring_info_free"
finalizeKeyringInfo :: FunPtr (Ptr a -> IO ())
data NetworkPassword = NetworkPassword
{ networkPasswordKeyring_ :: Keyring
, networkPasswordItemID_ :: ItemID
, networkPasswordNetwork_ :: Network
, networkPasswordSecret_ :: String
}
deriving (Eq)
networkPasswordKeyring :: NetworkPassword -> Keyring
networkPasswordKeyring = networkPasswordKeyring_
networkPasswordItemID :: NetworkPassword -> ItemID
networkPasswordItemID = networkPasswordItemID_
networkPasswordNetwork :: NetworkPassword -> Network
networkPasswordNetwork = networkPasswordNetwork_
networkPasswordSecret :: NetworkPassword -> String
networkPasswordSecret = networkPasswordSecret_
instance Show NetworkPassword where
showsPrec d x = showParen (d > 10) $
s "NetworkPassword" .
s " {networkPasswordKeyring = " . shows (networkPasswordKeyring_ x) .
s ", networkPasswordItemID = " . shows (networkPasswordItemID_ x) .
s ", networkPasswordNetwork = " . shows (networkPasswordNetwork_ x) .
s ", networkPasswordSecret = " . shows (networkPasswordSecret_ x) .
s "}"
where s = showString
data Network = Network
{
networkProtocol :: Maybe String
, networkServer :: Maybe String
, networkObject :: Maybe String
, networkAuthType :: Maybe String
, networkPort :: Word32
, networkUser :: Maybe String
, networkDomain :: Maybe String
}
deriving (Show, Eq)
network :: Network
network = Network
{ networkProtocol = Nothing
, networkServer = Nothing
, networkObject = Nothing
, networkAuthType = Nothing
, networkPort = 0
, networkUser = Nothing
, networkDomain = Nothing
}
findNetworkPassword :: Network -> Operation [NetworkPassword]
findNetworkPassword net = let
p1 = networkUser net
p2 = networkDomain net
p3 = networkServer net
p4 = networkObject net
p5 = networkProtocol net
p6 = networkAuthType net
p7 = networkPort net
in passwordListOperation
(find_network_password p1 p2 p3 p4 p5 p6 p7)
(do
(rc, lst) <- find_network_password_sync p1 p2 p3 p4 p5 p6 p7
return $ if rc == Result 9
then (Result 0, [])
else (rc, lst))
passwordListOperation :: OperationImpl GetListCallback [NetworkPassword]
passwordListOperation = operationImpl $ \checkResult ->
wrapGetListCallback $ \cres list _ -> if cres == 9
then checkResult 0 (return [])
else checkResult cres (mapGList peekPassword list)
find_network_password :: (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Word32) -> (GetListCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
find_network_password a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
withNullableUtf8 a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 a3 $ \a3' ->
withNullableUtf8 a4 $ \a4' ->
withNullableUtf8 a5 $ \a5' ->
withNullableUtf8 a6 $ \a6' ->
let {a7' = fromIntegral a7} in
let {a8' = id a8} in
let {a9' = id a9} in
let {a10' = id a10} in
find_network_password'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
let {res' = CancellationKey res} in
return (res')
find_network_password_sync :: (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Word32) -> IO ((Result), ([NetworkPassword]))
find_network_password_sync a1 a2 a3 a4 a5 a6 a7 =
withNullableUtf8 a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 a3 $ \a3' ->
withNullableUtf8 a4 $ \a4' ->
withNullableUtf8 a5 $ \a5' ->
withNullableUtf8 a6 $ \a6' ->
let {a7' = fromIntegral a7} in
alloca $ \a8' ->
find_network_password_sync'_ a1' a2' a3' a4' a5' a6' a7' a8' >>= \res ->
let {res' = Result res} in
stealPasswordList a8'>>= \a8'' ->
return (res', a8'')
setNetworkPassword :: Keyring
-> Network
-> String
-> Operation ItemID
setNetworkPassword k net secret = let
p1 = networkUser net
p2 = networkDomain net
p3 = networkServer net
p4 = networkObject net
p5 = networkProtocol net
p6 = networkAuthType net
p7 = networkPort net
in itemIDOperation
(set_network_password k p1 p2 p3 p4 p5 p6 p7 secret)
(set_network_password_sync k p1 p2 p3 p4 p5 p6 p7 secret)
set_network_password :: (Keyring) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Word32) -> (String) -> (GetIntCallbackPtr) -> (Ptr ()) -> (DestroyNotifyPtr) -> IO ((CancellationKey))
set_network_password a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
withKeyringName a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 a3 $ \a3' ->
withNullableUtf8 a4 $ \a4' ->
withNullableUtf8 a5 $ \a5' ->
withNullableUtf8 a6 $ \a6' ->
withNullableUtf8 a7 $ \a7' ->
let {a8' = fromIntegral a8} in
withUtf8 a9 $ \a9' ->
let {a10' = id a10} in
let {a11' = id a11} in
let {a12' = id a12} in
set_network_password'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
let {res' = CancellationKey res} in
return (res')
set_network_password_sync :: (Keyring) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Maybe String) -> (Word32) -> (String) -> IO ((Result), (ItemID))
set_network_password_sync a1 a2 a3 a4 a5 a6 a7 a8 a9 =
withKeyringName a1 $ \a1' ->
withNullableUtf8 a2 $ \a2' ->
withNullableUtf8 a3 $ \a3' ->
withNullableUtf8 a4 $ \a4' ->
withNullableUtf8 a5 $ \a5' ->
withNullableUtf8 a6 $ \a6' ->
withNullableUtf8 a7 $ \a7' ->
let {a8' = fromIntegral a8} in
withUtf8 a9 $ \a9' ->
alloca $ \a10' ->
set_network_password_sync'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
let {res' = Result res} in
peekItemID a10'>>= \a10'' ->
return (res', a10'')
peekPassword :: Ptr () -> IO NetworkPassword
peekPassword pwd = do
protocol <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 16 ::IO (Ptr CChar)}) pwd
server <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 24 ::IO (Ptr CChar)}) pwd
object <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 32 ::IO (Ptr CChar)}) pwd
authType <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 40 ::IO (Ptr CChar)}) pwd
port <- fromIntegral `fmap` (\ptr -> do {peekByteOff ptr 48 ::IO CUInt}) pwd
user <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 56 ::IO (Ptr CChar)}) pwd
domain <- peekNullableUtf8 =<< (\ptr -> do {peekByteOff ptr 64 ::IO (Ptr CChar)}) pwd
let net = Network
{ networkProtocol = protocol
, networkServer = server
, networkObject = object
, networkAuthType = authType
, networkPort = port
, networkUser = user
, networkDomain = domain
}
keyringName <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr CChar)}) pwd
itemID <- ItemID `fmap` (\ptr -> do {peekByteOff ptr 8 ::IO CUInt}) pwd
password <- peekUtf8 =<< (\ptr -> do {peekByteOff ptr 72 ::IO (Ptr CChar)}) pwd
return (NetworkPassword (keyring keyringName) itemID net password)
stealPasswordList :: Ptr (Ptr ()) -> IO [NetworkPassword]
stealPasswordList ptr = bracket (peek ptr)
gnome_keyring_network_password_list_free
(mapGList peekPassword)
data Operation a = Operation
{ asyncImpl :: (KeyringError -> IO ()) -> (a -> IO ()) -> IO CancellationKey
, syncImpl :: IO (Result, a)
}
sync :: Operation a -> IO (Either KeyringError a)
sync op = do
(res, x) <- syncImpl op
return $ case res of
Result 0 -> Right x
_ -> Left (resultToError res)
sync_ :: Operation a -> IO a
sync_ op = do
res <- sync op
case res of
Right x -> return x
Left err -> throwIO (KeyringException err)
async :: Operation a -> (KeyringError -> IO ()) -> (a -> IO ()) -> IO CancellationKey
async = asyncImpl
type OperationImpl a b = (FunPtr a -> Ptr () -> DestroyNotifyPtr -> IO CancellationKey) -> IO (Result, b) -> Operation b
operationImpl :: ((CInt -> IO a -> IO ()) -> IO (FunPtr b)) -> OperationImpl b a
operationImpl impl asyncIO = Operation $ \onError onSuccess -> do
callback <- impl $ \cres io -> case cres of
0 -> io >>= onSuccess
x -> onError (resultToError (Result x))
destroy <- wrapDestroyNotify $ \ptr -> do
let stable = castPtrToStablePtr ptr
_ <- join (deRefStablePtr stable)
freeStablePtr stable
stable <- newStablePtr $ do
freeHaskellFunPtr callback
freeHaskellFunPtr destroy
asyncIO callback (castStablePtrToPtr stable) destroy
voidOperation :: OperationImpl DoneCallback ()
voidOperation = operationImpl $ \checkResult ->
wrapDoneCallback $ \cres _ ->
checkResult cres (return ())
maybeStringOperation :: OperationImpl GetStringCallback (Maybe String)
maybeStringOperation = operationImpl $ \checkResult ->
wrapGetStringCallback $ \cres cstr _ ->
checkResult cres (peekNullableUtf8 cstr)
stringListOperation :: OperationImpl GetListCallback [String]
stringListOperation = operationImpl $ \checkResult ->
wrapGetListCallback $ \cres list _ ->
checkResult cres (mapGList peekUtf8 list)
cToUTC :: Integral a => a -> UTCTime
cToUTC = posixSecondsToUTCTime . fromIntegral
peekText :: CString -> IO Text
peekText cstr
| cstr == nullPtr = error "Gnome.Keyring.FFI.peekText nullPtr"
| otherwise = do
bytes <- ByteString.packCString cstr
return (decodeUtf8 bytes)
withUtf8 :: String -> (CString -> IO a) -> IO a
withUtf8 = ByteString.useAsCString . encodeUtf8 . Data.Text.pack
peekUtf8 :: CString -> IO String
peekUtf8 cstr = fmap Data.Text.unpack (peekText cstr)
withNullableUtf8 :: Maybe String -> (CString -> IO a) -> IO a
withNullableUtf8 = maybeWith withUtf8
peekNullableUtf8 :: CString -> IO (Maybe String)
peekNullableUtf8= maybePeek peekUtf8
stealNullableUtf8 :: CString -> IO (Maybe String)
stealNullableUtf8 cstr = bracket (return cstr) free peekNullableUtf8
withKeyringName :: Keyring -> (CString -> IO a) -> IO a
withKeyringName k = withNullableUtf8 name where
name = case k of
DefaultKeyring -> Nothing
NamedKeyring s -> Just s
mapGList :: (Ptr a -> IO b) -> Ptr () -> IO [b]
mapGList f list
| list == nullPtr = return []
| otherwise = do
item <- (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr ())}) list
next <- (\ptr -> do {peekByteOff ptr 8 ::IO (Ptr ())}) list
items <- mapGList f next
item' <- f (castPtr item)
return (item' : items)
mapGArray :: (Ptr a -> IO b) -> Int -> Ptr () -> IO [b]
mapGArray f size array = do
len <- (\ptr -> do {peekByteOff ptr 8 ::IO CUInt}) array
start <- (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr CChar)}) array
mapGArray' f size (fromIntegral len) (castPtr start)
mapGArray' :: (Ptr a -> IO b) -> Int -> Integer -> Ptr () -> IO [b]
mapGArray' _ _ 0 _ = return []
mapGArray' f size n ptr = do
attr <- f (castPtr ptr)
attrs <- mapGArray' f size (n 1) (plusPtr ptr size)
return (attr : attrs)
resultToError :: Result -> KeyringError
resultToError (Result 7) = KeyringError "Operation canceled by user or application"
resultToError (Result x) = unsafePerformIO $ do
ptr <- gnome_keyring_result_to_message x
msg <- peekUtf8 ptr
return (KeyringError msg)
type DestroyNotify = Ptr () -> IO ()
type DestroyNotifyPtr = FunPtr (((Ptr ()) -> (IO ())))
foreign import ccall "wrapper"
wrapDestroyNotify :: DestroyNotify -> IO DestroyNotifyPtr
type DoneCallback = CInt -> Ptr () -> IO ()
type DoneCallbackPtr = FunPtr ((CInt -> ((Ptr ()) -> (IO ()))))
foreign import ccall "wrapper"
wrapDoneCallback :: DoneCallback -> IO DoneCallbackPtr
type GetStringCallback = CInt -> CString -> Ptr () -> IO ()
type GetStringCallbackPtr = FunPtr ((CInt -> ((Ptr CChar) -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetStringCallback :: GetStringCallback -> IO GetStringCallbackPtr
type GetIntCallback = CInt -> CUInt -> Ptr () -> IO ()
type GetIntCallbackPtr = FunPtr ((CInt -> (CUInt -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetIntCallback :: GetIntCallback -> IO GetIntCallbackPtr
type GetListCallback = CInt -> Ptr () -> Ptr () -> IO ()
type GetListCallbackPtr = FunPtr ((CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ())))))
foreign import ccall "wrapper"
wrapGetListCallback :: GetListCallback -> IO GetListCallbackPtr
unpackKey :: CancellationKey -> Ptr ()
unpackKey (CancellationKey x) = x
cancel :: (CancellationKey) -> IO ((()))
cancel a1 =
let {a1' = unpackKey a1} in
cancel'_ a1' >>= \res ->
let {res' = id res} in
return (res')
newtype CancellationKey = CancellationKey (Ptr ())
newtype KeyringError = KeyringError String
deriving (Eq, Show)
keyringErrorMessage :: KeyringError -> String
keyringErrorMessage (KeyringError msg) = msg
newtype KeyringException = KeyringException KeyringError
deriving (Show, Eq, Typeable)
instance Exception KeyringException
newtype Result = Result CInt
deriving (Eq)
resultAndTuple :: CInt -> (Result, ())
resultAndTuple x = (Result x, ())
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_is_available"
available'_ :: (IO CInt)
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_get_type"
gnome_keyring_item_info_get_type :: ((Ptr ()) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_get_secret"
gnome_keyring_item_info_get_secret :: ((Ptr ()) -> (IO (Ptr CChar)))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_get_display_name"
gnome_keyring_item_info_get_display_name :: ((Ptr ()) -> (IO (Ptr CChar)))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_get_mtime"
gnome_keyring_item_info_get_mtime :: ((Ptr ()) -> (IO CLong))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_get_ctime"
gnome_keyring_item_info_get_ctime :: ((Ptr ()) -> (IO CLong))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_free"
gnome_keyring_item_info_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_new"
gnome_keyring_item_info_new :: (IO (Ptr ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_set_type"
gnome_keyring_item_info_set_type :: ((Ptr ()) -> (CInt -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_set_secret"
gnome_keyring_item_info_set_secret :: ((Ptr ()) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_info_set_display_name"
gnome_keyring_item_info_set_display_name :: ((Ptr ()) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_create"
item_create'_ :: ((Ptr CChar) -> (CInt -> ((Ptr CChar) -> ((Ptr ()) -> ((Ptr CChar) -> (CInt -> ((FunPtr (CInt -> (CUInt -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_create_sync"
item_create_sync'_ :: ((Ptr CChar) -> (CInt -> ((Ptr CChar) -> ((Ptr ()) -> ((Ptr CChar) -> (CInt -> ((Ptr CUInt) -> (IO CInt))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_delete"
item_delete'_ :: ((Ptr CChar) -> (CUInt -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_delete_sync"
item_delete_sync'_ :: ((Ptr CChar) -> (CUInt -> (IO CInt)))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_list_item_ids_sync"
list_item_ids_sync'_ :: ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO CInt)))
foreign import ccall safe "Gnome/Keyring.chs.h g_list_free"
g_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_info_full"
item_get_info_full'_ :: ((Ptr CChar) -> (CUInt -> (CUInt -> ((GetItemInfoCallbackPtr) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_info_full_sync"
item_get_info_full_sync'_ :: ((Ptr CChar) -> (CUInt -> (CUInt -> ((Ptr (Ptr ())) -> (IO CInt)))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_info"
item_set_info'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_info_sync"
item_set_info_sync'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h g_array_new"
g_array_new :: (CInt -> (CInt -> (CUInt -> (IO (Ptr ())))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_attribute_list_append_string"
appendString'_ :: ((Ptr ()) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO ()))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_attribute_list_free"
gnome_keyring_attribute_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_attributes"
item_get_attributes'_ :: ((Ptr CChar) -> (CUInt -> ((GetAttributesCallbackPtr) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_attributes_sync"
item_get_attributes_sync'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_attributes"
item_set_attributes'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_attributes_sync"
item_set_attributes_sync'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_ac_get_display_name"
gnome_keyring_item_ac_get_display_name :: ((Ptr ()) -> (IO (Ptr CChar)))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_ac_get_path_name"
gnome_keyring_item_ac_get_path_name :: ((Ptr ()) -> (IO (Ptr CChar)))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_ac_get_access_type"
gnome_keyring_item_ac_get_access_type :: ((Ptr ()) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_application_ref_new"
gnome_keyring_application_ref_new :: (IO (Ptr ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_application_ref_free"
gnome_keyring_application_ref_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h g_list_append"
g_list_append :: ((Ptr ()) -> ((Ptr ()) -> (IO (Ptr ()))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_access_control_new"
gnome_keyring_access_control_new :: ((Ptr ()) -> (CInt -> (IO (Ptr ()))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_ac_set_display_name"
gnome_keyring_item_ac_set_display_name :: ((Ptr ()) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_ac_set_path_name"
gnome_keyring_item_ac_set_path_name :: ((Ptr ()) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_acl_free"
gnome_keyring_acl_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_acl"
item_get_acl'_ :: ((Ptr CChar) -> (CUInt -> ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_get_acl_sync"
item_get_acl_sync'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_acl"
item_set_acl'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_set_acl_sync"
item_set_acl_sync'_ :: ((Ptr CChar) -> (CUInt -> ((Ptr ()) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_grant_access_rights"
item_grant_access_rights'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> (CInt -> ((FunPtr (CInt -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_item_grant_access_rights_sync"
item_grant_access_rights_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> (CInt -> (IO CInt))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_found_list_free"
gnome_keyring_found_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_find_items"
find_items'_ :: (CInt -> ((Ptr ()) -> ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ())))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_find_items_sync"
find_items_sync'_ :: (CInt -> ((Ptr ()) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_get_default_keyring_sync"
get_default_keyring_sync'_ :: ((Ptr (Ptr CChar)) -> (IO CInt))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_set_default_keyring_sync"
set_default_keyring_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_list_keyring_names_sync"
list_keyring_names_sync'_ :: ((Ptr (Ptr ())) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_string_list_free"
gnome_keyring_string_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_create_sync"
create_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_delete_sync"
delete_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_lock_sync"
lock_sync'_ :: ((Ptr CChar) -> (IO CInt))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_lock_all_sync"
lock_all_sync'_ :: (IO CInt)
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_unlock_sync"
unlock_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_get_info_sync"
get_info_sync'_ :: ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO CInt)))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_set_info_sync"
set_info_sync'_ :: ((Ptr CChar) -> ((Ptr ()) -> (IO CInt)))
foreign import ccall safe "Gnome/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.chs.h gnome_keyring_change_password_sync"
change_password_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO CInt))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_copy"
c_copy :: ((Ptr ()) -> (IO (Ptr ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_get_lock_on_idle"
gnome_keyring_info_get_lock_on_idle :: ((Ptr ()) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_get_lock_timeout"
gnome_keyring_info_get_lock_timeout :: ((Ptr ()) -> (IO CUInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_get_mtime"
gnome_keyring_info_get_mtime :: ((Ptr ()) -> (IO CLong))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_get_ctime"
gnome_keyring_info_get_ctime :: ((Ptr ()) -> (IO CLong))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_get_is_locked"
gnome_keyring_info_get_is_locked :: ((Ptr ()) -> (IO CInt))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_set_lock_on_idle"
gnome_keyring_info_set_lock_on_idle :: ((Ptr ()) -> (CInt -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_info_set_lock_timeout"
gnome_keyring_info_set_lock_timeout :: ((Ptr ()) -> (CUInt -> (IO ())))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_find_network_password"
find_network_password'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> ((FunPtr (CInt -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_find_network_password_sync"
find_network_password_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> ((Ptr (Ptr ())) -> (IO CInt)))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_set_network_password"
set_network_password'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> ((Ptr CChar) -> ((FunPtr (CInt -> (CUInt -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO (Ptr ()))))))))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_set_network_password_sync"
set_network_password_sync'_ :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CUInt -> ((Ptr CChar) -> ((Ptr CUInt) -> (IO CInt)))))))))))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_network_password_list_free"
gnome_keyring_network_password_list_free :: ((Ptr ()) -> (IO ()))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_result_to_message"
gnome_keyring_result_to_message :: (CInt -> (IO (Ptr CChar)))
foreign import ccall safe "Gnome/Keyring.chs.h gnome_keyring_cancel_request"
cancel'_ :: ((Ptr ()) -> (IO ()))