summaryrefslogtreecommitdiff
path: root/totpgen.h
diff options
context:
space:
mode:
Diffstat (limited to 'totpgen.h')
-rw-r--r--totpgen.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/totpgen.h b/totpgen.h
new file mode 100644
index 0000000..f1a368d
--- /dev/null
+++ b/totpgen.h
@@ -0,0 +1,76 @@
+#include <iostream>
+#include <cstdio>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <cstdlib>
+#include <ctime>
+#include <cstring>
+#include <cctype>
+#include <unordered_set>
+
+#include <unistd.h>
+
+#include <wx/wx.h>
+#include <wx/stdpaths.h>
+#include <wx/dir.h>
+#include <wx/clipbrd.h>
+#include <wx/regex.h>
+
+static const std::string base32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+
+class TOTPGenGUI : public wxApp {
+ public:
+ virtual bool OnInit();
+};
+
+class TOTPGen : public wxFrame {
+ public:
+ TOTPGen();
+
+ private:
+ wxPanel *MainWindow;
+ wxBoxSizer *MainSizer;
+
+ wxBoxSizer *ButtonSizer_Upper;
+ wxBoxSizer *ButtonSizer_Lower;
+
+ wxButton *UpdateSecretButton;
+ void UpdateSecret(wxCommandEvent& event);
+
+ bool Locked;
+ wxButton *UnlockButton;
+ void Unlock(wxCommandEvent& event);
+
+ wxButton *CopyButton;
+ void CopyText(wxCommandEvent& event);
+
+ wxButton *QuitButton;
+ void OnExit(wxCommandEvent& event);
+
+ wxBoxSizer *TextSizer;
+ wxStaticText *TOTPField;
+
+ wxString SecretFile;
+
+ void InitAES(const char *passphrase,
+ unsigned char *salt,
+ unsigned char *key,
+ unsigned char *iv);
+
+ wxTimer *CountdownTimer;
+ wxGauge *CountdownGauge;
+ void UpdateStatus(wxTimerEvent& event);
+
+ 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