{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.OSTree.Interfaces.Sign
    ( 
#if defined(ENABLE_OVERLOADING)
    SignDummyAddPkMethodInfo                ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummyDataMethodInfo                 ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummyDataVerifyMethodInfo           ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummyGetNameMethodInfo              ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummyMetadataFormatMethodInfo       ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummyMetadataKeyMethodInfo          ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummySetPkMethodInfo                ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignDummySetSkMethodInfo                ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519AddPkMethodInfo              ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519ClearKeysMethodInfo          ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519DataMethodInfo               ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519DataVerifyMethodInfo         ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519GetNameMethodInfo            ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519LoadPkMethodInfo             ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519MetadataFormatMethodInfo     ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519MetadataKeyMethodInfo        ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519SetPkMethodInfo              ,
#endif
#if defined(ENABLE_OVERLOADING)
    SignEd25519SetSkMethodInfo              ,
#endif

-- * Exported types
    Sign(..)                                ,
    IsSign                                  ,
    toSign                                  ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveSignMethod                       ,
#endif


-- ** addPk #method:addPk#

#if defined(ENABLE_OVERLOADING)
    SignAddPkMethodInfo                     ,
#endif
    signAddPk                               ,


-- ** clearKeys #method:clearKeys#

#if defined(ENABLE_OVERLOADING)
    SignClearKeysMethodInfo                 ,
#endif
    signClearKeys                           ,


-- ** commit #method:commit#

#if defined(ENABLE_OVERLOADING)
    SignCommitMethodInfo                    ,
#endif
    signCommit                              ,


-- ** commitVerify #method:commitVerify#

#if defined(ENABLE_OVERLOADING)
    SignCommitVerifyMethodInfo              ,
#endif
    signCommitVerify                        ,


-- ** data #method:data#

#if defined(ENABLE_OVERLOADING)
    SignDataMethodInfo                      ,
#endif
    signData                                ,


-- ** dataVerify #method:dataVerify#

#if defined(ENABLE_OVERLOADING)
    SignDataVerifyMethodInfo                ,
#endif
    signDataVerify                          ,


-- ** getAll #method:getAll#

    signGetAll                              ,


-- ** getByName #method:getByName#

    signGetByName                           ,


-- ** getName #method:getName#

#if defined(ENABLE_OVERLOADING)
    SignGetNameMethodInfo                   ,
#endif
    signGetName                             ,


-- ** loadPk #method:loadPk#

#if defined(ENABLE_OVERLOADING)
    SignLoadPkMethodInfo                    ,
#endif
    signLoadPk                              ,


-- ** metadataFormat #method:metadataFormat#

#if defined(ENABLE_OVERLOADING)
    SignMetadataFormatMethodInfo            ,
#endif
    signMetadataFormat                      ,


-- ** metadataKey #method:metadataKey#

#if defined(ENABLE_OVERLOADING)
    SignMetadataKeyMethodInfo               ,
#endif
    signMetadataKey                         ,


-- ** setPk #method:setPk#

#if defined(ENABLE_OVERLOADING)
    SignSetPkMethodInfo                     ,
#endif
    signSetPk                               ,


-- ** setSk #method:setSk#

#if defined(ENABLE_OVERLOADING)
    SignSetSkMethodInfo                     ,
#endif
    signSetSk                               ,


-- ** summary #method:summary#

#if defined(ENABLE_OVERLOADING)
    SignSummaryMethodInfo                   ,
#endif
    signSummary                             ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.OverloadedLabels as OL

import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.OSTree.Objects.Repo as OSTree.Repo

-- interface Sign 
-- | Memory-managed wrapper type.
newtype Sign = Sign (SP.ManagedPtr Sign)
    deriving (Sign -> Sign -> Bool
(Sign -> Sign -> Bool) -> (Sign -> Sign -> Bool) -> Eq Sign
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sign -> Sign -> Bool
$c/= :: Sign -> Sign -> Bool
== :: Sign -> Sign -> Bool
$c== :: Sign -> Sign -> Bool
Eq)

instance SP.ManagedPtrNewtype Sign where
    toManagedPtr :: Sign -> ManagedPtr Sign
toManagedPtr (Sign p :: ManagedPtr Sign
p) = ManagedPtr Sign
p

foreign import ccall "ostree_sign_get_type"
    c_ostree_sign_get_type :: IO B.Types.GType

instance B.Types.TypedObject Sign where
    glibType :: IO GType
glibType = IO GType
c_ostree_sign_get_type

instance B.Types.GObject Sign

-- | Convert 'Sign' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Sign where
    toGValue :: Sign -> IO GValue
toGValue o :: Sign
o = do
        GType
gtype <- IO GType
c_ostree_sign_get_type
        Sign -> (Ptr Sign -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Sign
o (GType -> (GValue -> Ptr Sign -> IO ()) -> Ptr Sign -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Sign -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Sign
fromGValue gv :: GValue
gv = do
        Ptr Sign
ptr <- GValue -> IO (Ptr Sign)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Sign)
        (ManagedPtr Sign -> Sign) -> Ptr Sign -> IO Sign
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Sign -> Sign
Sign Ptr Sign
ptr
        
    

-- | Type class for types which can be safely cast to `Sign`, for instance with `toSign`.
class (SP.GObject o, O.IsDescendantOf Sign o) => IsSign o
instance (SP.GObject o, O.IsDescendantOf Sign o) => IsSign o

instance O.HasParentTypes Sign
type instance O.ParentTypes Sign = '[GObject.Object.Object]

-- | Cast to `Sign`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toSign :: (MonadIO m, IsSign o) => o -> m Sign
toSign :: o -> m Sign
toSign = IO Sign -> m Sign
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sign -> m Sign) -> (o -> IO Sign) -> o -> m Sign
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Sign -> Sign) -> o -> IO Sign
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Sign -> Sign
Sign

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Sign
type instance O.AttributeList Sign = SignAttributeList
type SignAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSignMethod (t :: Symbol) (o :: *) :: * where
    ResolveSignMethod "addPk" o = SignAddPkMethodInfo
    ResolveSignMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSignMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSignMethod "clearKeys" o = SignClearKeysMethodInfo
    ResolveSignMethod "commit" o = SignCommitMethodInfo
    ResolveSignMethod "commitVerify" o = SignCommitVerifyMethodInfo
    ResolveSignMethod "data" o = SignDataMethodInfo
    ResolveSignMethod "dataVerify" o = SignDataVerifyMethodInfo
    ResolveSignMethod "dummyAddPk" o = SignDummyAddPkMethodInfo
    ResolveSignMethod "dummyData" o = SignDummyDataMethodInfo
    ResolveSignMethod "dummyDataVerify" o = SignDummyDataVerifyMethodInfo
    ResolveSignMethod "dummyGetName" o = SignDummyGetNameMethodInfo
    ResolveSignMethod "dummyMetadataFormat" o = SignDummyMetadataFormatMethodInfo
    ResolveSignMethod "dummyMetadataKey" o = SignDummyMetadataKeyMethodInfo
    ResolveSignMethod "dummySetPk" o = SignDummySetPkMethodInfo
    ResolveSignMethod "dummySetSk" o = SignDummySetSkMethodInfo
    ResolveSignMethod "ed25519AddPk" o = SignEd25519AddPkMethodInfo
    ResolveSignMethod "ed25519ClearKeys" o = SignEd25519ClearKeysMethodInfo
    ResolveSignMethod "ed25519Data" o = SignEd25519DataMethodInfo
    ResolveSignMethod "ed25519DataVerify" o = SignEd25519DataVerifyMethodInfo
    ResolveSignMethod "ed25519GetName" o = SignEd25519GetNameMethodInfo
    ResolveSignMethod "ed25519LoadPk" o = SignEd25519LoadPkMethodInfo
    ResolveSignMethod "ed25519MetadataFormat" o = SignEd25519MetadataFormatMethodInfo
    ResolveSignMethod "ed25519MetadataKey" o = SignEd25519MetadataKeyMethodInfo
    ResolveSignMethod "ed25519SetPk" o = SignEd25519SetPkMethodInfo
    ResolveSignMethod "ed25519SetSk" o = SignEd25519SetSkMethodInfo
    ResolveSignMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSignMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSignMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSignMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSignMethod "loadPk" o = SignLoadPkMethodInfo
    ResolveSignMethod "metadataFormat" o = SignMetadataFormatMethodInfo
    ResolveSignMethod "metadataKey" o = SignMetadataKeyMethodInfo
    ResolveSignMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSignMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSignMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSignMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSignMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSignMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSignMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSignMethod "summary" o = SignSummaryMethodInfo
    ResolveSignMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSignMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSignMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSignMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSignMethod "getName" o = SignGetNameMethodInfo
    ResolveSignMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSignMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSignMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSignMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSignMethod "setPk" o = SignSetPkMethodInfo
    ResolveSignMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSignMethod "setSk" o = SignSetSkMethodInfo
    ResolveSignMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSignMethod t Sign, O.MethodInfo info Sign p) => OL.IsLabel t (Sign -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

-- method Sign::add_pk
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "public_key"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "single public key to be added"
--                 , 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 "ostree_sign_add_pk" ostree_sign_add_pk :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GVariant ->                         -- public_key : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Add the public key for verification. Could be called multiple times for
-- adding all needed keys to be used for verification.
-- 
-- The /@publicKey@/ argument depends of the particular engine implementation.
-- 
-- /Since: 2020.2/
signAddPk ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GVariant
    -- ^ /@publicKey@/: single public key to be added
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signAddPk :: a -> GVariant -> m ()
signAddPk self :: a
self publicKey :: GVariant
publicKey = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
publicKey' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
publicKey
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign -> Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_sign_add_pk Ptr Sign
self' Ptr GVariant
publicKey'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
publicKey
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignAddPkMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsSign a) => O.MethodInfo SignAddPkMethodInfo a signature where
    overloadedMethod = signAddPk

