UNPKG

@whiskeysockets/baileys

Version:

A WebSockets library for interacting with WhatsApp Web

1,175 lines (1,064 loc) 4.45 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*/ import $protobuf from "protobufjs/minimal.js"; const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); export const proto = $root.proto = (() => { const proto = {}; proto.ADVDeviceIdentity = (function() { function ADVDeviceIdentity(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } ADVDeviceIdentity.prototype.rawId = null; ADVDeviceIdentity.prototype.timestamp = null; ADVDeviceIdentity.prototype.keyIndex = null; ADVDeviceIdentity.prototype.accountType = null; ADVDeviceIdentity.prototype.deviceType = null; let $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) }); ADVDeviceIdentity.create = function create(properties) { return new ADVDeviceIdentity(properties); }; ADVDeviceIdentity.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.rawId != null && Object.hasOwnProperty.call(m, "rawId")) w.uint32(8).uint32(m.rawId); if (m.timestamp != null && Object.hasOwnProperty.call(m, "timestamp")) w.uint32(16).uint64(m.timestamp); if (m.keyIndex != null && Object.hasOwnProperty.call(m, "keyIndex")) w.uint32(24).uint32(m.keyIndex); if (m.accountType != null && Object.hasOwnProperty.call(m, "accountType")) w.uint32(32).int32(m.accountType); if (m.deviceType != null && Object.hasOwnProperty.call(m, "deviceType")) w.uint32(40).int32(m.deviceType); return w; }; ADVDeviceIdentity.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.ADVDeviceIdentity(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.rawId = r.uint32(); break; } case 2: { m.timestamp = r.uint64(); break; } case 3: { m.keyIndex = r.uint32(); break; } case 4: { m.accountType = r.int32(); break; } case 5: { m.deviceType = r.int32(); break; } default: r.skipType(t & 7); break; } } return m; }; ADVDeviceIdentity.fromObject = function fromObject(d) { if (d instanceof $root.proto.ADVDeviceIdentity) return d; var m = new $root.proto.ADVDeviceIdentity(); if (d.rawId != null) { m.rawId = d.rawId >>> 0; } if (d.timestamp != null) { if ($util.Long) (m.timestamp = $util.Long.fromValue(d.timestamp)).unsigned = true; else if (typeof d.timestamp === "string") m.timestamp = parseInt(d.timestamp, 10); else if (typeof d.timestamp === "number") m.timestamp = d.timestamp; else if (typeof d.timestamp === "object") m.timestamp = new $util.LongBits(d.timestamp.low >>> 0, d.timestamp.high >>> 0).toNumber(true); } if (d.keyIndex != null) { m.keyIndex = d.keyIndex >>> 0; } switch (d.accountType) { default: if (typeof d.accountType === "number") { m.accountType = d.accountType; break; } break; case "E2EE": case 0: m.accountType = 0; break; case "HOSTED": case 1: m.accountType = 1; break; } switch (d.deviceType) { default: if (typeof d.deviceType === "number") { m.deviceType = d.deviceType; break; } break; case "E2EE": case 0: m.deviceType = 0; break; case "HOSTED": case 1: m.deviceType = 1; break; } return m; }; ADVDeviceIdentity.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (m.rawId != null && m.hasOwnProperty("rawId")) { d.rawId = m.rawId; if (o.oneofs) d._rawId = "rawId"; } if (m.timestamp != null && m.hasOwnProperty("timestamp")) { if (typeof m.timestamp === "number") d.timestamp = o.longs === String ? String(m.timestamp) : m.timestamp; else d.timestamp = o.longs === String ? $util.Long.prototype.toString.call(m.timestamp) : o.longs === Number ? new $util.LongBits(m.timestamp.low >>> 0, m.timestamp.high >>> 0).toNumber(true) : m.timestamp; if (o.oneofs) d._timestamp = "timestamp"; } if (m.keyIndex != null && m.hasOwnProperty("keyIndex")) { d.keyIndex = m.keyIndex; if (o.oneofs) d._keyIndex = "keyIndex"; } if (m.accountType != null && m.hasOwnProperty("accountType")) { d.accountType = o.enums === String ? $root.proto.ADVEncryptionType[m.accountType] === undefined ? m.accountType : $root.proto.ADVEncryptionType[m.accountType] : m.accountType; if (o.oneofs) d._accountType = "accountType"; } if (m.deviceType != null && m.hasOwnProperty("deviceType")) { d.deviceType = o.enums === String ? $root.proto.ADVEncryptionType[m.deviceType] === undefined ? m.deviceType : $root.proto.ADVEncryptionType[m.deviceType] : m.deviceType; if (o.oneofs) d._deviceType = "deviceType"; } return d; }; ADVDeviceIdentity.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; ADVDeviceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVDeviceIdentity"; }; return ADVDeviceIdentity; })(); proto.ADVEncryptionType = (function() { const valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "E2EE"] = 0; values[valuesById[1] = "HOSTED"] = 1; return values; })(); proto.ADVKeyIndexList = (function() { function ADVKeyIndexList(p) { this.validIndexes = []; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } ADVKeyIndexList.prototype.rawId = null; ADVKeyIndexList.prototype.timestamp = null; ADVKeyIndexList.prototype.currentIndex = null; ADVKeyIndexList.prototype.validIndexes = $util.emptyArray; ADVKeyIndexList.prototype.accountType = null; let $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) }); ADVKeyIndexList.create = function create(properties) { return new ADVKeyIndexList(properties); }; ADVKeyIndexList.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.rawId != null && Object.hasOwnProperty.call(m, "rawId")) w.uint32(8).uint32(m.rawId); if (m.timestamp != null && Object.hasOwnProperty.call(m, "timestamp")) w.uint32(16).uint64(m.timestamp); if (m.currentIndex != null && Object.hasOwnProperty.call(m, "currentIndex")) w.uint32(24).uint32(m.currentIndex); if (m.validIndexes != null && m.validIndexes.length) { w.uint32(34).fork(); for (var i = 0; i < m.validIndexes.length; ++i) w.uint32(m.validIndexes[i]); w.ldelim(); } if (m.accountType != null && Object.hasOwnProperty.call(m, "accountType")) w.uint32(40).int32(m.accountType); return w; }; ADVKeyIndexList.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.ADVKeyIndexList(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.rawId = r.uint32(); break; } case 2: { m.timestamp = r.uint64(); break; } case 3: { m.currentIndex = r.uint32(); break; } case 4: { if (!(m.validIndexes && m.validIndexes.length)) m.validIndexes = []; if ((t & 7) === 2) { var c2 = r.uint32() + r.pos; while (r.pos < c2) m.validIndexes.push(r.uint32()); } else m.validIndexes.push(r.uint32()); break; } case 5: { m.accountType = r.int32(); break; } default: r.skipType(t & 7); break; } } return m; }; ADVKeyIndexList.fromObject = function fromObject(d) { if (d instanceof $root.proto.ADVKeyIndexList) return d; var m = new $root.proto.ADVKeyIndexList(); if (d.rawId != null) { m.rawId = d.rawId >>> 0; } if (d.timestamp != null) { if ($util.Long) (m.timestamp = $util.Long.fromValue(d.timestamp)).unsigned = true; else if (typeof d.timestamp === "string") m.timestamp = parseInt(d.timestamp, 10); else if (typeof d.timestamp === "number") m.timestamp = d.timestamp; else if (typeof d.timestamp === "object") m.timestamp = new $util.LongBits(d.timestamp.low >>> 0, d.timestamp.high >>> 0).toNumber(true); } if (d.currentIndex != null) { m.currentIndex = d.currentIndex >>> 0; } if (d.validIndexes) { if (!Array.isArray(d.validIndexes)) throw TypeError(".proto.ADVKeyIndexList.validIndexes: array expected"); m.validIndexes = []; for (var i = 0; i < d.validIndexes.length; ++i) { m.validIndexes[i] = d.validIndexes[i] >>> 0; } } switch (d.accountType) { default: if (typeof d.accountType === "number") { m.accountType = d.accountType; break; } break; case "E2EE": case 0: m.accountType = 0; break; case "HOSTED": case 1: m.accountType = 1; break; } return m; }; ADVKeyIndexList.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (o.arrays || o.defaults) { d.validIndexes = []; } if (m.rawId != null && m.hasOwnProperty("rawId")) { d.rawId = m.rawId; if (o.oneofs) d._rawId = "rawId"; } if (m.timestamp != null && m.hasOwnProperty("timestamp")) { if (typeof m.timestamp === "number") d.timestamp = o.longs === String ? String(m.timestamp) : m.timestamp; else d.timestamp = o.longs === String ? $util.Long.prototype.toString.call(m.timestamp) : o.longs === Number ? new $util.LongBits(m.timestamp.low >>> 0, m.timestamp.high >>> 0).toNumber(true) : m.timestamp; if (o.oneofs) d._timestamp = "timestamp"; } if (m.currentIndex != null && m.hasOwnProperty("currentIndex")) { d.currentIndex = m.currentIndex; if (o.oneofs) d._currentIndex = "currentIndex"; } if (m.validIndexes && m.validIndexes.length) { d.validIndexes = []; for (var j = 0; j < m.validIndexes.length; ++j) { d.validIndexes[j] = m.validIndexes[j]; } } if (m.accountType != null && m.hasOwnProperty("accountType")) { d.accountType = o.enums === String ? $root.proto.ADVEncryptionType[m.accountType] === undefined ? m.accountType : $root.proto.ADVEncryptionType[m.accountType] : m.accountType; if (o.oneofs) d._accountType = "accountType"; } return d; }; ADVKeyIndexList.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; ADVKeyIndexList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVKeyIndexList"; }; return ADVKeyIndexList; })(); proto.ADVSignedDeviceIdentity = (function() { function ADVSignedDeviceIdentity(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } ADVSignedDeviceIdentity.prototype.details = null; ADVSignedDeviceIdentity.prototype.accountSignatureKey = null; ADVSignedDeviceIdentity.prototype.accountSignature = null; ADVSignedDeviceIdentity.prototype.deviceSignature = null; let $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) }); ADVSignedDeviceIdentity.create = function create(properties) { return new ADVSignedDeviceIdentity(properties); }; ADVSignedDeviceIdentity.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.details != null && Object.hasOwnProperty.call(m, "details")) w.uint32(10).bytes(m.details); if (m.accountSignatureKey != null && Object.hasOwnProperty.call(m, "accountSignatureKey")) w.uint32(18).bytes(m.accountSignatureKey); if (m.accountSignature != null && Object.hasOwnProperty.call(m, "accountSignature")) w.uint32(26).bytes(m.accountSignature); if (m.deviceSignature != null && Object.hasOwnProperty.call(m, "deviceSignature")) w.uint32(34).bytes(m.deviceSignature); return w; }; ADVSignedDeviceIdentity.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.ADVSignedDeviceIdentity(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.details = r.bytes(); break; } case 2: { m.accountSignatureKey = r.bytes(); break; } case 3: { m.accountSignature = r.bytes(); break; } case 4: { m.deviceSignature = r.bytes(); break; } default: r.skipType(t & 7); break; } } return m; }; ADVSignedDeviceIdentity.fromObject = function fromObject(d) { if (d instanceof $root.proto.ADVSignedDeviceIdentity) return d; var m = new $root.proto.ADVSignedDeviceIdentity(); if (d.details != null) { if (typeof d.details === "string") $util.base64.decode(d.details, m.details = $util.newBuffer($util.base64.length(d.details)), 0); else if (d.details.length >= 0) m.details = d.details; } if (d.accountSignatureKey != null) { if (typeof d.accountSignatureKey === "string") $util.base64.decode(d.accountSignatureKey, m.accountSignatureKey = $util.newBuffer($util.base64.length(d.accountSignatureKey)), 0); else if (d.accountSignatureKey.length >= 0) m.accountSignatureKey = d.accountSignatureKey; } if (d.accountSignature != null) { if (typeof d.accountSignature === "string") $util.base64.decode(d.accountSignature, m.accountSignature = $util.newBuffer($util.base64.length(d.accountSignature)), 0); else if (d.accountSignature.length >= 0) m.accountSignature = d.accountSignature; } if (d.deviceSignature != null) { if (typeof d.deviceSignature === "string") $util.base64.decode(d.deviceSignature, m.deviceSignature = $util.newBuffer($util.base64.length(d.deviceSignature)), 0); else if (d.deviceSignature.length >= 0) m.deviceSignature = d.deviceSignature; } return m; }; ADVSignedDeviceIdentity.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (m.details != null && m.hasOwnProperty("details")) { d.details = o.bytes === String ? $util.base64.encode(m.details, 0, m.details.length) : o.bytes === Array ? Array.prototype.slice.call(m.details) : m.details; if (o.oneofs) d._details = "details"; } if (m.accountSignatureKey != null && m.hasOwnProperty("accountSignatureKey")) { d.accountSignatureKey = o.bytes === String ? $util.base64.encode(m.accountSignatureKey, 0, m.accountSignatureKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.accountSignatureKey) : m.accountSignatureKey; if (o.oneofs) d._accountSignatureKey = "accountSignatureKey"; } if (m.accountSignature != null && m.hasOwnProperty("accountSignature")) { d.accountSignature = o.bytes === String ? $util.base64.encode(m.accountSignature, 0, m.accountSignature.length) : o.bytes === Array ? Array.prototype.slice.call(m.accountSignature) : m.accountSignature; if (o.oneofs) d._accountSignature = "accountSignature"; } if (m.deviceSignature != null && m.hasOwnProperty("deviceSignature")) { d.deviceSignature = o.bytes === String ? $util.base64.encode(m.deviceSignature, 0, m.deviceSignature.length) : o.bytes === Array ? Array.prototype.slice.call(m.deviceSignature) : m.deviceSignature; if (o.oneofs) d._deviceSignature = "deviceSignature"; } return d; }; ADVSignedDeviceIdentity.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; ADVSignedDeviceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVSignedDeviceIdentity"; }; return ADVSignedDeviceIdentity; })(); proto.ADVSignedDeviceIdentityHMAC = (function() { function ADVSignedDeviceIdentityHMAC(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } ADVSignedDeviceIdentityHMAC.prototype.details = null; ADVSignedDeviceIdentityHMAC.prototype.hmac = null; ADVSignedDeviceIdentityHMAC.prototype.accountType = null; let $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_details", { get: $util.oneOfGetter($oneOfFields = ["details"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_hmac", { get: $util.oneOfGetter($oneOfFields = ["hmac"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_accountType", { get: $util.oneOfGetter($oneOfFields = ["accountType"]), set: $util.oneOfSetter($oneOfFields) }); ADVSignedDeviceIdentityHMAC.create = function create(properties) { return new ADVSignedDeviceIdentityHMAC(properties); }; ADVSignedDeviceIdentityHMAC.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.details != null && Object.hasOwnProperty.call(m, "details")) w.uint32(10).bytes(m.details); if (m.hmac != null && Object.hasOwnProperty.call(m, "hmac")) w.uint32(18).bytes(m.hmac); if (m.accountType != null && Object.hasOwnProperty.call(m, "accountType")) w.uint32(24).int32(m.accountType); return w; }; ADVSignedDeviceIdentityHMAC.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.ADVSignedDeviceIdentityHMAC(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.details = r.bytes(); break; } case 2: { m.hmac = r.bytes(); break; } case 3: { m.accountType = r.int32(); break; } default: r.skipType(t & 7); break; } } return m; }; ADVSignedDeviceIdentityHMAC.fromObject = function fromObject(d) { if (d instanceof $root.proto.ADVSignedDeviceIdentityHMAC) return d; var m = new $root.proto.ADVSignedDeviceIdentityHMAC(); if (d.details != null) { if (typeof d.details === "string") $util.base64.decode(d.details, m.details = $util.newBuffer($util.base64.length(d.details)), 0); else if (d.details.length >= 0) m.details = d.details; } if (d.hmac != null) { if (typeof d.hmac === "string") $util.base64.decode(d.hmac, m.hmac = $util.newBuffer($util.base64.length(d.hmac)), 0); else if (d.hmac.length >= 0) m.hmac = d.hmac; } switch (d.accountType) { default: if (typeof d.accountType === "number") { m.accountType = d.accountType; break; } break; case "E2EE": case 0: m.accountType = 0; break; case "HOSTED": case 1: m.accountType = 1; break; } return m; }; ADVSignedDeviceIdentityHMAC.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (m.details != null && m.hasOwnProperty("details")) { d.details = o.bytes === String ? $util.base64.encode(m.details, 0, m.details.length) : o.bytes === Array ? Array.prototype.slice.call(m.details) : m.details; if (o.oneofs) d._details = "details"; } if (m.hmac != null && m.hasOwnProperty("hmac")) { d.hmac = o.bytes === String ? $util.base64.encode(m.hmac, 0, m.hmac.length) : o.bytes === Array ? Array.prototype.slice.call(m.hmac) : m.hmac; if (o.oneofs) d._hmac = "hmac"; } if (m.accountType != null && m.hasOwnProperty("accountType")) { d.accountType = o.enums === String ? $root.proto.ADVEncryptionType[m.accountType] === undefined ? m.accountType : $root.proto.ADVEncryptionType[m.accountType] : m.accountType; if (o.oneofs) d._accountType = "accountType"; } return d; }; ADVSignedDeviceIdentityHMAC.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; ADVSignedDeviceIdentityHMAC.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVSignedDeviceIdentityHMAC"; }; return ADVSignedDeviceIdentityHMAC; })(); proto.ADVSignedKeyIndexList = (function() { function ADVSignedKeyIndexList(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } ADVSignedKeyIndexList.prototype.details = null; ADVSignedKeyIndexList.prototype.accountSignature = null; ADVSignedKeyIndexList.prototype.accountSignatureKey = null; let $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedKeyIndexList.prototype, "_details", { get: $util.oneOfGetter($oneOfFields = ["details"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedKeyIndexList.prototype, "_accountSignature", { get: $util.oneOfGetter($oneOfFields = ["accountSignature"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(ADVSignedKeyIndexList.prototype, "_accountSignatureKey", { get: $util.oneOfGetter($oneOfFields = ["accountSignatureKey"]), set: $util.oneOfSetter($oneOfFields) }); ADVSignedKeyIndexList.create = function create(properties) { return new ADVSignedKeyIndexList(properties); }; ADVSignedKeyIndexList.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.details != null && Object.hasOwnProperty.call(m, "details")) w.uint32(10).bytes(m.details); if (m.accountSignature != null && Object.hasOwnProperty.call(m, "accountSignature")) w.uint32(18).bytes(m.accountSignature); if (m.accountSignatureKey != null && Object.hasOwnProperty.call(m, "accountSignatureKey")) w.uint32(26).bytes(m.accountSignatureKey); return w; }; ADVSignedKeyIndexList.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.ADVSignedKeyIndexList(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.details = r.bytes(); break; } case 2: { m.accountSignature = r.bytes(); break; } case 3: { m.accountSignatureKey = r.bytes(); break; } default: r.skipType(t & 7); break; } } return m; }; ADVSignedKeyIndexList.fromObject = function fromObject(d) { if (d instanceof $root.proto.ADVSignedKeyIndexList) return d; var m = new $root.proto.ADVSignedKeyIndexList(); if (d.details != null) { if (typeof d.details === "string") $util.base64.decode(d.details, m.details = $util.newBuffer($util.base64.length(d.details)), 0); else if (d.details.length >= 0) m.details = d.details; } if (d.accountSignature != null) { if (typeof d.accountSignature === "string") $util.base64.decode(d.accountSignature, m.accountSignature = $util.newBuffer($util.base64.length(d.accountSignature)), 0); else if (d.accountSignature.length >= 0) m.accountSignature = d.accountSignature; } if (d.accountSignatureKey != null) { if (typeof d.accountSignatureKey === "string") $util.base64.decode(d.accountSignatureKey, m.accountSignatureKey = $util.newBuffer($util.base64.length(d.accountSignatureKey)), 0); else if (d.accountSignatureKey.length >= 0) m.accountSignatureKey = d.accountSignatureKey; } return m; }; ADVSignedKeyIndexList.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (m.details != null && m.hasOwnProperty("details")) { d.details = o.bytes === String ? $util.base64.encode(m.details, 0, m.details.length) : o.bytes === Array ? Array.prototype.slice.call(m.details) : m.details; if (o.oneofs) d._details = "details"; } if (m.accountSignature != null && m.hasOwnProperty("accountSignature")) { d.accountSignature = o.bytes === String ? $util.base64.encode(m.accountSignature, 0, m.accountSignature.length) : o.bytes === Array ? Array.prototype.slice.call(m.accountSignature) : m.accountSignature; if (o.oneofs) d._accountSignature = "accountSignature"; } if (m.accountSignatureKey != null && m.hasOwnProperty("accountSignatureKey")) { d.accountSignatureKey = o.bytes === String ? $util.base64.encode(m.accountSignatureKey, 0, m.accountSignatureKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.accountSignatureKey) : m.accountSignatureKey; if (o.oneofs) d._accountSignatureKey = "accountSignatureKey"; } return d; }; ADVSignedKeyIndexList.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; ADVSignedKeyIndexList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.ADVSignedKeyIndexList"; }; return ADVSignedKeyIndexList; })(); proto.AIHomeState = (function() { function AIHomeState(p) { this.capabilityOptions = []; this.conversationOptions = []; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } AIHomeState.prototype.lastFetchTime = null; AIHomeState.prototype.capabilityOptions = $util.emptyArray; AIHomeState.prototype.conversationOptions = $util.emptyArray; let $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeState.prototype, "_lastFetchTime", { get: $util.oneOfGetter($oneOfFields = ["lastFetchTime"]), set: $util.oneOfSetter($oneOfFields) }); AIHomeState.create = function create(properties) { return new AIHomeState(properties); }; AIHomeState.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.lastFetchTime != null && Object.hasOwnProperty.call(m, "lastFetchTime")) w.uint32(8).int64(m.lastFetchTime); if (m.capabilityOptions != null && m.capabilityOptions.length) { for (var i = 0; i < m.capabilityOptions.length; ++i) $root.proto.AIHomeState.AIHomeOption.encode(m.capabilityOptions[i], w.uint32(18).fork()).ldelim(); } if (m.conversationOptions != null && m.conversationOptions.length) { for (var i = 0; i < m.conversationOptions.length; ++i) $root.proto.AIHomeState.AIHomeOption.encode(m.conversationOptions[i], w.uint32(26).fork()).ldelim(); } return w; }; AIHomeState.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.AIHomeState(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.lastFetchTime = r.int64(); break; } case 2: { if (!(m.capabilityOptions && m.capabilityOptions.length)) m.capabilityOptions = []; m.capabilityOptions.push($root.proto.AIHomeState.AIHomeOption.decode(r, r.uint32())); break; } case 3: { if (!(m.conversationOptions && m.conversationOptions.length)) m.conversationOptions = []; m.conversationOptions.push($root.proto.AIHomeState.AIHomeOption.decode(r, r.uint32())); break; } default: r.skipType(t & 7); break; } } return m; }; AIHomeState.fromObject = function fromObject(d) { if (d instanceof $root.proto.AIHomeState) return d; var m = new $root.proto.AIHomeState(); if (d.lastFetchTime != null) { if ($util.Long) (m.lastFetchTime = $util.Long.fromValue(d.lastFetchTime)).unsigned = false; else if (typeof d.lastFetchTime === "string") m.lastFetchTime = parseInt(d.lastFetchTime, 10); else if (typeof d.lastFetchTime === "number") m.lastFetchTime = d.lastFetchTime; else if (typeof d.lastFetchTime === "object") m.lastFetchTime = new $util.LongBits(d.lastFetchTime.low >>> 0, d.lastFetchTime.high >>> 0).toNumber(); } if (d.capabilityOptions) { if (!Array.isArray(d.capabilityOptions)) throw TypeError(".proto.AIHomeState.capabilityOptions: array expected"); m.capabilityOptions = []; for (var i = 0; i < d.capabilityOptions.length; ++i) { if (typeof d.capabilityOptions[i] !== "object") throw TypeError(".proto.AIHomeState.capabilityOptions: object expected"); m.capabilityOptions[i] = $root.proto.AIHomeState.AIHomeOption.fromObject(d.capabilityOptions[i]); } } if (d.conversationOptions) { if (!Array.isArray(d.conversationOptions)) throw TypeError(".proto.AIHomeState.conversationOptions: array expected"); m.conversationOptions = []; for (var i = 0; i < d.conversationOptions.length; ++i) { if (typeof d.conversationOptions[i] !== "object") throw TypeError(".proto.AIHomeState.conversationOptions: object expected"); m.conversationOptions[i] = $root.proto.AIHomeState.AIHomeOption.fromObject(d.conversationOptions[i]); } } return m; }; AIHomeState.toObject = function toObject(m, o) { if (!o) o = {}; var d = {}; if (o.arrays || o.defaults) { d.capabilityOptions = []; d.conversationOptions = []; } if (m.lastFetchTime != null && m.hasOwnProperty("lastFetchTime")) { if (typeof m.lastFetchTime === "number") d.lastFetchTime = o.longs === String ? String(m.lastFetchTime) : m.lastFetchTime; else d.lastFetchTime = o.longs === String ? $util.Long.prototype.toString.call(m.lastFetchTime) : o.longs === Number ? new $util.LongBits(m.lastFetchTime.low >>> 0, m.lastFetchTime.high >>> 0).toNumber() : m.lastFetchTime; if (o.oneofs) d._lastFetchTime = "lastFetchTime"; } if (m.capabilityOptions && m.capabilityOptions.length) { d.capabilityOptions = []; for (var j = 0; j < m.capabilityOptions.length; ++j) { d.capabilityOptions[j] = $root.proto.AIHomeState.AIHomeOption.toObject(m.capabilityOptions[j], o); } } if (m.conversationOptions && m.conversationOptions.length) { d.conversationOptions = []; for (var j = 0; j < m.conversationOptions.length; ++j) { d.conversationOptions[j] = $root.proto.AIHomeState.AIHomeOption.toObject(m.conversationOptions[j], o); } } return d; }; AIHomeState.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; AIHomeState.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/proto.AIHomeState"; }; AIHomeState.AIHomeOption = (function() { function AIHomeOption(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } AIHomeOption.prototype.type = null; AIHomeOption.prototype.title = null; AIHomeOption.prototype.promptText = null; AIHomeOption.prototype.sessionId = null; AIHomeOption.prototype.imageWdsIdentifier = null; AIHomeOption.prototype.imageTintColor = null; AIHomeOption.prototype.imageBackgroundColor = null; let $oneOfFields; // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_type", { get: $util.oneOfGetter($oneOfFields = ["type"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_title", { get: $util.oneOfGetter($oneOfFields = ["title"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_promptText", { get: $util.oneOfGetter($oneOfFields = ["promptText"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_sessionId", { get: $util.oneOfGetter($oneOfFields = ["sessionId"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_imageWdsIdentifier", { get: $util.oneOfGetter($oneOfFields = ["imageWdsIdentifier"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_imageTintColor", { get: $util.oneOfGetter($oneOfFields = ["imageTintColor"]), set: $util.oneOfSetter($oneOfFields) }); // Virtual OneOf for proto3 optional field Object.defineProperty(AIHomeOption.prototype, "_imageBackgroundColor", { get: $util.oneOfGetter($oneOfFields = ["imageBackgroundColor"]), set: $util.oneOfSetter($oneOfFields) }); AIHomeOption.create = function create(properties) { return new AIHomeOption(properties); }; AIHomeOption.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.type != null && Object.hasOwnProperty.call(m, "type")) w.uint32(8).int32(m.type); if (m.title != null && Object.hasOwnProperty.call(m, "title")) w.uint32(18).string(m.title); if (m.promptText != null && Object.hasOwnProperty.call(m, "promptText")) w.uint32(26).string(m.promptText); if (m.sessionId != null && Object.hasOwnProperty.call(m, "sessionId")) w.uint32(34).string(m.sessionId); if (m.imageWdsIdentifier != null && Object.hasOwnProperty.call(m, "imageWdsIdentifier")) w.uint32(42).string(m.imageWdsIdentifier); if (m.imageTintColor != null && Object.hasOwnProperty.call(m, "imageTintColor")) w.uint32(50).string(m.imageTintColor); if (m.imageBackgroundColor != null && Object.hasOwnProperty.call(m, "imageBackgroundColor")) w.uint32(58).string(m.imageBackgroundColor); return w; }; AIHomeOption.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.AIHomeState.AIHomeOption(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.type = r.int32(); break; } case 2: { m.title = r.string(); break; } case 3: { m.promptText = r.string(); break; } case 4: { m.sessionId = r.string(); break; } case 5: { m.imageWdsIdentifier = r.string(); break; } case 6: { m.imageTintColor = r.string(); break; } case 7: { m.imageBackgroundColor = r.string(); break; } default: r.skipType(t & 7); break; } } return m; }; AIHomeOption.fromObject = function fromObject(d) { if (d instanceof $root.proto.AIHomeState.AIHomeOption) return