Skip to content

Commit d85b9a9

Browse files
Merge pull request #71 from Shxde1/main
Updated x64 to have 2fa with function chaning.
2 parents 2520a4e + aace44d commit d85b9a9

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

Diff for: x64/auth.hpp

+15-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace KeyAuth {
2222
void init();
2323
void check(bool check_paid = false);
2424
void log(std::string msg);
25-
void license(std::string key);
25+
void license(std::string key, std::string code = "");
2626
std::string var(std::string varid);
2727
std::string webhook(std::string id, std::string params, std::string body = "", std::string contenttype = "");
2828
void setvar(std::string var, std::string vardata);
@@ -31,7 +31,7 @@ namespace KeyAuth {
3131
void web_login();
3232
void button(std::string value);
3333
void upgrade(std::string username, std::string key);
34-
void login(std::string username, std::string password);
34+
void login(std::string username, std::string password, std::string code = "");
3535
std::vector<unsigned char> download(std::string fileid);
3636
void regstr(std::string username, std::string password, std::string key, std::string email = "");
3737
void chatget(std::string channel);
@@ -80,6 +80,19 @@ namespace KeyAuth {
8080
bool isPaid{};
8181
};
8282

83+
bool activate = false;
84+
class Tfa {
85+
public:
86+
std::string secret;
87+
std::string link;
88+
Tfa& handleInput(KeyAuth::api& apiInstance);
89+
private:
90+
void QrCode();
91+
};
92+
93+
Tfa& enable2fa(std::string code = "");
94+
Tfa& disable2fa(std::string code = "");
95+
8396
userdata user_data;
8497
appdata app_data;
8598
responsedata response;

Diff for: x64/library_x64.lib

554 KB
Binary file not shown.

Diff for: x64/main.cpp

+25-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <thread>
55
#include "utils.hpp"
66
#include "skStr.h"
7+
#include <iostream>
78
std::string tm_to_readable_time(tm ctx);
89
static std::time_t string_to_timet(std::string timestamp);
910
static std::tm timet_to_tm(time_t timestamp);
@@ -15,11 +16,12 @@ using namespace KeyAuth;
1516

1617
// copy and paste from https://keyauth.cc/app/ and replace these string variables
1718
// Please watch tutorial HERE https://www.youtube.com/watch?v=5x4YkTmFH-U
18-
std::string name = skCrypt("name").decrypt();
19-
std::string ownerid = skCrypt("ownerid").decrypt();
20-
std::string version = skCrypt("1.0").decrypt();
19+
std::string name = skCrypt("name").decrypt(); // App name
20+
std::string ownerid = skCrypt("ownerid").decrypt(); // Account ID
21+
std::string version = skCrypt("1.0").decrypt(); // Application version. Used for automatic downloads see video here https://www.youtube.com/watch?v=kW195PLCBKs
2122
std::string url = skCrypt("https://keyauth.win/api/1.3/").decrypt(); // change if using KeyAuth custom domains feature
22-
std::string path = skCrypt("").decrypt(); //optional, set a path if you're using the token validation setting
23+
std::string path = skCrypt("").decrypt(); // (OPTIONAL) see tutorial here https://www.youtube.com/watch?v=I9rxt821gMk&t=1s
24+
2325

2426
api KeyAuthApp(name, ownerid, version, url, path);
2527

@@ -72,9 +74,7 @@ int main()
7274
std::cout << skCrypt("\n\n [1] Login\n [2] Register\n [3] Upgrade\n [4] License key only\n\n Choose option: ");
7375

7476
int option;
75-
std::string username;
76-
std::string password;
77-
std::string key;
77+
std::string username, password, key, TfaCode;
7878

7979
std::cin >> option;
8080
switch (option)
@@ -84,7 +84,9 @@ int main()
8484
std::cin >> username;
8585
std::cout << skCrypt("\n Enter password: ");
8686
std::cin >> password;
87-
KeyAuthApp.login(username, password);
87+
std::cout << skCrypt("\n Enter 2fa code if applicable: ");
88+
std::cin >> TfaCode;
89+
KeyAuthApp.login(username, password, TfaCode);
8890
break;
8991
case 2:
9092
std::cout << skCrypt("\n\n Enter username: ");
@@ -105,7 +107,9 @@ int main()
105107
case 4:
106108
std::cout << skCrypt("\n Enter license: ");
107109
std::cin >> key;
108-
KeyAuthApp.license(key);
110+
std::cout << skCrypt("\n Enter 2fa code if applicable: ");
111+
std::cin >> TfaCode;
112+
KeyAuthApp.license(key, TfaCode);
109113
break;
110114
default:
111115
std::cout << skCrypt("\n\n Status: Failure: Invalid Selection");
@@ -141,6 +145,14 @@ int main()
141145
// do NOT remove checkAuthenticated(), it MUST stay for security reasons
142146
std::thread check(sessionStatus); // do NOT remove this function either.
143147

148+
//enable 2FA
149+
// KeyAuthApp.enable2fa(); you will need to ask for the code
150+
//enable 2fa without the need of asking for the code
151+
//KeyAuthApp.enable2fa().handleInput(KeyAuthApp);
152+
153+
//disbale 2FA
154+
// KeyAuthApp.disable2fa();
155+
144156
if (KeyAuthApp.user_data.username.empty()) exit(10);
145157
std::cout << skCrypt("\n User data:");
146158
std::cout << skCrypt("\n Username: ") << KeyAuthApp.user_data.username;
@@ -156,6 +168,10 @@ int main()
156168
std::cout << skCrypt(" : expiry: ") << tm_to_readable_time(timet_to_tm(string_to_timet(sub.expiry)));
157169
}
158170

171+
172+
std::cout << skCrypt("\n\n Status: ") << KeyAuthApp.response.message;
173+
174+
159175
std::cout << skCrypt("\n\n Closing in five seconds...");
160176
Sleep(5000);
161177

0 commit comments

Comments
 (0)