#endif

-- method Sign::clear_keys
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign 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 "ostree_sign_clear_keys" ostree_sign_clear_keys :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Clear all previously preloaded secret and public keys.
-- 
-- /Since: 2020.2/
signClearKeys ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signClearKeys :: a -> m ()
signClearKeys self :: a
self = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign -> Ptr (Ptr GError) -> IO CInt
ostree_sign_clear_keys Ptr Sign
self'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignClearKeysMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSign a) => O.MethodInfo SignClearKeysMethodInfo a signature where
    overloadedMethod = signClearKeys

#endif

-- method Sign::commit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "repo"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Repo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OsreeRepo object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "commit_checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "SHA256 of given commit to sign"
--                 , 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 "A #GCancellable" , 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 "ostree_sign_commit" ostree_sign_commit :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr OSTree.Repo.Repo ->                 -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    CString ->                              -- commit_checksum : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Add a signature to a commit.
-- 
-- Depending of the signing engine used you will need to load
-- the secret key with @/ostree_sign_set_sk/@.
-- 
-- /Since: 2020.2/
signCommit ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> b
    -- ^ /@repo@/: an @/OsreeRepo/@ object
    -> T.Text
    -- ^ /@commitChecksum@/: SHA256 of given commit to sign
    -> Maybe (c)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signCommit :: a -> b -> Text -> Maybe c -> m ()
