Commit e5ecab72 authored by Mohammed Sadiq's avatar Mohammed Sadiq Committed by Mohammed Sadiq
Browse files

secret-store: Use simple API to manage secrets

Only Simple API is supposed to work in flatpak.  So let's use it
parent 8124d7d5
Pipeline #64111 failed with stages
in 3 minutes and 57 seconds
......@@ -115,7 +115,7 @@ secret_load_cb (GObject *object,
g_assert_true (G_IS_TASK (task));
secrets = secret_service_search_finish (NULL, result, &error);
secrets = secret_password_search_finish (result, &error);
if (error) {
g_task_return_error (task, error);
......@@ -144,18 +144,16 @@ chatty_secret_load_async (GCancellable *cancellable,
gpointer user_data)
const SecretSchema *schema;
g_autoptr(GHashTable) attr = NULL;
GTask *task;
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
schema = secret_store_get_schema ();
task = g_task_new (NULL, cancellable, callback, user_data);
attr = secret_attributes_build (schema, NULL);
secret_service_search (NULL, schema, attr,
secret_password_search (schema,
cancellable, secret_load_cb, task);
cancellable, secret_load_cb, task, NULL);
GPtrArray *
......@@ -174,19 +172,17 @@ chatty_secret_delete_async (ChattyAccount *account,
gpointer user_data)
const SecretSchema *schema;
g_autoptr(GHashTable) attr = NULL;
const char *server;
g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
schema = secret_store_get_schema ();
server = chatty_ma_account_get_homeserver (CHATTY_MA_ACCOUNT (account));
attr = secret_attributes_build (schema,
secret_password_clear (schema, cancellable, callback, user_data,
CHATTY_USERNAME_ATTRIBUTE, chatty_account_get_username (account),
secret_service_clear (NULL, schema, attr, cancellable, callback, user_data);
......@@ -195,5 +191,5 @@ chatty_secret_delete_finish (GAsyncResult *result,
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
return secret_service_clear_finish (NULL, result, error);
return secret_password_clear_finish (result, error);
......@@ -790,22 +790,22 @@ ma_account_get_value (const char *str,
ChattyMaAccount *
chatty_ma_account_new_secret (gpointer secret_item)
chatty_ma_account_new_secret (gpointer secret_retrievable)
ChattyMaAccount *self = NULL;
g_autoptr(GHashTable) attributes = NULL;
SecretItem *item = secret_item;
SecretRetrievable *item = secret_retrievable;
SecretValue *value;
const char *username, *homeserver, *credentials;
char *password, *token, *device_id;
char *password_str, *token_str = NULL;
g_return_val_if_fail (SECRET_IS_ITEM (item), NULL);
g_return_val_if_fail (SECRET_IS_RETRIEVABLE (item), NULL);
value = secret_item_get_secret (item);
value = secret_retrievable_retrieve_secret_sync (item, NULL, NULL);
credentials = secret_value_get_text (value);
attributes = secret_item_get_attributes (item);
attributes = secret_retrievable_get_attributes (item);
username = g_hash_table_lookup (attributes, CHATTY_USERNAME_ATTRIBUTE);
homeserver = g_hash_table_lookup (attributes, CHATTY_SERVER_ATTRIBUTE);
......@@ -25,7 +25,7 @@ G_DECLARE_FINAL_TYPE (ChattyMaAccount, chatty_ma_account, CHATTY, MA_ACCOUNT, Ch
ChattyMaAccount *chatty_ma_account_new (const char *username,
const char *password);
ChattyMaAccount *chatty_ma_account_new_secret (gpointer secret_item);
ChattyMaAccount *chatty_ma_account_new_secret (gpointer secret_retrievable);
void chatty_ma_account_set_history_db (ChattyMaAccount *self,
gpointer history_db);
void chatty_ma_account_set_db (ChattyMaAccount *self,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment