diff options
| author | Walker Thompson <walker.thompson@urz.uni-heidelberg.de> | 2026-06-10 02:33:22 +0200 |
|---|---|---|
| committer | Walker Thompson <walker.thompson@urz.uni-heidelberg.de> | 2026-06-10 02:33:22 +0200 |
| commit | e26c95df4413562ccfb7464a5c90539fab8bd18a (patch) | |
| tree | 00b1e12c1c81f98b7feb3106cb9f1b0958108909 /totpgen.h | |
| parent | f64aeefd863ebcc20b39f432c99e9d8bb961aa47 (diff) | |
Diffstat (limited to 'totpgen.h')
| -rw-r--r-- | totpgen.h | 58 |
1 files changed, 34 insertions, 24 deletions
@@ -18,6 +18,9 @@ #include <wx/regex.h> #include <wx/font.h> +#include <nlohmann/json.hpp> +using json = nlohmann::json; + static const std::string base32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; class TOTPGenGUI : public wxApp { @@ -33,15 +36,30 @@ class TOTPGen : public wxFrame { wxPanel *MainWindow; wxBoxSizer *MainSizer; + wxBoxSizer *SelectSizer; + wxBoxSizer *TextSizer; + wxBoxSizer *ButtonSizer_Upper; + wxBoxSizer *ButtonSizer_Middle; wxBoxSizer *ButtonSizer_Lower; - wxButton *UpdateSecretButton; - void UpdateSecret(wxCommandEvent& event); + wxComboBox *SecretChooser; + void ReloadSelections(void); + void SelectSecret(wxCommandEvent& event); - bool Locked; - wxButton *UnlockButton; - void Unlock(wxCommandEvent& event); + wxStaticText *TOTPField; + void ResizeTextToFit(wxStaticText *text_field); + + wxTimer *CountdownTimer; + wxGauge *CountdownGauge; + void UpdateStatus(wxTimerEvent& event); + + wxButton *AddButton; + void AddSecret(wxCommandEvent& event); + bool IsBase32(std::string& str); + + wxButton *DeleteButton; + void DeleteSecret(wxCommandEvent& event); wxButton *CopyButton; void CopyText(wxCommandEvent& event); @@ -49,30 +67,22 @@ class TOTPGen : public wxFrame { wxButton *QuitButton; void OnExit(wxCommandEvent& event); - wxBoxSizer *TextSizer; - wxStaticText *TOTPField; - void ResizeTextToFit(wxStaticText *text_field); - - wxString SecretFile; + std::string Passphrase; + wxButton *SecurityButton; + void InitDB(wxCommandEvent& event); + void SetPassword(wxCommandEvent& event); + void Unlock(wxCommandEvent& event); + json KeyDB; + wxString SecretDB_File; void InitAES(const char *passphrase, unsigned char *salt, unsigned char *key, unsigned char *iv); - - wxTimer *CountdownTimer; - wxGauge *CountdownGauge; - void UpdateStatus(wxTimerEvent& event); + bool DecryptDB(void); + bool EncryptDB(const std::string& secret_str); std::string Secret; - std::string Passphrase; - - bool IsBase32(std::string& str); - - bool DecryptSecret(void); - bool EncryptSecret(std::string& secret_str); - std::string TOTP; - - bool GenTOTP(std::string& secret_str); -};
\ No newline at end of file + bool GenTOTP(const std::string& secret_str); +}; |
