From 812a4ed24aad63564e41a1ae7c26d8643f3e2422 Mon Sep 17 00:00:00 2001 From: allyans3 Date: Wed, 21 Jun 2023 14:42:09 +0200 Subject: [PATCH] Added loginMobile() and getDataForPlatformType() methods --- README.md | 11 +- src/SteamAuth.php | 339 +++++++++----------------------- src/Traits/SteamAuthMethods.php | 232 ++++++++++++++++++++++ src/Traits/UsefulMethods.php | 106 ++++++++++ 4 files changed, 440 insertions(+), 248 deletions(-) create mode 100644 src/Traits/SteamAuthMethods.php diff --git a/README.md b/README.md index b3303a7..f259f46 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,10 @@ require "vendor/autoload.php"; $auth = new SteamAuth('login', 'password', 'shared_secret'); +// For WebBrowser $auth->login(); +// or for MobileApp +$auth->loginMobile(); // You can check if you are authorized $auth->isAuthorized(); @@ -60,6 +63,9 @@ $auth->getCookies(); // or by host $auth->getCookiesByHost(); +// Getting data for platform type +$auth->getDataForPlatformType(1) // 1 => Steam Client, 2 => Web Browser, 3 => Mobile App + ``` ## Cookie storage @@ -96,7 +102,10 @@ $cookieOptions = [ "sessionid" => "*******", "steamCountry" => "*******", "steamLoginSecure" => "*******" - ] + ], + "checkout.steampowered.com" => [ + "steamLoginSecure" => "*******" + ] ] ]; diff --git a/src/SteamAuth.php b/src/SteamAuth.php index 7f3c4b0..01510cd 100644 --- a/src/SteamAuth.php +++ b/src/SteamAuth.php @@ -8,26 +8,19 @@ use Exception; use SteamAuth\Configs\SteamConfig; use SteamAuth\Exceptions\SteamErrorException; -use SteamAuth\pb2\CAuthentication_BeginAuthSessionViaCredentials_Request; -use SteamAuth\pb2\CAuthentication_BeginAuthSessionViaCredentials_Response; -use SteamAuth\pb2\CAuthentication_GetPasswordRSAPublicKey_Request; -use SteamAuth\pb2\CAuthentication_GetPasswordRSAPublicKey_Response; -use SteamAuth\pb2\CAuthentication_PollAuthSessionStatus_Request; -use SteamAuth\pb2\CAuthentication_PollAuthSessionStatus_Response; -use SteamAuth\pb2\CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request; use SteamAuth\pb2\EAuthSessionGuardType; use SteamAuth\pb2\EAuthTokenPlatformType; -use SteamAuth\pb2\ESessionPersistence; use SteamAuth\RSA\Crypt\Crypt_RSA; use SteamAuth\RSA\Math\MathBigInteger; use SteamAuth\Exceptions\SteamResponseException; use SteamAuth\Traits\CookieMethods; +use SteamAuth\Traits\SteamAuthMethods; use SteamAuth\Traits\UsefulMethods; use SteamTotp\SteamTotp; class SteamAuth { - use CookieMethods, UsefulMethods; + use CookieMethods, UsefulMethods, SteamAuthMethods; private $login; private $password; @@ -41,18 +34,14 @@ class SteamAuth private $refreshToken = null; private $clientId = -1; - const HEADERS = [ - 'Origin' => "https://steamcommunity.com", - 'Referer' => "https://steamcommunity.com/" - ]; - const MAIN_HOST = "steamcommunity.com"; const DOMAINS = [ "https://steamcommunity.com", "https://store.steampowered.com", "https://help.steampowered.com", - "https://steam.tv" + "https://steam.tv", + "https://checkout.steampowered.com", ]; @@ -65,6 +54,54 @@ public function __construct($login, $password, $sharedSecret = null, array $cook self::setCookieOptions($cookieOptions); } + /** + * @return int + */ + public function getSteamID() + { + return $this->steamID; + } + + /** + * @return mixed + */ + public function getAccountName() + { + return $this->login; + } + + /** + * @return mixed + */ + public function getSharedSecret() + { + return $this->sharedSecret; + } + + /** + * @return null + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * @return null + */ + public function getRefreshToken() + { + return $this->refreshToken; + } + + /** + * @return int + */ + public function getClientId() + { + return $this->clientId; + } + private function setCookieOptions(array $options) { $this->cookieStorage = isset($options['cookie_storage']) ? $options['cookie_storage'] : $this->cookieStorage; @@ -72,9 +109,10 @@ private function setCookieOptions(array $options) } /** + * @param string|null $code * @return bool - * @throws SteamResponseException * @throws SteamErrorException + * @throws SteamResponseException */ public function login(string $code = null): bool { @@ -86,7 +124,7 @@ public function login(string $code = null): bool $keys = self::getRSAKey(); $encryptedPassword = self::encryptPassword($keys); - $authSession = self::beginAuthSession($encryptedPassword, $keys->getTimestamp()); + $authSession = self::beginAuthSession($encryptedPassword, $keys->getTimestamp(), EAuthTokenPlatformType::k_EAuthTokenPlatformType_WebBrowser); if ($authSession->getAllowedConfirmations()) { if (self::isTwoFactorRequired($authSession->getAllowedConfirmations()[0])) { @@ -119,37 +157,54 @@ public function login(string $code = null): bool } /** - * @return CAuthentication_GetPasswordRSAPublicKey_Response - * @throws SteamResponseException + * @param string|null $code + * @return bool|void * @throws SteamErrorException + * @throws SteamResponseException */ - private function getRSAKey(): CAuthentication_GetPasswordRSAPublicKey_Response + public function loginMobile(string $code = null) { - $curl = new Curl();; -// $curl->setHeaders(self::HEADERS); + if (self::isAuthorized()) + return true; + else if (!array_key_exists('sessionid', self::getCookiesByHost())) + self::getStartupCookies(); - $message = new CAuthentication_GetPasswordRSAPublicKey_Request(); - $message->setAccountName($this->login); + $keys = self::getRSAKey(); + $encryptedPassword = self::encryptPassword($keys); - $curl->get('https://api.steampowered.com/IAuthenticationService/GetPasswordRSAPublicKey/v1', - [ - 'origin' => 'https://steamcommunity.com', - 'input_protobuf_encoded' => base64_encode($message->serializeToString()) - ] - ); + $authSession = self::beginAuthSession($encryptedPassword, $keys->getTimestamp(), EAuthTokenPlatformType::k_EAuthTokenPlatformType_MobileApp); - $rsaResponse = new CAuthentication_GetPasswordRSAPublicKey_Response(); + if ($authSession->getAllowedConfirmations()) { + if (self::isTwoFactorRequired($authSession->getAllowedConfirmations()[0])) { + $twoFactorCode = $code ?? SteamTotp::getAuthCode($this->sharedSecret); - if (!$curl->error) - $rsaResponse->parseFromString($curl->response); - else - throw new SteamResponseException($curl->errorMessage); + self::updateAuthSession($authSession->getClientId(), $authSession->getSteamid(), $twoFactorCode, + EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceCode); + } + } + + $session = self::pollAuthSessionStatus($authSession->getClientId(), $authSession->getRequestId()); + + $tokens = self::finalizeLogin($session->getRefreshToken(), self::getCookiesByHost()['sessionid']); + + foreach ($tokens['transfer_info'] as $token) { + self::setToken($token['url'], $token['params']['nonce'], $token['params']['auth'], $authSession->getSteamid()); + } + + foreach (self::DOMAINS as $domain) { + self::getAdditionalCookies($domain); + } - self::checkSteamError($curl->responseHeaders['x-eresult']); + $this->steamID = $authSession->getSteamid(); + $this->login = $session->getAccountName(); + $this->accessToken = $session->getAccessToken(); + $this->refreshToken = $session->getRefreshToken(); + $this->clientId = $session->getNewClientId(); - return $rsaResponse; + return true; } + /** * @param $keys * @return string @@ -170,47 +225,6 @@ private function encryptPassword($keys): string return base64_encode($rsa->encrypt($this->password)); } - /** - * @param $encryptedPassword - * @param $rsaTimestamp - * @return CAuthentication_BeginAuthSessionViaCredentials_Response - * @throws SteamResponseException - * @throws SteamErrorException - */ - private function beginAuthSession($encryptedPassword, $rsaTimestamp): CAuthentication_BeginAuthSessionViaCredentials_Response - { - $curl = new Curl(); -// $curl->setHeaders(self::HEADERS); - - $message = new CAuthentication_BeginAuthSessionViaCredentials_Request(); - - $message->setAccountName($this->login); - $message->setEncryptedPassword($encryptedPassword); - $message->setEncryptionTimestamp($rsaTimestamp); - $message->setRememberLogin(true); - $message->setPlatformType(EAuthTokenPlatformType::k_EAuthTokenPlatformType_WebBrowser); - $message->setWebsiteId('Community'); - $message->setPersistence(ESessionPersistence::k_ESessionPersistence_Persistent); - $message->setDeviceFriendlyName('Mozilla/5.0 (X11; Linux x86_64; rv:1.9.5.20) Gecko/2812-12-10 04:56:28 Firefox/3.8'); - - $curl->post('https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1', - [ - 'input_protobuf_encoded' => base64_encode($message->serializeToString()) - ] - ); - - $sessionResponse = new CAuthentication_BeginAuthSessionViaCredentials_Response(); - - if (!$curl->error) - $sessionResponse->parseFromString($curl->response); - else - throw new SteamResponseException($curl->errorMessage); - - self::checkSteamError($curl->responseHeaders['x-eresult']); - - return $sessionResponse; - } - /** * @param $confirmation * @return bool @@ -220,72 +234,6 @@ private function isTwoFactorRequired($confirmation): bool return $confirmation->getConfirmationType() == EAuthSessionGuardType::k_EAuthSessionGuardType_DeviceCode; } - /** - * @param $clientId - * @param $steamId - * @param $twoFactoryCode - * @param $codeType - * @throws SteamResponseException - * @throws SteamErrorException - */ - private function updateAuthSession($clientId, $steamId, $twoFactoryCode, $codeType) - { - $curl = new Curl(); -// $curl->setHeaders(self::HEADERS); - - $message = new CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request(); - - $message->setClientId($clientId); - $message->setSteamid($steamId); - $message->setCode($twoFactoryCode); - $message->setCodeType($codeType); - - $curl->post('https://api.steampowered.com/IAuthenticationService/UpdateAuthSessionWithSteamGuardCode/v1', - [ - 'input_protobuf_encoded' => base64_encode($message->serializeToString()) - ] - ); - - if ($curl->error) - throw new SteamResponseException($curl->errorMessage); - - self::checkSteamError($curl->responseHeaders['x-eresult']); - } - - /** - * @param $clientId - * @param $requestId - * @return CAuthentication_PollAuthSessionStatus_Response - * @throws SteamResponseException - * @throws SteamErrorException - */ - private function pollAuthSessionStatus($clientId, $requestId): CAuthentication_PollAuthSessionStatus_Response - { - $curl = new Curl(); - - $message = new CAuthentication_PollAuthSessionStatus_Request(); - - $message->setClientId($clientId); - $message->setRequestId($requestId); - - $curl->post('https://api.steampowered.com/IAuthenticationService/PollAuthSessionStatus/v1', - [ - 'input_protobuf_encoded' => base64_encode($message->serializeToString()) - ] - ); - - $pollAuthResponse = new CAuthentication_PollAuthSessionStatus_Response(); - - if (!$curl->error) - $pollAuthResponse->parseFromString($curl->response); - else - throw new SteamResponseException($curl->errorMessage); - - self::checkSteamError($curl->responseHeaders['x-eresult']); - - return $pollAuthResponse; - } - /** * @throws SteamResponseException */ @@ -306,68 +254,6 @@ public function getStartupCookies() self::updateCookieStorage($curl->responseCookies); } - /** - * @param $refreshToken - * @param $sessionId - * @return array - * @throws SteamResponseException - * @throws SteamErrorException - */ - private function finalizeLogin($refreshToken, $sessionId): array - { - $curl = new Curl(); - $curl->setDefaultJsonDecoder($assoc = true); - $curl->setConnectTimeout(30); - $curl->setTimeout(60); - - $curl->post('https://login.steampowered.com/jwt/finalizelogin', - [ - 'nonce' => $refreshToken, - 'sessionid' => $sessionId, - 'redir' => 'https://steamcommunity.com/login/home/?goto=' - ] - ); - - if ($curl->error) - throw new SteamResponseException($curl->errorMessage); - - self::checkSteamError($curl->responseHeaders['x-eresult']); - - return $curl->response; - } - - /** - * @param string $url - * @param string $nonce - * @param $auth - * @param $steamId - * @throws SteamResponseException - */ - private function setToken(string $url, string $nonce, $auth, $steamId) - { - $curl = new Curl(); - $curl->setDefaultJsonDecoder($assoc = true); - $curl->setConnectTimeout(30); - $curl->setTimeout(60); - - $curl->setCookies(self::getCookiesByHost(self::getHostFromUrl($url))); - $curl->setCookieFile($this->cookieFile); - $curl->setCookieJar($this->cookieFile); - - $curl->post($url, - [ - 'nonce' => $nonce, - 'auth' => $auth, - 'steamID' => $steamId - ] - ); - - if ($curl->error) - throw new SteamResponseException($curl->errorMessage); - - self::updateCookieStorage($curl->responseCookies, self::getHostFromUrl($url)); - } - /** * @return null * @throws SteamResponseException @@ -413,47 +299,6 @@ private function getAdditionalCookies($url) self::updateCookieStorage($curl->responseCookies, self::getHostFromUrl($url)); } - public function getSteamID() - { - return $this->steamID; - } - - public function getAccountName() - { - return $this->login; - } - - /** - * @return mixed|null - */ - public function getSharedSecret(): mixed - { - return $this->sharedSecret; - } - - /** - * @return null - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * @return null - */ - public function getRefreshToken() - { - return $this->refreshToken; - } - - /** - * @return int - */ - public function getClientId(): int - { - return $this->clientId; - } /** * @param string $url diff --git a/src/Traits/SteamAuthMethods.php b/src/Traits/SteamAuthMethods.php new file mode 100644 index 0000000..2b792a2 --- /dev/null +++ b/src/Traits/SteamAuthMethods.php @@ -0,0 +1,232 @@ +setAccountName($this->login); + + $curl->get('https://api.steampowered.com/IAuthenticationService/GetPasswordRSAPublicKey/v1', + [ + 'origin' => 'https://steamcommunity.com', + 'input_protobuf_encoded' => base64_encode($message->serializeToString()) + ] + ); + + $rsaResponse = new CAuthentication_GetPasswordRSAPublicKey_Response(); + + if (!$curl->error) + $rsaResponse->parseFromString($curl->response); + else + throw new SteamResponseException($curl->errorMessage); + + self::checkSteamError($curl->responseHeaders['x-eresult']); + + return $rsaResponse; + } + + /** + * @param $encryptedPassword + * @param $rsaTimestamp + * @param $platformType + * @return CAuthentication_BeginAuthSessionViaCredentials_Response + * @throws SteamErrorException + * @throws SteamResponseException + */ + private function beginAuthSession($encryptedPassword, $rsaTimestamp, $platformType): CAuthentication_BeginAuthSessionViaCredentials_Response + { + $curl = new Curl(); + + $message = new CAuthentication_BeginAuthSessionViaCredentials_Request(); + + $dataForPlatformType = self::getDataForPlatformType($platformType); + + $message->setDeviceFriendlyName($dataForPlatformType['device_details']['device_friendly_name']); + $message->setAccountName($this->login); + $message->setEncryptedPassword($encryptedPassword); + $message->setEncryptionTimestamp($rsaTimestamp); + $message->setRememberLogin(true); + $message->setPlatformType($platformType); + $message->setPersistence(ESessionPersistence::k_ESessionPersistence_Persistent); + $message->setWebsiteId($dataForPlatformType['website_id']); + + $deviceDetails = new CAuthentication_DeviceDetails(); + $deviceDetails->setDeviceFriendlyName($dataForPlatformType['device_details']['device_friendly_name']); + $deviceDetails->setPlatformType($dataForPlatformType['device_details']['platform_type']); + $deviceDetails->setOsType($dataForPlatformType['device_details']['os_type']); + + if (array_key_exists('gaming_device_type', $dataForPlatformType['device_details'])) + $deviceDetails->setGamingDeviceType($dataForPlatformType['device_details']['gaming_device_type']); + + $message->setDeviceDetails($deviceDetails); + + $curl->post('https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1', + [ + 'input_protobuf_encoded' => base64_encode($message->serializeToString()) + ] + ); + + $sessionResponse = new CAuthentication_BeginAuthSessionViaCredentials_Response(); + + if (!$curl->error) + $sessionResponse->parseFromString($curl->response); + else + throw new SteamResponseException($curl->errorMessage); + + self::checkSteamError($curl->responseHeaders['x-eresult']); + + return $sessionResponse; + } + + /** + * @param $clientId + * @param $steamId + * @param $twoFactoryCode + * @param $codeType + * @throws SteamResponseException + * @throws SteamErrorException + */ + private function updateAuthSession($clientId, $steamId, $twoFactoryCode, $codeType) + { + $curl = new Curl(); + + $message = new CAuthentication_UpdateAuthSessionWithSteamGuardCode_Request(); + + $message->setClientId($clientId); + $message->setSteamid($steamId); + $message->setCode($twoFactoryCode); + $message->setCodeType($codeType); + + $curl->post('https://api.steampowered.com/IAuthenticationService/UpdateAuthSessionWithSteamGuardCode/v1', + [ + 'input_protobuf_encoded' => base64_encode($message->serializeToString()) + ] + ); + + if ($curl->error) + throw new SteamResponseException($curl->errorMessage); + + self::checkSteamError($curl->responseHeaders['x-eresult']); + } + + /** + * @param $clientId + * @param $requestId + * @return CAuthentication_PollAuthSessionStatus_Response + * @throws SteamResponseException + * @throws SteamErrorException + */ + private function pollAuthSessionStatus($clientId, $requestId): CAuthentication_PollAuthSessionStatus_Response + { + $curl = new Curl(); + + $message = new CAuthentication_PollAuthSessionStatus_Request(); + + $message->setClientId($clientId); + $message->setRequestId($requestId); + + $curl->post('https://api.steampowered.com/IAuthenticationService/PollAuthSessionStatus/v1', + [ + 'input_protobuf_encoded' => base64_encode($message->serializeToString()) + ] + ); + + $pollAuthResponse = new CAuthentication_PollAuthSessionStatus_Response(); + + if (!$curl->error) + $pollAuthResponse->parseFromString($curl->response); + else + throw new SteamResponseException($curl->errorMessage); + + self::checkSteamError($curl->responseHeaders['x-eresult']); + + return $pollAuthResponse; + } + + /** + * @param $refreshToken + * @param $sessionId + * @return array + * @throws SteamResponseException + * @throws SteamErrorException + */ + private function finalizeLogin($refreshToken, $sessionId): array + { + $curl = new Curl(); + $curl->setDefaultJsonDecoder($assoc = true); + $curl->setConnectTimeout(30); + $curl->setTimeout(60); + + $curl->post('https://login.steampowered.com/jwt/finalizelogin', + [ + 'nonce' => $refreshToken, + 'sessionid' => $sessionId, + 'redir' => 'https://steamcommunity.com/login/home/?goto=' + ] + ); + + if ($curl->error) + throw new SteamResponseException($curl->errorMessage); + + self::checkSteamError($curl->responseHeaders['x-eresult']); + + return $curl->response; + } + + /** + * @param string $url + * @param string $nonce + * @param $auth + * @param $steamId + * @throws SteamResponseException + */ + private function setToken(string $url, string $nonce, $auth, $steamId) + { + $curl = new Curl(); + $curl->setDefaultJsonDecoder($assoc = true); + $curl->setConnectTimeout(30); + $curl->setTimeout(60); + + $curl->setCookies(self::getCookiesByHost(self::getHostFromUrl($url))); + $curl->setCookieFile($this->cookieFile); + $curl->setCookieJar($this->cookieFile); + + $curl->post($url, + [ + 'nonce' => $nonce, + 'auth' => $auth, + 'steamID' => $steamId + ] + ); + + if ($curl->error) + throw new SteamResponseException($curl->errorMessage); + + self::updateCookieStorage($curl->responseCookies, self::getHostFromUrl($url)); + } +} \ No newline at end of file diff --git a/src/Traits/UsefulMethods.php b/src/Traits/UsefulMethods.php index ce68a3d..15a1014 100644 --- a/src/Traits/UsefulMethods.php +++ b/src/Traits/UsefulMethods.php @@ -3,10 +3,116 @@ namespace SteamAuth\Traits; use Ramsey\Uuid\Uuid; +use SteamAuth\Exceptions\SteamErrorException; +use SteamAuth\pb2\EAuthTokenPlatformType; use SteamTotp\SteamTotp; trait UsefulMethods { + /** + * @param $platformType + * @return array + * @throws SteamErrorException + */ + public function getDataForPlatformType($platformType): array + { + $steamClientUserAgent = 'Mozilla/5.0 (Windows; U; Windows NT 10.0; en-US; Valve Steam Client/default/1665786434; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'; + $chromeUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'; + $mobileUserAgent = 'Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv; Valve Steam App) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36'; + + switch ($platformType) { + case EAuthTokenPlatformType::k_EAuthTokenPlatformType_SteamClient: + $refererQuery = [ + 'IN_CLIENT' => 'true', + 'WEBSITE_ID'=> 'Client', + 'LOCAL_HOSTNAME'=> self::getSpoofedHostname(), + 'WEBAPI_BASE_URL'=> 'https://api.steampowered.com/', + 'STORE_BASE_URL'=> 'https://store.steampowered.com/', + 'USE_POPUPS'=> 'true', + 'DEV_MODE'=> 'false', + 'LANGUAGE'=> 'english', + 'PLATFORM'=> 'windows', + 'COUNTRY'=> 'US', + 'LAUNCHER_TYPE'=> '0', + 'IN_LOGIN'=> 'true' + ]; + + return [ + 'website_id' => 'Client', + 'headers' => [ + 'user-agent' => $steamClientUserAgent, + 'origin' => 'https://steamloopback.host', + 'referer' => 'https://steamloopback.host/index.html?' . http_build_query($refererQuery) + ], + 'device_details' => [ + 'device_friendly_name' => $refererQuery['LOCAL_HOSTNAME'], + 'platform_type' => EAuthTokenPlatformType::k_EAuthTokenPlatformType_SteamClient, + 'os_type' => 16, // Windows 10 + // EGamingDeviceType full definition is unknown, but 1 appears to be a desktop PC + 'gaming_device_type' => 1 + ] + ]; + case EAuthTokenPlatformType::k_EAuthTokenPlatformType_WebBrowser: + return [ + 'website_id' => 'Community', + 'headers' => [ + 'user-agent' => $chromeUserAgent, + 'origin' => 'https://steamcommunity.com', + 'referer' => 'https://steamcommunity.com', + ], + 'device_details' => [ + 'device_friendly_name' => $chromeUserAgent, + 'platform_type' => EAuthTokenPlatformType::k_EAuthTokenPlatformType_WebBrowser, + 'os_type' => -1 + ] + ]; + case EAuthTokenPlatformType::k_EAuthTokenPlatformType_MobileApp: + return [ + 'website_id' => 'Mobile', + 'headers' => [ + 'user-agent' => $mobileUserAgent, + 'cookie' => [ + 'steamLoginSecure' => '', + 'sessionid' => '', + 'mobileClient' => 'android', + 'mobileClientVersion' => '777777 3.6.1', + 'Steam_Language' => 'english' + ] + ], + 'device_details' => [ + 'device_friendly_name' => 'Galaxy S22', + 'platform_type' => EAuthTokenPlatformType::k_EAuthTokenPlatformType_MobileApp, + 'os_type' => -500, + 'gaming_device_type' => 528 // dunno + ] + ]; + default: + throw new SteamErrorException("Unsupported platform type"); + } + } + + /** + * @return string + */ + public function getSpoofedHostname(): string + { + $sha1 = array_map(function($x){ return ord($x); }, str_split(sha1(gethostname()))); + + define("SteamAuth\Traits\CHARS", 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); + + $output = 'DESKTOP-'; + + for ($i = 0; $i < 7; $i++) { + $output .= CHARS[$sha1[$i] % strlen(CHARS)]; + } + + return $output; + } + + + + + // Get parameters for Mobile Methods /**