Documentation ¶
Index ¶
- Constants
- Variables
- func CollectionCreate(ctx context.Context, service *Service, label, alias string, ...)
- func CollectionForAlias(ctx context.Context, service *Service, alias string, flags CollectionFlags, ...)
- func ErrorGetQuark() glib.Quark
- func ItemCreate(ctx context.Context, collection *Collection, schema *Schema, ...)
- func ItemLoadSecrets(ctx context.Context, items []*Item, callback gio.AsyncReadyCallback)
- func ItemLoadSecretsFinish(result gio.AsyncResulter) error
- func ItemLoadSecretsSync(ctx context.Context, items []*Item) error
- func PasswordClear(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func PasswordClearFinish(result gio.AsyncResulter) error
- func PasswordClearSync(ctx context.Context, schema *Schema, attributes map[string]string) error
- func PasswordLookup(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func PasswordLookupFinish(result gio.AsyncResulter) (string, error)
- func PasswordLookupSync(ctx context.Context, schema *Schema, attributes map[string]string) (string, error)
- func PasswordSearch(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func PasswordStore(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func PasswordStoreBinary(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func PasswordStoreBinarySync(ctx context.Context, schema *Schema, attributes map[string]string, ...) error
- func PasswordStoreFinish(result gio.AsyncResulter) error
- func PasswordStoreSync(ctx context.Context, schema *Schema, attributes map[string]string, ...) error
- func PasswordWipe(password string)
- func ServiceDisconnect()
- func ServiceGet(ctx context.Context, flags ServiceFlags, callback gio.AsyncReadyCallback)
- func ServiceOpen(ctx context.Context, serviceGtype externglib.Type, serviceBusName string, ...)
- type Collection
- func CollectionCreateFinish(result gio.AsyncResulter) (*Collection, error)
- func CollectionCreateSync(ctx context.Context, service *Service, label, alias string, ...) (*Collection, error)
- func CollectionForAliasFinish(result gio.AsyncResulter) (*Collection, error)
- func CollectionForAliasSync(ctx context.Context, service *Service, alias string, flags CollectionFlags) (*Collection, error)
- func (self *Collection) Created() uint64
- func (self *Collection) Delete(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Collection) DeleteFinish(result gio.AsyncResulter) error
- func (self *Collection) DeleteSync(ctx context.Context) error
- func (self *Collection) Flags() CollectionFlags
- func (self *Collection) Items() []*Item
- func (self *Collection) Label() string
- func (self *Collection) LoadItems(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Collection) LoadItemsFinish(result gio.AsyncResulter) error
- func (self *Collection) LoadItemsSync(ctx context.Context) error
- func (self *Collection) Locked() bool
- func (self *Collection) Modified() uint64
- func (self *Collection) Refresh()
- func (self *Collection) Search(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (self *Collection) SearchFinish(result gio.AsyncResulter) ([]*Item, error)
- func (self *Collection) SearchSync(ctx context.Context, schema *Schema, attributes map[string]string, ...) ([]*Item, error)
- func (self *Collection) Service() *Service
- func (self *Collection) SetLabel(ctx context.Context, label string, callback gio.AsyncReadyCallback)
- func (self *Collection) SetLabelFinish(result gio.AsyncResulter) error
- func (self *Collection) SetLabelSync(ctx context.Context, label string) error
- type CollectionCreateFlags
- type CollectionFlags
- type CollectionOverrider
- type Error
- type Item
- func (self *Item) Attributes() map[string]string
- func (self *Item) Created() uint64
- func (self *Item) Delete(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Item) DeleteFinish(result gio.AsyncResulter) error
- func (self *Item) DeleteSync(ctx context.Context) error
- func (self *Item) Flags() ItemFlags
- func (self *Item) Label() string
- func (self *Item) LoadSecret(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Item) LoadSecretFinish(result gio.AsyncResulter) error
- func (self *Item) LoadSecretSync(ctx context.Context) error
- func (self *Item) Locked() bool
- func (self *Item) Modified() uint64
- func (self *Item) Refresh()
- func (self *Item) SchemaName() string
- func (self *Item) Secret() *Value
- func (self *Item) Service() *Service
- func (self *Item) SetAttributes(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (self *Item) SetAttributesFinish(result gio.AsyncResulter) error
- func (self *Item) SetAttributesSync(ctx context.Context, schema *Schema, attributes map[string]string) error
- func (self *Item) SetLabel(ctx context.Context, label string, callback gio.AsyncReadyCallback)
- func (self *Item) SetLabelFinish(result gio.AsyncResulter) error
- func (self *Item) SetLabelSync(ctx context.Context, label string) error
- func (self *Item) SetSecret(ctx context.Context, value *Value, callback gio.AsyncReadyCallback)
- func (self *Item) SetSecretFinish(result gio.AsyncResulter) error
- func (self *Item) SetSecretSync(ctx context.Context, value *Value) error
- type ItemCreateFlags
- type ItemFlags
- type ItemOverrider
- type Prompt
- func (self *Prompt) Perform(ctx context.Context, windowId string, returnType *glib.VariantType, ...)
- func (self *Prompt) PerformFinish(result gio.AsyncResulter) (*glib.Variant, error)
- func (self *Prompt) PerformSync(ctx context.Context, windowId string, returnType *glib.VariantType) (*glib.Variant, error)
- func (self *Prompt) Run(ctx context.Context, windowId string, returnType *glib.VariantType) (*glib.Variant, error)
- type PromptOverrider
- type Retrievable
- func (self *Retrievable) Attributes() map[string]string
- func (self *Retrievable) Created() uint64
- func (self *Retrievable) Label() string
- func (self *Retrievable) Modified() uint64
- func (self *Retrievable) RetrieveSecret(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Retrievable) RetrieveSecretFinish(result gio.AsyncResulter) (*Value, error)
- func (self *Retrievable) RetrieveSecretSync(ctx context.Context) (*Value, error)
- type Retrievabler
- type Schema
- type SchemaAttribute
- type SchemaAttributeType
- type SchemaFlags
- type SchemaType
- type SearchFlags
- type Service
- func ServiceGetFinish(result gio.AsyncResulter) (*Service, error)
- func ServiceGetSync(ctx context.Context, flags ServiceFlags) (*Service, error)
- func ServiceOpenFinish(result gio.AsyncResulter) (*Service, error)
- func ServiceOpenSync(ctx context.Context, serviceGtype externglib.Type, serviceBusName string, ...) (*Service, error)
- func (service *Service) Clear(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (service *Service) ClearFinish(result gio.AsyncResulter) error
- func (service *Service) ClearSync(ctx context.Context, schema *Schema, attributes map[string]string) error
- func (self *Service) CollectionGType() externglib.Type
- func (self *Service) Collections() []*Collection
- func (self *Service) EnsureSession(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Service) EnsureSessionFinish(result gio.AsyncResulter) error
- func (self *Service) EnsureSessionSync(ctx context.Context) error
- func (self *Service) Flags() ServiceFlags
- func (self *Service) ItemGType() externglib.Type
- func (self *Service) LoadCollections(ctx context.Context, callback gio.AsyncReadyCallback)
- func (self *Service) LoadCollectionsFinish(result gio.AsyncResulter) error
- func (self *Service) LoadCollectionsSync(ctx context.Context) error
- func (service *Service) Lock(ctx context.Context, objects []*gio.DBusProxy, callback gio.AsyncReadyCallback)
- func (service *Service) LockFinish(result gio.AsyncResulter) ([]*gio.DBusProxy, int, error)
- func (service *Service) LockSync(ctx context.Context, objects []*gio.DBusProxy) ([]*gio.DBusProxy, int, error)
- func (service *Service) Lookup(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (service *Service) LookupFinish(result gio.AsyncResulter) (*Value, error)
- func (service *Service) LookupSync(ctx context.Context, schema *Schema, attributes map[string]string) (*Value, error)
- func (self *Service) Prompt(ctx context.Context, prompt *Prompt, returnType *glib.VariantType, ...)
- func (self *Service) PromptFinish(result gio.AsyncResulter) (*glib.Variant, error)
- func (self *Service) PromptSync(ctx context.Context, prompt *Prompt, returnType *glib.VariantType) (*glib.Variant, error)
- func (service *Service) Search(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (service *Service) SearchFinish(result gio.AsyncResulter) ([]*Item, error)
- func (service *Service) SearchSync(ctx context.Context, schema *Schema, attributes map[string]string, ...) ([]*Item, error)
- func (self *Service) SessionAlgorithms() string
- func (service *Service) SetAlias(ctx context.Context, alias string, collection *Collection, ...)
- func (service *Service) SetAliasFinish(result gio.AsyncResulter) error
- func (service *Service) SetAliasSync(ctx context.Context, alias string, collection *Collection) error
- func (service *Service) Store(ctx context.Context, schema *Schema, attributes map[string]string, ...)
- func (service *Service) StoreFinish(result gio.AsyncResulter) error
- func (service *Service) StoreSync(ctx context.Context, schema *Schema, attributes map[string]string, ...) error
- func (service *Service) Unlock(ctx context.Context, objects []*gio.DBusProxy, callback gio.AsyncReadyCallback)
- func (service *Service) UnlockFinish(result gio.AsyncResulter) ([]*gio.DBusProxy, int, error)
- func (service *Service) UnlockSync(ctx context.Context, objects []*gio.DBusProxy) ([]*gio.DBusProxy, int, error)
- type ServiceFlags
- type ServiceOverrider
- type Value
Constants ¶
const BACKEND_EXTENSION_POINT_NAME = "secret-backend"
const COLLECTION_DEFAULT = "default"
COLLECTION_DEFAULT alias to the default collection. This can be passed to secret_password_store() secret_collection_for_alias().
const COLLECTION_SESSION = "session"
COLLECTION_SESSION alias to the session collection, which will be cleared when the user ends the session. This can be passed to secret_password_store(), secret_collection_for_alias() or similar functions.
const MAJOR_VERSION = 0
MAJOR_VERSION: major version of libsecret.
const MICRO_VERSION = 4
MICRO_VERSION: micro version of libsecret.
const MINOR_VERSION = 20
MINOR_VERSION: minor version of libsecret.
Variables ¶
var ( GTypeCollectionCreateFlags = externglib.Type(C.secret_collection_create_flags_get_type()) GTypeCollectionFlags = externglib.Type(C.secret_collection_flags_get_type()) GTypeCollection = externglib.Type(C.secret_collection_get_type()) )
glib.Type values for secret-collection.go.
var ( GTypeItemCreateFlags = externglib.Type(C.secret_item_create_flags_get_type()) GTypeItemFlags = externglib.Type(C.secret_item_flags_get_type()) GTypeItem = externglib.Type(C.secret_item_get_type()) )
glib.Type values for secret-item.go.
var ( GTypeSchemaAttributeType = externglib.Type(C.secret_schema_attribute_type_get_type()) GTypeSchemaFlags = externglib.Type(C.secret_schema_flags_get_type()) GTypeSchema = externglib.Type(C.secret_schema_get_type()) GTypeSchemaAttribute = externglib.Type(C.secret_schema_attribute_get_type()) )
glib.Type values for secret-schema.go.
var ( GTypeServiceFlags = externglib.Type(C.secret_service_flags_get_type()) GTypeService = externglib.Type(C.secret_service_get_type()) )
glib.Type values for secret-service.go.
var GTypeError = externglib.Type(C.secret_error_get_type())
glib.Type values for secret.go.
var GTypePrompt = externglib.Type(C.secret_prompt_get_type())
glib.Type values for secret-prompt.go.
var GTypeRetrievable = externglib.Type(C.secret_retrievable_get_type())
glib.Type values for secret-retrievable.go.
var GTypeSchemaType = externglib.Type(C.secret_schema_type_get_type())
glib.Type values for secret-schemas.go.
var GTypeSearchFlags = externglib.Type(C.secret_search_flags_get_type())
glib.Type values for secret-methods.go.
var GTypeValue = externglib.Type(C.secret_value_get_type())
glib.Type values for secret-value.go.
Functions ¶
func CollectionCreate ¶
func CollectionCreate(ctx context.Context, service *Service, label, alias string, flags CollectionCreateFlags, callback gio.AsyncReadyCallback)
CollectionCreate: create a new collection in the secret service.
This method returns immediately and completes asynchronously. The secret service may prompt the user. secret_service_prompt() 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 secret_service_get() will be called to get the default Service proxy.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- service (optional): secret service object.
- label for the new collection.
- alias (optional) to assign to the collection.
- flags: currently unused.
- callback (optional): called when the operation completes.
func CollectionForAlias ¶
func CollectionForAlias(ctx context.Context, service *Service, alias string, flags CollectionFlags, callback gio.AsyncReadyCallback)
CollectionForAlias: lookup which collection is assigned to this alias. Aliases help determine well known collections, such as 'default'.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- service (optional): secret service object.
- alias to lookup.
- flags options for the collection initialization.
- callback (optional): called when the operation completes.
func ItemCreate ¶
func ItemCreate(ctx context.Context, collection *Collection, schema *Schema, attributes map[string]string, label string, value *Value, flags ItemCreateFlags, callback gio.AsyncReadyCallback)
ItemCreate: create a new item in the secret service.
If the flags contains SECRET_ITEM_CREATE_REPLACE, then the secret service will search for an item matching the attributes, and update that item instead of creating a new one.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that are required.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- collection: secret collection to create this item in.
- schema (optional) for the attributes.
- attributes for the new item.
- label for the new item.
- value: secret value for the new item.
- flags for the creation of the new item.
- callback (optional): called when the operation completes.
func ItemLoadSecrets ¶
ItemLoadSecrets: load the secret values for a secret item stored in the service.
The items must all have the same SecretItem::service property.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- items to retrieve secrets for.
- callback (optional): called when the operation completes.
func ItemLoadSecretsFinish ¶
func ItemLoadSecretsFinish(result gio.AsyncResulter) error
ItemLoadSecretsFinish: complete asynchronous operation to load the secret values for secret items stored in the service.
Items that are locked will not have their secrets loaded.
The function takes the following parameters:
- result asynchronous result passed to callback.
func ItemLoadSecretsSync ¶
ItemLoadSecretsSync: load the secret values for a secret item stored in the service.
The items must all have the same SecretItem::service property.
This method may block indefinitely and should not be used in user interface threads.
Items that are locked will not have their secrets loaded.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- items to retrieve secrets for.
func PasswordClear ¶
func PasswordClear(ctx context.Context, schema *Schema, attributes map[string]string, callback gio.AsyncReadyCallback)
PasswordClear: remove unlocked matching passwords from the secret service.
The attributes should be a set of key and value string pairs.
All unlocked items that match the attributes will be deleted.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
- callback (optional): called when the operation completes.
func PasswordClearFinish ¶
func PasswordClearFinish(result gio.AsyncResulter) error
PasswordClearFinish: finish an asynchronous operation to remove passwords from the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func PasswordClearSync ¶
PasswordClearSync: remove unlocked matching passwords from the secret service.
The attributes should be a set of key and value string pairs.
All unlocked items that match the attributes will be deleted.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
func PasswordLookup ¶
func PasswordLookup(ctx context.Context, schema *Schema, attributes map[string]string, callback gio.AsyncReadyCallback)
PasswordLookup: lookup a password in the secret service.
The attributes should be a set of key and value string pairs.
If no secret is found then NULL is returned.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- callback (optional): called when the operation completes.
func PasswordLookupFinish ¶
PasswordLookupFinish: finish an asynchronous operation to lookup a password in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- utf8: new password string which should be freed with secret_password_free() or may be freed with g_free() when done.
func PasswordLookupSync ¶
func PasswordLookupSync(ctx context.Context, schema *Schema, attributes map[string]string) (string, error)
PasswordLookupSync: lookup a password in the secret service.
The attributes should be a set of key and value string pairs.
If no secret is found then NULL is returned.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
The function returns the following values:
- utf8: new password string which should be freed with secret_password_free() or may be freed with g_free() when done.
func PasswordSearch ¶
func PasswordSearch(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags, callback gio.AsyncReadyCallback)
PasswordSearch: search for items in the secret service.
The attributes should be a set of key and value string pairs.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- flags: search option flags.
- callback (optional): called when the operation completes.
func PasswordStore ¶
func PasswordStore(ctx context.Context, schema *Schema, attributes map[string]string, collection, label, password string, callback gio.AsyncReadyCallback)
PasswordStore: store a password in the secret service.
The attributes should be a set of key and value string pairs.
If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.
If collection is NULL, then the default collection will be used. Use CRET_COLLECTION_SESSION to store the password in the session collection, which doesn't get stored across login sessions.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- password: null-terminated password to store.
- callback (optional): called when the operation completes.
func PasswordStoreBinary ¶
func PasswordStoreBinary(ctx context.Context, schema *Schema, attributes map[string]string, collection, label string, value *Value, callback gio.AsyncReadyCallback)
PasswordStoreBinary: store a password in the secret service.
This is similar to secret_password_storev(), but takes a Value as the argument instead of a null-terminated password.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- value: Value.
- callback (optional): called when the operation completes.
func PasswordStoreBinarySync ¶
func PasswordStoreBinarySync(ctx context.Context, schema *Schema, attributes map[string]string, collection, label string, value *Value) error
PasswordStoreBinarySync: store a password in the secret service.
This is similar to secret_password_storev_sync(), but takes a Value as the argument instead of a null-terminated passwords.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- value: Value.
func PasswordStoreFinish ¶
func PasswordStoreFinish(result gio.AsyncResulter) error
PasswordStoreFinish: finish asynchronous operation to store a password in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func PasswordStoreSync ¶
func PasswordStoreSync(ctx context.Context, schema *Schema, attributes map[string]string, collection, label, password string) error
PasswordStoreSync: store a password in the secret service.
The attributes should be a set of key and value string pairs.
If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.
If collection is NULL, then the default collection will be used. Use CRET_COLLECTION_SESSION to store the password in the session collection, which doesn't get stored across login sessions.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- password: null-terminated password to store.
func PasswordWipe ¶
func PasswordWipe(password string)
PasswordWipe: clear the memory used by a password.
The function takes the following parameters:
- password (optional) to clear.
func ServiceDisconnect ¶
func ServiceDisconnect()
ServiceDisconnect: disconnect the default Service proxy returned by secret_service_get() and secret_service_get_sync().
It is not necessary to call this function, but you may choose to do so at program exit. It is useful for testing that memory is not leaked.
This function is safe to call at any time. But if other objects in this library are still referenced, then this will not result in all memory being freed.
func ServiceGet ¶
func ServiceGet(ctx context.Context, flags ServiceFlags, callback gio.AsyncReadyCallback)
ServiceGet: get a Service proxy for the Secret Service. If such a proxy object already exists, then the same proxy is returned.
If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before completing.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- flags for which service functionality to ensure is initialized.
- callback (optional): called when the operation completes.
func ServiceOpen ¶
func ServiceOpen(ctx context.Context, serviceGtype externglib.Type, serviceBusName string, flags ServiceFlags, callback gio.AsyncReadyCallback)
ServiceOpen: create a new Service proxy for the Secret Service.
This function is rarely used, see secret_service_get() instead.
The service_gtype argument should be set to SECRET_TYPE_SERVICE or a the type of a derived class.
If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.
If service_bus_name is NULL then the default is used.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- serviceGtype: GType of the new secret service.
- serviceBusName (optional) d-Bus service name of the secret service.
- flags for which service functionality to ensure is initialized.
- callback (optional): called when the operation completes.
Types ¶
type Collection ¶
type Collection struct { gio.DBusProxy // contains filtered or unexported fields }
Collection: proxy object representing a collection of secrets in the Secret Service.
func CollectionCreateFinish ¶
func CollectionCreateFinish(result gio.AsyncResulter) (*Collection, error)
CollectionCreateFinish: finish operation to create a new collection in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- collection: new collection, which should be unreferenced with g_object_unref().
func CollectionCreateSync ¶
func CollectionCreateSync(ctx context.Context, service *Service, label, alias string, flags CollectionCreateFlags) (*Collection, error)
CollectionCreateSync: 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. secret_service_prompt() 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 secret_service_get_sync() will be called to get the default Service proxy.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- service (optional): secret service object.
- label for the new collection.
- alias (optional) to assign to the collection.
- flags: currently unused.
The function returns the following values:
- collection: new collection, which should be unreferenced with g_object_unref().
func CollectionForAliasFinish ¶
func CollectionForAliasFinish(result gio.AsyncResulter) (*Collection, error)
CollectionForAliasFinish: finish an asynchronous operation to lookup which collection is assigned to an alias.
The function takes the following parameters:
- result asynchronous result passed to callback.
The function returns the following values:
- collection: collection, or NULL if none assigned to the alias.
func CollectionForAliasSync ¶
func CollectionForAliasSync(ctx context.Context, service *Service, alias string, flags CollectionFlags) (*Collection, error)
CollectionForAliasSync: lookup which collection is assigned to this alias. Aliases help determine well known collections, such as 'default'.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- service (optional): secret service object.
- alias to lookup.
- flags options for the collection initialization.
The function returns the following values:
- collection: collection, or NULL if none assigned to the alias.
func (*Collection) Created ¶
func (self *Collection) Created() uint64
Created: get the created date and time of the collection. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: created date and time.
func (*Collection) Delete ¶
func (self *Collection) Delete(ctx context.Context, callback gio.AsyncReadyCallback)
Delete this collection.
This method returns immediately and completes asynchronously. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Collection) DeleteFinish ¶
func (self *Collection) DeleteFinish(result gio.AsyncResulter) error
DeleteFinish: complete operation to delete this collection.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Collection) DeleteSync ¶
func (self *Collection) DeleteSync(ctx context.Context) error
DeleteSync: delete this collection.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Collection) Flags ¶
func (self *Collection) Flags() CollectionFlags
Flags: get the flags representing what features of the Collection proxy have been initialized.
Use secret_collection_load_items() to initialize further features and change the flags.
The function returns the following values:
- collectionFlags flags for features initialized.
func (*Collection) Items ¶
func (self *Collection) Items() []*Item
Items: get the list of items in this collection.
The function returns the following values:
- list of items, when done, the list should be freed with g_list_free, and each item should be released with g_object_unref().
func (*Collection) Label ¶
func (self *Collection) Label() string
Label: get the label of this collection.
The function returns the following values:
- utf8: label, which should be freed with g_free().
func (*Collection) LoadItems ¶
func (self *Collection) LoadItems(ctx context.Context, callback gio.AsyncReadyCallback)
LoadItems: ensure that the Collection proxy has loaded all the items present in the Secret Service. This affects the result of secret_collection_get_items().
For collections returned from secret_service_get_collections() the items will have already been loaded.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Collection) LoadItemsFinish ¶
func (self *Collection) LoadItemsFinish(result gio.AsyncResulter) error
LoadItemsFinish: complete an asynchronous operation to ensure that the Collection proxy has loaded all the items present in the Secret Service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Collection) LoadItemsSync ¶
func (self *Collection) LoadItemsSync(ctx context.Context) error
LoadItemsSync: ensure that the Collection proxy has loaded all the items present in the Secret Service. This affects the result of secret_collection_get_items().
For collections returned from secret_service_get_collections() the items will have already been loaded.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Collection) Locked ¶
func (self *Collection) Locked() bool
Locked: get whether the collection is locked or not.
Use secret_service_lock() or secret_service_unlock() to lock or unlock the collection.
The function returns the following values:
- ok: whether the collection is locked or not.
func (*Collection) Modified ¶
func (self *Collection) Modified() uint64
Modified: get the modified date and time of the collection. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: modified date and time.
func (*Collection) Refresh ¶
func (self *Collection) Refresh()
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.
func (*Collection) Search ¶
func (self *Collection) Search(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags, callback gio.AsyncReadyCallback)
Search for items matching the attributes in the collection. The attributes should be a table of string keys and string values.
If SECRET_SEARCH_ALL 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 SECRET_SEARCH_UNLOCK 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 SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have their secret values loaded and available via secret_item_get_secret().
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: search for items matching these attributes.
- flags: search option flags.
- callback (optional): called when the operation completes.
func (*Collection) SearchFinish ¶
func (self *Collection) SearchFinish(result gio.AsyncResulter) ([]*Item, error)
SearchFinish: complete asynchronous operation to search for items in a collection.
The function takes the following parameters:
- result asynchronous result passed to callback.
The function returns the following values:
- list: a list of items that matched the search.
func (*Collection) SearchSync ¶
func (self *Collection) SearchSync(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags) ([]*Item, error)
SearchSync: search for items matching the attributes in the collection. The attributes should be a table of string keys and string values.
If SECRET_SEARCH_ALL 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 SECRET_SEARCH_UNLOCK 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 SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have their secret values loaded and available via secret_item_get_secret().
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: search for items matching these attributes.
- flags: search option flags.
The function returns the following values:
- list: a list of items that matched the search.
func (*Collection) Service ¶
func (self *Collection) Service() *Service
Service: get the Secret Service object that this collection was created with.
The function returns the following values:
- service: secret Service object.
func (*Collection) SetLabel ¶
func (self *Collection) SetLabel(ctx context.Context, label string, callback gio.AsyncReadyCallback)
SetLabel: set the label of this collection.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- label: new label.
- callback (optional): called when the operation completes.
func (*Collection) SetLabelFinish ¶
func (self *Collection) SetLabelFinish(result gio.AsyncResulter) error
SetLabelFinish: complete asynchronous operation to set the label of this collection.
The function takes the following parameters:
- result asynchronous result passed to callback.
func (*Collection) SetLabelSync ¶
func (self *Collection) SetLabelSync(ctx context.Context, label string) error
SetLabelSync: set the label of this collection.
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- label: new label.
type CollectionCreateFlags ¶
CollectionCreateFlags flags for secret_collection_create().
const ( // CollectionCreateNone: no flags. CollectionCreateNone CollectionCreateFlags = 0b0 )
func (CollectionCreateFlags) Has ¶
func (c CollectionCreateFlags) Has(other CollectionCreateFlags) bool
Has returns true if c contains other.
func (CollectionCreateFlags) String ¶
func (c CollectionCreateFlags) String() string
String returns the names in string for CollectionCreateFlags.
type CollectionFlags ¶
CollectionFlags flags which determine which parts of the Collection proxy are initialized.
const ( // CollectionNone: no flags. CollectionNone CollectionFlags = 0b0 // CollectionLoadItems items have or should be loaded. CollectionLoadItems CollectionFlags = 0b10 )
func (CollectionFlags) Has ¶
func (c CollectionFlags) Has(other CollectionFlags) bool
Has returns true if c contains other.
func (CollectionFlags) String ¶
func (c CollectionFlags) String() string
String returns the names in string for CollectionFlags.
type CollectionOverrider ¶
type CollectionOverrider interface { }
CollectionOverrider contains methods that are overridable.
type Item ¶
type Item struct { gio.DBusProxy *externglib.Object Retrievable // contains filtered or unexported fields }
Item: proxy object representing a secret item in the Secret Service.
func ItemCreateFinish ¶
ItemCreateFinish: finish operation to create a new item in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- item: new item, which should be unreferenced with g_object_unref().
func ItemCreateSync ¶
func ItemCreateSync(ctx context.Context, collection *Collection, schema *Schema, attributes map[string]string, label string, value *Value, flags ItemCreateFlags) (*Item, error)
ItemCreateSync: create a new item in the secret service.
If the flags contains SECRET_ITEM_CREATE_REPLACE, then the secret service will search for an item matching the attributes, and update that item instead of creating a new one.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that are required.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- collection: secret collection to create this item in.
- schema (optional) for the attributes.
- attributes for the new item.
- label for the new item.
- value: secret value for the new item.
- flags for the creation of the new item.
The function returns the following values:
- item: new item, which should be unreferenced with g_object_unref().
func (*Item) Attributes ¶
Attributes: set the attributes of this item.
The attributes are a mapping of string keys to string values. Attributes are used to search for items. Attributes are not stored or transferred securely by the secret service.
Do not modify the attributes returned by this method. Use secret_item_set_attributes() instead.
The function returns the following values:
- hashTable: new reference to the attributes, which should not be modified, and released with g_hash_table_unref().
func (*Item) Created ¶
Created: get the created date and time of the item. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: created date and time.
func (*Item) Delete ¶
Delete this item.
This method returns immediately and completes asynchronously. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Item) DeleteFinish ¶
DeleteFinish: complete asynchronous operation to delete the secret item.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Item) DeleteSync ¶
DeleteSync: delete this secret item.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Item) Flags ¶
Flags: get the flags representing what features of the Item proxy have been initialized.
Use secret_item_load_secret() to initialize further features and change the flags.
The function returns the following values:
- itemFlags flags for features initialized.
func (*Item) Label ¶
Label: get the label of this item.
The function returns the following values:
- utf8: label, which should be freed with g_free().
func (*Item) LoadSecret ¶
LoadSecret: load the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function will fail if the secret item is locked.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Item) LoadSecretFinish ¶
LoadSecretFinish: complete asynchronous operation to load the secret value of this item.
The newly loaded secret value can be accessed by calling secret_item_get_secret().
The function takes the following parameters:
- result asynchronous result passed to callback.
func (*Item) LoadSecretSync ¶
LoadSecretSync: load the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Item) Locked ¶
Locked: get whether the item is locked or not.
Depending on the secret service an item may not be able to be locked independently from the collection that it is in.
The function returns the following values:
- ok: whether the item is locked or not.
func (*Item) Modified ¶
Modified: get the modified date and time of the item. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: modified date and time.
func (*Item) Refresh ¶
func (self *Item) Refresh()
Refresh the properties on this item. 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.
func (*Item) SchemaName ¶
SchemaName gets the name of the schema that this item was stored with. This is also available at the <literal>xdg:schema</literal> attribute.
The function returns the following values:
- utf8 (optional): schema name.
func (*Item) Secret ¶
Secret: get the secret value of this item. If this item is locked or the secret has not yet been loaded then this will return NULL.
To load the secret call the secret_item_load_secret() method.
The function returns the following values:
- value (optional): secret value which should be released with secret_value_unref(), or NULL.
func (*Item) Service ¶
Service: get the Secret Service object that this item was created with.
The function returns the following values:
- service: secret Service object.
func (*Item) SetAttributes ¶
func (self *Item) SetAttributes(ctx context.Context, schema *Schema, attributes map[string]string, callback gio.AsyncReadyCallback)
SetAttributes: set the attributes of this item.
The attributes are a mapping of string keys to string values. Attributes are used to search for items. Attributes are not stored or transferred securely by the secret service.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: new set of attributes.
- callback (optional): called when the asynchronous operation completes.
func (*Item) SetAttributesFinish ¶
SetAttributesFinish: complete operation to set the attributes of this item.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Item) SetAttributesSync ¶
func (self *Item) SetAttributesSync(ctx context.Context, schema *Schema, attributes map[string]string) error
SetAttributesSync: set the attributes of this item.
The attributes are a mapping of string keys to string values. Attributes are used to search for items. Attributes are not stored or transferred securely by the secret service.
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: new set of attributes.
func (*Item) SetLabel ¶
SetLabel: set the label of this item.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- label: new label.
- callback (optional): called when the operation completes.
func (*Item) SetLabelFinish ¶
SetLabelFinish: complete asynchronous operation to set the label of this collection.
The function takes the following parameters:
- result asynchronous result passed to callback.
func (*Item) SetLabelSync ¶
SetLabelSync: set the label of this item.
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- label: new label.
func (*Item) SetSecret ¶
SetSecret: set the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- value: new secret value.
- callback (optional): called when the operation completes.
func (*Item) SetSecretFinish ¶
SetSecretFinish: complete asynchronous operation to set the secret value of this item.
The function takes the following parameters:
- result asynchronous result passed to callback.
func (*Item) SetSecretSync ¶
SetSecretSync: set the secret value of this item.
Each item has a single secret which might be a password or some other secret binary value.
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- value: new secret value.
type ItemCreateFlags ¶
ItemCreateFlags flags for secret_item_create().
const ( // ItemCreateNone: no flags. ItemCreateNone ItemCreateFlags = 0b0 // ItemCreateReplace: replace an item with the same attributes. ItemCreateReplace ItemCreateFlags = 0b10 )
func (ItemCreateFlags) Has ¶
func (i ItemCreateFlags) Has(other ItemCreateFlags) bool
Has returns true if i contains other.
func (ItemCreateFlags) String ¶
func (i ItemCreateFlags) String() string
String returns the names in string for ItemCreateFlags.
type ItemFlags ¶
ItemFlags flags which determine which parts of the Item proxy are initialized.
type ItemOverrider ¶
type ItemOverrider interface { }
ItemOverrider contains methods that are overridable.
type Prompt ¶
type Prompt struct { gio.DBusProxy // contains filtered or unexported fields }
Prompt: proxy object representing a prompt that the Secret Service will display to the user.
func (*Prompt) Perform ¶
func (self *Prompt) Perform(ctx context.Context, windowId string, returnType *glib.VariantType, callback gio.AsyncReadyCallback)
Perform runs a prompt and performs the prompting. Returns TRUE if the prompt was completed and not dismissed.
If window_id is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the <literal>d</literal> printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- windowId (optional): string form of XWindow id for parent window to be transient for.
- returnType: variant type of the prompt result.
- callback (optional): called when the operation completes.
func (*Prompt) PerformFinish ¶
PerformFinish: complete asynchronous operation to run a prompt and perform the prompting.
Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- variant: NULL if the prompt was dismissed or an error occurred, a variant result if the prompt was successful.
func (*Prompt) PerformSync ¶
func (self *Prompt) PerformSync(ctx context.Context, windowId string, returnType *glib.VariantType) (*glib.Variant, error)
PerformSync runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.
If window_id is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the <literal>d</literal> printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- windowId (optional): string form of XWindow id for parent window to be transient for.
- returnType: variant type of the prompt result.
The function returns the following values:
- variant: NULL if the prompt was dismissed or an error occurred.
func (*Prompt) Run ¶
func (self *Prompt) Run(ctx context.Context, windowId string, returnType *glib.VariantType) (*glib.Variant, error)
Run runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.
If window_id is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the <literal>d</literal> printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.
This runs the dialog in a recursive mainloop. When run from a user interface thread, this means the user interface will remain responsive. Care should be taken that appropriate user interface actions are disabled while running the prompt.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- windowId (optional): string form of XWindow id for parent window to be transient for.
- returnType: variant type of the prompt result.
The function returns the following values:
- variant: NULL if the prompt was dismissed or an error occurred.
type PromptOverrider ¶
type PromptOverrider interface { }
PromptOverrider contains methods that are overridable.
type Retrievable ¶
type Retrievable struct { *externglib.Object // contains filtered or unexported fields }
Retrievable: object representing a read-only view of a secret item in the Secret Service.
Retrievable wraps an interface. This means the user can get the underlying type by calling Cast().
func PasswordSearchFinish ¶
func PasswordSearchFinish(result gio.AsyncResulter) ([]*Retrievable, error)
PasswordSearchFinish: finish an asynchronous operation to search for items in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- list of Retrievable containing attributes of the matched items.
func PasswordSearchSync ¶
func PasswordSearchSync(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags) ([]*Retrievable, error)
PasswordSearchSync: search for items in the secret service.
The attributes should be a set of key and value string pairs.
If no secret is found then NULL is returned.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for attributes.
- attributes: attribute keys and values.
- flags: search option flags.
The function returns the following values:
- list of Retrievable containing attributes of the matched items.
func (*Retrievable) Attributes ¶
func (self *Retrievable) Attributes() map[string]string
Attributes: get the attributes of this object.
The attributes are a mapping of string keys to string values. Attributes are used to search for items. Attributes are not stored or transferred securely by the secret service.
Do not modify the attribute returned by this method.
The function returns the following values:
- hashTable: new reference to the attributes, which should not be modified, and released with g_hash_table_unref().
func (*Retrievable) Created ¶
func (self *Retrievable) Created() uint64
Created: get the created date and time of the object. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: created date and time.
func (*Retrievable) Label ¶
func (self *Retrievable) Label() string
Label: get the label of this item.
The function returns the following values:
- utf8: label, which should be freed with g_free().
func (*Retrievable) Modified ¶
func (self *Retrievable) Modified() uint64
Modified: get the modified date and time of the object. The return value is the number of seconds since the unix epoch, January 1st 1970.
The function returns the following values:
- guint64: modified date and time.
func (*Retrievable) RetrieveSecret ¶
func (self *Retrievable) RetrieveSecret(ctx context.Context, callback gio.AsyncReadyCallback)
RetrieveSecret: retrieve the secret value of this object.
Each retrievable object has a single secret which might be a password or some other secret binary value.
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Retrievable) RetrieveSecretFinish ¶
func (self *Retrievable) RetrieveSecretFinish(result gio.AsyncResulter) (*Value, error)
RetrieveSecretFinish: complete asynchronous operation to retrieve the secret value of this object.
The function takes the following parameters:
- result asynchronous result passed to callback.
The function returns the following values:
- value (optional): secret value which should be released with secret_value_unref(), or NULL.
func (*Retrievable) RetrieveSecretSync ¶
func (self *Retrievable) RetrieveSecretSync(ctx context.Context) (*Value, error)
RetrieveSecretSync: retrieve the secret value of this object synchronously.
Each retrievable object has a single secret which might be a password or some other secret binary value.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
The function returns the following values:
- value (optional): secret value which should be released with secret_value_unref(), or NULL.
type Retrievabler ¶
type Retrievabler interface { externglib.Objector // Attributes: get the attributes of this object. Attributes() map[string]string // Created: get the created date and time of the object. Created() uint64 // Label: get the label of this item. Label() string // Modified: get the modified date and time of the object. Modified() uint64 // RetrieveSecret: retrieve the secret value of this object. RetrieveSecret(ctx context.Context, callback gio.AsyncReadyCallback) // RetrieveSecretFinish: complete asynchronous operation to retrieve the // secret value of this object. RetrieveSecretFinish(result gio.AsyncResulter) (*Value, error) // RetrieveSecretSync: retrieve the secret value of this object // synchronously. RetrieveSecretSync(ctx context.Context) (*Value, error) }
Retrievabler describes Retrievable's interface methods.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents a set of attributes that are stored with an item. These schemas are used for interoperability between various services storing the same types of items.
Each schema has a name like "org.gnome.keyring.NetworkPassword", and defines a set of attributes, and types (string, integer, boolean) for those attributes.
Attributes are stored as strings in the Secret Service, and the attribute types simply define standard ways to store integer and boolean values as strings. Attributes are represented in libsecret via a Table with string keys and values. Even for values that defined as an integer or boolean in the schema, the attribute values in the Table are strings. Boolean values are stored as the strings 'true' and 'false'. Integer values are stored in decimal, with a preceding negative sign for negative integers.
Schemas are handled entirely on the client side by this library. The name of the schema is automatically stored as an attribute on the item.
Normally when looking up passwords only those with matching schema names are returned. If the schema flags contain the SECRET_SCHEMA_DONT_MATCH_NAME flag, then lookups will not check that the schema name matches that on the item, only the schema's attributes are matched. This is useful when you are looking up items that are not stored by the libsecret library. Other libraries such as libgnome-keyring don't store the schema name.
An instance of this type is always passed by reference.
func GetSchema ¶
func GetSchema(typ SchemaType) *Schema
GetSchema: get a secret storage schema of the given type.
C code may access the schemas (such as SECRET_SCHEMA_NOTE) directly, but language bindings cannot, and must use this accessor.
The function takes the following parameters:
- typ: type of schema to get.
The function returns the following values:
- schema type.
func NewSchema ¶
func NewSchema(name string, flags SchemaFlags, attributeNamesAndTypes map[string]SchemaAttributeType) *Schema
NewSchema constructs a struct Schema.
func (*Schema) Attributes ¶
func (s *Schema) Attributes() [32]SchemaAttribute
Attributes: attribute names and types of those attributes.
type SchemaAttribute ¶
type SchemaAttribute struct {
// contains filtered or unexported fields
}
SchemaAttribute: attribute in a Schema.
An instance of this type is always passed by reference.
func (*SchemaAttribute) Type ¶
func (s *SchemaAttribute) Type() SchemaAttributeType
Type: type of the attribute.
type SchemaAttributeType ¶
SchemaAttributeType: type of an attribute in a Schema. Attributes are stored as strings in the Secret Service, and the attribute types simply define standard ways to store integer and boolean values as strings.
const ( // SchemaAttributeString: utf-8 string attribute. SchemaAttributeString SchemaAttributeType = iota // SchemaAttributeInteger: integer attribute, stored as a decimal. SchemaAttributeInteger // SchemaAttributeBoolean: boolean attribute, stored as 'true' or 'false'. SchemaAttributeBoolean )
func (SchemaAttributeType) String ¶
func (s SchemaAttributeType) String() string
String returns the name in string for SchemaAttributeType.
type SchemaFlags ¶
SchemaFlags flags for a Schema definition.
const ( // SchemaNone: no flags for the schema. SchemaNone SchemaFlags = 0b0 // SchemaDontMatchName: don't match the schema name when looking up or // removing passwords. SchemaDontMatchName SchemaFlags = 0b10 )
func (SchemaFlags) Has ¶
func (s SchemaFlags) Has(other SchemaFlags) bool
Has returns true if s contains other.
func (SchemaFlags) String ¶
func (s SchemaFlags) String() string
String returns the names in string for SchemaFlags.
type SchemaType ¶
SchemaType: different types of schemas for storing secrets, intended for use with secret_get_schema().
const ( // SchemaTypeNote: personal passwords; see SECRET_SCHEMA_NOTE. SchemaTypeNote SchemaType = iota // SchemaTypeCompatNetwork: network passwords from older libgnome-keyring // storage; see SECRET_SCHEMA_COMPAT_NETWORK. SchemaTypeCompatNetwork )
func (SchemaType) String ¶
func (s SchemaType) String() string
String returns the name in string for SchemaType.
type SearchFlags ¶
SearchFlags various flags to be used with secret_service_search() and secret_service_search_sync().
const ( // SearchNone: no flags. SearchNone SearchFlags = 0b0 // SearchAll: all the items matching the search will be returned, instead of // just the first one. SearchAll SearchFlags = 0b10 // SearchUnlock: unlock locked items while searching. SearchUnlock SearchFlags = 0b100 // SearchLoadSecrets: while searching load secrets for items that are not // locked. SearchLoadSecrets SearchFlags = 0b1000 )
func (SearchFlags) Has ¶
func (s SearchFlags) Has(other SearchFlags) bool
Has returns true if s contains other.
func (SearchFlags) String ¶
func (s SearchFlags) String() string
String returns the names in string for SearchFlags.
type Service ¶
type Service struct { gio.DBusProxy // contains filtered or unexported fields }
Service: proxy object representing the Secret Service.
func ServiceGetFinish ¶
ServiceGetFinish: complete an asynchronous operation to get a Service proxy for the Secret Service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- service: new reference to a Service proxy, which should be released with g_object_unref().
func ServiceGetSync ¶
func ServiceGetSync(ctx context.Context, flags ServiceFlags) (*Service, error)
ServiceGetSync: get a Service proxy for the Secret Service. If such a proxy object already exists, then the same proxy is returned.
If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- flags for which service functionality to ensure is initialized.
The function returns the following values:
- service: new reference to a Service proxy, which should be released with g_object_unref().
func ServiceOpenFinish ¶
ServiceOpenFinish: complete an asynchronous operation to create a new Service proxy for the Secret Service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- service: new reference to a Service proxy, which should be released with g_object_unref().
func ServiceOpenSync ¶
func ServiceOpenSync(ctx context.Context, serviceGtype externglib.Type, serviceBusName string, flags ServiceFlags) (*Service, error)
ServiceOpenSync: create a new Service proxy for the Secret Service.
This function is rarely used, see secret_service_get_sync() instead.
The service_gtype argument should be set to SECRET_TYPE_SERVICE or a the type of a derived class.
If flags contains any flags of which parts of the secret service to ensure are initialized, then those will be initialized before returning.
If service_bus_name is NULL then the default is used.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- serviceGtype: GType of the new secret service.
- serviceBusName (optional) d-Bus service name of the secret service.
- flags for which service functionality to ensure is initialized.
The function returns the following values:
- service: new reference to a Service proxy, which should be released with g_object_unref().
func (*Service) Clear ¶
func (service *Service) Clear(ctx context.Context, schema *Schema, attributes map[string]string, callback gio.AsyncReadyCallback)
Clear: remove unlocked items which match the attributes from the secret service.
The attributes should be a set of key and value string pairs.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
- callback (optional): called when the operation completes.
func (*Service) ClearFinish ¶
ClearFinish: finish asynchronous operation to remove items from the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Service) ClearSync ¶
func (service *Service) ClearSync(ctx context.Context, schema *Schema, attributes map[string]string) error
ClearSync: remove unlocked items which match the attributes from the secret service.
The attributes should be a set of key and value string pairs.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
func (*Service) CollectionGType ¶
func (self *Service) CollectionGType() externglib.Type
CollectionGType: get the GObject type for collections instantiated by this service. This will always be either Collection or derived from it.
The function returns the following values:
- gType: gobject type for collections.
func (*Service) Collections ¶
func (self *Service) Collections() []*Collection
Collections: get a list of Collection objects representing all the collections in the secret service.
If the SECRET_SERVICE_LOAD_COLLECTIONS flag was not specified when initializing Service proxy object, then this method will return NULL. Use secret_service_load_collections() to load the collections.
The function returns the following values:
- list (optional): a list of the collections in the secret service.
func (*Service) EnsureSession ¶
EnsureSession: ensure that the Service proxy has established a session with the Secret Service. This session is used to transfer secrets.
It is not normally necessary to call this method, as the session is established as necessary. You can also pass the SECRET_SERVICE_OPEN_SESSION to secret_service_get() in order to ensure that a session has been established by the time you get the Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Service) EnsureSessionFinish ¶
EnsureSessionFinish: finish an asynchronous operation to ensure that the Service proxy has established a session with the Secret Service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Service) EnsureSessionSync ¶
EnsureSessionSync: ensure that the Service proxy has established a session with the Secret Service. This session is used to transfer secrets.
It is not normally necessary to call this method, as the session is established as necessary. You can also pass the SECRET_SERVICE_OPEN_SESSION to secret_service_get_sync() in order to ensure that a session has been established by the time you get the Service proxy.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Service) Flags ¶
func (self *Service) Flags() ServiceFlags
Flags: get the flags representing what features of the Service proxy have been initialized.
Use secret_service_ensure_session() or secret_service_load_collections() to initialize further features and change the flags.
The function returns the following values:
- serviceFlags flags for features initialized.
func (*Service) ItemGType ¶
func (self *Service) ItemGType() externglib.Type
ItemGType: get the GObject type for items instantiated by this service. This will always be either Item or derived from it.
The function returns the following values:
- gType: gobject type for items.
func (*Service) LoadCollections ¶
LoadCollections: ensure that the Service proxy has loaded all the collections present in the Secret Service. This affects the result of secret_service_get_collections().
You can also pass the SECRET_SERVICE_LOAD_COLLECTIONS to secret_service_get_sync() in order to ensure that the collections have been loaded by the time you get the Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- callback (optional): called when the operation completes.
func (*Service) LoadCollectionsFinish ¶
LoadCollectionsFinish: complete an asynchronous operation to ensure that the Service proxy has loaded all the collections present in the Secret Service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Service) LoadCollectionsSync ¶
LoadCollectionsSync: ensure that the Service proxy has loaded all the collections present in the Secret Service. This affects the result of secret_service_get_collections().
You can also pass the SECRET_SERVICE_LOAD_COLLECTIONS to secret_service_get_sync() in order to ensure that the collections have been loaded by the time you get the Service proxy.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
func (*Service) Lock ¶
func (service *Service) Lock(ctx context.Context, objects []*gio.DBusProxy, callback gio.AsyncReadyCallback)
Lock items or collections in the secret service.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method returns immediately and completes asynchronously. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- objects items or collections to lock.
- callback (optional): called when the operation completes.
func (*Service) LockFinish ¶
LockFinish: complete asynchronous operation to lock items or collections in the secret service.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- locked (optional): location to place list of items or collections that were locked.
- gint: number of items or collections that were locked.
func (*Service) LockSync ¶
func (service *Service) LockSync(ctx context.Context, objects []*gio.DBusProxy) ([]*gio.DBusProxy, int, error)
LockSync: lock items or collections in the secret service.
The secret service may not be able to lock items individually, and may lock an entire collection instead.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- objects items or collections to lock.
The function returns the following values:
- locked (optional): location to place list of items or collections that were locked.
- gint: number of items or collections that were locked.
func (*Service) Lookup ¶
func (service *Service) Lookup(ctx context.Context, schema *Schema, attributes map[string]string, callback gio.AsyncReadyCallback)
Lookup a secret value in the secret service.
The attributes should be a set of key and value string pairs.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
- callback (optional): called when the operation completes.
func (*Service) LookupFinish ¶
LookupFinish: finish asynchronous operation to lookup a secret value in the secret service.
If no secret is found then NULL is returned.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- value: newly allocated Value, which should be released with secret_value_unref(), or NULL if no secret found.
func (*Service) LookupSync ¶
func (service *Service) LookupSync(ctx context.Context, schema *Schema, attributes map[string]string) (*Value, error)
LookupSync: lookup a secret value in the secret service.
The attributes should be a set of key and value string pairs.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
The function returns the following values:
- value: newly allocated Value, which should be released with secret_value_unref(), or NULL if no secret found.
func (*Service) Prompt ¶
func (self *Service) Prompt(ctx context.Context, prompt *Prompt, returnType *glib.VariantType, callback gio.AsyncReadyCallback)
Prompt: perform prompting for a Prompt.
This function is called by other parts of this library to handle prompts for the various actions that can require prompting.
Override the ServiceClass <literal>prompt_async</literal> virtual method to change the behavior of the prompting. The default behavior is to simply run secret_prompt_perform() on the prompt.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- prompt: prompt.
- returnType (optional): variant type of the prompt result.
- callback (optional): called when the operation completes.
func (*Service) PromptFinish ¶
PromptFinish: complete asynchronous operation to perform prompting for a Prompt.
Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- variant: NULL if the prompt was dismissed or an error occurred, a variant result if the prompt was successful.
func (*Service) PromptSync ¶
func (self *Service) PromptSync(ctx context.Context, prompt *Prompt, returnType *glib.VariantType) (*glib.Variant, error)
PromptSync: perform prompting for a Prompt.
Runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.
This function is called by other parts of this library to handle prompts for the various actions that can require prompting.
Override the ServiceClass <literal>prompt_sync</literal> virtual method to change the behavior of the prompting. The default behavior is to simply run secret_prompt_perform_sync() on the prompt with a NULL <literal>window_id</literal>.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- prompt: prompt.
- returnType: variant type of the prompt result.
The function returns the following values:
- variant: NULL if the prompt was dismissed or an error occurred, a variant result if the prompt was successful.
func (*Service) Search ¶
func (service *Service) Search(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags, callback gio.AsyncReadyCallback)
Search for items matching the attributes. All collections are searched. The attributes should be a table of string keys and string values.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
If SECRET_SEARCH_ALL 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 SECRET_SEARCH_UNLOCK 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 SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items will have their secret values loaded and available via secret_item_get_secret().
This function returns immediately and completes asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: search for items matching these attributes.
- flags: search option flags.
- callback (optional): called when the operation completes.
func (*Service) SearchFinish ¶
SearchFinish: complete asynchronous operation to search for items.
The function takes the following parameters:
- result asynchronous result passed to callback.
The function returns the following values:
- list: a list of items that matched the search.
func (*Service) SearchSync ¶
func (service *Service) SearchSync(ctx context.Context, schema *Schema, attributes map[string]string, flags SearchFlags) ([]*Item, error)
SearchSync: search for items matching the attributes. All collections are searched. The attributes should be a table of string keys and string values.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
If SECRET_SEARCH_ALL 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 SECRET_SEARCH_UNLOCK 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 SECRET_SEARCH_LOAD_SECRETS is set in flags, then the items' secret values will be loaded for any unlocked items. Loaded item secret values are available via secret_item_get_secret(). If the load of a secret values fail, then the
This function may block indefinitely. Use the asynchronous version in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: search for items matching these attributes.
- flags: search option flags.
The function returns the following values:
- list: a list of items that matched the search.
func (*Service) SessionAlgorithms ¶
SessionAlgorithms: get the set of algorithms being used to transfer secrets between this secret service proxy and the Secret Service itself.
This will be NULL if no session has been established. Use secret_service_ensure_session() to establish a session.
The function returns the following values:
- utf8 (optional): string representing the algorithms for transferring secrets.
func (*Service) SetAlias ¶
func (service *Service) SetAlias(ctx context.Context, alias string, collection *Collection, callback gio.AsyncReadyCallback)
SetAlias: assign a collection to this alias. Aliases help determine well known collections, such as 'default'.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- alias to assign the collection to.
- collection (optional) to assign to the alias.
- callback (optional): called when the operation completes.
func (*Service) SetAliasFinish ¶
SetAliasFinish: finish an asynchronous operation to assign a collection to an alias.
The function takes the following parameters:
- result asynchronous result passed to callback.
func (*Service) SetAliasSync ¶
func (service *Service) SetAliasSync(ctx context.Context, alias string, collection *Collection) error
SetAliasSync: assign a collection to this alias. Aliases help determine well known collections, such as 'default'.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- alias to assign the collection to.
- collection (optional) to assign to the alias.
func (*Service) Store ¶
func (service *Service) Store(ctx context.Context, schema *Schema, attributes map[string]string, collection, label string, value *Value, callback gio.AsyncReadyCallback)
Store a secret value in the secret service.
The attributes should be a set of key and value string pairs.
If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
If collection is not specified, then the default collection will be used. Use CRET_COLLECTION_SESSION to store the password in the session collection, which doesn't get stored across login sessions.
This method will return immediately and complete asynchronously.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) to use to check attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- value: secret value.
- callback (optional): called when the operation completes.
func (*Service) StoreFinish ¶
StoreFinish: finish asynchronous operation to store a secret value in the secret service.
The function takes the following parameters:
- result asynchronous result passed to the callback.
func (*Service) StoreSync ¶
func (service *Service) StoreSync(ctx context.Context, schema *Schema, attributes map[string]string, collection, label string, value *Value) error
StoreSync: store a secret value in the secret service.
The attributes should be a set of key and value string pairs.
If the attributes match a secret item already stored in the collection, then the item will be updated with these new values.
If collection is NULL, then the default collection will be used. Use CRET_COLLECTION_SESSION to store the password in the session collection, which doesn't get stored across login sessions.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- schema (optional) for the attributes.
- attributes: attribute keys and values.
- collection (optional) alias, or D-Bus object path of the collection where to store the secret.
- label for the secret.
- value: secret value.
func (*Service) Unlock ¶
func (service *Service) Unlock(ctx context.Context, objects []*gio.DBusProxy, callback gio.AsyncReadyCallback)
Unlock items or collections in the secret service.
The secret service may not be able to unlock items individually, and may unlock an entire collection instead.
If service is NULL, then secret_service_get() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- objects items or collections to unlock.
- callback (optional): called when the operation completes.
func (*Service) UnlockFinish ¶
UnlockFinish: complete asynchronous operation to unlock items or collections in the secret service.
The secret service may not be able to unlock items individually, and may unlock an entire collection instead.
The function takes the following parameters:
- result asynchronous result passed to the callback.
The function returns the following values:
- unlocked (optional): location to place list of items or collections that were unlocked.
- gint: number of items or collections that were unlocked.
func (*Service) UnlockSync ¶
func (service *Service) UnlockSync(ctx context.Context, objects []*gio.DBusProxy) ([]*gio.DBusProxy, int, error)
UnlockSync: unlock items or collections in the secret service.
The secret service may not be able to unlock items individually, and may unlock an entire collection instead.
If service is NULL, then secret_service_get_sync() will be called to get the default Service proxy.
This method may block indefinitely and should not be used in user interface threads. The secret service may prompt the user. secret_service_prompt() will be used to handle any prompts that show up.
The function takes the following parameters:
- ctx (optional): optional cancellation object.
- objects items or collections to unlock.
The function returns the following values:
- unlocked (optional): location to place list of items or collections that were unlocked.
- gint: number of items or collections that were unlocked.
type ServiceFlags ¶
ServiceFlags flags which determine which parts of the Service proxy are initialized during a secret_service_get() or secret_service_open() operation.
const ( // ServiceNone: no flags for initializing the Service. ServiceNone ServiceFlags = 0b0 // ServiceOpenSession: establish a session for transfer of secrets while // initializing the Service. ServiceOpenSession ServiceFlags = 0b10 // ServiceLoadCollections: load collections while initializing the Service. ServiceLoadCollections ServiceFlags = 0b100 )
func (ServiceFlags) Has ¶
func (s ServiceFlags) Has(other ServiceFlags) bool
Has returns true if s contains other.
func (ServiceFlags) String ¶
func (s ServiceFlags) String() string
String returns the names in string for ServiceFlags.
type ServiceOverrider ¶
type ServiceOverrider interface { // CollectionGType: get the GObject type for collections instantiated by // this service. This will always be either Collection or derived from it. // // The function returns the following values: // // - gType: gobject type for collections. // CollectionGType() externglib.Type // ItemGType: get the GObject type for items instantiated by this service. // This will always be either Item or derived from it. // // The function returns the following values: // // - gType: gobject type for items. // ItemGType() externglib.Type // PromptFinish: complete asynchronous operation to perform prompting for a // Prompt. // // Returns a variant result if the prompt was completed and not dismissed. // The type of result depends on the action the prompt is completing, and is // defined in the Secret Service DBus API specification. // // The function takes the following parameters: // // - result asynchronous result passed to the callback. // // The function returns the following values: // // - variant: NULL if the prompt was dismissed or an error occurred, a // variant result if the prompt was successful. // PromptFinish(result gio.AsyncResulter) (*glib.Variant, error) // PromptSync: perform prompting for a Prompt. // // Runs a prompt and performs the prompting. Returns a variant result if the // prompt was completed and not dismissed. The type of result depends on the // action the prompt is completing, and is defined in the Secret Service // DBus API specification. // // This function is called by other parts of this library to handle prompts // for the various actions that can require prompting. // // Override the ServiceClass <literal>prompt_sync</literal> virtual method // to change the behavior of the prompting. The default behavior is to // simply run secret_prompt_perform_sync() on the prompt with a NULL // <literal>window_id</literal>. // // The function takes the following parameters: // // - ctx (optional): optional cancellation object. // - prompt: prompt. // - returnType: variant type of the prompt result. // // The function returns the following values: // // - variant: NULL if the prompt was dismissed or an error occurred, a // variant result if the prompt was successful. // PromptSync(ctx context.Context, prompt *Prompt, returnType *glib.VariantType) (*glib.Variant, error) }
ServiceOverrider contains methods that are overridable.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value: secret value, like a password or other binary secret.
An instance of this type is always passed by reference.
func (*Value) ContentType ¶
ContentType: get the content type of the secret value, such as <literal>text/plain</literal>.
The function returns the following values:
- utf8: content type.
func (*Value) Get ¶
Get the secret data in the Value. The value is not necessarily null-terminated unless it was created with secret_value_new() or a null-terminated string was passed to secret_value_new_full().
The function returns the following values:
- guint8s: secret data.
func (*Value) Text ¶
Text: get the secret data in the Value if it contains a textual value. The content type must be <literal>text/plain</literal>.
The function returns the following values:
- utf8 (optional): content type.
func (*Value) UnrefToPassword ¶
UnrefToPassword: unreference a Value and steal the secret data in Value as nonpageable memory.
The function takes the following parameters:
- length of the secret.
The function returns the following values:
- utf8: new password string stored in nonpageable memory which must be freed with secret_password_free() when done.