MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / InitSecretService

Function InitSecretService

src/platform/linux/token_store_linux.cpp:51–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51static void InitSecretService() {
52#if defined(__i386__)
53 LOG("[TokenStorage] Secret Service unavailable in 32-bit Steam process; using file fallback");
54 return;
55#endif
56
57 g_libsecret = dlopen("libsecret-1.so.0", RTLD_NOW | RTLD_LOCAL);
58 if (!g_libsecret) {
59 LOG("[TokenStorage] libsecret not available: %s", dlerror());
60 return;
61 }
62
63 g_libglib = dlopen("libglib-2.0.so.0", RTLD_NOW | RTLD_LOCAL);
64 if (!g_libglib) {
65 LOG("[TokenStorage] libglib not available: %s", dlerror());
66 dlclose(g_libsecret);
67 g_libsecret = nullptr;
68 return;
69 }
70
71 secret_password_lookup_sync = (secret_password_lookup_sync_fn)dlsym(g_libsecret, "secret_password_lookup_sync");
72 secret_password_store_sync = (secret_password_store_sync_fn)dlsym(g_libsecret, "secret_password_store_sync");
73 secret_password_free = (secret_password_free_fn)dlsym(g_libsecret, "secret_password_free");
74 g_error_free = (g_error_free_fn)dlsym(g_libglib, "g_error_free");
75
76 if (!secret_password_lookup_sync || !secret_password_store_sync ||
77 !secret_password_free || !g_error_free) {
78 LOG("[TokenStorage] Failed to resolve libsecret symbols");
79 dlclose(g_libsecret);
80 dlclose(g_libglib);
81 g_libsecret = nullptr;
82 g_libglib = nullptr;
83 return;
84 }
85
86 g_secretServiceAvailable = true;
87 LOG("[TokenStorage] libsecret available, using Secret Service for token storage");
88}
89
90// Parse "tokens_gdrive.json" -> provider="gdrive", account from path
91static bool ParseTokenPath(const std::string& path, std::string& provider, std::string& account) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected