@aseppxyzz12/baileys 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +2579 -0
  3. package/WAProto/AICommon/AICommon.js +19396 -0
  4. package/WAProto/AICommon/AICommon.proto +820 -0
  5. package/WAProto/Adv/Adv.js +1137 -0
  6. package/WAProto/Adv/Adv.proto +42 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +8975 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +484 -0
  9. package/WAProto/Cert/Cert.js +893 -0
  10. package/WAProto/Cert/Cert.proto +30 -0
  11. package/WAProto/ChatLockSettings/ChatLockSettings.js +673 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.proto +9 -0
  13. package/WAProto/CompanionReg/CompanionReg.js +2457 -0
  14. package/WAProto/CompanionReg/CompanionReg.proto +103 -0
  15. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +846 -0
  16. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +38 -0
  17. package/WAProto/E2E/E2E.js +78728 -0
  18. package/WAProto/E2E/E2E.proto +1970 -0
  19. package/WAProto/Ephemeral/Ephemeral.js +143 -0
  20. package/WAProto/Ephemeral/Ephemeral.proto +7 -0
  21. package/WAProto/HistorySync/HistorySync.js +95931 -0
  22. package/WAProto/HistorySync/HistorySync.proto +229 -0
  23. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +414 -0
  24. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +13 -0
  25. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +980 -0
  26. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +38 -0
  27. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +81185 -0
  28. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +88 -0
  29. package/WAProto/MmsRetry/MmsRetry.js +310 -0
  30. package/WAProto/MmsRetry/MmsRetry.proto +19 -0
  31. package/WAProto/Protocol/Protocol.js +399 -0
  32. package/WAProto/Protocol/Protocol.proto +22 -0
  33. package/WAProto/Reporting/Reporting.js +535 -0
  34. package/WAProto/Reporting/Reporting.proto +22 -0
  35. package/WAProto/ServerSync/ServerSync.js +1830 -0
  36. package/WAProto/ServerSync/ServerSync.proto +70 -0
  37. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +3267 -0
  38. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +95 -0
  39. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1140 -0
  40. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +44 -0
  41. package/WAProto/StatusAttributions/StatusAttributions.js +1604 -0
  42. package/WAProto/StatusAttributions/StatusAttributions.proto +89 -0
  43. package/WAProto/SyncAction/SyncAction.js +17424 -0
  44. package/WAProto/SyncAction/SyncAction.proto +663 -0
  45. package/WAProto/UserPassword/UserPassword.js +544 -0
  46. package/WAProto/UserPassword/UserPassword.proto +28 -0
  47. package/WAProto/VnameCert/VnameCert.js +1466 -0
  48. package/WAProto/VnameCert/VnameCert.proto +65 -0
  49. package/WAProto/Wa6/Wa6.js +4601 -0
  50. package/WAProto/Wa6/Wa6.proto +241 -0
  51. package/WAProto/Web/Web.js +90819 -0
  52. package/WAProto/Web/Web.proto +605 -0
  53. package/WAProto/index.js +30 -0
  54. package/engine-requirements.js +9 -0
  55. package/lib/Defaults/baileys-version.json +3 -0
  56. package/lib/Defaults/connection.js +39 -0
  57. package/lib/Defaults/constants.js +50 -0
  58. package/lib/Defaults/history.js +13 -0
  59. package/lib/Defaults/index.js +36 -0
  60. package/lib/Defaults/media.js +43 -0
  61. package/lib/Defaults/phonenumber-mcc.json +223 -0
  62. package/lib/Defaults/prefix.js +12 -0
  63. package/lib/Function/Download/tiktok.js +19 -0
  64. package/lib/Function/Tools/bypass.js +19 -0
  65. package/lib/Function/index.js +13 -0
  66. package/lib/Signal/Group/ciphertext-message.js +14 -0
  67. package/lib/Signal/Group/group-session-builder.js +46 -0
  68. package/lib/Signal/Group/group_cipher.js +104 -0
  69. package/lib/Signal/Group/index.js +42 -0
  70. package/lib/Signal/Group/keyhelper.js +21 -0
  71. package/lib/Signal/Group/queue-job.js +57 -0
  72. package/lib/Signal/Group/sender-chain-key.js +34 -0
  73. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  74. package/lib/Signal/Group/sender-key-message.js +78 -0
  75. package/lib/Signal/Group/sender-key-name.js +49 -0
  76. package/lib/Signal/Group/sender-key-record.js +45 -0
  77. package/lib/Signal/Group/sender-key-state.js +100 -0
  78. package/lib/Signal/Group/sender-message-key.js +28 -0
  79. package/lib/Signal/libsignal.js +364 -0
  80. package/lib/Signal/lid-mapping.js +164 -0
  81. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  82. package/lib/Socket/Client/index.js +31 -0
  83. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  84. package/lib/Socket/Client/types.js +12 -0
  85. package/lib/Socket/Client/web-socket-client.js +62 -0
  86. package/lib/Socket/Client/websocket.js +67 -0
  87. package/lib/Socket/business.js +291 -0
  88. package/lib/Socket/chats.js +874 -0
  89. package/lib/Socket/community.js +454 -0
  90. package/lib/Socket/dugong.js +658 -0
  91. package/lib/Socket/groups.js +357 -0
  92. package/lib/Socket/index.js +13 -0
  93. package/lib/Socket/messages-recv.js +1509 -0
  94. package/lib/Socket/messages-send.js +1505 -0
  95. package/lib/Socket/mex.js +54 -0
  96. package/lib/Socket/newsletter.js +171 -0
  97. package/lib/Socket/registration.js +167 -0
  98. package/lib/Socket/rich-content.js +279 -0
  99. package/lib/Socket/socket.js +905 -0
  100. package/lib/Socket/username.js +157 -0
  101. package/lib/Socket/usync.js +70 -0
  102. package/lib/Store/index.js +37 -0
  103. package/lib/Store/keyed-db.js +114 -0
  104. package/lib/Store/make-cache-manager-store.js +77 -0
  105. package/lib/Store/make-in-memory-store.js +423 -0
  106. package/lib/Store/make-ordered-dictionary.js +78 -0
  107. package/lib/Store/object-repository.js +26 -0
  108. package/lib/Types/Auth.js +2 -0
  109. package/lib/Types/Bussines.js +2 -0
  110. package/lib/Types/Call.js +2 -0
  111. package/lib/Types/Chat.js +10 -0
  112. package/lib/Types/Contact.js +2 -0
  113. package/lib/Types/Events.js +2 -0
  114. package/lib/Types/GroupMetadata.js +2 -0
  115. package/lib/Types/Label.js +25 -0
  116. package/lib/Types/LabelAssociation.js +4 -0
  117. package/lib/Types/Message.js +11 -0
  118. package/lib/Types/Mex.js +40 -0
  119. package/lib/Types/MexUpdates.js +15 -0
  120. package/lib/Types/Newsletter.js +32 -0
  121. package/lib/Types/Product.js +2 -0
  122. package/lib/Types/Signal.js +2 -0
  123. package/lib/Types/Socket.js +2 -0
  124. package/lib/Types/State.js +9 -0
  125. package/lib/Types/USync.js +2 -0
  126. package/lib/Types/index.js +60 -0
  127. package/lib/Utils/auth-utils.js +256 -0
  128. package/lib/Utils/baileys-event-stream.js +63 -0
  129. package/lib/Utils/bot-toolkit.js +455 -0
  130. package/lib/Utils/browser-utils.js +29 -0
  131. package/lib/Utils/business.js +233 -0
  132. package/lib/Utils/chat-utils.js +904 -0
  133. package/lib/Utils/companion-reg-client-utils.js +41 -0
  134. package/lib/Utils/crypto.js +144 -0
  135. package/lib/Utils/decode-wa-message.js +305 -0
  136. package/lib/Utils/event-buffer.js +555 -0
  137. package/lib/Utils/generics.js +411 -0
  138. package/lib/Utils/history.js +100 -0
  139. package/lib/Utils/identity-change-handler.js +53 -0
  140. package/lib/Utils/index.js +57 -0
  141. package/lib/Utils/link-preview.js +76 -0
  142. package/lib/Utils/logger.js +4 -0
  143. package/lib/Utils/lt-hash.js +45 -0
  144. package/lib/Utils/make-mutex.js +33 -0
  145. package/lib/Utils/message-composer.js +289 -0
  146. package/lib/Utils/message-retry-manager.js +134 -0
  147. package/lib/Utils/messages-media.js +806 -0
  148. package/lib/Utils/messages.js +1908 -0
  149. package/lib/Utils/noise-handler.js +157 -0
  150. package/lib/Utils/offline-node-processor.js +42 -0
  151. package/lib/Utils/pre-key-manager.js +86 -0
  152. package/lib/Utils/process-message.js +814 -0
  153. package/lib/Utils/reporting-utils.js +264 -0
  154. package/lib/Utils/signal.js +183 -0
  155. package/lib/Utils/stanza-ack.js +36 -0
  156. package/lib/Utils/sync-action-utils.js +52 -0
  157. package/lib/Utils/tc-token-utils.js +167 -0
  158. package/lib/Utils/use-multi-file-auth-state.js +104 -0
  159. package/lib/Utils/validate-connection.js +229 -0
  160. package/lib/Utils/vialeys-event-stream.js +41 -0
  161. package/lib/WABinary/constants.js +1308 -0
  162. package/lib/WABinary/decode.js +233 -0
  163. package/lib/WABinary/encode.js +212 -0
  164. package/lib/WABinary/generic-utils.js +124 -0
  165. package/lib/WABinary/index.js +36 -0
  166. package/lib/WABinary/jid-utils.js +101 -0
  167. package/lib/WABinary/types.js +2 -0
  168. package/lib/WAM/BinaryInfo.js +12 -0
  169. package/lib/WAM/constants.js +20491 -0
  170. package/lib/WAM/encode.js +148 -0
  171. package/lib/WAM/index.js +34 -0
  172. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -0
  173. package/lib/WAUSync/Protocols/USyncContactProtocol.js +38 -0
  174. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +50 -0
  175. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +25 -0
  176. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -0
  177. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +32 -0
  178. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  179. package/lib/WAUSync/Protocols/index.js +38 -0
  180. package/lib/WAUSync/USyncQuery.js +97 -0
  181. package/lib/WAUSync/USyncUser.js +33 -0
  182. package/lib/WAUSync/index.js +34 -0
  183. package/lib/index.js +113 -0
  184. package/lib/messages-send.js +1496 -0
  185. package/package.json +100 -0
