GpgFrontend Project A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.

DataObjectOperator.h
1
29 #ifndef GPGFRONTEND_DATAOBJECTOPERATOR_H
30 #define GPGFRONTEND_DATAOBJECTOPERATOR_H
31
32 #include "core/GpgFunctionObject.h"
33 #include "core/function/GlobalSettingStation.h"
34
35 namespace GpgFrontend {
36
37 class GPGFRONTEND_CORE_EXPORT DataObjectOperator
38 : public SingletonFunctionObject<DataObjectOperator> {
39 public:
45 explicit DataObjectOperator(
46 int channel = SingletonFunctionObject::GetDefaultChannel());
47
48 std::string SaveDataObj(const std::string &_key, const nlohmann::json &value);
49
50 std::optional<nlohmann::json> GetDataObject(const std::string &_key);
51
52 std::optional<nlohmann::json> GetDataObjectByRef(const std::string &_ref);
53
54 private:
59 void init_app_secure_key();
60
61 GlobalSettingStation &global_setting_station_ =
62 GlobalSettingStation::GetInstance();
63 std::filesystem::path app_secure_path_ =
64 global_setting_station_.GetAppConfigPath() /
65 "secure";
66 std::filesystem::path app_secure_key_path_ =
67 app_secure_path_ / "app.key";
68 std::filesystem::path app_data_objs_path_ =
69 global_setting_station_.GetAppDataPath() / "data_objs";
72
73 std::random_device rd_;
74 std::mt19937 mt_ = std::mt19937(rd_());
75 QByteArray hash_key_;
76 };
77
78 } // namespace GpgFrontend
79
80 #endif // GPGFRONTEND_DATAOBJECTOPERATOR_H
GpgFrontend::DataObjectOperator
Definition: DataObjectOperator.h:38
GpgFrontend::DataObjectOperator::rd_
std::random_device rd_
Random device.
Definition: DataObjectOperator.h:73
GpgFrontend::DataObjectOperator::hash_key_
QByteArray hash_key_
Hash key.
Definition: DataObjectOperator.h:75
GpgFrontend::GlobalSettingStation
Definition: GlobalSettingStation.h:45
GpgFrontend::SingletonFunctionObject
Definition: GpgFunctionObject.h:150
GpgFrontend::SingletonFunctionObject::GetDefaultChannel
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:251
GpgFrontend::SingletonFunctionObject< GlobalSettingStation >::GetInstance
static GlobalSettingStation & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:172
GpgFrontend
Definition: CoreCommonUtil.cpp:31