summaryrefslogtreecommitdiff
path: root/totpgen.h
diff options
context:
space:
mode:
Diffstat (limited to 'totpgen.h')
-rw-r--r--totpgen.h58
1 files changed, 34 insertions, 24 deletions
diff --git a/totpgen.h b/totpgen.h
index 8feee9a..e9283d8 100644
--- a/totpgen.h
+++ b/totpgen.h
@@ -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);
+};