@@ -0,0 +1,1137 @@
1
+ "use strict";
2
+ var $protobuf = require("protobufjs/minimal");
3
+ var $Reader = $protobuf.Reader,
4
+ $Writer = $protobuf.Writer,
5
+ $util = $protobuf.util;
6
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
7
+ $root.Adv = (function () {
8
+ var Adv = {};
9
+ Adv.ADVSignedDeviceIdentityHMAC = (function () {
10
+ function ADVSignedDeviceIdentityHMAC(properties) {
11
+ if (properties)
12
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
13
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
14
+ }
15
+ ADVSignedDeviceIdentityHMAC.prototype.details = null;
16
+ ADVSignedDeviceIdentityHMAC.prototype.hmac = null;
17
+ ADVSignedDeviceIdentityHMAC.prototype.accountType = null;
18
+ var $oneOfFields;
19
+ Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_details", {
20
+ get: $util.oneOfGetter(($oneOfFields = ["details"])),
21
+ set: $util.oneOfSetter($oneOfFields),
22
+ });
23
+ Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_hmac", {
24
+ get: $util.oneOfGetter(($oneOfFields = ["hmac"])),
25
+ set: $util.oneOfSetter($oneOfFields),
26
+ });
27
+ Object.defineProperty(ADVSignedDeviceIdentityHMAC.prototype, "_accountType", {
28
+ get: $util.oneOfGetter(($oneOfFields = ["accountType"])),
29
+ set: $util.oneOfSetter($oneOfFields),
30
+ });
31
+ ADVSignedDeviceIdentityHMAC.create = function create(properties) {
32
+ return new ADVSignedDeviceIdentityHMAC(properties);
33
+ };
34
+ ADVSignedDeviceIdentityHMAC.encode = function encode(message, writer) {
35
+ if (!writer) writer = $Writer.create();
36
+ if (message.details != null && Object.hasOwnProperty.call(message, "details"))
37
+ writer.uint32(10).bytes(message.details);
38
+ if (message.hmac != null && Object.hasOwnProperty.call(message, "hmac"))
39
+ writer.uint32(18).bytes(message.hmac);
40
+ if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType"))
41
+ writer.uint32(24).int32(message.accountType);
42
+ return writer;
43
+ };
44
+ ADVSignedDeviceIdentityHMAC.encodeDelimited = function encodeDelimited(message, writer) {
45
+ return this.encode(message, writer).ldelim();
46
+ };
47
+ ADVSignedDeviceIdentityHMAC.decode = function decode(reader, length, error) {
48
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
49
+ var end = length === undefined ? reader.len : reader.pos + length,
50
+ message = new $root.Adv.ADVSignedDeviceIdentityHMAC();
51
+ while (reader.pos < end) {
52
+ var tag = reader.uint32();
53
+ if (tag === error) break;
54
+ switch (tag >>> 3) {
55
+ case 1: {
56
+ message.details = reader.bytes();
57
+ break;
58
+ }
59
+ case 2: {
60
+ message.hmac = reader.bytes();
61
+ break;
62
+ }
63
+ case 3: {
64
+ message.accountType = reader.int32();
65
+ break;
66
+ }
67
+ default:
68
+ reader.skipType(tag & 7);
69
+ break;
70
+ }
71
+ }
72
+ return message;
73
+ };
74
+ ADVSignedDeviceIdentityHMAC.decodeDelimited = function decodeDelimited(reader) {
75
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
76
+ return this.decode(reader, reader.uint32());
77
+ };
78
+ ADVSignedDeviceIdentityHMAC.verify = function verify(message) {
79
+ if (typeof message !== "object" || message === null) return "object expected";
80
+ var properties = {};
81
+ if (message.details != null && message.hasOwnProperty("details")) {
82
+ properties._details = 1;
83
+ if (
84
+ !(
85
+ (message.details && typeof message.details.length === "number") ||
86
+ $util.isString(message.details)
87
+ )
88
+ )
89
+ return "details: buffer expected";
90
+ }
91
+ if (message.hmac != null && message.hasOwnProperty("hmac")) {
92
+ properties._hmac = 1;
93
+ if (
94
+ !(
95
+ (message.hmac && typeof message.hmac.length === "number") ||
96
+ $util.isString(message.hmac)
97
+ )
98
+ )
99
+ return "hmac: buffer expected";
100
+ }
101
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
102
+ properties._accountType = 1;
103
+ switch (message.accountType) {
104
+ default:
105
+ return "accountType: enum value expected";
106
+ case 0:
107
+ case 1:
108
+ break;
109
+ }
110
+ }
111
+ return null;
112
+ };
113
+ ADVSignedDeviceIdentityHMAC.fromObject = function fromObject(object) {
114
+ if (object instanceof $root.Adv.ADVSignedDeviceIdentityHMAC) return object;
115
+ var message = new $root.Adv.ADVSignedDeviceIdentityHMAC();
116
+ if (object.details != null)
117
+ if (typeof object.details === "string")
118
+ $util.base64.decode(
119
+ object.details,
120
+ (message.details = $util.newBuffer($util.base64.length(object.details))),
121
+ 0
122
+ );
123
+ else if (object.details.length >= 0) message.details = object.details;
124
+ if (object.hmac != null)
125
+ if (typeof object.hmac === "string")
126
+ $util.base64.decode(
127
+ object.hmac,
128
+ (message.hmac = $util.newBuffer($util.base64.length(object.hmac))),
129
+ 0
130
+ );
131
+ else if (object.hmac.length >= 0) message.hmac = object.hmac;
132
+ switch (object.accountType) {
133
+ default:
134
+ if (typeof object.accountType === "number") {
135
+ message.accountType = object.accountType;
136
+ break;
137
+ }
138
+ break;
139
+ case "E2EE":
140
+ case 0:
141
+ message.accountType = 0;
142
+ break;
143
+ case "HOSTED":
144
+ case 1:
145
+ message.accountType = 1;
146
+ break;
147
+ }
148
+ return message;
149
+ };
150
+ ADVSignedDeviceIdentityHMAC.toObject = function toObject(message, options) {
151
+ if (!options) options = {};
152
+ var object = {};
153
+ if (message.details != null && message.hasOwnProperty("details")) {
154
+ object.details =
155
+ options.bytes === String
156
+ ? $util.base64.encode(message.details, 0, message.details.length)
157
+ : options.bytes === Array
158
+ ? Array.prototype.slice.call(message.details)
159
+ : message.details;
160
+ if (options.oneofs) object._details = "details";
161
+ }
162
+ if (message.hmac != null && message.hasOwnProperty("hmac")) {
163
+ object.hmac =
164
+ options.bytes === String
165
+ ? $util.base64.encode(message.hmac, 0, message.hmac.length)
166
+ : options.bytes === Array
167
+ ? Array.prototype.slice.call(message.hmac)
168
+ : message.hmac;
169
+ if (options.oneofs) object._hmac = "hmac";
170
+ }
171
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
172
+ object.accountType =
173
+ options.enums === String
174
+ ? $root.Adv.ADVEncryptionType[message.accountType] === undefined
175
+ ? message.accountType
176
+ : $root.Adv.ADVEncryptionType[message.accountType]
177
+ : message.accountType;
178
+ if (options.oneofs) object._accountType = "accountType";
179
+ }
180
+ return object;
181
+ };
182
+ ADVSignedDeviceIdentityHMAC.prototype.toJSON = function toJSON() {
183
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
184
+ };
185
+ ADVSignedDeviceIdentityHMAC.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
186
+ if (typeUrlPrefix === undefined) {
187
+ typeUrlPrefix = "type.googleapis.com";
188
+ }
189
+ return typeUrlPrefix + "/Adv.ADVSignedDeviceIdentityHMAC";
190
+ };
191
+ return ADVSignedDeviceIdentityHMAC;
192
+ })();
193
+ Adv.ADVSignedDeviceIdentity = (function () {
194
+ function ADVSignedDeviceIdentity(properties) {
195
+ if (properties)
196
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
197
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
198
+ }
199
+ ADVSignedDeviceIdentity.prototype.details = null;
200
+ ADVSignedDeviceIdentity.prototype.accountSignatureKey = null;
201
+ ADVSignedDeviceIdentity.prototype.accountSignature = null;
202
+ ADVSignedDeviceIdentity.prototype.deviceSignature = null;
203
+ var $oneOfFields;
204
+ Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_details", {
205
+ get: $util.oneOfGetter(($oneOfFields = ["details"])),
206
+ set: $util.oneOfSetter($oneOfFields),
207
+ });
208
+ Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_accountSignatureKey", {
209
+ get: $util.oneOfGetter(($oneOfFields = ["accountSignatureKey"])),
210
+ set: $util.oneOfSetter($oneOfFields),
211
+ });
212
+ Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_accountSignature", {
213
+ get: $util.oneOfGetter(($oneOfFields = ["accountSignature"])),
214
+ set: $util.oneOfSetter($oneOfFields),
215
+ });
216
+ Object.defineProperty(ADVSignedDeviceIdentity.prototype, "_deviceSignature", {
217
+ get: $util.oneOfGetter(($oneOfFields = ["deviceSignature"])),
218
+ set: $util.oneOfSetter($oneOfFields),
219
+ });
220
+ ADVSignedDeviceIdentity.create = function create(properties) {
221
+ return new ADVSignedDeviceIdentity(properties);
222
+ };
223
+ ADVSignedDeviceIdentity.encode = function encode(message, writer) {
224
+ if (!writer) writer = $Writer.create();
225
+ if (message.details != null && Object.hasOwnProperty.call(message, "details"))
226
+ writer.uint32(10).bytes(message.details);
227
+ if (
228
+ message.accountSignatureKey != null &&
229
+ Object.hasOwnProperty.call(message, "accountSignatureKey")
230
+ )
231
+ writer.uint32(18).bytes(message.accountSignatureKey);
232
+ if (
233
+ message.accountSignature != null &&
234
+ Object.hasOwnProperty.call(message, "accountSignature")
235
+ )
236
+ writer.uint32(26).bytes(message.accountSignature);
237
+ if (
238
+ message.deviceSignature != null &&
239
+ Object.hasOwnProperty.call(message, "deviceSignature")
240
+ )
241
+ writer.uint32(34).bytes(message.deviceSignature);
242
+ return writer;
243
+ };
244
+ ADVSignedDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) {
245
+ return this.encode(message, writer).ldelim();
246
+ };
247
+ ADVSignedDeviceIdentity.decode = function decode(reader, length, error) {
248
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
249
+ var end = length === undefined ? reader.len : reader.pos + length,
250
+ message = new $root.Adv.ADVSignedDeviceIdentity();
251
+ while (reader.pos < end) {
252
+ var tag = reader.uint32();
253
+ if (tag === error) break;
254
+ switch (tag >>> 3) {
255
+ case 1: {
256
+ message.details = reader.bytes();
257
+ break;
258
+ }
259
+ case 2: {
260
+ message.accountSignatureKey = reader.bytes();
261
+ break;
262
+ }
263
+ case 3: {
264
+ message.accountSignature = reader.bytes();
265
+ break;
266
+ }
267
+ case 4: {
268
+ message.deviceSignature = reader.bytes();
269
+ break;
270
+ }
271
+ default:
272
+ reader.skipType(tag & 7);
273
+ break;
274
+ }
275
+ }
276
+ return message;
277
+ };
278
+ ADVSignedDeviceIdentity.decodeDelimited = function decodeDelimited(reader) {
279
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
280
+ return this.decode(reader, reader.uint32());
281
+ };
282
+ ADVSignedDeviceIdentity.verify = function verify(message) {
283
+ if (typeof message !== "object" || message === null) return "object expected";
284
+ var properties = {};
285
+ if (message.details != null && message.hasOwnProperty("details")) {
286
+ properties._details = 1;
287
+ if (
288
+ !(
289
+ (message.details && typeof message.details.length === "number") ||
290
+ $util.isString(message.details)
291
+ )
292
+ )
293
+ return "details: buffer expected";
294
+ }
295
+ if (
296
+ message.accountSignatureKey != null &&
297
+ message.hasOwnProperty("accountSignatureKey")
298
+ ) {
299
+ properties._accountSignatureKey = 1;
300
+ if (
301
+ !(
302
+ (message.accountSignatureKey &&
303
+ typeof message.accountSignatureKey.length === "number") ||
304
+ $util.isString(message.accountSignatureKey)
305
+ )
306
+ )
307
+ return "accountSignatureKey: buffer expected";
308
+ }
309
+ if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) {
310
+ properties._accountSignature = 1;
311
+ if (
312
+ !(
313
+ (message.accountSignature &&
314
+ typeof message.accountSignature.length === "number") ||
315
+ $util.isString(message.accountSignature)
316
+ )
317
+ )
318
+ return "accountSignature: buffer expected";
319
+ }
320
+ if (message.deviceSignature != null && message.hasOwnProperty("deviceSignature")) {
321
+ properties._deviceSignature = 1;
322
+ if (
323
+ !(
324
+ (message.deviceSignature &&
325
+ typeof message.deviceSignature.length === "number") ||
326
+ $util.isString(message.deviceSignature)
327
+ )
328
+ )
329
+ return "deviceSignature: buffer expected";
330
+ }
331
+ return null;
332
+ };
333
+ ADVSignedDeviceIdentity.fromObject = function fromObject(object) {
334
+ if (object instanceof $root.Adv.ADVSignedDeviceIdentity) return object;
335
+ var message = new $root.Adv.ADVSignedDeviceIdentity();
336
+ if (object.details != null)
337
+ if (typeof object.details === "string")
338
+ $util.base64.decode(
339
+ object.details,
340
+ (message.details = $util.newBuffer($util.base64.length(object.details))),
341
+ 0
342
+ );
343
+ else if (object.details.length >= 0) message.details = object.details;
344
+ if (object.accountSignatureKey != null)
345
+ if (typeof object.accountSignatureKey === "string")
346
+ $util.base64.decode(
347
+ object.accountSignatureKey,
348
+ (message.accountSignatureKey = $util.newBuffer(
349
+ $util.base64.length(object.accountSignatureKey)
350
+ )),
351
+ 0
352
+ );
353
+ else if (object.accountSignatureKey.length >= 0)
354
+ message.accountSignatureKey = object.accountSignatureKey;
355
+ if (object.accountSignature != null)
356
+ if (typeof object.accountSignature === "string")
357
+ $util.base64.decode(
358
+ object.accountSignature,
359
+ (message.accountSignature = $util.newBuffer(
360
+ $util.base64.length(object.accountSignature)
361
+ )),
362
+ 0
363
+ );
364
+ else if (object.accountSignature.length >= 0)
365
+ message.accountSignature = object.accountSignature;
366
+ if (object.deviceSignature != null)
367
+ if (typeof object.deviceSignature === "string")
368
+ $util.base64.decode(
369
+ object.deviceSignature,
370
+ (message.deviceSignature = $util.newBuffer(
371
+ $util.base64.length(object.deviceSignature)
372
+ )),
373
+ 0
374
+ );
375
+ else if (object.deviceSignature.length >= 0)
376
+ message.deviceSignature = object.deviceSignature;
377
+ return message;
378
+ };
379
+ ADVSignedDeviceIdentity.toObject = function toObject(message, options) {
380
+ if (!options) options = {};
381
+ var object = {};
382
+ if (message.details != null && message.hasOwnProperty("details")) {
383
+ object.details =
384
+ options.bytes === String
385
+ ? $util.base64.encode(message.details, 0, message.details.length)
386
+ : options.bytes === Array
387
+ ? Array.prototype.slice.call(message.details)
388
+ : message.details;
389
+ if (options.oneofs) object._details = "details";
390
+ }
391
+ if (
392
+ message.accountSignatureKey != null &&
393
+ message.hasOwnProperty("accountSignatureKey")
394
+ ) {
395
+ object.accountSignatureKey =
396
+ options.bytes === String
397
+ ? $util.base64.encode(
398
+ message.accountSignatureKey,
399
+ 0,
400
+ message.accountSignatureKey.length
401
+ )
402
+ : options.bytes === Array
403
+ ? Array.prototype.slice.call(message.accountSignatureKey)
404
+ : message.accountSignatureKey;
405
+ if (options.oneofs) object._accountSignatureKey = "accountSignatureKey";
406
+ }
407
+ if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) {
408
+ object.accountSignature =
409
+ options.bytes === String
410
+ ? $util.base64.encode(
411
+ message.accountSignature,
412
+ 0,
413
+ message.accountSignature.length
414
+ )
415
+ : options.bytes === Array
416
+ ? Array.prototype.slice.call(message.accountSignature)
417
+ : message.accountSignature;
418
+ if (options.oneofs) object._accountSignature = "accountSignature";
419
+ }
420
+ if (message.deviceSignature != null && message.hasOwnProperty("deviceSignature")) {
421
+ object.deviceSignature =
422
+ options.bytes === String
423
+ ? $util.base64.encode(
424
+ message.deviceSignature,
425
+ 0,
426
+ message.deviceSignature.length
427
+ )
428
+ : options.bytes === Array
429
+ ? Array.prototype.slice.call(message.deviceSignature)
430
+ : message.deviceSignature;
431
+ if (options.oneofs) object._deviceSignature = "deviceSignature";
432
+ }
433
+ return object;
434
+ };
435
+ ADVSignedDeviceIdentity.prototype.toJSON = function toJSON() {
436
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
437
+ };
438
+ ADVSignedDeviceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
439
+ if (typeUrlPrefix === undefined) {
440
+ typeUrlPrefix = "type.googleapis.com";
441
+ }
442
+ return typeUrlPrefix + "/Adv.ADVSignedDeviceIdentity";
443
+ };
444
+ return ADVSignedDeviceIdentity;
445
+ })();
446
+ Adv.ADVDeviceIdentity = (function () {
447
+ function ADVDeviceIdentity(properties) {
448
+ if (properties)
449
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
450
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
451
+ }
452
+ ADVDeviceIdentity.prototype.rawId = null;
453
+ ADVDeviceIdentity.prototype.timestamp = null;
454
+ ADVDeviceIdentity.prototype.keyIndex = null;
455
+ ADVDeviceIdentity.prototype.accountType = null;
456
+ ADVDeviceIdentity.prototype.deviceType = null;
457
+ var $oneOfFields;
458
+ Object.defineProperty(ADVDeviceIdentity.prototype, "_rawId", {
459
+ get: $util.oneOfGetter(($oneOfFields = ["rawId"])),
460
+ set: $util.oneOfSetter($oneOfFields),
461
+ });
462
+ Object.defineProperty(ADVDeviceIdentity.prototype, "_timestamp", {
463
+ get: $util.oneOfGetter(($oneOfFields = ["timestamp"])),
464
+ set: $util.oneOfSetter($oneOfFields),
465
+ });
466
+ Object.defineProperty(ADVDeviceIdentity.prototype, "_keyIndex", {
467
+ get: $util.oneOfGetter(($oneOfFields = ["keyIndex"])),
468
+ set: $util.oneOfSetter($oneOfFields),
469
+ });
470
+ Object.defineProperty(ADVDeviceIdentity.prototype, "_accountType", {
471
+ get: $util.oneOfGetter(($oneOfFields = ["accountType"])),
472
+ set: $util.oneOfSetter($oneOfFields),
473
+ });
474
+ Object.defineProperty(ADVDeviceIdentity.prototype, "_deviceType", {
475
+ get: $util.oneOfGetter(($oneOfFields = ["deviceType"])),
476
+ set: $util.oneOfSetter($oneOfFields),
477
+ });
478
+ ADVDeviceIdentity.create = function create(properties) {
479
+ return new ADVDeviceIdentity(properties);
480
+ };
481
+ ADVDeviceIdentity.encode = function encode(message, writer) {
482
+ if (!writer) writer = $Writer.create();
483
+ if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId"))
484
+ writer.uint32(8).uint32(message.rawId);
485
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
486
+ writer.uint32(16).uint64(message.timestamp);
487
+ if (message.keyIndex != null && Object.hasOwnProperty.call(message, "keyIndex"))
488
+ writer.uint32(24).uint32(message.keyIndex);
489
+ if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType"))
490
+ writer.uint32(32).int32(message.accountType);
491
+ if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType"))
492
+ writer.uint32(40).int32(message.deviceType);
493
+ return writer;
494
+ };
495
+ ADVDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) {
496
+ return this.encode(message, writer).ldelim();
497
+ };
498
+ ADVDeviceIdentity.decode = function decode(reader, length, error) {
499
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
500
+ var end = length === undefined ? reader.len : reader.pos + length,
501
+ message = new $root.Adv.ADVDeviceIdentity();
502
+ while (reader.pos < end) {
503
+ var tag = reader.uint32();
504
+ if (tag === error) break;
505
+ switch (tag >>> 3) {
506
+ case 1: {
507
+ message.rawId = reader.uint32();
508
+ break;
509
+ }
510
+ case 2: {
511
+ message.timestamp = reader.uint64();
512
+ break;
513
+ }
514
+ case 3: {
515
+ message.keyIndex = reader.uint32();
516
+ break;
517
+ }
518
+ case 4: {
519
+ message.accountType = reader.int32();
520
+ break;
521
+ }
522
+ case 5: {
523
+ message.deviceType = reader.int32();
524
+ break;
525
+ }
526
+ default:
527
+ reader.skipType(tag & 7);
528
+ break;
529
+ }
530
+ }
531
+ return message;
532
+ };
533
+ ADVDeviceIdentity.decodeDelimited = function decodeDelimited(reader) {
534
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
535
+ return this.decode(reader, reader.uint32());
536
+ };
537
+ ADVDeviceIdentity.verify = function verify(message) {
538
+ if (typeof message !== "object" || message === null) return "object expected";
539
+ var properties = {};
540
+ if (message.rawId != null && message.hasOwnProperty("rawId")) {
541
+ properties._rawId = 1;
542
+ if (!$util.isInteger(message.rawId)) return "rawId: integer expected";
543
+ }
544
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
545
+ properties._timestamp = 1;
546
+ if (
547
+ !$util.isInteger(message.timestamp) &&
548
+ !(
549
+ message.timestamp &&
550
+ $util.isInteger(message.timestamp.low) &&
551
+ $util.isInteger(message.timestamp.high)
552
+ )
553
+ )
554
+ return "timestamp: integer|Long expected";
555
+ }
556
+ if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) {
557
+ properties._keyIndex = 1;
558
+ if (!$util.isInteger(message.keyIndex)) return "keyIndex: integer expected";
559
+ }
560
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
561
+ properties._accountType = 1;
562
+ switch (message.accountType) {
563
+ default:
564
+ return "accountType: enum value expected";
565
+ case 0:
566
+ case 1:
567
+ break;
568
+ }
569
+ }
570
+ if (message.deviceType != null && message.hasOwnProperty("deviceType")) {
571
+ properties._deviceType = 1;
572
+ switch (message.deviceType) {
573
+ default:
574
+ return "deviceType: enum value expected";
575
+ case 0:
576
+ case 1:
577
+ break;
578
+ }
579
+ }
580
+ return null;
581
+ };
582
+ ADVDeviceIdentity.fromObject = function fromObject(object) {
583
+ if (object instanceof $root.Adv.ADVDeviceIdentity) return object;
584
+ var message = new $root.Adv.ADVDeviceIdentity();
585
+ if (object.rawId != null) message.rawId = object.rawId >>> 0;
586
+ if (object.timestamp != null)
587
+ if ($util.Long)
588
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true;
589
+ else if (typeof object.timestamp === "string")
590
+ message.timestamp = parseInt(object.timestamp, 10);
591
+ else if (typeof object.timestamp === "number") message.timestamp = object.timestamp;
592
+ else if (typeof object.timestamp === "object")
593
+ message.timestamp = new $util.LongBits(
594
+ object.timestamp.low >>> 0,
595
+ object.timestamp.high >>> 0
596
+ ).toNumber(true);
597
+ if (object.keyIndex != null) message.keyIndex = object.keyIndex >>> 0;
598
+ switch (object.accountType) {
599
+ default:
600
+ if (typeof object.accountType === "number") {
601
+ message.accountType = object.accountType;
602
+ break;
603
+ }
604
+ break;
605
+ case "E2EE":
606
+ case 0:
607
+ message.accountType = 0;
608
+ break;
609
+ case "HOSTED":
610
+ case 1:
611
+ message.accountType = 1;
612
+ break;
613
+ }
614
+ switch (object.deviceType) {
615
+ default:
616
+ if (typeof object.deviceType === "number") {
617
+ message.deviceType = object.deviceType;
618
+ break;
619
+ }
620
+ break;
621
+ case "E2EE":
622
+ case 0:
623
+ message.deviceType = 0;
624
+ break;
625
+ case "HOSTED":
626
+ case 1:
627
+ message.deviceType = 1;
628
+ break;
629
+ }
630
+ return message;
631
+ };
632
+ ADVDeviceIdentity.toObject = function toObject(message, options) {
633
+ if (!options) options = {};
634
+ var object = {};
635
+ if (message.rawId != null && message.hasOwnProperty("rawId")) {
636
+ object.rawId = message.rawId;
637
+ if (options.oneofs) object._rawId = "rawId";
638
+ }
639
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
640
+ if (typeof message.timestamp === "number")
641
+ object.timestamp =
642
+ options.longs === String ? String(message.timestamp) : message.timestamp;
643
+ else
644
+ object.timestamp =
645
+ options.longs === String
646
+ ? $util.Long.prototype.toString.call(message.timestamp)
647
+ : options.longs === Number
648
+ ? new $util.LongBits(
649
+ message.timestamp.low >>> 0,
650
+ message.timestamp.high >>> 0
651
+ ).toNumber(true)
652
+ : message.timestamp;
653
+ if (options.oneofs) object._timestamp = "timestamp";
654
+ }
655
+ if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) {
656
+ object.keyIndex = message.keyIndex;
657
+ if (options.oneofs) object._keyIndex = "keyIndex";
658
+ }
659
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
660
+ object.accountType =
661
+ options.enums === String
662
+ ? $root.Adv.ADVEncryptionType[message.accountType] === undefined
663
+ ? message.accountType
664
+ : $root.Adv.ADVEncryptionType[message.accountType]
665
+ : message.accountType;
666
+ if (options.oneofs) object._accountType = "accountType";
667
+ }
668
+ if (message.deviceType != null && message.hasOwnProperty("deviceType")) {
669
+ object.deviceType =
670
+ options.enums === String
671
+ ? $root.Adv.ADVEncryptionType[message.deviceType] === undefined
672
+ ? message.deviceType
673
+ : $root.Adv.ADVEncryptionType[message.deviceType]
674
+ : message.deviceType;
675
+ if (options.oneofs) object._deviceType = "deviceType";
676
+ }
677
+ return object;
678
+ };
679
+ ADVDeviceIdentity.prototype.toJSON = function toJSON() {
680
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
681
+ };
682
+ ADVDeviceIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
683
+ if (typeUrlPrefix === undefined) {
684
+ typeUrlPrefix = "type.googleapis.com";
685
+ }
686
+ return typeUrlPrefix + "/Adv.ADVDeviceIdentity";
687
+ };
688
+ return ADVDeviceIdentity;
689
+ })();
690
+ Adv.ADVSignedKeyIndexList = (function () {
691
+ function ADVSignedKeyIndexList(properties) {
692
+ if (properties)
693
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
694
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
695
+ }
696
+ ADVSignedKeyIndexList.prototype.details = null;
697
+ ADVSignedKeyIndexList.prototype.accountSignature = null;
698
+ ADVSignedKeyIndexList.prototype.accountSignatureKey = null;
699
+ var $oneOfFields;
700
+ Object.defineProperty(ADVSignedKeyIndexList.prototype, "_details", {
701
+ get: $util.oneOfGetter(($oneOfFields = ["details"])),
702
+ set: $util.oneOfSetter($oneOfFields),
703
+ });
704
+ Object.defineProperty(ADVSignedKeyIndexList.prototype, "_accountSignature", {
705
+ get: $util.oneOfGetter(($oneOfFields = ["accountSignature"])),
706
+ set: $util.oneOfSetter($oneOfFields),
707
+ });
708
+ Object.defineProperty(ADVSignedKeyIndexList.prototype, "_accountSignatureKey", {
709
+ get: $util.oneOfGetter(($oneOfFields = ["accountSignatureKey"])),
710
+ set: $util.oneOfSetter($oneOfFields),
711
+ });
712
+ ADVSignedKeyIndexList.create = function create(properties) {
713
+ return new ADVSignedKeyIndexList(properties);
714
+ };
715
+ ADVSignedKeyIndexList.encode = function encode(message, writer) {
716
+ if (!writer) writer = $Writer.create();
717
+ if (message.details != null && Object.hasOwnProperty.call(message, "details"))
718
+ writer.uint32(10).bytes(message.details);
719
+ if (
720
+ message.accountSignature != null &&
721
+ Object.hasOwnProperty.call(message, "accountSignature")
722
+ )
723
+ writer.uint32(18).bytes(message.accountSignature);
724
+ if (
725
+ message.accountSignatureKey != null &&
726
+ Object.hasOwnProperty.call(message, "accountSignatureKey")
727
+ )
728
+ writer.uint32(26).bytes(message.accountSignatureKey);
729
+ return writer;
730
+ };
731
+ ADVSignedKeyIndexList.encodeDelimited = function encodeDelimited(message, writer) {
732
+ return this.encode(message, writer).ldelim();
733
+ };
734
+ ADVSignedKeyIndexList.decode = function decode(reader, length, error) {
735
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
736
+ var end = length === undefined ? reader.len : reader.pos + length,
737
+ message = new $root.Adv.ADVSignedKeyIndexList();
738
+ while (reader.pos < end) {
739
+ var tag = reader.uint32();
740
+ if (tag === error) break;
741
+ switch (tag >>> 3) {
742
+ case 1: {
743
+ message.details = reader.bytes();
744
+ break;
745
+ }
746
+ case 2: {
747
+ message.accountSignature = reader.bytes();
748
+ break;
749
+ }
750
+ case 3: {
751
+ message.accountSignatureKey = reader.bytes();
752
+ break;
753
+ }
754
+ default:
755
+ reader.skipType(tag & 7);
756
+ break;
757
+ }
758
+ }
759
+ return message;
760
+ };
761
+ ADVSignedKeyIndexList.decodeDelimited = function decodeDelimited(reader) {
762
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
763
+ return this.decode(reader, reader.uint32());
764
+ };
765
+ ADVSignedKeyIndexList.verify = function verify(message) {
766
+ if (typeof message !== "object" || message === null) return "object expected";
767
+ var properties = {};
768
+ if (message.details != null && message.hasOwnProperty("details")) {
769
+ properties._details = 1;
770
+ if (
771
+ !(
772
+ (message.details && typeof message.details.length === "number") ||
773
+ $util.isString(message.details)
774
+ )
775
+ )
776
+ return "details: buffer expected";
777
+ }
778
+ if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) {
779
+ properties._accountSignature = 1;
780
+ if (
781
+ !(
782
+ (message.accountSignature &&
783
+ typeof message.accountSignature.length === "number") ||
784
+ $util.isString(message.accountSignature)
785
+ )
786
+ )
787
+ return "accountSignature: buffer expected";
788
+ }
789
+ if (
790
+ message.accountSignatureKey != null &&
791
+ message.hasOwnProperty("accountSignatureKey")
792
+ ) {
793
+ properties._accountSignatureKey = 1;
794
+ if (
795
+ !(
796
+ (message.accountSignatureKey &&
797
+ typeof message.accountSignatureKey.length === "number") ||
798
+ $util.isString(message.accountSignatureKey)
799
+ )
800
+ )
801
+ return "accountSignatureKey: buffer expected";
802
+ }
803
+ return null;
804
+ };
805
+ ADVSignedKeyIndexList.fromObject = function fromObject(object) {
806
+ if (object instanceof $root.Adv.ADVSignedKeyIndexList) return object;
807
+ var message = new $root.Adv.ADVSignedKeyIndexList();
808
+ if (object.details != null)
809
+ if (typeof object.details === "string")
810
+ $util.base64.decode(
811
+ object.details,
812
+ (message.details = $util.newBuffer($util.base64.length(object.details))),
813
+ 0
814
+ );
815
+ else if (object.details.length >= 0) message.details = object.details;
816
+ if (object.accountSignature != null)
817
+ if (typeof object.accountSignature === "string")
818
+ $util.base64.decode(
819
+ object.accountSignature,
820
+ (message.accountSignature = $util.newBuffer(
821
+ $util.base64.length(object.accountSignature)
822
+ )),
823
+ 0
824
+ );
825
+ else if (object.accountSignature.length >= 0)
826
+ message.accountSignature = object.accountSignature;
827
+ if (object.accountSignatureKey != null)
828
+ if (typeof object.accountSignatureKey === "string")
829
+ $util.base64.decode(
830
+ object.accountSignatureKey,
831
+ (message.accountSignatureKey = $util.newBuffer(
832
+ $util.base64.length(object.accountSignatureKey)
833
+ )),
834
+ 0
835
+ );
836
+ else if (object.accountSignatureKey.length >= 0)
837
+ message.accountSignatureKey = object.accountSignatureKey;
838
+ return message;
839
+ };
840
+ ADVSignedKeyIndexList.toObject = function toObject(message, options) {
841
+ if (!options) options = {};
842
+ var object = {};
843
+ if (message.details != null && message.hasOwnProperty("details")) {
844
+ object.details =
845
+ options.bytes === String
846
+ ? $util.base64.encode(message.details, 0, message.details.length)
847
+ : options.bytes === Array
848
+ ? Array.prototype.slice.call(message.details)
849
+ : message.details;
850
+ if (options.oneofs) object._details = "details";
851
+ }
852
+ if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) {
853
+ object.accountSignature =
854
+ options.bytes === String
855
+ ? $util.base64.encode(
856
+ message.accountSignature,
857
+ 0,
858
+ message.accountSignature.length
859
+ )
860
+ : options.bytes === Array
861
+ ? Array.prototype.slice.call(message.accountSignature)
862
+ : message.accountSignature;
863
+ if (options.oneofs) object._accountSignature = "accountSignature";
864
+ }
865
+ if (
866
+ message.accountSignatureKey != null &&
867
+ message.hasOwnProperty("accountSignatureKey")
868
+ ) {
869
+ object.accountSignatureKey =
870
+ options.bytes === String
871
+ ? $util.base64.encode(
872
+ message.accountSignatureKey,
873
+ 0,
874
+ message.accountSignatureKey.length
875
+ )
876
+ : options.bytes === Array
877
+ ? Array.prototype.slice.call(message.accountSignatureKey)
878
+ : message.accountSignatureKey;
879
+ if (options.oneofs) object._accountSignatureKey = "accountSignatureKey";
880
+ }
881
+ return object;
882
+ };
883
+ ADVSignedKeyIndexList.prototype.toJSON = function toJSON() {
884
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
885
+ };
886
+ ADVSignedKeyIndexList.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
887
+ if (typeUrlPrefix === undefined) {
888
+ typeUrlPrefix = "type.googleapis.com";
889
+ }
890
+ return typeUrlPrefix + "/Adv.ADVSignedKeyIndexList";
891
+ };
892
+ return ADVSignedKeyIndexList;
893
+ })();
894
+ Adv.ADVKeyIndexList = (function () {
895
+ function ADVKeyIndexList(properties) {
896
+ this.validIndexes = [];
897
+ if (properties)
898
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
899
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
900
+ }
901
+ ADVKeyIndexList.prototype.rawId = null;
902
+ ADVKeyIndexList.prototype.timestamp = null;
903
+ ADVKeyIndexList.prototype.currentIndex = null;
904
+ ADVKeyIndexList.prototype.validIndexes = $util.emptyArray;
905
+ ADVKeyIndexList.prototype.accountType = null;
906
+ var $oneOfFields;
907
+ Object.defineProperty(ADVKeyIndexList.prototype, "_rawId", {
908
+ get: $util.oneOfGetter(($oneOfFields = ["rawId"])),
909
+ set: $util.oneOfSetter($oneOfFields),
910
+ });
911
+ Object.defineProperty(ADVKeyIndexList.prototype, "_timestamp", {
912
+ get: $util.oneOfGetter(($oneOfFields = ["timestamp"])),
913
+ set: $util.oneOfSetter($oneOfFields),
914
+ });
915
+ Object.defineProperty(ADVKeyIndexList.prototype, "_currentIndex", {
916
+ get: $util.oneOfGetter(($oneOfFields = ["currentIndex"])),
917
+ set: $util.oneOfSetter($oneOfFields),
918
+ });
919
+ Object.defineProperty(ADVKeyIndexList.prototype, "_accountType", {
920
+ get: $util.oneOfGetter(($oneOfFields = ["accountType"])),
921
+ set: $util.oneOfSetter($oneOfFields),
922
+ });
923
+ ADVKeyIndexList.create = function create(properties) {
924
+ return new ADVKeyIndexList(properties);
925
+ };
926
+ ADVKeyIndexList.encode = function encode(message, writer) {
927
+ if (!writer) writer = $Writer.create();
928
+ if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId"))
929
+ writer.uint32(8).uint32(message.rawId);
930
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
931
+ writer.uint32(16).uint64(message.timestamp);
932
+ if (message.currentIndex != null && Object.hasOwnProperty.call(message, "currentIndex"))
933
+ writer.uint32(24).uint32(message.currentIndex);
934
+ if (message.validIndexes != null && message.validIndexes.length) {
935
+ writer.uint32(34).fork();
936
+ for (var i = 0; i < message.validIndexes.length; ++i)
937
+ writer.uint32(message.validIndexes[i]);
938
+ writer.ldelim();
939
+ }
940
+ if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType"))
941
+ writer.uint32(40).int32(message.accountType);
942
+ return writer;
943
+ };
944
+ ADVKeyIndexList.encodeDelimited = function encodeDelimited(message, writer) {
945
+ return this.encode(message, writer).ldelim();
946
+ };
947
+ ADVKeyIndexList.decode = function decode(reader, length, error) {
948
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
949
+ var end = length === undefined ? reader.len : reader.pos + length,
950
+ message = new $root.Adv.ADVKeyIndexList();
951
+ while (reader.pos < end) {
952
+ var tag = reader.uint32();
953
+ if (tag === error) break;
954
+ switch (tag >>> 3) {
955
+ case 1: {
956
+ message.rawId = reader.uint32();
957
+ break;
958
+ }
959
+ case 2: {
960
+ message.timestamp = reader.uint64();
961
+ break;
962
+ }
963
+ case 3: {
964
+ message.currentIndex = reader.uint32();
965
+ break;
966
+ }
967
+ case 4: {
968
+ if (!(message.validIndexes && message.validIndexes.length))
969
+ message.validIndexes = [];
970
+ if ((tag & 7) === 2) {
971
+ var end2 = reader.uint32() + reader.pos;
972
+ while (reader.pos < end2) message.validIndexes.push(reader.uint32());
973
+ } else message.validIndexes.push(reader.uint32());
974
+ break;
975
+ }
976
+ case 5: {
977
+ message.accountType = reader.int32();
978
+ break;
979
+ }
980
+ default:
981
+ reader.skipType(tag & 7);
982
+ break;
983
+ }
984
+ }
985
+ return message;
986
+ };
987
+ ADVKeyIndexList.decodeDelimited = function decodeDelimited(reader) {
988
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
989
+ return this.decode(reader, reader.uint32());
990
+ };
991
+ ADVKeyIndexList.verify = function verify(message) {
992
+ if (typeof message !== "object" || message === null) return "object expected";
993
+ var properties = {};
994
+ if (message.rawId != null && message.hasOwnProperty("rawId")) {
995
+ properties._rawId = 1;
996
+ if (!$util.isInteger(message.rawId)) return "rawId: integer expected";
997
+ }
998
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
999
+ properties._timestamp = 1;
1000
+ if (
1001
+ !$util.isInteger(message.timestamp) &&
1002
+ !(
1003
+ message.timestamp &&
1004
+ $util.isInteger(message.timestamp.low) &&
1005
+ $util.isInteger(message.timestamp.high)
1006
+ )
1007
+ )
1008
+ return "timestamp: integer|Long expected";
1009
+ }
1010
+ if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) {
1011
+ properties._currentIndex = 1;
1012
+ if (!$util.isInteger(message.currentIndex)) return "currentIndex: integer expected";
1013
+ }
1014
+ if (message.validIndexes != null && message.hasOwnProperty("validIndexes")) {
1015
+ if (!Array.isArray(message.validIndexes)) return "validIndexes: array expected";
1016
+ for (var i = 0; i < message.validIndexes.length; ++i)
1017
+ if (!$util.isInteger(message.validIndexes[i]))
1018
+ return "validIndexes: integer[] expected";
1019
+ }
1020
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
1021
+ properties._accountType = 1;
1022
+ switch (message.accountType) {
1023
+ default:
1024
+ return "accountType: enum value expected";
1025
+ case 0:
1026
+ case 1:
1027
+ break;
1028
+ }
1029
+ }
1030
+ return null;
1031
+ };
1032
+ ADVKeyIndexList.fromObject = function fromObject(object) {
1033
+ if (object instanceof $root.Adv.ADVKeyIndexList) return object;
1034
+ var message = new $root.Adv.ADVKeyIndexList();
1035
+ if (object.rawId != null) message.rawId = object.rawId >>> 0;
1036
+ if (object.timestamp != null)
1037
+ if ($util.Long)
1038
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true;
1039
+ else if (typeof object.timestamp === "string")
1040
+ message.timestamp = parseInt(object.timestamp, 10);
1041
+ else if (typeof object.timestamp === "number") message.timestamp = object.timestamp;
1042
+ else if (typeof object.timestamp === "object")
1043
+ message.timestamp = new $util.LongBits(
1044
+ object.timestamp.low >>> 0,
1045
+ object.timestamp.high >>> 0
1046
+ ).toNumber(true);
1047
+ if (object.currentIndex != null) message.currentIndex = object.currentIndex >>> 0;
1048
+ if (object.validIndexes) {
1049
+ if (!Array.isArray(object.validIndexes))
1050
+ throw TypeError(".Adv.ADVKeyIndexList.validIndexes: array expected");
1051
+ message.validIndexes = [];
1052
+ for (var i = 0; i < object.validIndexes.length; ++i)
1053
+ message.validIndexes[i] = object.validIndexes[i] >>> 0;
1054
+ }
1055
+ switch (object.accountType) {
1056
+ default:
1057
+ if (typeof object.accountType === "number") {
1058
+ message.accountType = object.accountType;
1059
+ break;
1060
+ }
1061
+ break;
1062
+ case "E2EE":
1063
+ case 0:
1064
+ message.accountType = 0;
1065
+ break;
1066
+ case "HOSTED":
1067
+ case 1:
1068
+ message.accountType = 1;
1069
+ break;
1070
+ }
1071
+ return message;
1072
+ };
1073
+ ADVKeyIndexList.toObject = function toObject(message, options) {
1074
+ if (!options) options = {};
1075
+ var object = {};
1076
+ if (options.arrays || options.defaults) object.validIndexes = [];
1077
+ if (message.rawId != null && message.hasOwnProperty("rawId")) {
1078
+ object.rawId = message.rawId;
1079
+ if (options.oneofs) object._rawId = "rawId";
1080
+ }
1081
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
1082
+ if (typeof message.timestamp === "number")
1083
+ object.timestamp =
1084
+ options.longs === String ? String(message.timestamp) : message.timestamp;
1085
+ else
1086
+ object.timestamp =
1087
+ options.longs === String
1088
+ ? $util.Long.prototype.toString.call(message.timestamp)
1089
+ : options.longs === Number
1090
+ ? new $util.LongBits(
1091
+ message.timestamp.low >>> 0,
1092
+ message.timestamp.high >>> 0
1093
+ ).toNumber(true)
1094
+ : message.timestamp;
1095
+ if (options.oneofs) object._timestamp = "timestamp";
1096
+ }
1097
+ if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) {
1098
+ object.currentIndex = message.currentIndex;
1099
+ if (options.oneofs) object._currentIndex = "currentIndex";
1100
+ }
1101
+ if (message.validIndexes && message.validIndexes.length) {
1102
+ object.validIndexes = [];
1103
+ for (var j = 0; j < message.validIndexes.length; ++j)
1104
+ object.validIndexes[j] = message.validIndexes[j];
1105
+ }
1106
+ if (message.accountType != null && message.hasOwnProperty("accountType")) {
1107
+ object.accountType =
1108
+ options.enums === String
1109
+ ? $root.Adv.ADVEncryptionType[message.accountType] === undefined
1110
+ ? message.accountType
1111
+ : $root.Adv.ADVEncryptionType[message.accountType]
1112
+ : message.accountType;
1113
+ if (options.oneofs) object._accountType = "accountType";
1114
+ }
1115
+ return object;
1116
+ };
1117
+ ADVKeyIndexList.prototype.toJSON = function toJSON() {
1118
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1119
+ };
1120
+ ADVKeyIndexList.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1121
+ if (typeUrlPrefix === undefined) {
1122
+ typeUrlPrefix = "type.googleapis.com";
1123
+ }
1124
+ return typeUrlPrefix + "/Adv.ADVKeyIndexList";
1125
+ };
1126
+ return ADVKeyIndexList;
1127
+ })();
1128
+ Adv.ADVEncryptionType = (function () {
1129
+ var valuesById = {},
1130
+ values = Object.create(valuesById);
1131
+ values[(valuesById[0] = "E2EE")] = 0;
1132
+ values[(valuesById[1] = "HOSTED")] = 1;
1133
+ return values;
1134
+ })();
1135
+ return Adv;
1136
+ })();
1137
+ module.exports = $root;