signCommit self :: a
self repo :: b
repo commitChecksum :: Text
commitChecksum cancellable :: Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Repo
repo' <- b -> IO (Ptr Repo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
repo
    CString
commitChecksum' <- Text -> IO CString
textToCString Text
commitChecksum
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign
-> Ptr Repo
-> CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sign_commit Ptr Sign
self' Ptr Repo
repo' CString
commitChecksum' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
repo
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
commitChecksum'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
commitChecksum'
     )

#if defined(ENABLE_OVERLOADING)
data SignCommitMethodInfo
instance (signature ~ (b -> T.Text -> Maybe (c) -> m ()), MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SignCommitMethodInfo a signature where
    overloadedMethod = signCommit

#endif

-- method Sign::commit_verify
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "repo"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Repo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OsreeRepo object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "commit_checksum"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "SHA256 of given commit to verify"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_success_message"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "success message returned by the signing engine"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GCancellable" , 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 "ostree_sign_commit_verify" ostree_sign_commit_verify :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr OSTree.Repo.Repo ->                 -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    CString ->                              -- commit_checksum : TBasicType TUTF8
    Ptr CString ->                          -- out_success_message : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Verify if commit is signed with known key.
-- 
-- Depending of the signing engine used you will need to load
-- the public key(s) for verification with @/ostree_sign_set_pk/@,
-- @/ostree_sign_add_pk/@ and\/or @/ostree_sign_load_pk/@.
-- 
-- /Since: 2020.2/
signCommitVerify ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> b
    -- ^ /@repo@/: an @/OsreeRepo/@ object
    -> T.Text
    -- ^ /@commitChecksum@/: SHA256 of given commit to verify
    -> Maybe (c)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ((Maybe T.Text))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signCommitVerify :: a -> b -> Text -> Maybe c -> m (Maybe Text)
signCommitVerify self :: a
self repo :: b
repo commitChecksum :: Text
commitChecksum cancellable :: Maybe c
cancellable = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Repo
repo' <- b -> IO (Ptr Repo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
repo
    CString
commitChecksum' <- Text -> IO CString
textToCString Text
commitChecksum
    Ptr CString
outSuccessMessage <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (Maybe Text) -> IO () -> IO (Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign
-> Ptr Repo
-> CString
-> Ptr CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sign_commit_verify Ptr Sign
self' Ptr Repo
repo' CString
commitChecksum' Ptr CString
outSuccessMessage Ptr Cancellable
maybeCancellable
        CString
outSuccessMessage' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outSuccessMessage
        Maybe Text
maybeOutSuccessMessage' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outSuccessMessage' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \outSuccessMessage'' :: CString
outSuccessMessage'' -> do
            Text
outSuccessMessage''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outSuccessMessage''
            Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outSuccessMessage'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outSuccessMessage'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
repo
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
commitChecksum'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outSuccessMessage
        Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeOutSuccessMessage'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
commitChecksum'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outSuccessMessage
     )

#if defined(ENABLE_OVERLOADING)
data SignCommitVerifyMethodInfo
instance (signature ~ (b -> T.Text -> Maybe (c) -> m ((Maybe T.Text))), MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SignCommitVerifyMethodInfo a signature where
    overloadedMethod = signCommitVerify

#endif

-- method Sign::data
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the raw data to be signed with pre-loaded secret key"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signature"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "in case of success will contain signature"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GCancellable" , 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 "ostree_sign_data" ostree_sign_data :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GLib.Bytes.Bytes ->                 -- data : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GLib.Bytes.Bytes) ->           -- signature : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Sign the given /@data@/ with pre-loaded secret key.
-- 
-- Depending of the signing engine used you will need to load
-- the secret key with @/ostree_sign_set_sk/@.
-- 
-- /Since: 2020.2/
signData ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GLib.Bytes.Bytes
    -- ^ /@data@/: the raw data to be signed with pre-loaded secret key
    -> Maybe (b)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m (GLib.Bytes.Bytes)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signData :: a -> Bytes -> Maybe b -> m Bytes
signData self :: a
self data_ :: Bytes
data_ cancellable :: Maybe b
cancellable = IO Bytes -> m Bytes
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Bytes
data_' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
data_
    Ptr (Ptr Bytes)
signature <- IO (Ptr (Ptr Bytes))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GLib.Bytes.Bytes))
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Bytes -> IO () -> IO Bytes
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign
-> Ptr Bytes
-> Ptr (Ptr Bytes)
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sign_data Ptr Sign
self' Ptr Bytes
data_' Ptr (Ptr Bytes)
signature Ptr Cancellable
maybeCancellable
        Ptr Bytes
signature' <- Ptr (Ptr Bytes) -> IO (Ptr Bytes)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Bytes)
signature
        Bytes
signature'' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
signature'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
data_
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
signature
        Bytes -> IO Bytes
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
signature''
     ) (do
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
signature
     )

#if defined(ENABLE_OVERLOADING)
data SignDataMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> Maybe (b) -> m (GLib.Bytes.Bytes)), MonadIO m, IsSign a, Gio.Cancellable.IsCancellable b) => O.MethodInfo SignDataMethodInfo a signature where
    overloadedMethod = signData

#endif

-- method Sign::data_verify
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the raw data to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signatures"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the signatures to be checked"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_success_message"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "success message returned by the signing engine"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sign_data_verify" ostree_sign_data_verify :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GLib.Bytes.Bytes ->                 -- data : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr GVariant ->                         -- signatures : TVariant
    Ptr CString ->                          -- out_success_message : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Verify given data against signatures with pre-loaded public keys.
-- 
-- Depending of the signing engine used you will need to load
-- the public key(s) with @/ostree_sign_set_pk/@, @/ostree_sign_add_pk/@
-- or @/ostree_sign_load_pk/@.
-- 
-- /Since: 2020.2/
signDataVerify ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GLib.Bytes.Bytes
    -- ^ /@data@/: the raw data to check
    -> GVariant
    -- ^ /@signatures@/: the signatures to be checked
    -> m ((Maybe T.Text))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signDataVerify :: a -> Bytes -> GVariant -> m (Maybe Text)
signDataVerify self :: a
self data_ :: Bytes
data_ signatures :: GVariant
signatures = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Bytes
data_' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
data_
    Ptr GVariant
signatures' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
signatures
    Ptr CString
outSuccessMessage <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    IO (Maybe Text) -> IO () -> IO (Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign
-> Ptr Bytes
-> Ptr GVariant
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
ostree_sign_data_verify Ptr Sign
self' Ptr Bytes
data_' Ptr GVariant
signatures' Ptr CString
outSuccessMessage
        CString
outSuccessMessage' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outSuccessMessage
        Maybe Text
maybeOutSuccessMessage' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outSuccessMessage' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \outSuccessMessage'' :: CString
outSuccessMessage'' -> do
            Text
outSuccessMessage''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outSuccessMessage''
            Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outSuccessMessage'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outSuccessMessage'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Bytes
data_
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
signatures
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outSuccessMessage
        Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeOutSuccessMessage'
     ) (do
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outSuccessMessage
     )

#if defined(ENABLE_OVERLOADING)
data SignDataVerifyMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> GVariant -> m ((Maybe T.Text))), MonadIO m, IsSign a) => O.MethodInfo SignDataVerifyMethodInfo a signature where
    overloadedMethod = signDataVerify

#endif

-- XXX Could not generate method Sign::dummy_add_pk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_add_pk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyAddPkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyAddPk" Sign) => O.MethodInfo SignDummyAddPkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_data
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_data” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyDataMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyData" Sign) => O.MethodInfo SignDummyDataMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_data_verify
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_data_verify” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyDataVerifyMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyDataVerify" Sign) => O.MethodInfo SignDummyDataVerifyMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_get_name
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_get_name” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyGetNameMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyGetName" Sign) => O.MethodInfo SignDummyGetNameMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_metadata_format
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_metadata_format” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyMetadataFormatMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyMetadataFormat" Sign) => O.MethodInfo SignDummyMetadataFormatMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_metadata_key
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_metadata_key” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummyMetadataKeyMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummyMetadataKey" Sign) => O.MethodInfo SignDummyMetadataKeyMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_set_pk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_set_pk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummySetPkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummySetPk" Sign) => O.MethodInfo SignDummySetPkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::dummy_set_sk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_dummy_set_sk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignDummySetSkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "dummySetSk" Sign) => O.MethodInfo SignDummySetSkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_add_pk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_add_pk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519AddPkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519AddPk" Sign) => O.MethodInfo SignEd25519AddPkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_clear_keys
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_clear_keys” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519ClearKeysMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519ClearKeys" Sign) => O.MethodInfo SignEd25519ClearKeysMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_data
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_data” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519DataMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519Data" Sign) => O.MethodInfo SignEd25519DataMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_data_verify
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_data_verify” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519DataVerifyMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519DataVerify" Sign) => O.MethodInfo SignEd25519DataVerifyMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_get_name
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_get_name” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519GetNameMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519GetName" Sign) => O.MethodInfo SignEd25519GetNameMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_load_pk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_load_pk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519LoadPkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519LoadPk" Sign) => O.MethodInfo SignEd25519LoadPkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_metadata_format
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_metadata_format” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519MetadataFormatMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519MetadataFormat" Sign) => O.MethodInfo SignEd25519MetadataFormatMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_metadata_key
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_metadata_key” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519MetadataKeyMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519MetadataKey" Sign) => O.MethodInfo SignEd25519MetadataKeyMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_set_pk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_set_pk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519SetPkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519SetPk" Sign) => O.MethodInfo SignEd25519SetPkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- XXX Could not generate method Sign::ed25519_set_sk
-- Bad introspection data: Could not resolve the symbol “ostree_sign_ed25519_set_sk” in the “OSTree” namespace, ignoring.
#if defined(ENABLE_OVERLOADING)
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data SignEd25519SetSkMethodInfo
instance (p ~ (), o ~ O.UnsupportedMethodError "ed25519SetSk" Sign) => O.MethodInfo SignEd25519SetSkMethodInfo o p where
    overloadedMethod = undefined
#endif

-- method Sign::get_name
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sign_get_name" ostree_sign_get_name :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    IO CString

-- | Return the pointer to the name of currently used\/selected signing engine.
-- 
-- /Since: 2020.2/
signGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> m T.Text
    -- ^ __Returns:__ pointer to the name
    -- /@nULL@/ in case of error (unlikely).
signGetName :: a -> m Text
signGetName self :: a
self = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    CString
result <- Ptr Sign -> IO CString
ostree_sign_get_name Ptr Sign
self'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "signGetName" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data SignGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSign a) => O.MethodInfo SignGetNameMethodInfo a signature where
    overloadedMethod = signGetName

#endif

-- method Sign::load_pk
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "options"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "any options" , 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 "ostree_sign_load_pk" ostree_sign_load_pk :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GVariant ->                         -- options : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Load public keys for verification from anywhere.
-- It is expected that all keys would be added to already pre-loaded keys.
-- 
-- The /@options@/ argument depends of the particular engine implementation.
-- 
-- For example, /@ed25515@/ engine could use following string-formatted options:
-- 
-- * /@filename@/ -- single file to use to load keys from
-- * /@basedir@/ -- directory containing subdirectories
-- \'trusted.ed25519.d\' and \'revoked.ed25519.d\' with appropriate
-- public keys. Used for testing and re-definition of system-wide
-- directories if defaults are not suitable for any reason.
-- 
-- 
-- /Since: 2020.2/
signLoadPk ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GVariant
    -- ^ /@options@/: any options
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signLoadPk :: a -> GVariant -> m ()
signLoadPk self :: a
self options :: GVariant
options = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
options' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
options
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign -> Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_sign_load_pk Ptr Sign
self' Ptr GVariant
options'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
options
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignLoadPkMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsSign a) => O.MethodInfo SignLoadPkMethodInfo a signature where
    overloadedMethod = signLoadPk

#endif

-- method Sign::metadata_format
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sign_metadata_format" ostree_sign_metadata_format :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    IO CString

-- | Return the pointer to the string with format used in (detached) metadata for
-- current signing engine.
-- 
-- /Since: 2020.2/
signMetadataFormat ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> m T.Text
    -- ^ __Returns:__ pointer to the metadata format,
    -- /@nULL@/ in case of error (unlikely).
signMetadataFormat :: a -> m Text
signMetadataFormat self :: a
self = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    CString
result <- Ptr Sign -> IO CString
ostree_sign_metadata_format Ptr Sign
self'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "signMetadataFormat" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data SignMetadataFormatMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSign a) => O.MethodInfo SignMetadataFormatMethodInfo a signature where
    overloadedMethod = signMetadataFormat

#endif

-- method Sign::metadata_key
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sign_metadata_key" ostree_sign_metadata_key :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    IO CString

-- | Return the pointer to the name of the key used in (detached) metadata for
-- current signing engine.
-- 
-- /Since: 2020.2/
signMetadataKey ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> m T.Text
    -- ^ __Returns:__ pointer to the metadata key name,
    -- /@nULL@/ in case of error (unlikely).
