mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
add minor improvements
This commit is contained in:
@@ -16,6 +16,12 @@
|
|||||||
|
|
||||||
using namespace QKeychain;
|
using namespace QKeychain;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
constexpr auto settingsKeyTag{"settingsKeyTag"};
|
||||||
|
constexpr auto settingsIvTag{"settingsIvTag"};
|
||||||
|
constexpr auto keyChainName{"AmneziaVPN-Keychain"};
|
||||||
|
}
|
||||||
|
|
||||||
SecureQSettings::SecureQSettings(const QString &organization, const QString &application, QObject *parent)
|
SecureQSettings::SecureQSettings(const QString &organization, const QString &application, QObject *parent)
|
||||||
: QObject { parent }, m_settings(organization, application, parent), encryptedKeys({ "Servers/serversList" })
|
: QObject { parent }, m_settings(organization, application, parent), encryptedKeys({ "Servers/serversList" })
|
||||||
{
|
{
|
||||||
@@ -50,7 +56,7 @@ QVariant SecureQSettings::value(const QString &key, const QVariant &defaultValue
|
|||||||
// check if value is not encrypted, v. < 2.0.x
|
// check if value is not encrypted, v. < 2.0.x
|
||||||
retVal = m_settings.value(key);
|
retVal = m_settings.value(key);
|
||||||
if (retVal.isValid()) {
|
if (retVal.isValid()) {
|
||||||
if (retVal.userType() == QVariant::ByteArray && retVal.toByteArray().mid(0, magicString.size()) == magicString) {
|
if (retVal.userType() == QMetaType::QByteArray && retVal.toByteArray().mid(0, magicString.size()) == magicString) {
|
||||||
|
|
||||||
if (getEncKey().isEmpty() || getEncIv().isEmpty()) {
|
if (getEncKey().isEmpty() || getEncIv().isEmpty()) {
|
||||||
qCritical() << "SecureQSettings::setValue Decryption requested, but key is empty";
|
qCritical() << "SecureQSettings::setValue Decryption requested, but key is empty";
|
||||||
|
|||||||
@@ -8,10 +8,6 @@
|
|||||||
|
|
||||||
#include "keychain.h"
|
#include "keychain.h"
|
||||||
|
|
||||||
constexpr const char *settingsKeyTag = "settingsKeyTag";
|
|
||||||
constexpr const char *settingsIvTag = "settingsIvTag";
|
|
||||||
constexpr const char *keyChainName = "AmneziaVPN-Keychain";
|
|
||||||
|
|
||||||
class SecureQSettings : public QObject
|
class SecureQSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -44,7 +40,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QSettings m_settings;
|
QSettings m_settings;
|
||||||
|
|
||||||
mutable QMap<QString, QVariant> m_cache;
|
mutable QHash<QString, QVariant> m_cache;
|
||||||
|
|
||||||
QStringList encryptedKeys; // encode only key listed here
|
QStringList encryptedKeys; // encode only key listed here
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user