Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
A proxy object representing a collection of secrets in the Secret Service.
Synopsis
- newtype Collection = Collection (ManagedPtr Collection)
- class (GObject o, IsDescendantOf Collection o) => IsCollection o
- toCollection :: (MonadIO m, IsCollection o) => o -> m Collection
- noCollection :: Maybe Collection
- collectionCreate :: (HasCallStack, MonadIO m, IsService a, IsCancellable b) => Maybe a -> Text -> Maybe Text -> [CollectionCreateFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionCreateFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m Collection
- collectionCreateSync :: (HasCallStack, MonadIO m, IsService a, IsCancellable b) => Maybe a -> Text -> Maybe Text -> [CollectionCreateFlags] -> Maybe b -> m Collection
- collectionDelete :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionDeleteFinish :: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) => a -> b -> m ()
- collectionDeleteSync :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe b -> m ()
- collectionForAlias :: (HasCallStack, MonadIO m, IsService a, IsCancellable b) => Maybe a -> Text -> [CollectionFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionForAliasFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m Collection
- collectionForAliasSync :: (HasCallStack, MonadIO m, IsService a, IsCancellable b) => Maybe a -> Text -> [CollectionFlags] -> Maybe b -> m Collection
- collectionGetCreated :: (HasCallStack, MonadIO m, IsCollection a) => a -> m Word64
- collectionGetFlags :: (HasCallStack, MonadIO m, IsCollection a) => a -> m [CollectionFlags]
- collectionGetItems :: (HasCallStack, MonadIO m, IsCollection a) => a -> m [Item]
- collectionGetLabel :: (HasCallStack, MonadIO m, IsCollection a) => a -> m Text
- collectionGetLocked :: (HasCallStack, MonadIO m, IsCollection a) => a -> m Bool
- collectionGetModified :: (HasCallStack, MonadIO m, IsCollection a) => a -> m Word64
- collectionGetService :: (HasCallStack, MonadIO m, IsCollection a) => a -> m Service
- collectionLoadItems :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionLoadItemsFinish :: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) => a -> b -> m ()
- collectionLoadItemsSync :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe b -> m ()
- collectionRefresh :: (HasCallStack, MonadIO m, IsCollection a) => a -> m ()
- collectionSearch :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe Schema -> Map Text Text -> [SearchFlags] -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionSearchFinish :: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) => a -> b -> m [Item]
- collectionSearchSync :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Maybe Schema -> Map Text Text -> [SearchFlags] -> Maybe b -> m [Item]
- collectionSetLabel :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- collectionSetLabelFinish :: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) => a -> b -> m ()
- collectionSetLabelSync :: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) => a -> Text -> Maybe b -> m ()
- constructCollectionCreated :: IsCollection o => Word64 -> IO (GValueConstruct o)
- getCollectionCreated :: (MonadIO m, IsCollection o) => o -> m Word64
- setCollectionCreated :: (MonadIO m, IsCollection o) => o -> Word64 -> m ()
- clearCollectionLabel :: (MonadIO m, IsCollection o) => o -> m ()
- constructCollectionLabel :: IsCollection o => Text -> IO (GValueConstruct o)
- getCollectionLabel :: (MonadIO m, IsCollection o) => o -> m (Maybe Text)
- setCollectionLabel :: (MonadIO m, IsCollection o) => o -> Text -> m ()
- getCollectionLocked :: (MonadIO m, IsCollection o) => o -> m Bool
- constructCollectionModified :: IsCollection o => Word64 -> IO (GValueConstruct o)
- getCollectionModified :: (MonadIO m, IsCollection o) => o -> m Word64
- setCollectionModified :: (MonadIO m, IsCollection o) => o -> Word64 -> m ()
- constructCollectionService :: (IsCollection o, IsService a) => a -> IO (GValueConstruct o)
- getCollectionService :: (MonadIO m, IsCollection o) => o -> m Service
Exported types
newtype Collection Source #
Memory-managed wrapper type.
Instances
GObject Collection Source # | |
Defined in GI.Secret.Objects.Collection gobjectType :: IO GType # | |
HasParentTypes Collection Source # | |
Defined in GI.Secret.Objects.Collection | |
type ParentTypes Collection Source # | |
Defined in GI.Secret.Objects.Collection type ParentTypes Collection = DBusProxy ': (Object ': (AsyncInitable ': (DBusInterface ': (Initable ': ([] :: [Type]))))) |
class (GObject o, IsDescendantOf Collection o) => IsCollection o Source #
Type class for types which can be safely cast to Collection
, for instance with toCollection
.
Instances
(GObject o, IsDescendantOf Collection o) => IsCollection o Source # | |
Defined in GI.Secret.Objects.Collection |
toCollection :: (MonadIO m, IsCollection o) => o -> m Collection Source #
Cast to Collection
, for types for which this is known to be safe. For general casts, use castTo
.
noCollection :: Maybe Collection Source #
A convenience alias for Nothing
:: Maybe
Collection
.
Methods
create
:: (HasCallStack, MonadIO m, IsService a, IsCancellable b) | |
=> Maybe a |
|
-> Text |
|
-> Maybe Text |
|
-> [CollectionCreateFlags] |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Create a new collection in the secret service.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. servicePrompt
will be used to handle
any prompts that are required.
An alias
is a well-known tag for a collection, such as 'default' (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an alias
, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.
If service
is NULL, then serviceGet
will be called to get
the default Service
proxy.
createFinish
collectionCreateFinish Source #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m Collection | Returns: the new collection, which should be unreferenced
with |
Finish operation to create a new collection in the secret service.
createSync
:: (HasCallStack, MonadIO m, IsService a, IsCancellable b) | |
=> Maybe a |
|
-> Text |
|
-> Maybe Text |
|
-> [CollectionCreateFlags] |
|
-> Maybe b |
|
-> m Collection | Returns: the new collection, which should be unreferenced
with |
Create a new collection in the secret service.
This method may block indefinitely and should not be used in user interface
threads. The secret service may prompt the user. servicePrompt
will be used to handle any prompts that are required.
An alias
is a well-known tag for a collection, such as 'default' (ie: the
default collection to store items in). This allows other applications to
easily identify and share a collection. If you specify an alias
, and a
collection with that alias already exists, then a new collection will not
be created. The previous one will be returned instead.
If service
is NULL, then serviceGetSync
will be called to get
the default Service
proxy.
delete
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Delete this collection.
This method returns immediately and completes asynchronously. The secret
service may prompt the user. servicePrompt
will be used to handle
any prompts that show up.
deleteFinish
collectionDeleteFinish Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Complete operation to delete this collection.
deleteSync
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Delete this collection.
This method may block indefinitely and should not be used in user
interface threads. The secret service may prompt the user.
servicePrompt
will be used to handle any prompts that show up.
forAlias
:: (HasCallStack, MonadIO m, IsService a, IsCancellable b) | |
=> Maybe a |
|
-> Text |
|
-> [CollectionFlags] |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Lookup which collection is assigned to this alias. Aliases help determine well known collections, such as 'default'.
If service
is NULL, then serviceGet
will be called to get
the default Service
proxy.
This method will return immediately and complete asynchronously.
forAliasFinish
collectionForAliasFinish Source #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m Collection | Returns: the collection, or |
Finish an asynchronous operation to lookup which collection is assigned to an alias.
forAliasSync
collectionForAliasSync Source #
:: (HasCallStack, MonadIO m, IsService a, IsCancellable b) | |
=> Maybe a |
|
-> Text |
|
-> [CollectionFlags] |
|
-> Maybe b |
|
-> m Collection | Returns: the collection, or |
Lookup which collection is assigned to this alias. Aliases help determine well known collections, such as 'default'.
If service
is NULL, then serviceGetSync
will be called to get
the default Service
proxy.
This method may block and should not be used in user interface threads.
getCreated
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m Word64 | Returns: the created date and time |
Get the created date and time of the collection. The return value is the number of seconds since the unix epoch, January 1st 1970.
getFlags
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m [CollectionFlags] | Returns: the flags for features initialized |
Get the flags representing what features of the Collection
proxy
have been initialized.
Use collectionLoadItems
to initialize further features
and change the flags.
getItems
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m [Item] | Returns: a list of items,
when done, the list should be freed with g_list_free, and each item should
be released with |
Get the list of items in this collection.
getLabel
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m Text | Returns: the label, which should be freed with |
Get the label of this collection.
getLocked
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m Bool | Returns: whether the collection is locked or not |
Get whether the collection is locked or not.
Use serviceLock
or serviceUnlock
to lock or unlock the
collection.
getModified
collectionGetModified Source #
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m Word64 | Returns: the modified date and time |
Get the modified date and time of the collection. The return value is the number of seconds since the unix epoch, January 1st 1970.
getService
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m Service | Returns: the Secret Service object |
Get the Secret Service object that this collection was created with.
loadItems
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Ensure that the Collection
proxy has loaded all the items present
in the Secret Service. This affects the result of
collectionGetItems
.
For collections returned from serviceGetCollections
the items
will have already been loaded.
This method will return immediately and complete asynchronously.
loadItemsFinish
collectionLoadItemsFinish Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Complete an asynchronous operation to ensure that the Collection
proxy
has loaded all the items present in the Secret Service.
loadItemsSync
collectionLoadItemsSync Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Ensure that the Collection
proxy has loaded all the items present
in the Secret Service. This affects the result of
collectionGetItems
.
For collections returned from serviceGetCollections
the items
will have already been loaded.
This method may block indefinitely and should not be used in user interface threads.
refresh
:: (HasCallStack, MonadIO m, IsCollection a) | |
=> a |
|
-> m () |
Refresh the properties on this collection. This fires off a request to refresh, and the properties will be updated later.
Calling this method is not normally necessary, as the secret service will notify the client when properties change.
search
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe Schema |
|
-> Map Text Text |
|
-> [SearchFlags] |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Search for items matching the attributes
in the collection
.
The attributes
should be a table of string keys and string values.
If SearchFlagsAll
is set in flags
, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.
If SearchFlagsUnlock
is set in flags
, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.
If SearchFlagsLoadSecrets
is set in flags
, then the items will have
their secret values loaded and available via itemGetSecret
.
This function returns immediately and completes asynchronously.
searchFinish
collectionSearchFinish Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m [Item] | Returns:
a list of items that matched the search (Can throw |
Complete asynchronous operation to search for items in a collection.
searchSync
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Maybe Schema |
|
-> Map Text Text |
|
-> [SearchFlags] |
|
-> Maybe b |
|
-> m [Item] | Returns:
a list of items that matched the search (Can throw |
Search for items matching the attributes
in the collection
.
The attributes
should be a table of string keys and string values.
If SearchFlagsAll
is set in flags
, then all the items matching the
search will be returned. Otherwise only the first item will be returned.
This is almost always the unlocked item that was most recently stored.
If SearchFlagsUnlock
is set in flags
, then items will be unlocked
if necessary. In either case, locked and unlocked items will match the
search and be returned. If the unlock fails, the search does not fail.
If SearchFlagsLoadSecrets
is set in flags
, then the items will have
their secret values loaded and available via itemGetSecret
.
This function may block indefinitely. Use the asynchronous version in user interface threads.
setLabel
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Set the label of this collection.
This function returns immediately and completes asynchronously.
setLabelFinish
collectionSetLabelFinish Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Complete asynchronous operation to set the label of this collection.
setLabelSync
collectionSetLabelSync Source #
:: (HasCallStack, MonadIO m, IsCollection a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> m () | (Can throw |
Set the label of this collection.
This function may block indefinitely. Use the asynchronous version in user interface threads.
Properties
created
The date and time (in seconds since the UNIX epoch) that this collection was created.
constructCollectionCreated :: IsCollection o => Word64 -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “created
” property. This is rarely needed directly, but it is used by new
.
getCollectionCreated :: (MonadIO m, IsCollection o) => o -> m Word64 Source #
Get the value of the “created
” property.
When overloading is enabled, this is equivalent to
get
collection #created
setCollectionCreated :: (MonadIO m, IsCollection o) => o -> Word64 -> m () Source #
Set the value of the “created
” property.
When overloading is enabled, this is equivalent to
set
collection [ #created:=
value ]
label
The human readable label for the collection.
Setting this property will result in the label of the collection being
set asynchronously. To properly track the changing of the label use the
collectionSetLabel
function.
clearCollectionLabel :: (MonadIO m, IsCollection o) => o -> m () Source #
Set the value of the “label
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#label
constructCollectionLabel :: IsCollection o => Text -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getCollectionLabel :: (MonadIO m, IsCollection o) => o -> m (Maybe Text) Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
collection #label
setCollectionLabel :: (MonadIO m, IsCollection o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
collection [ #label:=
value ]
locked
Whether the collection is locked or not.
To lock or unlock a collection use the serviceLock
or
serviceUnlock
functions.
getCollectionLocked :: (MonadIO m, IsCollection o) => o -> m Bool Source #
Get the value of the “locked
” property.
When overloading is enabled, this is equivalent to
get
collection #locked
modified
The date and time (in seconds since the UNIX epoch) that this collection was last modified.
constructCollectionModified :: IsCollection o => Word64 -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “modified
” property. This is rarely needed directly, but it is used by new
.
getCollectionModified :: (MonadIO m, IsCollection o) => o -> m Word64 Source #
Get the value of the “modified
” property.
When overloading is enabled, this is equivalent to
get
collection #modified
setCollectionModified :: (MonadIO m, IsCollection o) => o -> Word64 -> m () Source #
Set the value of the “modified
” property.
When overloading is enabled, this is equivalent to
set
collection [ #modified:=
value ]
service
The Service
object that this collection is associated with and
uses to interact with the actual D-Bus Secret Service.
constructCollectionService :: (IsCollection o, IsService a) => a -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “service
” property. This is rarely needed directly, but it is used by new
.
getCollectionService :: (MonadIO m, IsCollection o) => o -> m Service Source #
Get the value of the “service
” property.
When overloading is enabled, this is equivalent to
get
collection #service