signMetadataKey :: a -> m Text
signMetadataKey self :: a
self = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    CString
result <- Ptr Sign -> IO CString
ostree_sign_metadata_key Ptr Sign
self'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "signMetadataKey" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data SignMetadataKeyMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsSign a) => O.MethodInfo SignMetadataKeyMethodInfo a signature where
    overloadedMethod = signMetadataKey

#endif

-- method Sign::set_pk
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "public_key"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "single public key to be added"
--                 , 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 "ostree_sign_set_pk" ostree_sign_set_pk :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GVariant ->                         -- public_key : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Set the public key for verification. It is expected what all
-- previously pre-loaded public keys will be dropped.
-- 
-- The /@publicKey@/ argument depends of the particular engine implementation.
-- 
-- /Since: 2020.2/
signSetPk ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GVariant
    -- ^ /@publicKey@/: single public key to be added
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signSetPk :: a -> GVariant -> m ()
signSetPk self :: a
self publicKey :: GVariant
publicKey = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
publicKey' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
publicKey
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign -> Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_sign_set_pk Ptr Sign
self' Ptr GVariant
publicKey'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
publicKey
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignSetPkMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsSign a) => O.MethodInfo SignSetPkMethodInfo a signature where
    overloadedMethod = signSetPk

#endif

-- method Sign::set_sk
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeSign object"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "secret_key"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "secret key to be added"
--                 , 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 "ostree_sign_set_sk" ostree_sign_set_sk :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr GVariant ->                         -- secret_key : TVariant
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Set the secret key to be used for signing data, commits and summary.
-- 
-- The /@secretKey@/ argument depends of the particular engine implementation.
-- 
-- /Since: 2020.2/
signSetSk ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a) =>
    a
    -- ^ /@self@/: an t'GI.OSTree.Interfaces.Sign.Sign' object
    -> GVariant
    -- ^ /@secretKey@/: secret key to be added
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signSetSk :: a -> GVariant -> m ()
signSetSk self :: a
self secretKey :: GVariant
secretKey = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
secretKey' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
secretKey
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign -> Ptr GVariant -> Ptr (Ptr GError) -> IO CInt
ostree_sign_set_sk Ptr Sign
self' Ptr GVariant
secretKey'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
secretKey
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignSetSkMethodInfo
instance (signature ~ (GVariant -> m ()), MonadIO m, IsSign a) => O.MethodInfo SignSetSkMethodInfo a signature where
    overloadedMethod = signSetSk

#endif

-- method Sign::summary
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Sign" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Self" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "repo"
--           , argType =
--               TInterface Name { namespace = "OSTree" , name = "Repo" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "ostree repository" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "keys"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "keys -- GVariant containing keys as GVarints specific to signature type."
--                 , 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 "A #GCancellable" , 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 "ostree_sign_summary" ostree_sign_summary :: 
    Ptr Sign ->                             -- self : TInterface (Name {namespace = "OSTree", name = "Sign"})
    Ptr OSTree.Repo.Repo ->                 -- repo : TInterface (Name {namespace = "OSTree", name = "Repo"})
    Ptr GVariant ->                         -- keys : TVariant
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Add a signature to a summary file.
-- Based on ostree_repo_add_gpg_signature_summary implementation.
-- 
-- /Since: 2020.2/
signSummary ::
    (B.CallStack.HasCallStack, MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) =>
    a
    -- ^ /@self@/: Self
    -> b
    -- ^ /@repo@/: ostree repository
    -> GVariant
    -- ^ /@keys@/: keys -- GVariant containing keys as GVarints specific to signature type.
    -> Maybe (c)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
signSummary :: a -> b -> GVariant -> Maybe c -> m ()
signSummary self :: a
self repo :: b
repo keys :: GVariant
keys cancellable :: Maybe c
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sign
self' <- a -> IO (Ptr Sign)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Repo
repo' <- b -> IO (Ptr Repo)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
repo
    Ptr GVariant
keys' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
keys
    Ptr Cancellable
maybeCancellable <- case Maybe c
cancellable of
        Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just jCancellable :: c
jCancellable -> do
            Ptr Cancellable
jCancellable' <- c -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Sign
-> Ptr Repo
-> Ptr GVariant
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
ostree_sign_summary Ptr Sign
self' Ptr Repo
repo' Ptr GVariant
keys' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
repo
        GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
keys
        Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
cancellable c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SignSummaryMethodInfo
instance (signature ~ (b -> GVariant -> Maybe (c) -> m ()), MonadIO m, IsSign a, OSTree.Repo.IsRepo b, Gio.Cancellable.IsCancellable c) => O.MethodInfo SignSummaryMethodInfo a signature where
    overloadedMethod = signSummary

#endif

-- method Sign::get_all
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TPtrArray
--                  (TInterface Name { namespace = "OSTree" , name = "Sign" }))
-- throws : False
-- Skip return : False

