| 101 | } |
| 102 | |
| 103 | static bool storeTokenInSecretService(const QString& provider, const QString& account, const QString& json) { |
| 104 | initSecretService(); |
| 105 | if (!g_secretServiceAvailable) return false; |
| 106 | |
| 107 | GError* error = nullptr; |
| 108 | QString label = QString("CloudRedirect %1 token").arg(provider); |
| 109 | |
| 110 | int ok = secret_password_store_sync( |
| 111 | &g_tokenSchema, "default", label.toUtf8().constData(), json.toUtf8().constData(), |
| 112 | nullptr, &error, |
| 113 | "provider", provider.toUtf8().constData(), |
| 114 | "account", account.toUtf8().constData(), |
| 115 | nullptr); |
| 116 | |
| 117 | if (error) { |
| 118 | qDebug() << "[TokenStorage] Secret Service store failed:" << error->message; |
| 119 | g_error_free(error); |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | return ok != 0; |
| 124 | } |
| 125 | |
| 126 | // Extract provider and account from token path |
| 127 | // Path format: ~/.config/CloudRedirect/tokens/{provider}_{account}.json |
no test coverage detected