UNPKG

@signalapp/mock-server

Version:
1,078 lines (1,008 loc) 2.88 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.signalservice = (function() { /** * Namespace signalservice. * @exports signalservice * @namespace */ var signalservice = {}; signalservice.CDSClientRequest = (function() { /** * Properties of a CDSClientRequest. * @memberof signalservice * @interface ICDSClientRequest * @property {Uint8Array|null} [aciUakPairs] CDSClientRequest aciUakPairs * @property {Uint8Array|null} [prevE164s] CDSClientRequest prevE164s * @property {Uint8Array|null} [newE164s] CDSClientRequest newE164s * @property {Uint8Array|null} [discardE164s] CDSClientRequest discardE164s * @property {boolean|null} [hasMore] CDSClientRequest hasMore * @property {Uint8Array|null} [token] CDSClientRequest token * @property {boolean|null} [tokenAck] CDSClientRequest tokenAck * @property {boolean|null} [returnAcisWithoutUaks] CDSClientRequest returnAcisWithoutUaks */ /** * Constructs a new CDSClientRequest. * @memberof signalservice * @classdesc Represents a CDSClientRequest. * @implements ICDSClientRequest * @constructor * @param {signalservice.ICDSClientRequest=} [properties] Properties to set */ function CDSClientRequest(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]]; } /** * CDSClientRequest aciUakPairs. * @member {Uint8Array} aciUakPairs * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.aciUakPairs = $util.newBuffer([]); /** * CDSClientRequest prevE164s. * @member {Uint8Array} prevE164s * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.prevE164s = $util.newBuffer([]); /** * CDSClientRequest newE164s. * @member {Uint8Array} newE164s * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.newE164s = $util.newBuffer([]); /** * CDSClientRequest discardE164s. * @member {Uint8Array} discardE164s * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.discardE164s = $util.newBuffer([]); /** * CDSClientRequest hasMore. * @member {boolean} hasMore * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.hasMore = false; /** * CDSClientRequest token. * @member {Uint8Array} token * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.token = $util.newBuffer([]); /** * CDSClientRequest tokenAck. * @member {boolean} tokenAck * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.tokenAck = false; /** * CDSClientRequest returnAcisWithoutUaks. * @member {boolean} returnAcisWithoutUaks * @memberof signalservice.CDSClientRequest * @instance */ CDSClientRequest.prototype.returnAcisWithoutUaks = false; /** * Creates a new CDSClientRequest instance using the specified properties. * @function create * @memberof signalservice.CDSClientRequest * @static * @param {signalservice.ICDSClientRequest=} [properties] Properties to set * @returns {signalservice.CDSClientRequest} CDSClientRequest instance */ CDSClientRequest.create = function create(properties) { return new CDSClientRequest(properties); }; /** * Encodes the specified CDSClientRequest message. Does not implicitly {@link signalservice.CDSClientRequest.verify|verify} messages. * @function encode * @memberof signalservice.CDSClientRequest * @static * @param {signalservice.ICDSClientRequest} message CDSClientRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CDSClientRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.aciUakPairs != null && Object.hasOwnProperty.call(message, "aciUakPairs")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.aciUakPairs); if (message.prevE164s != null && Object.hasOwnProperty.call(message, "prevE164s")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.prevE164s); if (message.newE164s != null && Object.hasOwnProperty.call(message, "newE164s")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.newE164s); if (message.discardE164s != null && Object.hasOwnProperty.call(message, "discardE164s")) writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.discardE164s); if (message.hasMore != null && Object.hasOwnProperty.call(message, "hasMore")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.hasMore); if (message.token != null && Object.hasOwnProperty.call(message, "token")) writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.token); if (message.tokenAck != null && Object.hasOwnProperty.call(message, "tokenAck")) writer.uint32(/* id 7, wireType 0 =*/56).bool(message.tokenAck); if (message.returnAcisWithoutUaks != null && Object.hasOwnProperty.call(message, "returnAcisWithoutUaks")) writer.uint32(/* id 8, wireType 0 =*/64).bool(message.returnAcisWithoutUaks); return writer; }; /** * Encodes the specified CDSClientRequest message, length delimited. Does not implicitly {@link signalservice.CDSClientRequest.verify|verify} messages. * @function encodeDelimited * @memberof signalservice.CDSClientRequest * @static * @param {signalservice.ICDSClientRequest} message CDSClientRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CDSClientRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CDSClientRequest message from the specified reader or buffer. * @function decode * @memberof signalservice.CDSClientRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {signalservice.CDSClientRequest} CDSClientRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CDSClientRequest.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.signalservice.CDSClientRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.aciUakPairs = reader.bytes(); break; } case 2: { message.prevE164s = reader.bytes(); break; } case 3: { message.newE164s = reader.bytes(); break; } case 4: { message.discardE164s = reader.bytes(); break; } case 5: { message.hasMore = reader.bool(); break; } case 6: { message.token = reader.bytes(); break; } case 7: { message.tokenAck = reader.bool(); break; } case 8: { message.returnAcisWithoutUaks = reader.bool(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CDSClientRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof signalservice.CDSClientRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {signalservice.CDSClientRequest} CDSClientRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CDSClientRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CDSClientRequest message. * @function verify * @memberof signalservice.CDSClientRequest * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CDSClientRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.aciUakPairs != null && message.hasOwnProperty("aciUakPairs")) if (!(message.aciUakPairs && typeof message.aciUakPairs.length === "number" || $util.isString(message.aciUakPairs))) return "aciUakPairs: buffer expected"; if (message.prevE164s != null && message.hasOwnProperty("prevE164s")) if (!(message.prevE164s && typeof message.prevE164s.length === "number" || $util.isString(message.prevE164s))) return "prevE164s: buffer expected"; if (message.newE164s != null && message.hasOwnProperty("newE164s")) if (!(message.newE164s && typeof message.newE164s.length === "number" || $util.isString(message.newE164s))) return "newE164s: buffer expected"; if (message.discardE164s != null && message.hasOwnProperty("discardE164s")) if (!(message.discardE164s && typeof message.discardE164s.length === "number" || $util.isString(message.discardE164s))) return "discardE164s: buffer expected"; if (message.hasMore != null && message.hasOwnProperty("hasMore")) if (typeof message.hasMore !== "boolean") return "hasMore: boolean expected"; if (message.token != null && message.hasOwnProperty("token")) if (!(message.token && typeof message.token.length === "number" || $util.isString(message.token))) return "token: buffer expected"; if (message.tokenAck != null && message.hasOwnProperty("tokenAck")) if (typeof message.tokenAck !== "boolean") return "tokenAck: boolean expected"; if (message.returnAcisWithoutUaks != null && message.hasOwnProperty("returnAcisWithoutUaks")) if (typeof message.returnAcisWithoutUaks !== "boolean") return "returnAcisWithoutUaks: boolean expected"; return null; }; /** * Creates a CDSClientRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof signalservice.CDSClientRequest * @static * @param {Object.<string,*>} object Plain object * @returns {signalservice.CDSClientRequest} CDSClientRequest */ CDSClientRequest.fromObject = function fromObject(object) { if (object instanceof $root.signalservice.CDSClientRequest) return object; var message = new $root.signalservice.CDSClientRequest(); if (object.aciUakPairs != null) if (typeof object.aciUakPairs === "string") $util.base64.decode(object.aciUakPairs, message.aciUakPairs = $util.newBuffer($util.base64.length(object.aciUakPairs)), 0); else if (object.aciUakPairs.length >= 0) message.aciUakPairs = object.aciUakPairs; if (object.prevE164s != null) if (typeof object.prevE164s === "string") $util.base64.decode(object.prevE164s, message.prevE164s = $util.newBuffer($util.base64.length(object.prevE164s)), 0); else if (object.prevE164s.length >= 0) message.prevE164s = object.prevE164s; if (object.newE164s != null) if (typeof object.newE164s === "string") $util.base64.decode(object.newE164s, message.newE164s = $util.newBuffer($util.base64.length(object.newE164s)), 0); else if (object.newE164s.length >= 0) message.newE164s = object.newE164s; if (object.discardE164s != null) if (typeof object.discardE164s === "string") $util.base64.decode(object.discardE164s, message.discardE164s = $util.newBuffer($util.base64.length(object.discardE164s)), 0); else if (object.discardE164s.length >= 0) message.discardE164s = object.discardE164s; if (object.hasMore != null) message.hasMore = Boolean(object.hasMore); if (object.token != null) if (typeof object.token === "string") $util.base64.decode(object.token, message.token = $util.newBuffer($util.base64.length(object.token)), 0); else if (object.token.length >= 0) message.token = object.token; if (object.tokenAck != null) message.tokenAck = Boolean(object.tokenAck); if (object.returnAcisWithoutUaks != null) message.returnAcisWithoutUaks = Boolean(object.returnAcisWithoutUaks); return message; }; /** * Creates a plain object from a CDSClientRequest message. Also converts values to other types if specified. * @function toObject * @memberof signalservice.CDSClientRequest * @static * @param {signalservice.CDSClientRequest} message CDSClientRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CDSClientRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) object.aciUakPairs = ""; else { object.aciUakPairs = []; if (options.bytes !== Array) object.aciUakPairs = $util.newBuffer(object.aciUakPairs); } if (options.bytes === String) object.prevE164s = ""; else { object.prevE164s = []; if (options.bytes !== Array) object.prevE164s = $util.newBuffer(object.prevE164s); } if (options.bytes === String) object.newE164s = ""; else { object.newE164s = []; if (options.bytes !== Array) object.newE164s = $util.newBuffer(object.newE164s); } if (options.bytes === String) object.discardE164s = ""; else { object.discardE164s = []; if (options.bytes !== Array) object.discardE164s = $util.newBuffer(object.discardE164s); } object.hasMore = false; if (options.bytes === String) object.token = ""; else { object.token = []; if (options.bytes !== Array) object.token = $util.newBuffer(object.token); } object.tokenAck = false; object.returnAcisWithoutUaks = false; } if (message.aciUakPairs != null && message.hasOwnProperty("aciUakPairs")) object.aciUakPairs = options.bytes === String ? $util.base64.encode(message.aciUakPairs, 0, message.aciUakPairs.length) : options.bytes === Array ? Array.prototype.slice.call(message.aciUakPairs) : message.aciUakPairs; if (message.prevE164s != null && message.hasOwnProperty("prevE164s")) object.prevE164s = options.bytes === String ? $util.base64.encode(message.prevE164s, 0, message.prevE164s.length) : options.bytes === Array ? Array.prototype.slice.call(message.prevE164s) : message.prevE164s; if (message.newE164s != null && message.hasOwnProperty("newE164s")) object.newE164s = options.bytes === String ? $util.base64.encode(message.newE164s, 0, message.newE164s.length) : options.bytes === Array ? Array.prototype.slice.call(message.newE164s) : message.newE164s; if (message.discardE164s != null && message.hasOwnProperty("discardE164s")) object.discardE164s = options.bytes === String ? $util.base64.encode(message.discardE164s, 0, message.discardE164s.length) : options.bytes === Array ? Array.prototype.slice.call(message.discardE164s) : message.discardE164s; if (message.hasMore != null && message.hasOwnProperty("hasMore")) object.hasMore = message.hasMore; if (message.token != null && message.hasOwnProperty("token")) object.token = options.bytes === String ? $util.base64.encode(message.token, 0, message.token.length) : options.bytes === Array ? Array.prototype.slice.call(message.token) : message.token; if (message.tokenAck != null && message.hasOwnProperty("tokenAck")) object.tokenAck = message.tokenAck; if (message.returnAcisWithoutUaks != null && message.hasOwnProperty("returnAcisWithoutUaks")) object.returnAcisWithoutUaks = message.returnAcisWithoutUaks; return object; }; /** * Converts this CDSClientRequest to JSON. * @function toJSON * @memberof signalservice.CDSClientRequest * @instance * @returns {Object.<string,*>} JSON object */ CDSClientRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CDSClientRequest * @function getTypeUrl * @memberof signalservice.CDSClientRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CDSClientRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/signalservice.CDSClientRequest"; }; return CDSClientRequest; })(); signalservice.CDSClientResponse = (function() { /** * Properties of a CDSClientResponse. * @memberof signalservice * @interface ICDSClientResponse * @property {Uint8Array|null} [e164PniAciTriples] CDSClientResponse e164PniAciTriples * @property {Uint8Array|null} [token] CDSClientResponse token */ /** * Constructs a new CDSClientResponse. * @memberof signalservice * @classdesc Represents a CDSClientResponse. * @implements ICDSClientResponse * @constructor * @param {signalservice.ICDSClientResponse=} [properties] Properties to set */ function CDSClientResponse(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]]; } /** * CDSClientResponse e164PniAciTriples. * @member {Uint8Array} e164PniAciTriples * @memberof signalservice.CDSClientResponse * @instance */ CDSClientResponse.prototype.e164PniAciTriples = $util.newBuffer([]); /** * CDSClientResponse token. * @member {Uint8Array} token * @memberof signalservice.CDSClientResponse * @instance */ CDSClientResponse.prototype.token = $util.newBuffer([]); /** * Creates a new CDSClientResponse instance using the specified properties. * @function create * @memberof signalservice.CDSClientResponse * @static * @param {signalservice.ICDSClientResponse=} [properties] Properties to set * @returns {signalservice.CDSClientResponse} CDSClientResponse instance */ CDSClientResponse.create = function create(properties) { return new CDSClientResponse(properties); }; /** * Encodes the specified CDSClientResponse message. Does not implicitly {@link signalservice.CDSClientResponse.verify|verify} messages. * @function encode * @memberof signalservice.CDSClientResponse * @static * @param {signalservice.ICDSClientResponse} message CDSClientResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CDSClientResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.e164PniAciTriples != null && Object.hasOwnProperty.call(message, "e164PniAciTriples")) writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.e164PniAciTriples); if (message.token != null && Object.hasOwnProperty.call(message, "token")) writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.token); return writer; }; /** * Encodes the specified CDSClientResponse message, length delimited. Does not implicitly {@link signalservice.CDSClientResponse.verify|verify} messages. * @function encodeDelimited * @memberof signalservice.CDSClientResponse * @static * @param {signalservice.ICDSClientResponse} message CDSClientResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CDSClientResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CDSClientResponse message from the specified reader or buffer. * @function decode * @memberof signalservice.CDSClientResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {signalservice.CDSClientResponse} CDSClientResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CDSClientResponse.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.signalservice.CDSClientResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.e164PniAciTriples = reader.bytes(); break; } case 3: { message.token = reader.bytes(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CDSClientResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof signalservice.CDSClientResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {signalservice.CDSClientResponse} CDSClientResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CDSClientResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CDSClientResponse message. * @function verify * @memberof signalservice.CDSClientResponse * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CDSClientResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.e164PniAciTriples != null && message.hasOwnProperty("e164PniAciTriples")) if (!(message.e164PniAciTriples && typeof message.e164PniAciTriples.length === "number" || $util.isString(message.e164PniAciTriples))) return "e164PniAciTriples: buffer expected"; if (message.token != null && message.hasOwnProperty("token")) if (!(message.token && typeof message.token.length === "number" || $util.isString(message.token))) return "token: buffer expected"; return null; }; /** * Creates a CDSClientResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof signalservice.CDSClientResponse * @static * @param {Object.<string,*>} object Plain object * @returns {signalservice.CDSClientResponse} CDSClientResponse */ CDSClientResponse.fromObject = function fromObject(object) { if (object instanceof $root.signalservice.CDSClientResponse) return object; var message = new $root.signalservice.CDSClientResponse(); if (object.e164PniAciTriples != null) if (typeof object.e164PniAciTriples === "string") $util.base64.decode(object.e164PniAciTriples, message.e164PniAciTriples = $util.newBuffer($util.base64.length(object.e164PniAciTriples)), 0); else if (object.e164PniAciTriples.length >= 0) message.e164PniAciTriples = object.e164PniAciTriples; if (object.token != null) if (typeof object.token === "string") $util.base64.decode(object.token, message.token = $util.newBuffer($util.base64.length(object.token)), 0); else if (object.token.length >= 0) message.token = object.token; return message; }; /** * Creates a plain object from a CDSClientResponse message. Also converts values to other types if specified. * @function toObject * @memberof signalservice.CDSClientResponse * @static * @param {signalservice.CDSClientResponse} message CDSClientResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CDSClientResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { if (options.bytes === String) object.e164PniAciTriples = ""; else { object.e164PniAciTriples = []; if (options.bytes !== Array) object.e164PniAciTriples = $util.newBuffer(object.e164PniAciTriples); } if (options.bytes === String) object.token = ""; else { object.token = []; if (options.bytes !== Array) object.token = $util.newBuffer(object.token); } } if (message.e164PniAciTriples != null && message.hasOwnProperty("e164PniAciTriples")) object.e164PniAciTriples = options.bytes === String ? $util.base64.encode(message.e164PniAciTriples, 0, message.e164PniAciTriples.length) : options.bytes === Array ? Array.prototype.slice.call(message.e164PniAciTriples) : message.e164PniAciTriples; if (message.token != null && message.hasOwnProperty("token")) object.token = options.bytes === String ? $util.base64.encode(message.token, 0, message.token.length) : options.bytes === Array ? Array.prototype.slice.call(message.token) : message.token; return object; }; /** * Converts this CDSClientResponse to JSON. * @function toJSON * @memberof signalservice.CDSClientResponse * @instance * @returns {Object.<string,*>} JSON object */ CDSClientResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CDSClientResponse * @function getTypeUrl * @memberof signalservice.CDSClientResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CDSClientResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/signalservice.CDSClientResponse"; }; return CDSClientResponse; })(); signalservice.CrashReport = (function() { /** * Properties of a CrashReport. * @memberof signalservice * @interface ICrashReport * @property {string|null} [filename] CrashReport filename * @property {Uint8Array|null} [content] CrashReport content */ /** * Constructs a new CrashReport. * @memberof signalservice * @classdesc Represents a CrashReport. * @implements ICrashReport * @constructor * @param {signalservice.ICrashReport=} [properties] Properties to set */ function CrashReport(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]]; } /** * CrashReport filename. * @member {string} filename * @memberof signalservice.CrashReport * @instance */ CrashReport.prototype.filename = ""; /** * CrashReport content. * @member {Uint8Array} content * @memberof signalservice.CrashReport * @instance */ CrashReport.prototype.content = $util.newBuffer([]); /** * Creates a new CrashReport instance using the specified properties. * @function create * @memberof signalservice.CrashReport * @static * @param {signalservice.ICrashReport=} [properties] Properties to set * @returns {signalservice.CrashReport} CrashReport instance */ CrashReport.create = function create(properties) { return new CrashReport(properties); }; /** * Encodes the specified CrashReport message. Does not implicitly {@link signalservice.CrashReport.verify|verify} messages. * @function encode * @memberof signalservice.CrashReport * @static * @param {signalservice.ICrashReport} message CrashReport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CrashReport.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.filename != null && Object.hasOwnProperty.call(message, "filename")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.filename); if (message.content != null && Object.hasOwnProperty.call(message, "content")) writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.content); return writer; }; /** * Encodes the specified CrashReport message, length delimited. Does not implicitly {@link signalservice.CrashReport.verify|verify} messages. * @function encodeDelimited * @memberof signalservice.CrashReport * @static * @param {signalservice.ICrashReport} message CrashReport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CrashReport.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CrashReport message from the specified reader or buffer. * @function decode * @memberof signalservice.CrashReport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {signalservice.CrashReport} CrashReport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CrashReport.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.signalservice.CrashReport(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { message.filename = reader.string(); break; } case 2: { message.content = reader.bytes(); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CrashReport message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof signalservice.CrashReport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {signalservice.CrashReport} CrashReport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CrashReport.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CrashReport message. * @function verify * @memberof signalservice.CrashReport * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CrashReport.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.filename != null && message.hasOwnProperty("filename")) if (!$util.isString(message.filename)) return "filename: string expected"; if (message.content != null && message.hasOwnProperty("content")) if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) return "content: buffer expected"; return null; }; /** * Creates a CrashReport message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof signalservice.CrashReport * @static * @param {Object.<string,*>} object Plain object * @returns {signalservice.CrashReport} CrashReport */ CrashReport.fromObject = function fromObject(object) { if (object instanceof $root.signalservice.CrashReport) return object; var message = new $root.signalservice.CrashReport(); if (object.filename != null) message.filename = String(object.filename); if (object.content != null) if (typeof object.content === "string") $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); else if (object.content.length >= 0) message.content = object.content; return message; }; /** * Creates a plain object from a CrashReport message. Also converts values to other types if specified. * @function toObject * @memberof signalservice.CrashReport * @static * @param {signalservice.CrashReport} message CrashReport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ CrashReport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.filename = ""; if (options.bytes === String) object.content = ""; else { object.content = []; if (options.bytes !== Array) object.content = $util.newBuffer(object.content); } } if (message.filename != null && message.hasOwnProperty("filename")) object.filename = message.filename; if (message.content != null && message.hasOwnProperty("content")) object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; return object; }; /** * Converts this CrashReport to JSON. * @function toJSON * @memberof signalservice.CrashReport * @instance * @returns {Object.<string,*>} JSON object */ CrashReport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * Gets the default type url for CrashReport * @function getTypeUrl * @memberof signalservice.CrashReport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ CrashReport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/signalservice.CrashReport"; }; return CrashReport; })(); signalservice.CrashReportList = (function() { /** * Properties of a CrashReportList. * @memberof signalservice * @interface ICrashReportList * @property {Array.<signalservice.ICrashReport>|null} [reports] CrashReportList reports */ /** * Constructs a new CrashReportList. * @memberof signalservice * @classdesc Represents a CrashReportList. * @implements ICrashReportList * @constructor * @param {signalservice.ICrashReportList=} [properties] Properties to set */ function CrashReportList(properties) { this.reports = []; 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]]; } /** * CrashReportList reports. * @member {Array.<signalservice.ICrashReport>} reports * @memberof signalservice.CrashReportList * @instance */ CrashReportList.prototype.reports = $util.emptyArray; /** * Creates a new CrashReportList instance using the specified properties. * @function create * @memberof signalservice.CrashReportList * @static * @param {signalservice.ICrashReportList=} [properties] Properties to set * @returns {signalservice.CrashReportList} CrashReportList instance */ CrashReportList.create = function create(properties) { return new CrashReportList(properties); }; /** * Encodes the specified CrashReportList message. Does not implicitly {@link signalservice.CrashReportList.verify|verify} messages. * @function encode * @memberof signalservice.CrashReportList * @static * @param {signalservice.ICrashReportList} message CrashReportList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CrashReportList.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.reports != null && message.reports.length) for (var i = 0; i < message.reports.length; ++i) $root.signalservice.CrashReport.encode(message.reports[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** * Encodes the specified CrashReportList message, length delimited. Does not implicitly {@link signalservice.CrashReportList.verify|verify} messages. * @function encodeDelimited * @memberof signalservice.CrashReportList * @static * @param {signalservice.ICrashReportList} message CrashReportList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CrashReportList.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CrashReportList message from the specified reader or buffer. * @function decode * @memberof signalservice.CrashReportList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {signalservice.CrashReportList} CrashReportList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CrashReportList.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.signalservice.CrashReportList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (!(message.reports && message.reports.length)) message.reports = []; message.reports.push($root.signalservice.CrashReport.decode(reader, reader.uint32())); break; } default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CrashReportList message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof signalservice.CrashReportList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {signalservice.CrashReportList} CrashReportList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CrashReportList.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a CrashReportList message. * @function verify * @memberof signalservice.CrashReportList * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ CrashReportList.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.reports != null && message.hasOwnProperty("reports")) { if (!Array.isArray(message.reports)) return "reports: array expected"; for (var i = 0; i < message.reports.length; ++i) { var error = $root.signalservice.CrashReport.verify(message.reports[i]); if (error) return "reports." + error; } } return null; }; /** * Creates a CrashReportList message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof signalservice.CrashReportList * @static * @param {Object.<string,*>} object Plain object * @returns {signalservice.CrashReportList} CrashReportList */ CrashReportList.fromObject = function fromObject(object) { if (object instanceof $root.signalservice.CrashReportList) return object; var message = new $root.signalservice.CrashReportList(); if (object.reports) { if (!Array.isArray(object.reports)) throw TypeError(".signalservice.CrashReportList.reports: array expected"); message.reports = []; for (var i = 0; i < object.reports.length; ++i) { if (typeof object.reports[i] !== "object") throw TypeError(".signalservice.CrashReportList.reports: object expected"); message.reports