node-cs2
Version:
Modern CS2/CS:GO Game Coordinator integration with latest GameTracking-CS2 protobuf definitions. Includes support for highlight_reel, wrapped_sticker, variations, Promise-based API, crate opening, sticker/patch/keychain operations, and all modern CS2 fiel
955 lines (897 loc) • 72.3 kB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("protobufjs/minimal"));
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.CMsgSteamNetworkingIdentityLegacyBinary = (function() {
/**
* Properties of a CMsgSteamNetworkingIdentityLegacyBinary.
* @exports ICMsgSteamNetworkingIdentityLegacyBinary
* @interface ICMsgSteamNetworkingIdentityLegacyBinary
* @property {number|Long|null} [steam_id] CMsgSteamNetworkingIdentityLegacyBinary steam_id
* @property {Uint8Array|null} [generic_bytes] CMsgSteamNetworkingIdentityLegacyBinary generic_bytes
* @property {string|null} [generic_string] CMsgSteamNetworkingIdentityLegacyBinary generic_string
* @property {Uint8Array|null} [ipv6_and_port] CMsgSteamNetworkingIdentityLegacyBinary ipv6_and_port
*/
/**
* Constructs a new CMsgSteamNetworkingIdentityLegacyBinary.
* @exports CMsgSteamNetworkingIdentityLegacyBinary
* @classdesc Represents a CMsgSteamNetworkingIdentityLegacyBinary.
* @implements ICMsgSteamNetworkingIdentityLegacyBinary
* @constructor
* @param {ICMsgSteamNetworkingIdentityLegacyBinary=} [properties] Properties to set
*/
function CMsgSteamNetworkingIdentityLegacyBinary(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CMsgSteamNetworkingIdentityLegacyBinary steam_id.
* @member {number|Long} steam_id
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @instance
*/
CMsgSteamNetworkingIdentityLegacyBinary.prototype.steam_id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* CMsgSteamNetworkingIdentityLegacyBinary generic_bytes.
* @member {Uint8Array} generic_bytes
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @instance
*/
CMsgSteamNetworkingIdentityLegacyBinary.prototype.generic_bytes = $util.newBuffer([]);
/**
* CMsgSteamNetworkingIdentityLegacyBinary generic_string.
* @member {string} generic_string
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @instance
*/
CMsgSteamNetworkingIdentityLegacyBinary.prototype.generic_string = "";
/**
* CMsgSteamNetworkingIdentityLegacyBinary ipv6_and_port.
* @member {Uint8Array} ipv6_and_port
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @instance
*/
CMsgSteamNetworkingIdentityLegacyBinary.prototype.ipv6_and_port = $util.newBuffer([]);
/**
* Creates a new CMsgSteamNetworkingIdentityLegacyBinary instance using the specified properties.
* @function create
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {ICMsgSteamNetworkingIdentityLegacyBinary=} [properties] Properties to set
* @returns {CMsgSteamNetworkingIdentityLegacyBinary} CMsgSteamNetworkingIdentityLegacyBinary instance
*/
CMsgSteamNetworkingIdentityLegacyBinary.create = function create(properties) {
return new CMsgSteamNetworkingIdentityLegacyBinary(properties);
};
/**
* Encodes the specified CMsgSteamNetworkingIdentityLegacyBinary message. Does not implicitly {@link CMsgSteamNetworkingIdentityLegacyBinary.verify|verify} messages.
* @function encode
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {ICMsgSteamNetworkingIdentityLegacyBinary} message CMsgSteamNetworkingIdentityLegacyBinary message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgSteamNetworkingIdentityLegacyBinary.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.generic_bytes != null && Object.hasOwnProperty.call(message, "generic_bytes"))
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.generic_bytes);
if (message.generic_string != null && Object.hasOwnProperty.call(message, "generic_string"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.generic_string);
if (message.ipv6_and_port != null && Object.hasOwnProperty.call(message, "ipv6_and_port"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.ipv6_and_port);
if (message.steam_id != null && Object.hasOwnProperty.call(message, "steam_id"))
writer.uint32(/* id 16, wireType 1 =*/129).fixed64(message.steam_id);
return writer;
};
/**
* Encodes the specified CMsgSteamNetworkingIdentityLegacyBinary message, length delimited. Does not implicitly {@link CMsgSteamNetworkingIdentityLegacyBinary.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {ICMsgSteamNetworkingIdentityLegacyBinary} message CMsgSteamNetworkingIdentityLegacyBinary message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgSteamNetworkingIdentityLegacyBinary.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgSteamNetworkingIdentityLegacyBinary message from the specified reader or buffer.
* @function decode
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgSteamNetworkingIdentityLegacyBinary} CMsgSteamNetworkingIdentityLegacyBinary
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgSteamNetworkingIdentityLegacyBinary.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.CMsgSteamNetworkingIdentityLegacyBinary();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 16: {
message.steam_id = reader.fixed64();
break;
}
case 2: {
message.generic_bytes = reader.bytes();
break;
}
case 3: {
message.generic_string = reader.string();
break;
}
case 4: {
message.ipv6_and_port = reader.bytes();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgSteamNetworkingIdentityLegacyBinary message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgSteamNetworkingIdentityLegacyBinary} CMsgSteamNetworkingIdentityLegacyBinary
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgSteamNetworkingIdentityLegacyBinary.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgSteamNetworkingIdentityLegacyBinary message.
* @function verify
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgSteamNetworkingIdentityLegacyBinary.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.steam_id != null && message.hasOwnProperty("steam_id"))
if (!$util.isInteger(message.steam_id) && !(message.steam_id && $util.isInteger(message.steam_id.low) && $util.isInteger(message.steam_id.high)))
return "steam_id: integer|Long expected";
if (message.generic_bytes != null && message.hasOwnProperty("generic_bytes"))
if (!(message.generic_bytes && typeof message.generic_bytes.length === "number" || $util.isString(message.generic_bytes)))
return "generic_bytes: buffer expected";
if (message.generic_string != null && message.hasOwnProperty("generic_string"))
if (!$util.isString(message.generic_string))
return "generic_string: string expected";
if (message.ipv6_and_port != null && message.hasOwnProperty("ipv6_and_port"))
if (!(message.ipv6_and_port && typeof message.ipv6_and_port.length === "number" || $util.isString(message.ipv6_and_port)))
return "ipv6_and_port: buffer expected";
return null;
};
/**
* Creates a CMsgSteamNetworkingIdentityLegacyBinary message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgSteamNetworkingIdentityLegacyBinary} CMsgSteamNetworkingIdentityLegacyBinary
*/
CMsgSteamNetworkingIdentityLegacyBinary.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgSteamNetworkingIdentityLegacyBinary)
return object;
var message = new $root.CMsgSteamNetworkingIdentityLegacyBinary();
if (object.steam_id != null)
if ($util.Long)
(message.steam_id = $util.Long.fromValue(object.steam_id)).unsigned = false;
else if (typeof object.steam_id === "string")
message.steam_id = parseInt(object.steam_id, 10);
else if (typeof object.steam_id === "number")
message.steam_id = object.steam_id;
else if (typeof object.steam_id === "object")
message.steam_id = new $util.LongBits(object.steam_id.low >>> 0, object.steam_id.high >>> 0).toNumber();
if (object.generic_bytes != null)
if (typeof object.generic_bytes === "string")
$util.base64.decode(object.generic_bytes, message.generic_bytes = $util.newBuffer($util.base64.length(object.generic_bytes)), 0);
else if (object.generic_bytes.length >= 0)
message.generic_bytes = object.generic_bytes;
if (object.generic_string != null)
message.generic_string = String(object.generic_string);
if (object.ipv6_and_port != null)
if (typeof object.ipv6_and_port === "string")
$util.base64.decode(object.ipv6_and_port, message.ipv6_and_port = $util.newBuffer($util.base64.length(object.ipv6_and_port)), 0);
else if (object.ipv6_and_port.length >= 0)
message.ipv6_and_port = object.ipv6_and_port;
return message;
};
/**
* Creates a plain object from a CMsgSteamNetworkingIdentityLegacyBinary message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {CMsgSteamNetworkingIdentityLegacyBinary} message CMsgSteamNetworkingIdentityLegacyBinary
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgSteamNetworkingIdentityLegacyBinary.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
if (options.bytes === String)
object.generic_bytes = "";
else {
object.generic_bytes = [];
if (options.bytes !== Array)
object.generic_bytes = $util.newBuffer(object.generic_bytes);
}
object.generic_string = "";
if (options.bytes === String)
object.ipv6_and_port = "";
else {
object.ipv6_and_port = [];
if (options.bytes !== Array)
object.ipv6_and_port = $util.newBuffer(object.ipv6_and_port);
}
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.steam_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.steam_id = options.longs === String ? "0" : 0;
}
if (message.generic_bytes != null && message.hasOwnProperty("generic_bytes"))
object.generic_bytes = options.bytes === String ? $util.base64.encode(message.generic_bytes, 0, message.generic_bytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.generic_bytes) : message.generic_bytes;
if (message.generic_string != null && message.hasOwnProperty("generic_string"))
object.generic_string = message.generic_string;
if (message.ipv6_and_port != null && message.hasOwnProperty("ipv6_and_port"))
object.ipv6_and_port = options.bytes === String ? $util.base64.encode(message.ipv6_and_port, 0, message.ipv6_and_port.length) : options.bytes === Array ? Array.prototype.slice.call(message.ipv6_and_port) : message.ipv6_and_port;
if (message.steam_id != null && message.hasOwnProperty("steam_id"))
if (typeof message.steam_id === "number")
object.steam_id = options.longs === String ? String(message.steam_id) : message.steam_id;
else
object.steam_id = options.longs === String ? $util.Long.prototype.toString.call(message.steam_id) : options.longs === Number ? new $util.LongBits(message.steam_id.low >>> 0, message.steam_id.high >>> 0).toNumber() : message.steam_id;
return object;
};
/**
* Converts this CMsgSteamNetworkingIdentityLegacyBinary to JSON.
* @function toJSON
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgSteamNetworkingIdentityLegacyBinary.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgSteamNetworkingIdentityLegacyBinary
* @function getTypeUrl
* @memberof CMsgSteamNetworkingIdentityLegacyBinary
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgSteamNetworkingIdentityLegacyBinary.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgSteamNetworkingIdentityLegacyBinary";
};
return CMsgSteamNetworkingIdentityLegacyBinary;
})();
$root.CMsgSteamDatagramCertificate = (function() {
/**
* Properties of a CMsgSteamDatagramCertificate.
* @exports ICMsgSteamDatagramCertificate
* @interface ICMsgSteamDatagramCertificate
* @property {CMsgSteamDatagramCertificate.EKeyType|null} [key_type] CMsgSteamDatagramCertificate key_type
* @property {Uint8Array|null} [key_data] CMsgSteamDatagramCertificate key_data
* @property {number|Long|null} [legacy_steam_id] CMsgSteamDatagramCertificate legacy_steam_id
* @property {ICMsgSteamNetworkingIdentityLegacyBinary|null} [legacy_identity_binary] CMsgSteamDatagramCertificate legacy_identity_binary
* @property {string|null} [identity_string] CMsgSteamDatagramCertificate identity_string
* @property {Array.<number>|null} [gameserver_datacenter_ids] CMsgSteamDatagramCertificate gameserver_datacenter_ids
* @property {number|null} [time_created] CMsgSteamDatagramCertificate time_created
* @property {number|null} [time_expiry] CMsgSteamDatagramCertificate time_expiry
* @property {Array.<number>|null} [app_ids] CMsgSteamDatagramCertificate app_ids
* @property {Array.<string>|null} [ip_addresses] CMsgSteamDatagramCertificate ip_addresses
*/
/**
* Constructs a new CMsgSteamDatagramCertificate.
* @exports CMsgSteamDatagramCertificate
* @classdesc Represents a CMsgSteamDatagramCertificate.
* @implements ICMsgSteamDatagramCertificate
* @constructor
* @param {ICMsgSteamDatagramCertificate=} [properties] Properties to set
*/
function CMsgSteamDatagramCertificate(properties) {
this.gameserver_datacenter_ids = [];
this.app_ids = [];
this.ip_addresses = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CMsgSteamDatagramCertificate key_type.
* @member {CMsgSteamDatagramCertificate.EKeyType} key_type
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.key_type = 0;
/**
* CMsgSteamDatagramCertificate key_data.
* @member {Uint8Array} key_data
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.key_data = $util.newBuffer([]);
/**
* CMsgSteamDatagramCertificate legacy_steam_id.
* @member {number|Long} legacy_steam_id
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.legacy_steam_id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* CMsgSteamDatagramCertificate legacy_identity_binary.
* @member {ICMsgSteamNetworkingIdentityLegacyBinary|null|undefined} legacy_identity_binary
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.legacy_identity_binary = null;
/**
* CMsgSteamDatagramCertificate identity_string.
* @member {string} identity_string
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.identity_string = "";
/**
* CMsgSteamDatagramCertificate gameserver_datacenter_ids.
* @member {Array.<number>} gameserver_datacenter_ids
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.gameserver_datacenter_ids = $util.emptyArray;
/**
* CMsgSteamDatagramCertificate time_created.
* @member {number} time_created
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.time_created = 0;
/**
* CMsgSteamDatagramCertificate time_expiry.
* @member {number} time_expiry
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.time_expiry = 0;
/**
* CMsgSteamDatagramCertificate app_ids.
* @member {Array.<number>} app_ids
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.app_ids = $util.emptyArray;
/**
* CMsgSteamDatagramCertificate ip_addresses.
* @member {Array.<string>} ip_addresses
* @memberof CMsgSteamDatagramCertificate
* @instance
*/
CMsgSteamDatagramCertificate.prototype.ip_addresses = $util.emptyArray;
/**
* Creates a new CMsgSteamDatagramCertificate instance using the specified properties.
* @function create
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {ICMsgSteamDatagramCertificate=} [properties] Properties to set
* @returns {CMsgSteamDatagramCertificate} CMsgSteamDatagramCertificate instance
*/
CMsgSteamDatagramCertificate.create = function create(properties) {
return new CMsgSteamDatagramCertificate(properties);
};
/**
* Encodes the specified CMsgSteamDatagramCertificate message. Does not implicitly {@link CMsgSteamDatagramCertificate.verify|verify} messages.
* @function encode
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {ICMsgSteamDatagramCertificate} message CMsgSteamDatagramCertificate message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgSteamDatagramCertificate.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.key_type != null && Object.hasOwnProperty.call(message, "key_type"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.key_type);
if (message.key_data != null && Object.hasOwnProperty.call(message, "key_data"))
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.key_data);
if (message.legacy_steam_id != null && Object.hasOwnProperty.call(message, "legacy_steam_id"))
writer.uint32(/* id 4, wireType 1 =*/33).fixed64(message.legacy_steam_id);
if (message.gameserver_datacenter_ids != null && message.gameserver_datacenter_ids.length)
for (var i = 0; i < message.gameserver_datacenter_ids.length; ++i)
writer.uint32(/* id 5, wireType 5 =*/45).fixed32(message.gameserver_datacenter_ids[i]);
if (message.time_created != null && Object.hasOwnProperty.call(message, "time_created"))
writer.uint32(/* id 8, wireType 5 =*/69).fixed32(message.time_created);
if (message.time_expiry != null && Object.hasOwnProperty.call(message, "time_expiry"))
writer.uint32(/* id 9, wireType 5 =*/77).fixed32(message.time_expiry);
if (message.app_ids != null && message.app_ids.length)
for (var i = 0; i < message.app_ids.length; ++i)
writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.app_ids[i]);
if (message.legacy_identity_binary != null && Object.hasOwnProperty.call(message, "legacy_identity_binary"))
$root.CMsgSteamNetworkingIdentityLegacyBinary.encode(message.legacy_identity_binary, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
if (message.identity_string != null && Object.hasOwnProperty.call(message, "identity_string"))
writer.uint32(/* id 12, wireType 2 =*/98).string(message.identity_string);
if (message.ip_addresses != null && message.ip_addresses.length)
for (var i = 0; i < message.ip_addresses.length; ++i)
writer.uint32(/* id 13, wireType 2 =*/106).string(message.ip_addresses[i]);
return writer;
};
/**
* Encodes the specified CMsgSteamDatagramCertificate message, length delimited. Does not implicitly {@link CMsgSteamDatagramCertificate.verify|verify} messages.
* @function encodeDelimited
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {ICMsgSteamDatagramCertificate} message CMsgSteamDatagramCertificate message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgSteamDatagramCertificate.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CMsgSteamDatagramCertificate message from the specified reader or buffer.
* @function decode
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {CMsgSteamDatagramCertificate} CMsgSteamDatagramCertificate
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgSteamDatagramCertificate.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.CMsgSteamDatagramCertificate();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.key_type = reader.int32();
break;
}
case 2: {
message.key_data = reader.bytes();
break;
}
case 4: {
message.legacy_steam_id = reader.fixed64();
break;
}
case 11: {
message.legacy_identity_binary = $root.CMsgSteamNetworkingIdentityLegacyBinary.decode(reader, reader.uint32());
break;
}
case 12: {
message.identity_string = reader.string();
break;
}
case 5: {
if (!(message.gameserver_datacenter_ids && message.gameserver_datacenter_ids.length))
message.gameserver_datacenter_ids = [];
if ((tag & 7) === 2) {
var end2 = reader.uint32() + reader.pos;
while (reader.pos < end2)
message.gameserver_datacenter_ids.push(reader.fixed32());
} else
message.gameserver_datacenter_ids.push(reader.fixed32());
break;
}
case 8: {
message.time_created = reader.fixed32();
break;
}
case 9: {
message.time_expiry = reader.fixed32();
break;
}
case 10: {
if (!(message.app_ids && message.app_ids.length))
message.app_ids = [];
if ((tag & 7) === 2) {
var end2 = reader.uint32() + reader.pos;
while (reader.pos < end2)
message.app_ids.push(reader.uint32());
} else
message.app_ids.push(reader.uint32());
break;
}
case 13: {
if (!(message.ip_addresses && message.ip_addresses.length))
message.ip_addresses = [];
message.ip_addresses.push(reader.string());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CMsgSteamDatagramCertificate message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {CMsgSteamDatagramCertificate} CMsgSteamDatagramCertificate
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CMsgSteamDatagramCertificate.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CMsgSteamDatagramCertificate message.
* @function verify
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CMsgSteamDatagramCertificate.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.key_type != null && message.hasOwnProperty("key_type"))
switch (message.key_type) {
default:
return "key_type: enum value expected";
case 0:
case 1:
break;
}
if (message.key_data != null && message.hasOwnProperty("key_data"))
if (!(message.key_data && typeof message.key_data.length === "number" || $util.isString(message.key_data)))
return "key_data: buffer expected";
if (message.legacy_steam_id != null && message.hasOwnProperty("legacy_steam_id"))
if (!$util.isInteger(message.legacy_steam_id) && !(message.legacy_steam_id && $util.isInteger(message.legacy_steam_id.low) && $util.isInteger(message.legacy_steam_id.high)))
return "legacy_steam_id: integer|Long expected";
if (message.legacy_identity_binary != null && message.hasOwnProperty("legacy_identity_binary")) {
var error = $root.CMsgSteamNetworkingIdentityLegacyBinary.verify(message.legacy_identity_binary);
if (error)
return "legacy_identity_binary." + error;
}
if (message.identity_string != null && message.hasOwnProperty("identity_string"))
if (!$util.isString(message.identity_string))
return "identity_string: string expected";
if (message.gameserver_datacenter_ids != null && message.hasOwnProperty("gameserver_datacenter_ids")) {
if (!Array.isArray(message.gameserver_datacenter_ids))
return "gameserver_datacenter_ids: array expected";
for (var i = 0; i < message.gameserver_datacenter_ids.length; ++i)
if (!$util.isInteger(message.gameserver_datacenter_ids[i]))
return "gameserver_datacenter_ids: integer[] expected";
}
if (message.time_created != null && message.hasOwnProperty("time_created"))
if (!$util.isInteger(message.time_created))
return "time_created: integer expected";
if (message.time_expiry != null && message.hasOwnProperty("time_expiry"))
if (!$util.isInteger(message.time_expiry))
return "time_expiry: integer expected";
if (message.app_ids != null && message.hasOwnProperty("app_ids")) {
if (!Array.isArray(message.app_ids))
return "app_ids: array expected";
for (var i = 0; i < message.app_ids.length; ++i)
if (!$util.isInteger(message.app_ids[i]))
return "app_ids: integer[] expected";
}
if (message.ip_addresses != null && message.hasOwnProperty("ip_addresses")) {
if (!Array.isArray(message.ip_addresses))
return "ip_addresses: array expected";
for (var i = 0; i < message.ip_addresses.length; ++i)
if (!$util.isString(message.ip_addresses[i]))
return "ip_addresses: string[] expected";
}
return null;
};
/**
* Creates a CMsgSteamDatagramCertificate message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {Object.<string,*>} object Plain object
* @returns {CMsgSteamDatagramCertificate} CMsgSteamDatagramCertificate
*/
CMsgSteamDatagramCertificate.fromObject = function fromObject(object) {
if (object instanceof $root.CMsgSteamDatagramCertificate)
return object;
var message = new $root.CMsgSteamDatagramCertificate();
switch (object.key_type) {
default:
if (typeof object.key_type === "number") {
message.key_type = object.key_type;
break;
}
break;
case "INVALID":
case 0:
message.key_type = 0;
break;
case "ED25519":
case 1:
message.key_type = 1;
break;
}
if (object.key_data != null)
if (typeof object.key_data === "string")
$util.base64.decode(object.key_data, message.key_data = $util.newBuffer($util.base64.length(object.key_data)), 0);
else if (object.key_data.length >= 0)
message.key_data = object.key_data;
if (object.legacy_steam_id != null)
if ($util.Long)
(message.legacy_steam_id = $util.Long.fromValue(object.legacy_steam_id)).unsigned = false;
else if (typeof object.legacy_steam_id === "string")
message.legacy_steam_id = parseInt(object.legacy_steam_id, 10);
else if (typeof object.legacy_steam_id === "number")
message.legacy_steam_id = object.legacy_steam_id;
else if (typeof object.legacy_steam_id === "object")
message.legacy_steam_id = new $util.LongBits(object.legacy_steam_id.low >>> 0, object.legacy_steam_id.high >>> 0).toNumber();
if (object.legacy_identity_binary != null) {
if (typeof object.legacy_identity_binary !== "object")
throw TypeError(".CMsgSteamDatagramCertificate.legacy_identity_binary: object expected");
message.legacy_identity_binary = $root.CMsgSteamNetworkingIdentityLegacyBinary.fromObject(object.legacy_identity_binary);
}
if (object.identity_string != null)
message.identity_string = String(object.identity_string);
if (object.gameserver_datacenter_ids) {
if (!Array.isArray(object.gameserver_datacenter_ids))
throw TypeError(".CMsgSteamDatagramCertificate.gameserver_datacenter_ids: array expected");
message.gameserver_datacenter_ids = [];
for (var i = 0; i < object.gameserver_datacenter_ids.length; ++i)
message.gameserver_datacenter_ids[i] = object.gameserver_datacenter_ids[i] >>> 0;
}
if (object.time_created != null)
message.time_created = object.time_created >>> 0;
if (object.time_expiry != null)
message.time_expiry = object.time_expiry >>> 0;
if (object.app_ids) {
if (!Array.isArray(object.app_ids))
throw TypeError(".CMsgSteamDatagramCertificate.app_ids: array expected");
message.app_ids = [];
for (var i = 0; i < object.app_ids.length; ++i)
message.app_ids[i] = object.app_ids[i] >>> 0;
}
if (object.ip_addresses) {
if (!Array.isArray(object.ip_addresses))
throw TypeError(".CMsgSteamDatagramCertificate.ip_addresses: array expected");
message.ip_addresses = [];
for (var i = 0; i < object.ip_addresses.length; ++i)
message.ip_addresses[i] = String(object.ip_addresses[i]);
}
return message;
};
/**
* Creates a plain object from a CMsgSteamDatagramCertificate message. Also converts values to other types if specified.
* @function toObject
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {CMsgSteamDatagramCertificate} message CMsgSteamDatagramCertificate
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CMsgSteamDatagramCertificate.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults) {
object.gameserver_datacenter_ids = [];
object.app_ids = [];
object.ip_addresses = [];
}
if (options.defaults) {
object.key_type = options.enums === String ? "INVALID" : 0;
if (options.bytes === String)
object.key_data = "";
else {
object.key_data = [];
if (options.bytes !== Array)
object.key_data = $util.newBuffer(object.key_data);
}
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.legacy_steam_id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.legacy_steam_id = options.longs === String ? "0" : 0;
object.time_created = 0;
object.time_expiry = 0;
object.legacy_identity_binary = null;
object.identity_string = "";
}
if (message.key_type != null && message.hasOwnProperty("key_type"))
object.key_type = options.enums === String ? $root.CMsgSteamDatagramCertificate.EKeyType[message.key_type] === undefined ? message.key_type : $root.CMsgSteamDatagramCertificate.EKeyType[message.key_type] : message.key_type;
if (message.key_data != null && message.hasOwnProperty("key_data"))
object.key_data = options.bytes === String ? $util.base64.encode(message.key_data, 0, message.key_data.length) : options.bytes === Array ? Array.prototype.slice.call(message.key_data) : message.key_data;
if (message.legacy_steam_id != null && message.hasOwnProperty("legacy_steam_id"))
if (typeof message.legacy_steam_id === "number")
object.legacy_steam_id = options.longs === String ? String(message.legacy_steam_id) : message.legacy_steam_id;
else
object.legacy_steam_id = options.longs === String ? $util.Long.prototype.toString.call(message.legacy_steam_id) : options.longs === Number ? new $util.LongBits(message.legacy_steam_id.low >>> 0, message.legacy_steam_id.high >>> 0).toNumber() : message.legacy_steam_id;
if (message.gameserver_datacenter_ids && message.gameserver_datacenter_ids.length) {
object.gameserver_datacenter_ids = [];
for (var j = 0; j < message.gameserver_datacenter_ids.length; ++j)
object.gameserver_datacenter_ids[j] = message.gameserver_datacenter_ids[j];
}
if (message.time_created != null && message.hasOwnProperty("time_created"))
object.time_created = message.time_created;
if (message.time_expiry != null && message.hasOwnProperty("time_expiry"))
object.time_expiry = message.time_expiry;
if (message.app_ids && message.app_ids.length) {
object.app_ids = [];
for (var j = 0; j < message.app_ids.length; ++j)
object.app_ids[j] = message.app_ids[j];
}
if (message.legacy_identity_binary != null && message.hasOwnProperty("legacy_identity_binary"))
object.legacy_identity_binary = $root.CMsgSteamNetworkingIdentityLegacyBinary.toObject(message.legacy_identity_binary, options);
if (message.identity_string != null && message.hasOwnProperty("identity_string"))
object.identity_string = message.identity_string;
if (message.ip_addresses && message.ip_addresses.length) {
object.ip_addresses = [];
for (var j = 0; j < message.ip_addresses.length; ++j)
object.ip_addresses[j] = message.ip_addresses[j];
}
return object;
};
/**
* Converts this CMsgSteamDatagramCertificate to JSON.
* @function toJSON
* @memberof CMsgSteamDatagramCertificate
* @instance
* @returns {Object.<string,*>} JSON object
*/
CMsgSteamDatagramCertificate.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CMsgSteamDatagramCertificate
* @function getTypeUrl
* @memberof CMsgSteamDatagramCertificate
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CMsgSteamDatagramCertificate.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/CMsgSteamDatagramCertificate";
};
/**
* EKeyType enum.
* @name CMsgSteamDatagramCertificate.EKeyType
* @enum {number}
* @property {number} INVALID=0 INVALID value
* @property {number} ED25519=1 ED25519 value
*/
CMsgSteamDatagramCertificate.EKeyType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "INVALID"] = 0;
values[valuesById[1] = "ED25519"] = 1;
return values;
})();
return CMsgSteamDatagramCertificate;
})();
$root.CMsgSteamDatagramCertificateSigned = (function() {
/**
* Properties of a CMsgSteamDatagramCertificateSigned.
* @exports ICMsgSteamDatagramCertificateSigned
* @interface ICMsgSteamDatagramCertificateSigned
* @property {Uint8Array|null} [cert] CMsgSteamDatagramCertificateSigned cert
* @property {number|Long|null} [ca_key_id] CMsgSteamDatagramCertificateSigned ca_key_id
* @property {Uint8Array|null} [ca_signature] CMsgSteamDatagramCertificateSigned ca_signature
* @property {Uint8Array|null} [private_key_data] CMsgSteamDatagramCertificateSigned private_key_data
*/
/**
* Constructs a new CMsgSteamDatagramCertificateSigned.
* @exports CMsgSteamDatagramCertificateSigned
* @classdesc Represents a CMsgSteamDatagramCertificateSigned.
* @implements ICMsgSteamDatagramCertificateSigned
* @constructor
* @param {ICMsgSteamDatagramCertificateSigned=} [properties] Properties to set
*/
function CMsgSteamDatagramCertificateSigned(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CMsgSteamDatagramCertificateSigned cert.
* @member {Uint8Array} cert
* @memberof CMsgSteamDatagramCertificateSigned
* @instance
*/
CMsgSteamDatagramCertificateSigned.prototype.cert = $util.newBuffer([]);
/**
* CMsgSteamDatagramCertificateSigned ca_key_id.
* @member {number|Long} ca_key_id
* @memberof CMsgSteamDatagramCertificateSigned
* @instance
*/
CMsgSteamDatagramCertificateSigned.prototype.ca_key_id = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* CMsgSteamDatagramCertificateSigned ca_signature.
* @member {Uint8Array} ca_signature
* @memberof CMsgSteamDatagramCertificateSigned
* @instance
*/
CMsgSteamDatagramCertificateSigned.prototype.ca_signature = $util.newBuffer([]);
/**
* CMsgSteamDatagramCertificateSigned private_key_data.
* @member {Uint8Array} private_key_data
* @memberof CMsgSteamDatagramCertificateSigned
* @instance
*/
CMsgSteamDatagramCertificateSigned.prototype.private_key_data = $util.newBuffer([]);
/**
* Creates a new CMsgSteamDatagramCertificateSigned instance using the specified properties.
* @function create
* @memberof CMsgSteamDatagramCertificateSigned
* @static
* @param {ICMsgSteamDatagramCertificateSigned=} [properties] Properties to set
* @returns {CMsgSteamDatagramCertificateSigned} CMsgSteamDatagramCertificateSigned instance
*/
CMsgSteamDatagramCertificateSigned.create = function create(properties) {
return new CMsgSteamDatagramCertificateSigned(properties);
};
/**
* Encodes the specified CMsgSteamDatagramCertificateSigned message. Does not implicitly {@link CMsgSteamDatagramCertificateSigned.verify|verify} messages.
* @function encode
* @memberof CMsgSteamDatagramCertificateSigned
* @static
* @param {ICMsgSteamDatagramCertificateSigned} message CMsgSteamDatagramCertificateSigned message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CMsgSteamDatagramCertificateSigned.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.private_key_data != null && Object.hasOwnProperty.call(message, "private_key_data"))
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.private_key_data);
if (message.cert != null && Object.hasOwnProperty.call(message, "cert"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.cert);
if (message.ca_key_id != null && Object.hasOwnProperty.call(message, "ca_key_id"))
writer.uint32(/* id 5, wireType 1 =*/41).fixed64(message.ca_key_id);
if (message.ca_signature != null && Object.hasOwnProperty.call(message, "ca_signature"))
writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.ca_signature);
return writer;
};
/**
* Encodes the specified