From fdda56c95ae249c90b47c1a060d081db66a730da Mon Sep 17 00:00:00 2001 From: Walker Thompson Date: Thu, 18 Dec 2025 23:13:27 +0000 Subject: Initial commit --- totpgen.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 totpgen.h (limited to 'totpgen.h') 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +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 -- cgit v1.3