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/GpgFrontendCore.h"
33 #include "core/GpgFunctionObject.h"
34 #include "core/function/GlobalSettingStation.h"
35 
36 namespace GpgFrontend {
37 
38 class GPGFRONTEND_CORE_EXPORT DataObjectOperator
39  : public SingletonFunctionObject<DataObjectOperator> {
40  public:
46  explicit DataObjectOperator(
48 
49  std::string SaveDataObj(const std::string &_key, const nlohmann::json &value);
50 
51  std::optional<nlohmann::json> GetDataObject(const std::string &_key);
52 
53  std::optional<nlohmann::json> GetDataObjectByRef(const std::string &_ref);
54 
55  private:
60  void init_app_secure_key();
61 
62  GlobalSettingStation &global_setting_station_ =
64  std::filesystem::path app_secure_path_ =
65  global_setting_station_.GetAppConfigPath() /
66  "secure";
67  std::filesystem::path app_secure_key_path_ =
68  app_secure_path_ / "app.key";
69  std::filesystem::path app_data_objs_path_ =
70  global_setting_station_.GetAppDataPath() / "data_objs";
73 
74  std::random_device rd_;
75  std::mt19937 mt_ = std::mt19937(rd_());
76  QByteArray hash_key_;
77 };
78 
79 } // namespace GpgFrontend
80 
81 #endif // GPGFRONTEND_DATAOBJECTOPERATOR_H
Definition: DataObjectOperator.h:39
std::random_device rd_
Random device.
Definition: DataObjectOperator.h:74
QByteArray hash_key_
Hash key.
Definition: DataObjectOperator.h:76
Definition: GlobalSettingStation.h:43
Definition: GpgFunctionObject.h:148
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:232
static GlobalSettingStation & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:170
Definition: CoreCommonUtil.cpp:29