diff options
| author | Walker Thompson <walker.thompson@urz.uni-heidelberg.de> | 2025-12-18 23:13:27 +0000 |
|---|---|---|
| committer | Walker Thompson <walker.thompson@urz.uni-heidelberg.de> | 2025-12-18 23:13:27 +0000 |
| commit | fdda56c95ae249c90b47c1a060d081db66a730da (patch) | |
| tree | 5320deba531b864f64d08883f97515b9d84850f0 /totpgen.h | |
Initial commit
Diffstat (limited to 'totpgen.h')
| -rw-r--r-- | totpgen.h | 76 |
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 |
