Class Secret

java.lang.Object
org.gnome.secret.Secret

@Generated("org.javagi.JavaGI") public final class Secret extends Object
Constants and functions that are declared in the global Secret namespace.
  • Field Details

  • Constructor Details

    • Secret

      public Secret()
  • Method Details

    • javagi$ensureInitialized

      public static void javagi$ensureInitialized()
    • attributesBuild

      public static HashTable<String,String> attributesBuild(Schema schema, Object... varargs)

      Build up a hash table of attribute values.

      The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a null.

      Parameters:
      schema - the schema for the attributes
      varargs - the attribute keys and values, terminated with null
      Returns:
      a new table of attributes, to be released with HashTable#unref
    • attributesValidate

      public static boolean attributesValidate(Schema schema, HashTable<MemorySegment, MemorySegment> attributes) throws GErrorException

      Check if attributes are valid according to the provided schema.

      Verifies schema name if available, attribute names and parsing of attribute values.

      Parameters:
      schema - the schema for the attributes
      attributes - the attributes to be validated
      Returns:
      whether or not the given attributes table is valid
      Throws:
      GErrorException - see GError
      Since:
      0.21.2
    • getSchema

      public static Schema getSchema(SchemaType type)

      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.

      Parameters:
      type - type of schema to get
      Returns:
      schema type
      Since:
      0.18.6
    • passwordClearFinish

      public static boolean passwordClearFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation to remove passwords from the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      whether any passwords were removed
      Throws:
      GErrorException - see GError
    • passwordClear

      public static void passwordClear(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      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.

      Parameters:
      schema - the schema for the attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      callback - called when the operation completes
    • passwordClearSync

      public static boolean passwordClearSync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable) throws GErrorException

      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.

      Parameters:
      schema - the schema for the attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      Returns:
      whether any passwords were removed
      Throws:
      GErrorException - see GError
    • passwordFree

      public static void passwordFree(@Nullable String password)

      Clear the memory used by a password, and then free it.

      This function must be used to free nonpageable memory returned by passwordLookupNonpageableFinish(AsyncResult), passwordLookupNonpageableSync(Schema, Cancellable, GError[], Object...) or passwordLookupvNonpageableSync(Schema, HashTable, Cancellable).

      Parameters:
      password - password to free
    • passwordLookupBinaryFinish

      public static Value passwordLookupBinaryFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation to lookup a password in the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      a newly allocated Value, which should be released with Value.unref(), or null if no secret found
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordLookupBinarySync

      public static Value passwordLookupBinarySync(Schema schema, @Nullable Cancellable cancellable, GError[] error, Object... varargs)

      Lookup a password in the secret service.

      This is similar to passwordLookupSync(Schema, HashTable, Cancellable), but returns a Value instead of a null-terminated password.

      This method may block indefinitely and should not be used in user interface threads.

      Parameters:
      schema - the schema for the attributes
      cancellable - optional cancellation object
      error - location to place an error on failure
      varargs - the attribute keys and values, terminated with null
      Returns:
      a newly allocated Value, which should be released with Value.unref(), or null if no secret found
      Since:
      0.19.0
    • passwordLookupFinish

      public static String passwordLookupFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation to lookup a password in the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      a new password string which should be freed with passwordFree(String) or may be freed with GLib#free when done
      Throws:
      GErrorException - see GError
    • passwordLookupNonpageableFinish

      public static String passwordLookupNonpageableFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation to lookup a password in the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      a new password string stored in nonpageable memory which must be freed with passwordFree(String) when done
      Throws:
      GErrorException - see GError
    • passwordLookupNonpageableSync

      public static String passwordLookupNonpageableSync(Schema schema, @Nullable Cancellable cancellable, GError[] error, Object... varargs)

      Lookup a password in the secret service.

      The variable argument list should contain pairs of a) The attribute name as a null-terminated string, followed by b) attribute value, either a character string, an int number, or a gboolean value, as defined in the password schema. The list of attributes should be terminated with a null.

      If no secret is found then null is returned.

      This method may block indefinitely and should not be used in user interface threads.

      Parameters:
      schema - the schema for the attributes
      cancellable - optional cancellation object
      error - location to place an error on failure
      varargs - the attribute keys and values, terminated with null
      Returns:
      a new password string stored in nonpageable memory which must be freed with passwordFree(String) when done
    • passwordLookup

      public static void passwordLookup(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      callback - called when the operation completes
    • passwordLookupvBinarySync

      public static Value passwordLookupvBinarySync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable) throws GErrorException

      Lookup a password in the secret service.

      This is similar to org.gnome.secret.Secret.passwordLookupvSync, but returns a Value instead of a null-terminated password.

      This method may block indefinitely and should not be used in user interface threads.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      Returns:
      a newly allocated Value, which should be released with Value.unref(), or null if no secret found
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordLookupvNonpageableSync

      public static String passwordLookupvNonpageableSync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable) throws GErrorException

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      Returns:
      a new password string stored in non pageable memory which should be freed with passwordFree(String) when done
      Throws:
      GErrorException - see GError
    • passwordLookupSync

      public static String passwordLookupSync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable Cancellable cancellable) throws GErrorException

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      cancellable - optional cancellation object
      Returns:
      a new password string which should be freed with passwordFree(String) or may be freed with GLib#free when done
      Throws:
      GErrorException - see GError
    • passwordSearchFinish

      public static List<Retrievable> passwordSearchFinish(AsyncResult result) throws GErrorException
      Finish an asynchronous operation to search for items in the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      a list of Retrievable containing attributes of the matched items
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordSearch

      public static void passwordSearch(@Nullable Schema schema, HashTable<String,String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      flags - search option flags
      cancellable - optional cancellation object
      callback - called when the operation completes
      Since:
      0.19.0
    • passwordSearch

      public static void passwordSearch(@Nullable Schema schema, HashTable<String,String> attributes, SearchFlags flags, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      flags - search option flags
      cancellable - optional cancellation object
      callback - called when the operation completes
      Since:
      0.19.0
    • passwordSearchSync

      public static List<Retrievable> passwordSearchSync(@Nullable Schema schema, HashTable<String,String> attributes, Set<SearchFlags> flags, @Nullable Cancellable cancellable) throws GErrorException

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      flags - search option flags
      cancellable - optional cancellation object
      Returns:
      a list of Retrievable containing attributes of the matched items
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordSearchSync

      public static List<Retrievable> passwordSearchSync(@Nullable Schema schema, HashTable<String,String> attributes, SearchFlags flags, @Nullable Cancellable cancellable) throws GErrorException

      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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      flags - search option flags
      cancellable - optional cancellation object
      Returns:
      a list of Retrievable containing attributes of the matched items
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordStoreFinish

      public static boolean passwordStoreFinish(AsyncResult result) throws GErrorException
      Finish asynchronous operation to store a password in the secret service.
      Parameters:
      result - the asynchronous result passed to the callback
      Returns:
      whether the storage was successful or not
      Throws:
      GErrorException - see GError
    • passwordStore

      public static void passwordStore(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable String collection, String label, String password, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      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 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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      collection - a collection alias, or D-Bus object path of the collection where to store the secret
      label - label for the secret
      password - the null-terminated password to store
      cancellable - optional cancellation object
      callback - called when the operation completes
    • passwordStoreBinary

      public static void passwordStoreBinary(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Store a password in the secret service.

      This is similar to org.gnome.secret.Secret.passwordStorev, but takes a Value as the argument instead of a null-terminated password.

      This method will return immediately and complete asynchronously.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      collection - a collection alias, or D-Bus object path of the collection where to store the secret
      label - label for the secret
      value - a Value
      cancellable - optional cancellation object
      callback - called when the operation completes
      Since:
      0.19.0
    • passwordStoreBinarySync

      public static boolean passwordStoreBinarySync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable String collection, String label, Value value, @Nullable Cancellable cancellable) throws GErrorException

      Store a password in the secret service.

      This is similar to org.gnome.secret.Secret.passwordStorevSync, 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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      collection - a collection alias, or D-Bus object path of the collection where to store the secret
      label - label for the secret
      value - a Value
      cancellable - optional cancellation object
      Returns:
      whether the storage was successful or not
      Throws:
      GErrorException - see GError
      Since:
      0.19.0
    • passwordStoreSync

      public static boolean passwordStoreSync(@Nullable Schema schema, HashTable<String,String> attributes, @Nullable String collection, String label, String password, @Nullable Cancellable cancellable) throws GErrorException

      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 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.

      Parameters:
      schema - the schema for attributes
      attributes - the attribute keys and values
      collection - a collection alias, or D-Bus object path of the collection where to store the secret
      label - label for the secret
      password - the null-terminated password to store
      cancellable - optional cancellation object
      Returns:
      whether the storage was successful or not
      Throws:
      GErrorException - see GError
    • passwordWipe

      public static void passwordWipe(@Nullable String password)
      Clear the memory used by a password.
      Parameters:
      password - password to clear