{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Secret.Functions ( -- * Methods -- ** errorGetQuark #method:errorGetQuark# errorGetQuark , -- ** passwordClear #method:passwordClear# passwordClear , -- ** passwordClearFinish #method:passwordClearFinish# passwordClearFinish , -- ** passwordClearSync #method:passwordClearSync# passwordClearSync , -- ** passwordLookup #method:passwordLookup# passwordLookup , -- ** passwordLookupFinish #method:passwordLookupFinish# passwordLookupFinish , -- ** passwordLookupSync #method:passwordLookupSync# passwordLookupSync , -- ** passwordStore #method:passwordStore# passwordStore , -- ** passwordStoreFinish #method:passwordStoreFinish# passwordStoreFinish , -- ** passwordStoreSync #method:passwordStoreSync# passwordStoreSync , -- ** passwordWipe #method:passwordWipe# passwordWipe , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GI.Gio.Callbacks as Gio.Callbacks import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable import {-# SOURCE #-} qualified GI.Secret.Structs.Schema as Secret.Schema -- function secret_password_wipe -- Args : [Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "password to clear", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "secret_password_wipe" secret_password_wipe :: CString -> -- password : TBasicType TUTF8 IO () {- | Clear the memory used by a password. -} passwordWipe :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) {- ^ /@password@/: password to clear -} -> m () passwordWipe password = liftIO $ do maybePassword <- case password of Nothing -> return nullPtr Just jPassword -> do jPassword' <- textToCString jPassword return jPassword' secret_password_wipe maybePassword freeMem maybePassword return () -- function secret_password_storev_sync -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a collection alias, or D-Bus object path of the collection where to store the secret", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "label for the secret", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the null-terminated password to store", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "secret_password_storev_sync" secret_password_storev_sync :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) CString -> -- collection : TBasicType TUTF8 CString -> -- label : TBasicType TUTF8 CString -> -- password : TBasicType TUTF8 Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO CInt {- | Store a password in the secret service. The /@attributes@/ should be a set of key and value string pairs. If the attributes match a secret item already stored in the collection, then the item will be updated with these new values. If /@collection@/ is 'Nothing', then the default collection will be used. Use 'GI.Secret.Constants.COLLECTION_SESSION' to store the password in the session collection, which doesn\'t get stored across login sessions. This method may block indefinitely and should not be used in user interface threads. -} passwordStoreSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (T.Text) {- ^ /@collection@/: a collection alias, or D-Bus object path of the collection where to store the secret -} -> T.Text {- ^ /@label@/: label for the secret -} -> T.Text {- ^ /@password@/: the null-terminated password to store -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordStoreSync schema attributes collection label password cancellable = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCollection <- case collection of Nothing -> return nullPtr Just jCollection -> do jCollection' <- textToCString jCollection return jCollection' label' <- textToCString label password' <- textToCString password maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' onException (do _ <- propagateGError $ secret_password_storev_sync schema' attributes'''''' maybeCollection label' password' maybeCancellable touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' freeMem maybeCollection freeMem label' freeMem password' return () ) (do unrefGHashTable attributes'''''' freeMem maybeCollection freeMem label' freeMem password' ) -- function secret_password_store_finish -- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "secret_password_store_finish" secret_password_store_finish :: Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"}) Ptr (Ptr GError) -> -- error IO CInt {- | Finish asynchronous operation to store a password in the secret service. -} passwordStoreFinish :: (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) => a {- ^ /@result@/: the asynchronous result passed to the callback -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordStoreFinish result_ = liftIO $ do result_' <- unsafeManagedPtrCastPtr result_ onException (do _ <- propagateGError $ secret_password_store_finish result_' touchManagedPtr result_ return () ) (do return () ) -- function secret_password_storev -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a collection alias, or D-Bus object path of the collection where to store the secret", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "label for the secret", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "password", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the null-terminated password to store", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 7, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to be passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "secret_password_storev" secret_password_storev :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) CString -> -- collection : TBasicType TUTF8 CString -> -- label : TBasicType TUTF8 CString -> -- password : TBasicType TUTF8 Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr IO () {- | Store a password in the secret service. The /@attributes@/ should be a set of key and value string pairs. If the attributes match a secret item already stored in the collection, then the item will be updated with these new values. If /@collection@/ is 'Nothing', then the default collection will be used. Use 'GI.Secret.Constants.COLLECTION_SESSION' to store the password in the session collection, which doesn\'t get stored across login sessions. This method will return immediately and complete asynchronously. -} passwordStore :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (T.Text) {- ^ /@collection@/: a collection alias, or D-Bus object path of the collection where to store the secret -} -> T.Text {- ^ /@label@/: label for the secret -} -> T.Text {- ^ /@password@/: the null-terminated password to store -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> Maybe (Gio.Callbacks.AsyncReadyCallback) {- ^ /@callback@/: called when the operation completes -} -> m () passwordStore schema attributes collection label password cancellable callback = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCollection <- case collection of Nothing -> return nullPtr Just jCollection -> do jCollection' <- textToCString jCollection return jCollection' label' <- textToCString label password' <- textToCString password maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' let userData = nullPtr secret_password_storev schema' attributes'''''' maybeCollection label' password' maybeCancellable maybeCallback userData touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' freeMem maybeCollection freeMem label' freeMem password' return () -- function secret_password_lookupv_sync -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "secret_password_lookupv_sync" secret_password_lookupv_sync :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO CString {- | Lookup a password in the secret service. The /@attributes@/ should be a set of key and value string pairs. If no secret is found then 'Nothing' is returned. This method may block indefinitely and should not be used in user interface threads. -} passwordLookupSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> m T.Text {- ^ __Returns:__ a new password string which should be freed with @/secret_password_free()/@ or may be freed with 'GI.GLib.Functions.free' when done /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordLookupSync schema attributes cancellable = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' onException (do result <- propagateGError $ secret_password_lookupv_sync schema' attributes'''''' maybeCancellable checkUnexpectedReturnNULL "passwordLookupSync" result result' <- cstringToText result freeMem result touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' return result' ) (do unrefGHashTable attributes'''''' ) -- function secret_password_lookup_finish -- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "secret_password_lookup_finish" secret_password_lookup_finish :: Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"}) Ptr (Ptr GError) -> -- error IO CString {- | Finish an asynchronous operation to lookup a password in the secret service. -} passwordLookupFinish :: (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) => a {- ^ /@result@/: the asynchronous result passed to the callback -} -> m T.Text {- ^ __Returns:__ a new password string which should be freed with @/secret_password_free()/@ or may be freed with 'GI.GLib.Functions.free' when done /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordLookupFinish result_ = liftIO $ do result_' <- unsafeManagedPtrCastPtr result_ onException (do result <- propagateGError $ secret_password_lookup_finish result_' checkUnexpectedReturnNULL "passwordLookupFinish" result result' <- cstringToText result freeMem result touchManagedPtr result_ return result' ) (do return () ) -- function secret_password_lookupv -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to be passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "secret_password_lookupv" secret_password_lookupv :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr IO () {- | Lookup a password in the secret service. The /@attributes@/ should be a set of key and value string pairs. If no secret is found then 'Nothing' is returned. This method will return immediately and complete asynchronously. -} passwordLookup :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> Maybe (Gio.Callbacks.AsyncReadyCallback) {- ^ /@callback@/: called when the operation completes -} -> m () passwordLookup schema attributes cancellable callback = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' let userData = nullPtr secret_password_lookupv schema' attributes'''''' maybeCancellable maybeCallback userData touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' return () -- function secret_password_clearv_sync -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for the attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "secret_password_clearv_sync" secret_password_clearv_sync :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO CInt {- | Remove unlocked matching passwords from the secret service. The /@attributes@/ should be a set of key and value string pairs. All unlocked items that match the attributes will be deleted. This method may block indefinitely and should not be used in user interface threads. -} passwordClearSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for the attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordClearSync schema attributes cancellable = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' onException (do _ <- propagateGError $ secret_password_clearv_sync schema' attributes'''''' maybeCancellable touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' return () ) (do unrefGHashTable attributes'''''' ) -- function secret_password_clear_finish -- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "Gio", name = "AsyncResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the asynchronous result passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "secret_password_clear_finish" secret_password_clear_finish :: Ptr Gio.AsyncResult.AsyncResult -> -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"}) Ptr (Ptr GError) -> -- error IO CInt {- | Finish an asynchronous operation to remove passwords from the secret service. -} passwordClearFinish :: (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) => a {- ^ /@result@/: the asynchronous result passed to the callback -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} passwordClearFinish result_ = liftIO $ do result_' <- unsafeManagedPtrCastPtr result_ onException (do _ <- propagateGError $ secret_password_clear_finish result_' touchManagedPtr result_ return () ) (do return () ) -- function secret_password_clearv -- Args : [Arg {argCName = "schema", argType = TInterface (Name {namespace = "Secret", name = "Schema"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the schema for the attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attributes", argType = TGHash (TBasicType TUTF8) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the attribute keys and values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cancellable", argType = TInterface (Name {namespace = "Gio", name = "Cancellable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional cancellation object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "called when the operation completes", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to be passed to the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "secret_password_clearv" secret_password_clearv :: Ptr Secret.Schema.Schema -> -- schema : TInterface (Name {namespace = "Secret", name = "Schema"}) Ptr (GHashTable CString CString) -> -- attributes : TGHash (TBasicType TUTF8) (TBasicType TUTF8) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr IO () {- | Remove unlocked matching passwords from the secret service. The /@attributes@/ should be a set of key and value string pairs. All unlocked items that match the attributes will be deleted. This method will return immediately and complete asynchronously. -} passwordClear :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Secret.Schema.Schema {- ^ /@schema@/: the schema for the attributes -} -> Map.Map T.Text T.Text {- ^ /@attributes@/: the attribute keys and values -} -> Maybe (a) {- ^ /@cancellable@/: optional cancellation object -} -> Maybe (Gio.Callbacks.AsyncReadyCallback) {- ^ /@callback@/: called when the operation completes -} -> m () passwordClear schema attributes cancellable callback = liftIO $ do schema' <- unsafeManagedPtrGetPtr schema let attributes' = Map.toList attributes attributes'' <- mapFirstA textToCString attributes' attributes''' <- mapSecondA textToCString attributes'' let attributes'''' = mapFirst cstringPackPtr attributes''' let attributes''''' = mapSecond cstringPackPtr attributes'''' attributes'''''' <- packGHashTable gStrHash gStrEqual (Just ptr_to_g_free) (Just ptr_to_g_free) attributes''''' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do jCancellable' <- unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' let userData = nullPtr secret_password_clearv schema' attributes'''''' maybeCancellable maybeCallback userData touchManagedPtr schema whenJust cancellable touchManagedPtr unrefGHashTable attributes'''''' return () -- function secret_error_get_quark -- Args : [] -- Lengths : [] -- returnType : Just (TBasicType TUInt32) -- throws : False -- Skip return : False foreign import ccall "secret_error_get_quark" secret_error_get_quark :: IO Word32 {- | /No description available in the introspection data./ -} errorGetQuark :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 errorGetQuark = liftIO $ do result <- secret_error_get_quark return result