UNPKG

@whiskeysockets/baileys

Version:

A WebSockets library for interacting with WhatsApp Web

1,105 lines (1,029 loc) 8.24 MB
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ "use strict"; var $protobuf = require("protobufjs/minimal"); // Common aliases var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); $root.proto = (function() { /** * Namespace proto. * @exports proto * @namespace */ var proto = {}; proto.ADVDeviceIdentity = (function() { /** * Properties of a ADVDeviceIdentity. * @memberof proto * @interface IADVDeviceIdentity * @property {number|null} [rawId] ADVDeviceIdentity rawId * @property {number|Long|null} [timestamp] ADVDeviceIdentity timestamp * @property {number|null} [keyIndex] ADVDeviceIdentity keyIndex * @property {proto.ADVEncryptionType|null} [accountType] ADVDeviceIdentity accountType * @property {proto.ADVEncryptionType|null} [deviceType] ADVDeviceIdentity deviceType */ /** * Constructs a new ADVDeviceIdentity. * @memberof proto * @classdesc Represents a ADVDeviceIdentity. * @implements IADVDeviceIdentity * @constructor * @param {proto.IADVDeviceIdentity=} [properties] Properties to set */ function ADVDeviceIdentity(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]]; } /** * ADVDeviceIdentity rawId. * @member {number|null|undefined} rawId * @memberof proto.ADVDeviceIdentity * @instance */ ADVDeviceIdentity.prototype.rawId = null; /** * ADVDeviceIdentity timestamp. * @member {number|Long|null|undefined} timestamp * @memberof proto.ADVDeviceIdentity * @instance */ ADVDeviceIdentity.prototype.timestamp = null; /** * ADVDeviceIdentity keyIndex. * @member {number|null|undefined} keyIndex * @memberof proto.ADVDeviceIdentity * @instance */ ADVDeviceIdentity.prototype.keyIndex = null; /** * ADVDeviceIdentity accountType. * @member {proto.ADVEncryptionType|null|undefined} accountType * @memberof proto.ADVDeviceIdentity * @instance */ ADVDeviceIdentity.prototype.accountType = null; /** * ADVDeviceIdentity deviceType. * @member {proto.ADVEncryptionType|null|undefined} deviceType * @memberof proto.ADVDeviceIdentity * @instance */ ADVDeviceIdentity.prototype.deviceType = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(ADVDeviceIdentity.prototype, "_rawId", { get: $util.oneOfGetter($oneOfFields = ["rawId"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVDeviceIdentity.prototype, "_timestamp", { get: $util.oneOfGetter($oneOfFields = ["timestamp"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVDeviceIdentity.prototype, "_keyIndex", { get: $util.oneOfGetter($oneOfFields = ["keyIndex"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVDeviceIdentity.prototype, "_accountType", { get: $util.oneOfGetter($oneOfFields = ["accountType"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVDeviceIdentity.prototype, "_deviceType", { get: $util.oneOfGetter($oneOfFields = ["deviceType"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new ADVDeviceIdentity instance using the specified properties. * @function create * @memberof proto.ADVDeviceIdentity * @static * @param {proto.IADVDeviceIdentity=} [properties] Properties to set * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity instance */ ADVDeviceIdentity.create = function create(properties) { return new ADVDeviceIdentity(properties); }; /** * Encodes the specified ADVDeviceIdentity message. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. * @function encode * @memberof proto.ADVDeviceIdentity * @static * @param {proto.IADVDeviceIdentity} message ADVDeviceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVDeviceIdentity.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.rawId); if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); if (message.keyIndex != null && Object.hasOwnProperty.call(message, "keyIndex")) writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.keyIndex); if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.accountType); if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.deviceType); return writer; }; /** * Encodes the specified ADVDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. * @function encodeDelimited * @memberof proto.ADVDeviceIdentity * @static * @param {proto.IADVDeviceIdentity} message ADVDeviceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ADVDeviceIdentity message from the specified reader or buffer. * @function decode * @memberof proto.ADVDeviceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVDeviceIdentity.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVDeviceIdentity(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.rawId = reader.uint32(); break; } case 2: { message.timestamp = reader.uint64(); break; } case 3: { message.keyIndex = reader.uint32(); break; } case 4: { message.accountType = reader.int32(); break; } case 5: { message.deviceType = reader.int32(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ADVDeviceIdentity message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof proto.ADVDeviceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVDeviceIdentity.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ADVDeviceIdentity message. * @function verify * @memberof proto.ADVDeviceIdentity * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ADVDeviceIdentity.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.rawId != null && message.hasOwnProperty("rawId")) { properties._rawId = 1; if (!$util.isInteger(message.rawId)) return "rawId: integer expected"; } if (message.timestamp != null && message.hasOwnProperty("timestamp")) { properties._timestamp = 1; if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) return "timestamp: integer|Long expected"; } if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) { properties._keyIndex = 1; if (!$util.isInteger(message.keyIndex)) return "keyIndex: integer expected"; } if (message.accountType != null && message.hasOwnProperty("accountType")) { properties._accountType = 1; switch (message.accountType) { default: return "accountType: enum value expected"; case 0: case 1: break; } } if (message.deviceType != null && message.hasOwnProperty("deviceType")) { properties._deviceType = 1; switch (message.deviceType) { default: return "deviceType: enum value expected"; case 0: case 1: break; } } return null; }; /** * Creates a ADVDeviceIdentity message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof proto.ADVDeviceIdentity * @static * @param {Object.<string,*>} object Plain object * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity */ ADVDeviceIdentity.fromObject = function fromObject(object) { if (object instanceof $root.proto.ADVDeviceIdentity) return object; var message = new $root.proto.ADVDeviceIdentity(); if (object.rawId != null) message.rawId = object.rawId >>> 0; if (object.timestamp != null) if ($util.Long) (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; else if (typeof object.timestamp === "string") message.timestamp = parseInt(object.timestamp, 10); else if (typeof object.timestamp === "number") message.timestamp = object.timestamp; else if (typeof object.timestamp === "object") message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); if (object.keyIndex != null) message.keyIndex = object.keyIndex >>> 0; switch (object.accountType) { default: if (typeof object.accountType === "number") { message.accountType = object.accountType; break; } break; case "E2EE": case 0: message.accountType = 0; break; case "HOSTED": case 1: message.accountType = 1; break; } switch (object.deviceType) { default: if (typeof object.deviceType === "number") { message.deviceType = object.deviceType; break; } break; case "E2EE": case 0: message.deviceType = 0; break; case "HOSTED": case 1: message.deviceType = 1; break; } return message; }; /** * Creates a plain object from a ADVDeviceIdentity message. Also converts values to other types if specified. * @function toObject * @memberof proto.ADVDeviceIdentity * @static * @param {proto.ADVDeviceIdentity} message ADVDeviceIdentity * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ ADVDeviceIdentity.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.rawId != null && message.hasOwnProperty("rawId")) { object.rawId = message.rawId; if (options.oneofs) object._rawId = "rawId"; } if (message.timestamp != null && message.hasOwnProperty("timestamp")) { if (typeof message.timestamp === "number") object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; else object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; if (options.oneofs) object._timestamp = "timestamp"; } if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) { object.keyIndex = message.keyIndex; if (options.oneofs) object._keyIndex = "keyIndex"; } if (message.accountType != null && message.hasOwnProperty("accountType")) { object.accountType = options.enums === String ? $root.proto.ADVEncryptionType[message.accountType] === undefined ? message.accountType : $root.proto.ADVEncryptionType[message.accountType] : message.accountType; if (options.oneofs) object._accountType = "accountType"; } if (message.deviceType != null && message.hasOwnProperty("deviceType")) { object.deviceType = options.enums === String ? $root.proto.ADVEncryptionType[message.deviceType] === undefined ? message.deviceType : $root.proto.ADVEncryptionType[message.deviceType] : message.deviceType; if (options.oneofs) object._deviceType = "deviceType"; } return object; }; /** * Converts this ADVDeviceIdentity to JSON. * @function toJSON * @memberof proto.ADVDeviceIdentity * @instance * @returns {Object.<string,*>} JSON object */ ADVDeviceIdentity.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for ADVDeviceIdentity * @function getTypeUrl * @memberof proto.ADVDeviceIdentity * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ ADVDeviceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVDeviceIdentity"; }; return ADVDeviceIdentity; })(); /** * ADVEncryptionType enum. * @name proto.ADVEncryptionType * @enum {number} * @property {number} E2EE=0 E2EE value * @property {number} HOSTED=1 HOSTED value */ proto.ADVEncryptionType = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "E2EE"] = 0; values[valuesById[1] = "HOSTED"] = 1; return values; })(); proto.ADVKeyIndexList = (function() { /** * Properties of a ADVKeyIndexList. * @memberof proto * @interface IADVKeyIndexList * @property {number|null} [rawId] ADVKeyIndexList rawId * @property {number|Long|null} [timestamp] ADVKeyIndexList timestamp * @property {number|null} [currentIndex] ADVKeyIndexList currentIndex * @property {Array.<number>|null} [validIndexes] ADVKeyIndexList validIndexes * @property {proto.ADVEncryptionType|null} [accountType] ADVKeyIndexList accountType */ /** * Constructs a new ADVKeyIndexList. * @memberof proto * @classdesc Represents a ADVKeyIndexList. * @implements IADVKeyIndexList * @constructor * @param {proto.IADVKeyIndexList=} [properties] Properties to set */ function ADVKeyIndexList(properties) { this.validIndexes = []; 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]]; } /** * ADVKeyIndexList rawId. * @member {number|null|undefined} rawId * @memberof proto.ADVKeyIndexList * @instance */ ADVKeyIndexList.prototype.rawId = null; /** * ADVKeyIndexList timestamp. * @member {number|Long|null|undefined} timestamp * @memberof proto.ADVKeyIndexList * @instance */ ADVKeyIndexList.prototype.timestamp = null; /** * ADVKeyIndexList currentIndex. * @member {number|null|undefined} currentIndex * @memberof proto.ADVKeyIndexList * @instance */ ADVKeyIndexList.prototype.currentIndex = null; /** * ADVKeyIndexList validIndexes. * @member {Array.<number>} validIndexes * @memberof proto.ADVKeyIndexList * @instance */ ADVKeyIndexList.prototype.validIndexes = $util.emptyArray; /** * ADVKeyIndexList accountType. * @member {proto.ADVEncryptionType|null|undefined} accountType * @memberof proto.ADVKeyIndexList * @instance */ ADVKeyIndexList.prototype.accountType = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(ADVKeyIndexList.prototype, "_rawId", { get: $util.oneOfGetter($oneOfFields = ["rawId"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVKeyIndexList.prototype, "_timestamp", { get: $util.oneOfGetter($oneOfFields = ["timestamp"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVKeyIndexList.prototype, "_currentIndex", { get: $util.oneOfGetter($oneOfFields = ["currentIndex"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVKeyIndexList.prototype, "_accountType", { get: $util.oneOfGetter($oneOfFields = ["accountType"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new ADVKeyIndexList instance using the specified properties. * @function create * @memberof proto.ADVKeyIndexList * @static * @param {proto.IADVKeyIndexList=} [properties] Properties to set * @returns {proto.ADVKeyIndexList} ADVKeyIndexList instance */ ADVKeyIndexList.create = function create(properties) { return new ADVKeyIndexList(properties); }; /** * Encodes the specified ADVKeyIndexList message. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. * @function encode * @memberof proto.ADVKeyIndexList * @static * @param {proto.IADVKeyIndexList} message ADVKeyIndexList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVKeyIndexList.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId")) writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.rawId); if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); if (message.currentIndex != null && Object.hasOwnProperty.call(message, "currentIndex")) writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.currentIndex); if (message.validIndexes != null && message.validIndexes.length) { writer.uint32(/* id 4, wireType 2 =*/34).fork(); for (var i = 0; i < message.validIndexes.length; ++i) writer.uint32(message.validIndexes[i]); writer.ldelim(); } if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.accountType); return writer; }; /** * Encodes the specified ADVKeyIndexList message, length delimited. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. * @function encodeDelimited * @memberof proto.ADVKeyIndexList * @static * @param {proto.IADVKeyIndexList} message ADVKeyIndexList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVKeyIndexList.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ADVKeyIndexList message from the specified reader or buffer. * @function decode * @memberof proto.ADVKeyIndexList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {proto.ADVKeyIndexList} ADVKeyIndexList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVKeyIndexList.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVKeyIndexList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.rawId = reader.uint32(); break; } case 2: { message.timestamp = reader.uint64(); break; } case 3: { message.currentIndex = reader.uint32(); break; } case 4: { if (!(message.validIndexes && message.validIndexes.length)) message.validIndexes = []; if ((tag & 7) === 2) { var end2 = reader.uint32() + reader.pos; while (reader.pos < end2) message.validIndexes.push(reader.uint32()); } else message.validIndexes.push(reader.uint32()); break; } case 5: { message.accountType = reader.int32(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ADVKeyIndexList message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof proto.ADVKeyIndexList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {proto.ADVKeyIndexList} ADVKeyIndexList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVKeyIndexList.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ADVKeyIndexList message. * @function verify * @memberof proto.ADVKeyIndexList * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ADVKeyIndexList.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.rawId != null && message.hasOwnProperty("rawId")) { properties._rawId = 1; if (!$util.isInteger(message.rawId)) return "rawId: integer expected"; } if (message.timestamp != null && message.hasOwnProperty("timestamp")) { properties._timestamp = 1; if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) return "timestamp: integer|Long expected"; } if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) { properties._currentIndex = 1; if (!$util.isInteger(message.currentIndex)) return "currentIndex: integer expected"; } if (message.validIndexes != null && message.hasOwnProperty("validIndexes")) { if (!Array.isArray(message.validIndexes)) return "validIndexes: array expected"; for (var i = 0; i < message.validIndexes.length; ++i) if (!$util.isInteger(message.validIndexes[i])) return "validIndexes: integer[] expected"; } if (message.accountType != null && message.hasOwnProperty("accountType")) { properties._accountType = 1; switch (message.accountType) { default: return "accountType: enum value expected"; case 0: case 1: break; } } return null; }; /** * Creates a ADVKeyIndexList message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof proto.ADVKeyIndexList * @static * @param {Object.<string,*>} object Plain object * @returns {proto.ADVKeyIndexList} ADVKeyIndexList */ ADVKeyIndexList.fromObject = function fromObject(object) { if (object instanceof $root.proto.ADVKeyIndexList) return object; var message = new $root.proto.ADVKeyIndexList(); if (object.rawId != null) message.rawId = object.rawId >>> 0; if (object.timestamp != null) if ($util.Long) (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; else if (typeof object.timestamp === "string") message.timestamp = parseInt(object.timestamp, 10); else if (typeof object.timestamp === "number") message.timestamp = object.timestamp; else if (typeof object.timestamp === "object") message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); if (object.currentIndex != null) message.currentIndex = object.currentIndex >>> 0; if (object.validIndexes) { if (!Array.isArray(object.validIndexes)) throw TypeError(".proto.ADVKeyIndexList.validIndexes: array expected"); message.validIndexes = []; for (var i = 0; i < object.validIndexes.length; ++i) message.validIndexes[i] = object.validIndexes[i] >>> 0; } switch (object.accountType) { default: if (typeof object.accountType === "number") { message.accountType = object.accountType; break; } break; case "E2EE": case 0: message.accountType = 0; break; case "HOSTED": case 1: message.accountType = 1; break; } return message; }; /** * Creates a plain object from a ADVKeyIndexList message. Also converts values to other types if specified. * @function toObject * @memberof proto.ADVKeyIndexList * @static * @param {proto.ADVKeyIndexList} message ADVKeyIndexList * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ ADVKeyIndexList.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.validIndexes = []; if (message.rawId != null && message.hasOwnProperty("rawId")) { object.rawId = message.rawId; if (options.oneofs) object._rawId = "rawId"; } if (message.timestamp != null && message.hasOwnProperty("timestamp")) { if (typeof message.timestamp === "number") object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; else object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; if (options.oneofs) object._timestamp = "timestamp"; } if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) { object.currentIndex = message.currentIndex; if (options.oneofs) object._currentIndex = "currentIndex"; } if (message.validIndexes && message.validIndexes.length) { object.validIndexes = []; for (var j = 0; j < message.validIndexes.length; ++j) object.validIndexes[j] = message.validIndexes[j]; } if (message.accountType != null && message.hasOwnProperty("accountType")) { object.accountType = options.enums === String ? $root.proto.ADVEncryptionType[message.accountType] === undefined ? message.accountType : $root.proto.ADVEncryptionType[message.accountType] : message.accountType; if (options.oneofs) object._accountType = "accountType"; } return object; }; /** * Converts this ADVKeyIndexList to JSON. * @function toJSON * @memberof proto.ADVKeyIndexList * @instance * @returns {Object.<string,*>} JSON object */ ADVKeyIndexList.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for ADVKeyIndexList * @function getTypeUrl * @memberof proto.ADVKeyIndexList * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ ADVKeyIndexList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVKeyIndexList"; }; return ADVKeyIndexList; })(); proto.ADVSignedDeviceIdentity = (function() { /** * Properties of a ADVSignedDeviceIdentity. * @memberof proto * @interface IADVSignedDeviceIdentity * @property {Uint8Array|null} [details] ADVSignedDeviceIdentity details * @property {Uint8Array|null} [accountSignatureKey] ADVSignedDeviceIdentity accountSignatureKey * @property {Uint8Array|null} [accountSignature] ADVSignedDeviceIdentity accountSignature * @property {Uint8Array|null} [deviceSignature] ADVSignedDeviceIdentity deviceSignature */ /** * Constructs a new ADVSignedDeviceIdentity. * @memberof proto * @classdesc Represents a ADVSignedDeviceIdentity. * @implements IADVSignedDeviceIdentity * @constructor * @param {proto.IADVSignedDeviceIdentity=} [properties] Properties to set */ function ADVSignedDeviceIdentity(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]]; } /** * ADVSignedDeviceIdentity details. * @member {Uint8Array|null|undefined} details * @memberof proto.ADVSignedDeviceIdentity * @instance */ ADVSignedDeviceIdentity.prototype.details = null; /** * ADVSignedDeviceIdentity accountSignatureKey. * @member {Uint8Array|null|undefined} accountSignatureKey * @memberof proto.ADVSignedDeviceIdentity * @instance */ ADVSignedDeviceIdentity.prototype.accountSignatureKey = null; /** * ADVSignedDeviceIdentity accountSignature. * @member {Uint8Array|null|undefined} accountSignature * @memberof proto.ADVSignedDeviceIdentity * @instance */ ADVSignedDeviceIdentity.prototype.accountSignature = null; /** * ADVSignedDeviceIdentity deviceSignature. * @member {Uint8Array|null|undefined} deviceSignature * @memberof proto.ADVSignedDeviceIdentity * @instance */ ADVSignedDeviceIdentity.prototype.deviceSignature = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_details", { get: $util.oneOfGetter($oneOfFields = ["details"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_accountSignatureKey", { get: $util.oneOfGetter($oneOfFields = ["accountSignatureKey"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_accountSignature", { get: $util.oneOfGetter($oneOfFields = ["accountSignature"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_deviceSignature", { get: $util.oneOfGetter($oneOfFields = ["deviceSignature"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new ADVSignedDeviceIdentity instance using the specified properties. * @function create * @memberof proto.ADVSignedDeviceIdentity * @static * @param {proto.IADVSignedDeviceIdentity=} [properties] Properties to set * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity instance */ ADVSignedDeviceIdentity.create = function create(properties) { return new ADVSignedDeviceIdentity(properties); }; /** * Encodes the specified ADVSignedDeviceIdentity message. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. * @function encode * @memberof proto.ADVSignedDeviceIdentity * @static * @param {proto.IADVSignedDeviceIdentity} message ADVSignedDeviceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVSignedDeviceIdentity.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.details != null && Object.hasOwnProperty.call(message, "details")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); if (message.accountSignatureKey != null && Object.hasOwnProperty.call(message, "accountSignatureKey")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.accountSignatureKey); if (message.accountSignature != null && Object.hasOwnProperty.call(message, "accountSignature")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.accountSignature); if (message.deviceSignature != null && Object.hasOwnProperty.call(message, "deviceSignature")) writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.deviceSignature); return writer; }; /** * Encodes the specified ADVSignedDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. * @function encodeDelimited * @memberof proto.ADVSignedDeviceIdentity * @static * @param {proto.IADVSignedDeviceIdentity} message ADVSignedDeviceIdentity message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ ADVSignedDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer. * @function decode * @memberof proto.ADVSignedDeviceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVSignedDeviceIdentity.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVSignedDeviceIdentity(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.details = reader.bytes(); break; } case 2: { message.accountSignatureKey = reader.bytes(); break; } case 3: { message.accountSignature = reader.bytes(); break; } case 4: { message.deviceSignature = reader.bytes(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof proto.ADVSignedDeviceIdentity * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ADVSignedDeviceIdentity.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a ADVSignedDeviceIdentity message. * @function verify * @memberof proto.ADVSignedDeviceIdentity * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ ADVSignedDeviceIdentity.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; var properties = {}; if (message.details != null && message.hasOwnProperty("details")) { properties._details = 1; if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) return "details: buffer expected"; } if (message.accountSignatureKey != null && message.hasOwnProperty("accountSignatureKey")) { properties._accountSignatureKey = 1; if (!(message.accountSignatureKey && typeof message.accountSignatureKey.length === "number" || $util.isString(message.accountSignatureKey))) return "accountSignatureKey: buffer expected"; } if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) { properties._accountSignature = 1; if (!(message.accountSignature && typeof message.accountSignature.length === "number" || $util.isString(message.accountSignature))) return "accountSignature: buffer expected"; } if (message.deviceSignature != null && message.hasOwnProperty("deviceSignature")) { properties._deviceSignature = 1; if (!(message.deviceSignature && typeof message.deviceSignature.length === "number" || $util.isString(message.deviceSignature))) return "deviceSignature: buffer expected"; } return null; }; /** * Creates a ADVSignedDeviceIdentity message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof proto.ADVSignedDeviceIdentity * @static * @param {Object.<string,*>} object Plain object * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity */ ADVSignedDeviceIdentity.fromObject = function fromObject(object) { if (object instanceof $root.proto.ADVSignedDeviceIdentity) return object; var message = new $root.proto.ADVSignedDeviceIdentity(); if (object.details != null) if (typeof object.details === "string") $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); else if (object.details.length >= 0) message.details = object.details; if (object.accountSignatureKey != null) if (typeof object.accountSignatureKey === "string") $util.base64.decode(object.accountSignatureKey, message.accountSignatureKey = $util.newBuffer($util.base64.length(object.accountSignatureKey)), 0); else if (object.accountSignatureKey.length >= 0) message.accountSignatureKey = object.accountSignatureKey; if (object.accountSignature != null) if (typeof object.accountSignature === "string") $util.base64.decode(object.accountSignature, message.accountSignature = $util.newBuffer($util.base64.length(object.accountSignature)), 0); else if (object.accountSignature.length >= 0) message.accountSignature = object.accountSignature; if (object.deviceSignature != null) if (typeof object.deviceSignature === "string") $util.base64.decode(object.deviceSignature, message.deviceSignature = $util.newBuffer($util.base64.length(object.deviceSignature)), 0); else if (object.deviceSignature.length >= 0) message.deviceSignature = object.deviceSignature; return message; }; /** * Creates a plain object from a ADVSignedDeviceIdentity message. Also converts values to other types if specified. * @function toObject * @memberof proto.ADVSignedDeviceIdentity * @static * @param {proto.ADVSignedDeviceIdentity} message ADVSignedDeviceIdentity * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ ADVSignedDeviceIdentity.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (message.details != null && message.hasOwnProperty("details")) { object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; if (options.oneofs) object._details = "details"; } if (message.accountSignatureKey != null && message.hasOwnProperty("accountSignatureKey")) { object.accountSignatureKey = options.bytes === String ? $util.base64.encode(message.accountSignatureKey, 0, message.accountSignatureKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.accountSignatureKey) : message.accountSignatureKey;