From d95ceb0fc9b3b8e766b4e64e329fa8ea86b6a73b Mon Sep 17 00:00:00 2001 From: a Date: Sat, 19 Aug 2023 23:38:33 +0300 Subject: [PATCH] impl for GetAuthTicketForWebApi --- dll/base.cpp | 17 +++++++++++++++++ dll/base.h | 1 + dll/steam_user.h | 6 ++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dll/base.cpp b/dll/base.cpp index 5a37ab04..c69001c2 100644 --- a/dll/base.cpp +++ b/dll/base.cpp @@ -387,6 +387,23 @@ uint32 Auth_Ticket_Manager::getTicket( void *pTicket, int cbMaxTicket, uint32 *p return ttt; } +uint32 Auth_Ticket_Manager::getWebApiTicket( const char* pchIdentity ) +{ + // https://docs.unity.com/ugs/en-us/manual/authentication/manual/platform-signin-steam + GetTicketForWebApiResponse_t data{}; + uint32 cbTicket = 0; + Auth_Ticket_Data ticket_data = getTicketData(data.m_rgubTicket, STEAM_AUTH_TICKET_SIZE, &cbTicket); + data.m_cubTicket = (int)cbTicket; + uint32 ttt = ticket_data.number; + data.m_hAuthTicket = ttt; + data.m_eResult = k_EResultOK; + callbacks->addCBResult(data.k_iCallback, &data, sizeof(data), STEAM_TICKET_PROCESS_TIME); + + outbound.push_back(ticket_data); + + return ttt; +} + CSteamID Auth_Ticket_Manager::fakeUser() { Auth_Ticket_Data data = {}; diff --git a/dll/base.h b/dll/base.h index fe59cba3..6a2bb6ba 100644 --- a/dll/base.h +++ b/dll/base.h @@ -413,6 +413,7 @@ public: void Callback(Common_Message *msg); uint32 getTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ); + uint32 getWebApiTicket( const char *pchIdentity ); void cancelTicket(uint32 number); EBeginAuthSessionResult beginAuth(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID); bool endAuth(CSteamID id); diff --git a/dll/steam_user.h b/dll/steam_user.h index 0f21124f..07c93e2f 100644 --- a/dll/steam_user.h +++ b/dll/steam_user.h @@ -319,8 +319,10 @@ HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTic // the ticket will be returned in callback GetTicketForWebApiResponse_t HAuthTicket GetAuthTicketForWebApi( const char *pchIdentity ) { - PRINT_DEBUG("TODO: Steam_User::GetAuthTicketForWebApi %s\n", pchIdentity); - return 0; + PRINT_DEBUG("Steam_User::GetAuthTicketForWebApi %s\n", pchIdentity); + std::lock_guard lock(global_mutex); + + return ticket_manager->getWebApiTicket(pchIdentity); } // Authenticate ticket from entity steamID to be sure it is valid and isnt reused