steamutils 1.5.43 → 1.5.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/steamproto.js CHANGED
@@ -1,58 +1,58 @@
1
- import path from "path";
2
- import { fileURLToPath } from "url";
3
- import Protobuf from "protobufjs";
4
- import gpf from "google-proto-files";
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- export class SteamProto {
10
- constructor(proto) {
11
- this._proto = proto;
12
- }
13
-
14
- toProto() {
15
- const localProto = path.join(`${__dirname}/protos/`, this._proto.filename);
16
-
17
- const descriptorPath = gpf.getProtoPath("protobuf/descriptor.proto");
18
-
19
- const root = new Protobuf.Root().loadSync([descriptorPath, localProto], {
20
- keepCase: true,
21
- });
22
- return root.lookupType(this._proto.name);
23
- }
24
-
25
- protoEncode(obj) {
26
- const protobuf = this.toProto();
27
- return protobuf.encode(protobuf.create(obj)).finish();
28
- }
29
-
30
- protoEncodeBase64(obj) {
31
- return this.protoEncode(obj).toString("base64");
32
- }
33
-
34
- protoDecode(obj) {
35
- if (isBase64(obj)) {
36
- obj = Buffer.from(obj, "base64");
37
- }
38
-
39
- const protobuf = this.toProto();
40
- try {
41
- return protobuf.toObject(protobuf.decode(obj), { defaults: true });
42
- } catch (e) {
43
- console.error(`[${this._proto.name}] protoDecode 1`, typeof obj, obj);
44
- console.error(`[${this._proto.name}] protoDecode 2`, e);
45
- return null;
46
- }
47
- }
48
- }
49
-
50
- function isBase64(str) {
51
- if (typeof str !== "string") return false;
52
- // remove whitespace and check
53
- str = str.trim();
54
- // base64 should only contain A-Z, a-z, 0-9, +, /, and possibly = at the end
55
- return /^[A-Za-z0-9+/]+={0,2}$/.test(str) && str.length % 4 === 0;
56
- }
57
-
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import Protobuf from "protobufjs";
4
+ import gpf from "google-proto-files";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ export class SteamProto {
10
+ constructor(proto) {
11
+ this._proto = proto;
12
+ }
13
+
14
+ toProto() {
15
+ const localProto = path.join(`${__dirname}/protos/`, this._proto.filename);
16
+
17
+ const descriptorPath = gpf.getProtoPath("protobuf/descriptor.proto");
18
+
19
+ const root = new Protobuf.Root().loadSync([descriptorPath, localProto], {
20
+ keepCase: true,
21
+ });
22
+ return root.lookupType(this._proto.name);
23
+ }
24
+
25
+ protoEncode(obj) {
26
+ const protobuf = this.toProto();
27
+ return protobuf.encode(protobuf.create(obj)).finish();
28
+ }
29
+
30
+ protoEncodeBase64(obj) {
31
+ return this.protoEncode(obj).toString("base64");
32
+ }
33
+
34
+ protoDecode(obj) {
35
+ if (isBase64(obj)) {
36
+ obj = Buffer.from(obj, "base64");
37
+ }
38
+
39
+ const protobuf = this.toProto();
40
+ try {
41
+ return protobuf.toObject(protobuf.decode(obj), { defaults: true });
42
+ } catch (e) {
43
+ console.error(`[${this._proto.name}] protoDecode 1`, typeof obj, obj);
44
+ console.error(`[${this._proto.name}] protoDecode 2`, e);
45
+ return null;
46
+ }
47
+ }
48
+ }
49
+
50
+ function isBase64(str) {
51
+ if (typeof str !== "string") return false;
52
+ // remove whitespace and check
53
+ str = str.trim();
54
+ // base64 should only contain A-Z, a-z, 0-9, +, /, and possibly = at the end
55
+ return /^[A-Za-z0-9+/]+={0,2}$/.test(str) && str.length % 4 === 0;
56
+ }
57
+
58
58
  export const SteamProtoType = {};export const ESteamProto = {};ESteamProto.ECsgoGCMsg = {"k_EMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate":9104,"k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello":9109,"k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello":9110,"k_EMsgGCCStrike15_v2_ClientReportPlayer":9119,"k_EMsgGCCStrike15_v2_ClientCommendPlayer":9121,"k_EMsgGCCStrike15_v2_ClientReportResponse":9122,"k_EMsgGCCStrike15_v2_ClientCommendPlayerQuery":9123,"k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse":9124,"k_EMsgGCCStrike15_v2_ClientRequestPlayersProfile":9127,"k_EMsgGCCStrike15_v2_PlayersProfile":9128,"k_EMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment":9132,"k_EMsgGCCStrike15_v2_GC2ClientTextMsg":9134,"k_EMsgGCCStrike15_v2_MatchList":9139,"k_EMsgGCCStrike15_v2_ClientRequestJoinFriendData":9163,"k_EMsgGCCStrike15_v2_AcknowledgePenalty":9171,"k_EMsgGCCStrike15_v2_GC2ClientGlobalStats":9173,"k_EMsgGCCStrike15_v2_ClientLogonFatalError":9187,"k_EMsgGCCStrike15_v2_ClientPollState":9188,"k_EMsgGCCStrike15_v2_Party_Register":9189,"k_EMsgGCCStrike15_v2_Party_Search":9191,"k_EMsgGCCStrike15_v2_Party_Invite":9192,"k_EMsgGCCStrike15_v2_Account_RequestCoPlays":9193,"k_EMsgGCCStrike15_v2_ClientGCRankUpdate":9194,"k_EMsgGCCStrike15_v2_GetEventFavorites_Response":9203,"k_EMsgGCCStrike15_ClientDeepStats":9210,"k_EMsgGCCStrike15_StartAgreementSessionInGame":9211,"k_EMsgGCCStrike15_v2_ClientNetworkConfig":9220};ESteamProto.EGCItemMsg = {"k_EMsgGCStoreGetUserData":2500,"k_EMsgGCStoreGetUserDataResponse":2501,"k_EMsgGCStorePurchaseFinalize":2504,"k_EMsgGCStorePurchaseFinalizeResponse":2505,"k_EMsgGCStorePurchaseCancel":2506,"k_EMsgGCStorePurchaseCancelResponse":2507,"k_EMsgGCStorePurchaseInit":2510,"k_EMsgGCStorePurchaseInitResponse":2511};ESteamProto.EMsg = {"k_EMsgClientChatInvite":800,"k_EMsgGCHInviteUserToLobby":2238,"k_EMsgClientRequestedClientStats":5480,"k_EMsgClientMMSCreateLobby":6601,"k_EMsgClientMMSCreateLobbyResponse":6602,"k_EMsgClientMMSJoinLobby":6603,"k_EMsgClientMMSSetLobbyData":6609,"k_EMsgClientMMSSetLobbyDataResponse":6610,"k_EMsgClientMMSGetLobbyData":6611,"k_EMsgClientMMSLobbyData":6612,"k_EMsgClientMMSInviteToLobby":6621};ESteamProto.EGCBaseClientMsg = {"k_EMsgGCClientWelcome":4004,"k_EMsgGCClientHello":4006,"k_EMsgGCClientConnectionStatus":4009};SteamProtoType.CMsgGCStorePurchaseInit = {"name":"CMsgGCStorePurchaseInit","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCStorePurchaseInitResponse = {"name":"CMsgGCStorePurchaseInitResponse","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconGameAccountClient = {"name":"CSOEconGameAccountClient","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOItemRecipe = {"name":"CSOItemRecipe","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconItem = {"name":"CSOEconItem","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgStoreGetUserData = {"name":"CMsgStoreGetUserData","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgStoreGetUserDataResponse = {"name":"CMsgStoreGetUserDataResponse","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconItemDropRateBonus = {"name":"CSOEconItemDropRateBonus","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconItemLeagueViewPass = {"name":"CSOEconItemLeagueViewPass","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconItemEventTicket = {"name":"CSOEconItemEventTicket","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCStorePurchaseCancel = {"name":"CMsgGCStorePurchaseCancel","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCStorePurchaseCancelResponse = {"name":"CMsgGCStorePurchaseCancelResponse","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCStorePurchaseFinalize = {"name":"CMsgGCStorePurchaseFinalize","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCStorePurchaseFinalizeResponse = {"name":"CMsgGCStorePurchaseFinalizeResponse","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CSOEconDefaultEquippedDefinitionInstanceClient = {"name":"CSOEconDefaultEquippedDefinitionInstanceClient","filename":"csgo\\base_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate = {"name":"CMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_MatchmakingGC2ClientHello = {"name":"CMsgGCCStrike15_v2_MatchmakingGC2ClientHello","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientGCRankUpdate = {"name":"CMsgGCCStrike15_v2_ClientGCRankUpdate","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientReportPlayer = {"name":"CMsgGCCStrike15_v2_ClientReportPlayer","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientCommendPlayer = {"name":"CMsgGCCStrike15_v2_ClientCommendPlayer","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientReportResponse = {"name":"CMsgGCCStrike15_v2_ClientReportResponse","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientRequestJoinFriendData = {"name":"CMsgGCCStrike15_v2_ClientRequestJoinFriendData","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCstrike15_v2_ClientRedeemFreeReward = {"name":"CMsgGCCstrike15_v2_ClientRedeemFreeReward","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientNetworkConfig = {"name":"CMsgGCCStrike15_v2_ClientNetworkConfig","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_ClientDeepStats = {"name":"CMsgGCCStrike15_ClientDeepStats","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientRequestPlayersProfile = {"name":"CMsgGCCStrike15_v2_ClientRequestPlayersProfile","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_PlayersProfile = {"name":"CMsgGCCStrike15_v2_PlayersProfile","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment = {"name":"CMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_GC2ClientTextMsg = {"name":"CMsgGCCStrike15_v2_GC2ClientTextMsg","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_MatchList = {"name":"CMsgGCCStrike15_v2_MatchList","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CSOEconCoupon = {"name":"CSOEconCoupon","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CSOAccountItemPersonalStore = {"name":"CSOAccountItemPersonalStore","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CSOQuestProgress = {"name":"CSOQuestProgress","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CSOAccountSeasonalOperation = {"name":"CSOAccountSeasonalOperation","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CSOPersonaDataPublic = {"name":"CSOPersonaDataPublic","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_AcknowledgePenalty = {"name":"CMsgGCCStrike15_v2_AcknowledgePenalty","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientLogonFatalError = {"name":"CMsgGCCStrike15_v2_ClientLogonFatalError","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_ClientPollState = {"name":"CMsgGCCStrike15_v2_ClientPollState","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_Party_Register = {"name":"CMsgGCCStrike15_v2_Party_Register","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_Party_Search = {"name":"CMsgGCCStrike15_v2_Party_Search","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_Party_SearchResults = {"name":"CMsgGCCStrike15_v2_Party_SearchResults","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_Party_Invite = {"name":"CMsgGCCStrike15_v2_Party_Invite","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_Account_RequestCoPlays = {"name":"CMsgGCCStrike15_v2_Account_RequestCoPlays","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgGCCStrike15_v2_GetEventFavorites_Response = {"name":"CMsgGCCStrike15_v2_GetEventFavorites_Response","filename":"csgo\\cstrike15_gcmessages.proto"};SteamProtoType.CMsgClientHello = {"name":"CMsgClientHello","filename":"csgo\\gcsdk_gcmessages.proto"};SteamProtoType.CMsgClientWelcome = {"name":"CMsgClientWelcome","filename":"csgo\\gcsdk_gcmessages.proto"};SteamProtoType.CMsgConnectionStatus = {"name":"CMsgConnectionStatus","filename":"csgo\\gcsdk_gcmessages.proto"};SteamProtoType.CPlayer_GetFriendsGameplayInfo_Request = {"name":"CPlayer_GetFriendsGameplayInfo_Request","filename":"csgo\\steammessages_player.steamworkssdk.proto"};SteamProtoType.CPlayer_GetFriendsGameplayInfo_Response = {"name":"CPlayer_GetFriendsGameplayInfo_Response","filename":"csgo\\steammessages_player.steamworkssdk.proto"};SteamProtoType.CAuthentication_RefreshToken_Revoke_Request = {"name":"CAuthentication_RefreshToken_Revoke_Request","filename":"steam\\steammessages_auth.steamclient.proto"};SteamProtoType.CAuthenticationSupport_QueryRefreshTokenByID_Request = {"name":"CAuthenticationSupport_QueryRefreshTokenByID_Request","filename":"steam\\steammessages_auth.steamclient.proto"};SteamProtoType.CMsgClientRequestedClientStats = {"name":"CMsgClientRequestedClientStats","filename":"steam\\steammessages_clientserver.proto"};SteamProtoType.CMsgClientUGSGetGlobalStats = {"name":"CMsgClientUGSGetGlobalStats","filename":"steam\\steammessages_clientserver_2.proto"};SteamProtoType.CMsgClientUGSGetGlobalStatsResponse = {"name":"CMsgClientUGSGetGlobalStatsResponse","filename":"steam\\steammessages_clientserver_2.proto"};SteamProtoType.CMsgClientMMSCreateLobby = {"name":"CMsgClientMMSCreateLobby","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSCreateLobbyResponse = {"name":"CMsgClientMMSCreateLobbyResponse","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSJoinLobby = {"name":"CMsgClientMMSJoinLobby","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSJoinLobbyResponse = {"name":"CMsgClientMMSJoinLobbyResponse","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSSetLobbyData = {"name":"CMsgClientMMSSetLobbyData","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSSetLobbyDataResponse = {"name":"CMsgClientMMSSetLobbyDataResponse","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSGetLobbyData = {"name":"CMsgClientMMSGetLobbyData","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSLobbyData = {"name":"CMsgClientMMSLobbyData","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSUserJoinedLobby = {"name":"CMsgClientMMSUserJoinedLobby","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CMsgClientMMSInviteToLobby = {"name":"CMsgClientMMSInviteToLobby","filename":"steam\\steammessages_clientserver_mms.proto"};SteamProtoType.CFriendMessages_GetRecentMessages_Request = {"name":"CFriendMessages_GetRecentMessages_Request","filename":"steam\\steammessages_friendmessages.steamclient.proto"};SteamProtoType.CFriendMessages_GetRecentMessages_Response = {"name":"CFriendMessages_GetRecentMessages_Response","filename":"steam\\steammessages_friendmessages.steamclient.proto"};SteamProtoType.CFriendMessages_SendMessage_Request = {"name":"CFriendMessages_SendMessage_Request","filename":"steam\\steammessages_friendmessages.steamclient.proto"};SteamProtoType.CFriendMessages_SendMessage_Response = {"name":"CFriendMessages_SendMessage_Response","filename":"steam\\steammessages_friendmessages.steamclient.proto"};SteamProtoType.CStoreBrowse_GetItems_Request = {"name":"CStoreBrowse_GetItems_Request","filename":"steam\\steammessages_storebrowse.steamclient.proto"};SteamProtoType.StoreItem = {"name":"StoreItem","filename":"steam\\steammessages_storebrowse.steamclient.proto"};SteamProtoType.CStoreBrowse_GetItems_Response = {"name":"CStoreBrowse_GetItems_Response","filename":"steam\\steammessages_storebrowse.steamclient.proto"};SteamProtoType.CPlayer_GetPlayerLinkDetails_Request = {"name":"CPlayer_GetPlayerLinkDetails_Request","filename":"steam\\steammessages_player.steamclient.proto"};SteamProtoType.CPlayer_GetPlayerLinkDetails_Response = {"name":"CPlayer_GetPlayerLinkDetails_Response","filename":"steam\\steammessages_player.steamclient.proto"};SteamProtoType.ProfileTheme = {"name":"ProfileTheme","filename":"steam\\steammessages_player.steamclient.proto"};SteamProtoType.ProfilePreferences = {"name":"ProfilePreferences","filename":"steam\\steammessages_player.steamclient.proto"};SteamProtoType.CCheckout_GetFriendOwnershipForGifting_Response = {"name":"CCheckout_GetFriendOwnershipForGifting_Response","filename":"webui\\service_checkout.proto"};SteamProtoType.CCommunity_GetApps_Request = {"name":"CCommunity_GetApps_Request","filename":"webui\\service_community.proto"};SteamProtoType.CCommunity_GetApps_Response = {"name":"CCommunity_GetApps_Response","filename":"webui\\service_community.proto"};SteamProtoType.CFriendsList_GetFriendsList_Response = {"name":"CFriendsList_GetFriendsList_Response","filename":"webui\\service_friendslist.proto"};SteamProtoType.CLoyaltyRewards_BatchedQueryRewardItems_Request = {"name":"CLoyaltyRewards_BatchedQueryRewardItems_Request","filename":"webui\\service_loyaltyrewards.proto"};SteamProtoType.CLoyaltyRewards_BatchedQueryRewardItems_Response = {"name":"CLoyaltyRewards_BatchedQueryRewardItems_Response","filename":"webui\\service_loyaltyrewards.proto"};SteamProtoType.CLoyaltyRewards_RedeemPoints_Request = {"name":"CLoyaltyRewards_RedeemPoints_Request","filename":"webui\\service_loyaltyrewards.proto"};SteamProtoType.CLoyaltyRewards_RedeemPoints_Response = {"name":"CLoyaltyRewards_RedeemPoints_Response","filename":"webui\\service_loyaltyrewards.proto"};