Example #1
0
        public void CreateGetRsaKeyDataTest()
        {
            List <KeyValuePair <string, string> > result =
                PostDataFactory.CreateGetRsaKeyData("usernameOfTheCoolUser");
            var usernameKeyValuePair =
                result.FirstOrDefault(e => e.Key == "username");

            Assert.Equal("username", usernameKeyValuePair.Key);
            Assert.Equal("usernameOfTheCoolUser", usernameKeyValuePair.Value);
        }
Example #2
0
        private void Transfer(DoLoginResponse doLoginResponse)
        {
            var content = PostDataFactory.CreateTransferData(doLoginResponse);

            _requestFactory.Create(HttpMethod.POST,
                                   Uris.HelpSteampoweredSecureBase,
                                   HelpSteampoweredEndpoints.TransferLogin,
                                   Accept.Html, HttpHeaderValues.AcceptLanguageTwo, true, true,
                                   true, false, true, content);
        }
Example #3
0
        private async Task <DoLoginResource> DoLogin(GetRsaKeyResource getRsaKeyResource, string password, string username, string twoFactorCode)
        {
            var encryptedPassword = Encrypter.Create(getRsaKeyResource, password);

            var content = PostDataFactory.CreateDoLoginData(username, encryptedPassword, getRsaKeyResource.Timestamp, twoFactorCode);

            var requestMessage  = new RequestMessage(HttpMethod.Post, _baseUrl + "login/dologin", body: content);
            var doLoginResource = await _jsonRequestParser.ExecuteAsType <DoLoginResource>(requestMessage);

            return(doLoginResource);
        }
Example #4
0
        public void CreateTransferDataTokenSecureTest()
        {
            List <KeyValuePair <string, string> >
            transferParametersKeyValuePairList =
                PostDataFactory.CreateTransferData(GetDoLoginResponse());
            var steamIdKeyValuePair =
                transferParametersKeyValuePairList.FirstOrDefault(
                    e => e.Key == "token_secure");

            Assert.Equal("token_secure", steamIdKeyValuePair.Key);
            Assert.Equal("O8W437FVTL29F9I31C6H48R0MBNAVIH5ILUMV4FW", steamIdKeyValuePair.Value);
        }
Example #5
0
        public void CreateTransferDataTokenTest()
        {
            List <KeyValuePair <string, string> >
            transferParametersKeyValuePairList =
                PostDataFactory.CreateTransferData(GetDoLoginResponse());
            var steamIdKeyValuePair =
                transferParametersKeyValuePairList.FirstOrDefault(
                    e => e.Key == "token");

            Assert.Equal("token", steamIdKeyValuePair.Key);
            Assert.Equal("7ACRVJ9F3D1ETEN9HKFPWSEXZ3X020KRBEZ6HDA7", steamIdKeyValuePair.Value);
        }
Example #6
0
        public void CreateTransferDataSteamIdTest()
        {
            List <KeyValuePair <string, string> >
            transferParametersKeyValuePairList =
                PostDataFactory.CreateTransferData(GetDoLoginResponse());
            var steamIdKeyValuePair =
                transferParametersKeyValuePairList.FirstOrDefault(
                    e => e.Key == "steamid");

            Assert.Equal("steamid", steamIdKeyValuePair.Key);
            Assert.Equal("76561198028630048", steamIdKeyValuePair.Value);
        }
Example #7
0
        public void CreateTransferDataRememberLoginTest()
        {
            List <KeyValuePair <string, string> >
            transferParametersKeyValuePairList =
                PostDataFactory.CreateTransferData(GetDoLoginResponse());
            var rememberLoginKeyValuePair =
                transferParametersKeyValuePairList.FirstOrDefault(
                    e => e.Key == "remember_login");

            Assert.Equal("remember_login", rememberLoginKeyValuePair.Key);
            Assert.True(bool.Parse(rememberLoginKeyValuePair.Value));
        }
Example #8
0
        public void CreateTransferDataAuthTest()
        {
            List <KeyValuePair <string, string> >
            transferParametersKeyValuePairList =
                PostDataFactory.CreateTransferData(GetDoLoginResponse());
            var authKeyValuePair =
                transferParametersKeyValuePairList.FirstOrDefault(
                    e => e.Key == "auth");

            Assert.Equal("auth", authKeyValuePair.Key);
            Assert.Equal("b9wr1irasauno6rjngp3z2cfwf3qk3an", authKeyValuePair.Value);
        }
Example #9
0
        private GetRsaKeyResponse GetRsaKey(string username)
        {
            var postContent = PostDataFactory.CreateGetRsaKeyData(username);
            GetRsaKeyResponse getRsaKeyResponse = null;

            var response = _requestFactory.Create(HttpMethod.POST,
                                                  Uris.SteamCommunitySecureBase,
                                                  SteamCommunityEndpoints.GetRsaKey, Accept.All,
                                                  HttpHeaderValues.AcceptLanguageOne, false, true, true, true,
                                                  false, postContent);
            string responseContent = response.Content.ReadAsStringAsync().Result;

            getRsaKeyResponse =
                JsonConvert.DeserializeObject <GetRsaKeyResponse>(responseContent);
            return(getRsaKeyResponse);
        }
Example #10
0
        private DoLoginResponse DoLogin(GetRsaKeyResponse getRsaKeyResponse,
                                        string username, string password, string sharedSecret)
        {
            DoLoginResponse doLoginResponse   = null;
            var             encryptedPassword = EncryptPasswordFactory.Create(getRsaKeyResponse, password);

            var content = PostDataFactory.CreateDoLoginData(username,
                                                            encryptedPassword, getRsaKeyResponse.Timestamp,
                                                            TwoFactorCodeFactory.Create(sharedSecret));

            var response = _requestFactory.Create(HttpMethod.POST,
                                                  Uris.SteamCommunitySecureBase,
                                                  SteamCommunityEndpoints.DoLogin, Accept.All,
                                                  HttpHeaderValues.AcceptLanguageOne, false, true, true, true,
                                                  false, content);

            string responseContent = response.Content.ReadAsStringAsync().Result;

            doLoginResponse =
                JsonConvert.DeserializeObject <DoLoginResponse>(responseContent);
            return(doLoginResponse);
        }
Example #11
0
 private async Task Transfer(DoLoginResource doLoginResource)
 {
     var content        = PostDataFactory.CreateTransferData(doLoginResource);
     var requestMessage = new RequestMessage(HttpMethod.Post, _baseUrl + "login/transfer", body: content);
     await _jsonRequestParser.ExecuteAsVoid(requestMessage);
 }
Example #12
0
 private List <KeyValuePair <string, string> > GetDoLoginData()
 {
     return(PostDataFactory.CreateDoLoginData("coolUsername01",
                                              "o7y4EHhhBs0AaAQtm6LfwdY0SOTcKz57cbqgzrZqSH74PqKOeZ5xDbSfgoqMkOlEUp4ppVNKKRapoGRKecrOtVgcPGhYLpxuw0zcwLjsYQVUYWkOWaVHBnMGJF3L0oghUJl4PEkK0loE5XCfJLhEK3Vg1u8lqrwDJEj16m4sSH4nRiWegcWtLMyZ3hob8xbLHYjORkEZdZI3YlDfrnthXDUQrxzMZPAlADM9UQxUs8CnVTX0igQSAvshkRIaVWAYnBJgBseLWIFCd6bPoMM7Hyngi0oUQhMcVwjjPsXS5axjbjGdwF6Y6gcH4pGbu8FRQ3Tnb4gPhUCZKsS1UOJWmd==",
                                              "464749950000", "6IPMI"));
 }