Skip to content
Snippets Groups Projects
Commit ab7a459c authored by Recolic K's avatar Recolic K
Browse files

playing libsecret

parent 625bf322
No related branches found
No related tags found
No related merge requests found
CXX ?= g++
# Accepts CXXSTD >= C++14
CXXFLAGS := $(shell pkg-config --cflags --libs gnome-keyring-1) -I ./lib -I . -std=c++14
CXXFLAGS := $(shell pkg-config --cflags --libs gnome-keyring-1) $(shell pkg-config --cflags --libs libsecret-1) -I ./lib -I . -std=c++14
EXTRA_FLAGS ?=
secret:
......
......@@ -2,6 +2,35 @@
#include <string>
#include <rlib/macro.hpp>
#include <libsecret/secret.h>
#include <gmodule.h>
#include <rlib/stdio.hpp>
inline std::string do_unlock_2(std::string keyring, std::string password) {
GError *err = NULL;
SecretService *service_proxy_ptr = secret_service_get_sync(SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &err);
if(err != NULL or service_proxy_ptr == NULL) {
return err->message;
}
rlib_defer([&]{g_object_unref(service_proxy_ptr);});
GList *collections = secret_service_get_collections(service_proxy_ptr);
if(collections == NULL) return "collection gg";
auto curr = collections;
while (curr != NULL)
{
auto iter = reinterpret_cast<SecretCollection *>(curr->data);
auto label = secret_collection_get_label(iter);
if(label == NULL) break;
rlib_defer([&]{g_free(label);});
rlib::println("DEBUG: LABEL=", label);
curr = curr->next;
}
return "";
}
inline GnomeKeyringResult do_unlock(std::string keyring, std::string password) {
return gnome_keyring_unlock_sync(keyring.c_str(), password.c_str());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment