@@ -0,0 +1,3447 @@
+import com.google.gson.Gson;%0Aimport com.google.gson.GsonBuilder;%0Aimport com.vitaxa.steamauth.AuthenticatorLinker;%0Aimport com.vitaxa.steamauth.Confirmation;%0Aimport com.vitaxa.steamauth.UserLogin;%0Aimport org.junit.Test;%0A%0Aimport java.io.*;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.OpenOption;%0Aimport java.nio.file.Paths;%0Aimport java.nio.file.StandardOpenOption;%0A%0Apublic class TestAuth %7B%0A    @Test%0A    public void testShit() %7B%0A        while(true) %7B%0A            System.out.println(%22Enter user/password: %22);%0A            String username = readLine();%0A            String password = readLine();%0A            UserLogin login = new UserLogin(username, password);%0A            UserLogin.LoginResult response = UserLogin.LoginResult.BAD_CREDENTIALS;%0A            while ((response = login.doLogin()) != UserLogin.LoginResult.LOGIN_OKAY) %7B%0A                switch (response) %7B%0A                    case NEED_EMAIL:%0A                        System.out.println(%22Please enter your email code: %22);%0A                        String code = readLine();%0A                        login.emailCode = code;%0A                        break;%0A                    case NEED_CAPTCHA:%0A                        System.out.println(%22Please enter captcha text: %22);%0A                        String captchaText = readLine();%0A                        login.captchaText = captchaText;%0A                        break;%0A                    case NEED_2FA:%0A                        System.out.println(%22Please enter your mobile authenticator code: %22);%0A                        code = readLine();%0A                        login.twoFactorCode = code;%0A                        break;%0A                %7D%0A            %7D%0A            AuthenticatorLinker linker = new AuthenticatorLinker(login.session);%0A            linker.setPhoneNumber(null); //Set this to non-null to add a new phone number to the account.%0A            AuthenticatorLinker.LinkResult result = linker.addAuthenticator();%0A%0A            if (result != AuthenticatorLinker.LinkResult.AWAITING_FINALIZATION) %7B%0A                System.out.println(%22Failed to add authenticator: %22 + result);%0A                continue;%0A            %7D%0A%0A            try %7B%0A                String sgFile = new Gson().toJson(linker.getLinkedAccount());%0A                String fileName = linker.getLinkedAccount().getAccountName() + %22.maFile%22;%0A                OpenOption%5B%5D WRITE_OPTIONS = %7B StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING %7D;%0A                Files.write(Paths.get(fileName), sgFile.getBytes(), WRITE_OPTIONS);%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A                System.out.println(%22EXCEPTION saving maFile. For security, authenticator will not be finalized.%22);%0A                continue;%0A            %7D%0A%0A            System.out.println(%22Please enter SMS code: %22);%0A            String smsCode = readLine();%0A            AuthenticatorLinker.FinalizeResult linkResult = linker.finalizeAddAuthenticator(smsCode);%0A%0A            if (linkResult != AuthenticatorLinker.FinalizeResult.SUCCESS) %7B%0A                System.out.println(%22Unable to finalize authenticator: %22 + linkResult);%0A            %7D%0A%0A        %7D%0A    %7D%0A%0A    private static String readLine() %7B%0A        String s = %22%22;%0A        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) %7B%0A            s = br.readLine();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A        return s;%0A    %7D%0A%0A%7D%0A

Test class added