foreign import ccall "ostree_sign_get_all" ostree_sign_get_all :: 
    IO (Ptr (GPtrArray (Ptr Sign)))

-- | Return an array with newly allocated instances of all available
-- signing engines; they will not be initialized.
-- 
-- /Since: 2020.2/
signGetAll ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [Sign]
    -- ^ __Returns:__ an array of signing engines
signGetAll :: m [Sign]
signGetAll  = IO [Sign] -> m [Sign]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Sign] -> m [Sign]) -> IO [Sign] -> m [Sign]
forall a b. (a -> b) -> a -> b
$ do
    Ptr (GPtrArray (Ptr Sign))
result <- IO (Ptr (GPtrArray (Ptr Sign)))
ostree_sign_get_all
    Text -> Ptr (GPtrArray (Ptr Sign)) -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "signGetAll" Ptr (GPtrArray (Ptr Sign))
result
    [Ptr Sign]
result' <- Ptr (GPtrArray (Ptr Sign)) -> IO [Ptr Sign]
forall a. Ptr (GPtrArray (Ptr a)) -> IO [Ptr a]
unpackGPtrArray Ptr (GPtrArray (Ptr Sign))
result
    [Sign]
result'' <- (Ptr Sign -> IO Sign) -> [Ptr Sign] -> IO [Sign]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Sign -> Sign) -> Ptr Sign -> IO Sign
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Sign -> Sign
Sign) [Ptr Sign]
result'
    Ptr (GPtrArray (Ptr Sign)) -> IO ()
forall a. Ptr (GPtrArray a) -> IO ()
unrefPtrArray Ptr (GPtrArray (Ptr Sign))
result
    [Sign] -> IO [Sign]
forall (m :: * -> *) a. Monad m => a -> m a
return [Sign]
result''

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sign::get_by_name
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of desired signature engine"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "OSTree" , name = "Sign" })
-- throws : True
-- Skip return : False

foreign import ccall "ostree_sign_get_by_name" ostree_sign_get_by_name :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Sign)

-- | Create a new instance of a signing engine.
-- 
-- /Since: 2020.2/
signGetByName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@name@/: the name of desired signature engine
    -> m Sign
    -- ^ __Returns:__ New signing engine, or 'P.Nothing' if the engine is not known /(Can throw 'Data.GI.Base.GError.GError')/
signGetByName :: Text -> m Sign
signGetByName name :: Text
name = IO Sign -> m Sign
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sign -> m Sign) -> IO Sign -> m Sign
forall a b. (a -> b) -> a -> b
$ do
    CString
name' <- Text -> IO CString
textToCString Text
name
    IO Sign -> IO () -> IO Sign
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Sign
result <- (Ptr (Ptr GError) -> IO (Ptr Sign)) -> IO (Ptr Sign)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Sign)) -> IO (Ptr Sign))
-> (Ptr (Ptr GError) -> IO (Ptr Sign)) -> IO (Ptr Sign)
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO (Ptr Sign)
ostree_sign_get_by_name CString
name'
        Text -> Ptr Sign -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "signGetByName" Ptr Sign
result
        Sign
result' <- ((ManagedPtr Sign -> Sign) -> Ptr Sign -> IO Sign
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Sign -> Sign
Sign) Ptr Sign
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
        Sign -> IO Sign
forall (m :: * -> *) a. Monad m => a -> m a
return Sign
result'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
     )

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Sign = SignSignalList
type SignSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif