@wireapp/protocol-messaging 1.38.0 → 1.40.0

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.
package/web/mls.d.ts ADDED
@@ -0,0 +1,62 @@
1
+ import * as $protobuf from "protobufjs";
2
+ import Long = require("long");
3
+ export namespace mls {
4
+
5
+ enum GroupInfoType {
6
+ PUBLIC_GROUP_STATE = 1,
7
+ GROUP_INFO = 2,
8
+ GROUP_INFO_JWE = 3
9
+ }
10
+
11
+ enum RatchetTreeType {
12
+ FULL = 1,
13
+ DELTA = 2,
14
+ REFERENCE = 3
15
+ }
16
+
17
+ interface IGroupInfoBundle {
18
+ groupInfoType: mls.GroupInfoType;
19
+ ratchetTreeType: mls.RatchetTreeType;
20
+ groupInfo: Uint8Array;
21
+ }
22
+
23
+ class GroupInfoBundle implements IGroupInfoBundle {
24
+ constructor(properties?: mls.IGroupInfoBundle);
25
+ public groupInfoType: mls.GroupInfoType;
26
+ public ratchetTreeType: mls.RatchetTreeType;
27
+ public groupInfo: Uint8Array;
28
+ public static create(properties?: mls.IGroupInfoBundle): mls.GroupInfoBundle;
29
+ public static encode(message: mls.IGroupInfoBundle, writer?: $protobuf.Writer): $protobuf.Writer;
30
+ public static encodeDelimited(message: mls.IGroupInfoBundle, writer?: $protobuf.Writer): $protobuf.Writer;
31
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): mls.GroupInfoBundle;
32
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): mls.GroupInfoBundle;
33
+ public static verify(message: { [k: string]: any }): (string|null);
34
+ public static fromObject(object: { [k: string]: any }): mls.GroupInfoBundle;
35
+ public static toObject(message: mls.GroupInfoBundle, options?: $protobuf.IConversionOptions): { [k: string]: any };
36
+ public toJSON(): { [k: string]: any };
37
+ public static getTypeUrl(typeUrlPrefix?: string): string;
38
+ }
39
+
40
+ interface ICommitBundle {
41
+ commit: Uint8Array;
42
+ welcome?: (Uint8Array|null);
43
+ groupInfoBundle: mls.IGroupInfoBundle;
44
+ }
45
+
46
+ class CommitBundle implements ICommitBundle {
47
+ constructor(properties?: mls.ICommitBundle);
48
+ public commit: Uint8Array;
49
+ public welcome: Uint8Array;
50
+ public groupInfoBundle: mls.IGroupInfoBundle;
51
+ public static create(properties?: mls.ICommitBundle): mls.CommitBundle;
52
+ public static encode(message: mls.ICommitBundle, writer?: $protobuf.Writer): $protobuf.Writer;
53
+ public static encodeDelimited(message: mls.ICommitBundle, writer?: $protobuf.Writer): $protobuf.Writer;
54
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): mls.CommitBundle;
55
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): mls.CommitBundle;
56
+ public static verify(message: { [k: string]: any }): (string|null);
57
+ public static fromObject(object: { [k: string]: any }): mls.CommitBundle;
58
+ public static toObject(message: mls.CommitBundle, options?: $protobuf.IConversionOptions): { [k: string]: any };
59
+ public toJSON(): { [k: string]: any };
60
+ public static getTypeUrl(typeUrlPrefix?: string): string;
61
+ }
62
+ }
package/web/mls.js ADDED
@@ -0,0 +1,637 @@
1
+ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
+ "use strict";
3
+
4
+ var $protobuf = require("protobufjs/minimal");
5
+
6
+ // Common aliases
7
+ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
8
+
9
+ // Exported root namespace
10
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
11
+
12
+ $root.mls = (function() {
13
+
14
+ /**
15
+ * Namespace mls.
16
+ * @exports mls
17
+ * @namespace
18
+ */
19
+ var mls = {};
20
+
21
+ /**
22
+ * GroupInfoType enum.
23
+ * @name mls.GroupInfoType
24
+ * @enum {number}
25
+ * @property {number} PUBLIC_GROUP_STATE=1 PUBLIC_GROUP_STATE value
26
+ * @property {number} GROUP_INFO=2 GROUP_INFO value
27
+ * @property {number} GROUP_INFO_JWE=3 GROUP_INFO_JWE value
28
+ */
29
+ mls.GroupInfoType = (function() {
30
+ var valuesById = {}, values = Object.create(valuesById);
31
+ values[valuesById[1] = "PUBLIC_GROUP_STATE"] = 1;
32
+ values[valuesById[2] = "GROUP_INFO"] = 2;
33
+ values[valuesById[3] = "GROUP_INFO_JWE"] = 3;
34
+ return values;
35
+ })();
36
+
37
+ /**
38
+ * RatchetTreeType enum.
39
+ * @name mls.RatchetTreeType
40
+ * @enum {number}
41
+ * @property {number} FULL=1 FULL value
42
+ * @property {number} DELTA=2 DELTA value
43
+ * @property {number} REFERENCE=3 REFERENCE value
44
+ */
45
+ mls.RatchetTreeType = (function() {
46
+ var valuesById = {}, values = Object.create(valuesById);
47
+ values[valuesById[1] = "FULL"] = 1;
48
+ values[valuesById[2] = "DELTA"] = 2;
49
+ values[valuesById[3] = "REFERENCE"] = 3;
50
+ return values;
51
+ })();
52
+
53
+ mls.GroupInfoBundle = (function() {
54
+
55
+ /**
56
+ * Properties of a GroupInfoBundle.
57
+ * @memberof mls
58
+ * @interface IGroupInfoBundle
59
+ * @property {mls.GroupInfoType} groupInfoType GroupInfoBundle groupInfoType
60
+ * @property {mls.RatchetTreeType} ratchetTreeType GroupInfoBundle ratchetTreeType
61
+ * @property {Uint8Array} groupInfo GroupInfoBundle groupInfo
62
+ */
63
+
64
+ /**
65
+ * Constructs a new GroupInfoBundle.
66
+ * @memberof mls
67
+ * @classdesc Represents a GroupInfoBundle.
68
+ * @implements IGroupInfoBundle
69
+ * @constructor
70
+ * @param {mls.IGroupInfoBundle=} [properties] Properties to set
71
+ */
72
+ function GroupInfoBundle(properties) {
73
+ if (properties)
74
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
75
+ if (properties[keys[i]] != null)
76
+ this[keys[i]] = properties[keys[i]];
77
+ }
78
+
79
+ /**
80
+ * GroupInfoBundle groupInfoType.
81
+ * @member {mls.GroupInfoType} groupInfoType
82
+ * @memberof mls.GroupInfoBundle
83
+ * @instance
84
+ */
85
+ GroupInfoBundle.prototype.groupInfoType = 1;
86
+
87
+ /**
88
+ * GroupInfoBundle ratchetTreeType.
89
+ * @member {mls.RatchetTreeType} ratchetTreeType
90
+ * @memberof mls.GroupInfoBundle
91
+ * @instance
92
+ */
93
+ GroupInfoBundle.prototype.ratchetTreeType = 1;
94
+
95
+ /**
96
+ * GroupInfoBundle groupInfo.
97
+ * @member {Uint8Array} groupInfo
98
+ * @memberof mls.GroupInfoBundle
99
+ * @instance
100
+ */
101
+ GroupInfoBundle.prototype.groupInfo = $util.newBuffer([]);
102
+
103
+ /**
104
+ * Creates a new GroupInfoBundle instance using the specified properties.
105
+ * @function create
106
+ * @memberof mls.GroupInfoBundle
107
+ * @static
108
+ * @param {mls.IGroupInfoBundle=} [properties] Properties to set
109
+ * @returns {mls.GroupInfoBundle} GroupInfoBundle instance
110
+ */
111
+ GroupInfoBundle.create = function create(properties) {
112
+ return new GroupInfoBundle(properties);
113
+ };
114
+
115
+ /**
116
+ * Encodes the specified GroupInfoBundle message. Does not implicitly {@link mls.GroupInfoBundle.verify|verify} messages.
117
+ * @function encode
118
+ * @memberof mls.GroupInfoBundle
119
+ * @static
120
+ * @param {mls.IGroupInfoBundle} message GroupInfoBundle message or plain object to encode
121
+ * @param {$protobuf.Writer} [writer] Writer to encode to
122
+ * @returns {$protobuf.Writer} Writer
123
+ */
124
+ GroupInfoBundle.encode = function encode(message, writer) {
125
+ if (!writer)
126
+ writer = $Writer.create();
127
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.groupInfoType);
128
+ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ratchetTreeType);
129
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.groupInfo);
130
+ return writer;
131
+ };
132
+
133
+ /**
134
+ * Encodes the specified GroupInfoBundle message, length delimited. Does not implicitly {@link mls.GroupInfoBundle.verify|verify} messages.
135
+ * @function encodeDelimited
136
+ * @memberof mls.GroupInfoBundle
137
+ * @static
138
+ * @param {mls.IGroupInfoBundle} message GroupInfoBundle message or plain object to encode
139
+ * @param {$protobuf.Writer} [writer] Writer to encode to
140
+ * @returns {$protobuf.Writer} Writer
141
+ */
142
+ GroupInfoBundle.encodeDelimited = function encodeDelimited(message, writer) {
143
+ return this.encode(message, writer).ldelim();
144
+ };
145
+
146
+ /**
147
+ * Decodes a GroupInfoBundle message from the specified reader or buffer.
148
+ * @function decode
149
+ * @memberof mls.GroupInfoBundle
150
+ * @static
151
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
152
+ * @param {number} [length] Message length if known beforehand
153
+ * @returns {mls.GroupInfoBundle} GroupInfoBundle
154
+ * @throws {Error} If the payload is not a reader or valid buffer
155
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
156
+ */
157
+ GroupInfoBundle.decode = function decode(reader, length) {
158
+ if (!(reader instanceof $Reader))
159
+ reader = $Reader.create(reader);
160
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.mls.GroupInfoBundle();
161
+ while (reader.pos < end) {
162
+ var tag = reader.uint32();
163
+ switch (tag >>> 3) {
164
+ case 1: {
165
+ message.groupInfoType = reader.int32();
166
+ break;
167
+ }
168
+ case 2: {
169
+ message.ratchetTreeType = reader.int32();
170
+ break;
171
+ }
172
+ case 3: {
173
+ message.groupInfo = reader.bytes();
174
+ break;
175
+ }
176
+ default:
177
+ reader.skipType(tag & 7);
178
+ break;
179
+ }
180
+ }
181
+ if (!message.hasOwnProperty("groupInfoType"))
182
+ throw $util.ProtocolError("missing required 'groupInfoType'", { instance: message });
183
+ if (!message.hasOwnProperty("ratchetTreeType"))
184
+ throw $util.ProtocolError("missing required 'ratchetTreeType'", { instance: message });
185
+ if (!message.hasOwnProperty("groupInfo"))
186
+ throw $util.ProtocolError("missing required 'groupInfo'", { instance: message });
187
+ return message;
188
+ };
189
+
190
+ /**
191
+ * Decodes a GroupInfoBundle message from the specified reader or buffer, length delimited.
192
+ * @function decodeDelimited
193
+ * @memberof mls.GroupInfoBundle
194
+ * @static
195
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
196
+ * @returns {mls.GroupInfoBundle} GroupInfoBundle
197
+ * @throws {Error} If the payload is not a reader or valid buffer
198
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
199
+ */
200
+ GroupInfoBundle.decodeDelimited = function decodeDelimited(reader) {
201
+ if (!(reader instanceof $Reader))
202
+ reader = new $Reader(reader);
203
+ return this.decode(reader, reader.uint32());
204
+ };
205
+
206
+ /**
207
+ * Verifies a GroupInfoBundle message.
208
+ * @function verify
209
+ * @memberof mls.GroupInfoBundle
210
+ * @static
211
+ * @param {Object.<string,*>} message Plain object to verify
212
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
213
+ */
214
+ GroupInfoBundle.verify = function verify(message) {
215
+ if (typeof message !== "object" || message === null)
216
+ return "object expected";
217
+ switch (message.groupInfoType) {
218
+ default:
219
+ return "groupInfoType: enum value expected";
220
+ case 1:
221
+ case 2:
222
+ case 3:
223
+ break;
224
+ }
225
+ switch (message.ratchetTreeType) {
226
+ default:
227
+ return "ratchetTreeType: enum value expected";
228
+ case 1:
229
+ case 2:
230
+ case 3:
231
+ break;
232
+ }
233
+ if (!(message.groupInfo && typeof message.groupInfo.length === "number" || $util.isString(message.groupInfo)))
234
+ return "groupInfo: buffer expected";
235
+ return null;
236
+ };
237
+
238
+ /**
239
+ * Creates a GroupInfoBundle message from a plain object. Also converts values to their respective internal types.
240
+ * @function fromObject
241
+ * @memberof mls.GroupInfoBundle
242
+ * @static
243
+ * @param {Object.<string,*>} object Plain object
244
+ * @returns {mls.GroupInfoBundle} GroupInfoBundle
245
+ */
246
+ GroupInfoBundle.fromObject = function fromObject(object) {
247
+ if (object instanceof $root.mls.GroupInfoBundle)
248
+ return object;
249
+ var message = new $root.mls.GroupInfoBundle();
250
+ switch (object.groupInfoType) {
251
+ default:
252
+ if (typeof object.groupInfoType === "number") {
253
+ message.groupInfoType = object.groupInfoType;
254
+ break;
255
+ }
256
+ break;
257
+ case "PUBLIC_GROUP_STATE":
258
+ case 1:
259
+ message.groupInfoType = 1;
260
+ break;
261
+ case "GROUP_INFO":
262
+ case 2:
263
+ message.groupInfoType = 2;
264
+ break;
265
+ case "GROUP_INFO_JWE":
266
+ case 3:
267
+ message.groupInfoType = 3;
268
+ break;
269
+ }
270
+ switch (object.ratchetTreeType) {
271
+ default:
272
+ if (typeof object.ratchetTreeType === "number") {
273
+ message.ratchetTreeType = object.ratchetTreeType;
274
+ break;
275
+ }
276
+ break;
277
+ case "FULL":
278
+ case 1:
279
+ message.ratchetTreeType = 1;
280
+ break;
281
+ case "DELTA":
282
+ case 2:
283
+ message.ratchetTreeType = 2;
284
+ break;
285
+ case "REFERENCE":
286
+ case 3:
287
+ message.ratchetTreeType = 3;
288
+ break;
289
+ }
290
+ if (object.groupInfo != null)
291
+ if (typeof object.groupInfo === "string")
292
+ $util.base64.decode(object.groupInfo, message.groupInfo = $util.newBuffer($util.base64.length(object.groupInfo)), 0);
293
+ else if (object.groupInfo.length >= 0)
294
+ message.groupInfo = object.groupInfo;
295
+ return message;
296
+ };
297
+
298
+ /**
299
+ * Creates a plain object from a GroupInfoBundle message. Also converts values to other types if specified.
300
+ * @function toObject
301
+ * @memberof mls.GroupInfoBundle
302
+ * @static
303
+ * @param {mls.GroupInfoBundle} message GroupInfoBundle
304
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
305
+ * @returns {Object.<string,*>} Plain object
306
+ */
307
+ GroupInfoBundle.toObject = function toObject(message, options) {
308
+ if (!options)
309
+ options = {};
310
+ var object = {};
311
+ if (options.defaults) {
312
+ object.groupInfoType = options.enums === String ? "PUBLIC_GROUP_STATE" : 1;
313
+ object.ratchetTreeType = options.enums === String ? "FULL" : 1;
314
+ if (options.bytes === String)
315
+ object.groupInfo = "";
316
+ else {
317
+ object.groupInfo = [];
318
+ if (options.bytes !== Array)
319
+ object.groupInfo = $util.newBuffer(object.groupInfo);
320
+ }
321
+ }
322
+ if (message.groupInfoType != null && message.hasOwnProperty("groupInfoType"))
323
+ object.groupInfoType = options.enums === String ? $root.mls.GroupInfoType[message.groupInfoType] === undefined ? message.groupInfoType : $root.mls.GroupInfoType[message.groupInfoType] : message.groupInfoType;
324
+ if (message.ratchetTreeType != null && message.hasOwnProperty("ratchetTreeType"))
325
+ object.ratchetTreeType = options.enums === String ? $root.mls.RatchetTreeType[message.ratchetTreeType] === undefined ? message.ratchetTreeType : $root.mls.RatchetTreeType[message.ratchetTreeType] : message.ratchetTreeType;
326
+ if (message.groupInfo != null && message.hasOwnProperty("groupInfo"))
327
+ object.groupInfo = options.bytes === String ? $util.base64.encode(message.groupInfo, 0, message.groupInfo.length) : options.bytes === Array ? Array.prototype.slice.call(message.groupInfo) : message.groupInfo;
328
+ return object;
329
+ };
330
+
331
+ /**
332
+ * Converts this GroupInfoBundle to JSON.
333
+ * @function toJSON
334
+ * @memberof mls.GroupInfoBundle
335
+ * @instance
336
+ * @returns {Object.<string,*>} JSON object
337
+ */
338
+ GroupInfoBundle.prototype.toJSON = function toJSON() {
339
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
340
+ };
341
+
342
+ /**
343
+ * Gets the default type url for GroupInfoBundle
344
+ * @function getTypeUrl
345
+ * @memberof mls.GroupInfoBundle
346
+ * @static
347
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
348
+ * @returns {string} The default type url
349
+ */
350
+ GroupInfoBundle.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
351
+ if (typeUrlPrefix === undefined) {
352
+ typeUrlPrefix = "type.googleapis.com";
353
+ }
354
+ return typeUrlPrefix + "/mls.GroupInfoBundle";
355
+ };
356
+
357
+ return GroupInfoBundle;
358
+ })();
359
+
360
+ mls.CommitBundle = (function() {
361
+
362
+ /**
363
+ * Properties of a CommitBundle.
364
+ * @memberof mls
365
+ * @interface ICommitBundle
366
+ * @property {Uint8Array} commit CommitBundle commit
367
+ * @property {Uint8Array|null} [welcome] CommitBundle welcome
368
+ * @property {mls.IGroupInfoBundle} groupInfoBundle CommitBundle groupInfoBundle
369
+ */
370
+
371
+ /**
372
+ * Constructs a new CommitBundle.
373
+ * @memberof mls
374
+ * @classdesc Represents a CommitBundle.
375
+ * @implements ICommitBundle
376
+ * @constructor
377
+ * @param {mls.ICommitBundle=} [properties] Properties to set
378
+ */
379
+ function CommitBundle(properties) {
380
+ if (properties)
381
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
382
+ if (properties[keys[i]] != null)
383
+ this[keys[i]] = properties[keys[i]];
384
+ }
385
+
386
+ /**
387
+ * CommitBundle commit.
388
+ * @member {Uint8Array} commit
389
+ * @memberof mls.CommitBundle
390
+ * @instance
391
+ */
392
+ CommitBundle.prototype.commit = $util.newBuffer([]);
393
+
394
+ /**
395
+ * CommitBundle welcome.
396
+ * @member {Uint8Array} welcome
397
+ * @memberof mls.CommitBundle
398
+ * @instance
399
+ */
400
+ CommitBundle.prototype.welcome = $util.newBuffer([]);
401
+
402
+ /**
403
+ * CommitBundle groupInfoBundle.
404
+ * @member {mls.IGroupInfoBundle} groupInfoBundle
405
+ * @memberof mls.CommitBundle
406
+ * @instance
407
+ */
408
+ CommitBundle.prototype.groupInfoBundle = null;
409
+
410
+ /**
411
+ * Creates a new CommitBundle instance using the specified properties.
412
+ * @function create
413
+ * @memberof mls.CommitBundle
414
+ * @static
415
+ * @param {mls.ICommitBundle=} [properties] Properties to set
416
+ * @returns {mls.CommitBundle} CommitBundle instance
417
+ */
418
+ CommitBundle.create = function create(properties) {
419
+ return new CommitBundle(properties);
420
+ };
421
+
422
+ /**
423
+ * Encodes the specified CommitBundle message. Does not implicitly {@link mls.CommitBundle.verify|verify} messages.
424
+ * @function encode
425
+ * @memberof mls.CommitBundle
426
+ * @static
427
+ * @param {mls.ICommitBundle} message CommitBundle message or plain object to encode
428
+ * @param {$protobuf.Writer} [writer] Writer to encode to
429
+ * @returns {$protobuf.Writer} Writer
430
+ */
431
+ CommitBundle.encode = function encode(message, writer) {
432
+ if (!writer)
433
+ writer = $Writer.create();
434
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.commit);
435
+ if (message.welcome != null && Object.hasOwnProperty.call(message, "welcome"))
436
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.welcome);
437
+ $root.mls.GroupInfoBundle.encode(message.groupInfoBundle, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
438
+ return writer;
439
+ };
440
+
441
+ /**
442
+ * Encodes the specified CommitBundle message, length delimited. Does not implicitly {@link mls.CommitBundle.verify|verify} messages.
443
+ * @function encodeDelimited
444
+ * @memberof mls.CommitBundle
445
+ * @static
446
+ * @param {mls.ICommitBundle} message CommitBundle message or plain object to encode
447
+ * @param {$protobuf.Writer} [writer] Writer to encode to
448
+ * @returns {$protobuf.Writer} Writer
449
+ */
450
+ CommitBundle.encodeDelimited = function encodeDelimited(message, writer) {
451
+ return this.encode(message, writer).ldelim();
452
+ };
453
+
454
+ /**
455
+ * Decodes a CommitBundle message from the specified reader or buffer.
456
+ * @function decode
457
+ * @memberof mls.CommitBundle
458
+ * @static
459
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
460
+ * @param {number} [length] Message length if known beforehand
461
+ * @returns {mls.CommitBundle} CommitBundle
462
+ * @throws {Error} If the payload is not a reader or valid buffer
463
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
464
+ */
465
+ CommitBundle.decode = function decode(reader, length) {
466
+ if (!(reader instanceof $Reader))
467
+ reader = $Reader.create(reader);
468
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.mls.CommitBundle();
469
+ while (reader.pos < end) {
470
+ var tag = reader.uint32();
471
+ switch (tag >>> 3) {
472
+ case 1: {
473
+ message.commit = reader.bytes();
474
+ break;
475
+ }
476
+ case 2: {
477
+ message.welcome = reader.bytes();
478
+ break;
479
+ }
480
+ case 3: {
481
+ message.groupInfoBundle = $root.mls.GroupInfoBundle.decode(reader, reader.uint32());
482
+ break;
483
+ }
484
+ default:
485
+ reader.skipType(tag & 7);
486
+ break;
487
+ }
488
+ }
489
+ if (!message.hasOwnProperty("commit"))
490
+ throw $util.ProtocolError("missing required 'commit'", { instance: message });
491
+ if (!message.hasOwnProperty("groupInfoBundle"))
492
+ throw $util.ProtocolError("missing required 'groupInfoBundle'", { instance: message });
493
+ return message;
494
+ };
495
+
496
+ /**
497
+ * Decodes a CommitBundle message from the specified reader or buffer, length delimited.
498
+ * @function decodeDelimited
499
+ * @memberof mls.CommitBundle
500
+ * @static
501
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
502
+ * @returns {mls.CommitBundle} CommitBundle
503
+ * @throws {Error} If the payload is not a reader or valid buffer
504
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
505
+ */
506
+ CommitBundle.decodeDelimited = function decodeDelimited(reader) {
507
+ if (!(reader instanceof $Reader))
508
+ reader = new $Reader(reader);
509
+ return this.decode(reader, reader.uint32());
510
+ };
511
+
512
+ /**
513
+ * Verifies a CommitBundle message.
514
+ * @function verify
515
+ * @memberof mls.CommitBundle
516
+ * @static
517
+ * @param {Object.<string,*>} message Plain object to verify
518
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
519
+ */
520
+ CommitBundle.verify = function verify(message) {
521
+ if (typeof message !== "object" || message === null)
522
+ return "object expected";
523
+ if (!(message.commit && typeof message.commit.length === "number" || $util.isString(message.commit)))
524
+ return "commit: buffer expected";
525
+ if (message.welcome != null && message.hasOwnProperty("welcome"))
526
+ if (!(message.welcome && typeof message.welcome.length === "number" || $util.isString(message.welcome)))
527
+ return "welcome: buffer expected";
528
+ {
529
+ var error = $root.mls.GroupInfoBundle.verify(message.groupInfoBundle);
530
+ if (error)
531
+ return "groupInfoBundle." + error;
532
+ }
533
+ return null;
534
+ };
535
+
536
+ /**
537
+ * Creates a CommitBundle message from a plain object. Also converts values to their respective internal types.
538
+ * @function fromObject
539
+ * @memberof mls.CommitBundle
540
+ * @static
541
+ * @param {Object.<string,*>} object Plain object
542
+ * @returns {mls.CommitBundle} CommitBundle
543
+ */
544
+ CommitBundle.fromObject = function fromObject(object) {
545
+ if (object instanceof $root.mls.CommitBundle)
546
+ return object;
547
+ var message = new $root.mls.CommitBundle();
548
+ if (object.commit != null)
549
+ if (typeof object.commit === "string")
550
+ $util.base64.decode(object.commit, message.commit = $util.newBuffer($util.base64.length(object.commit)), 0);
551
+ else if (object.commit.length >= 0)
552
+ message.commit = object.commit;
553
+ if (object.welcome != null)
554
+ if (typeof object.welcome === "string")
555
+ $util.base64.decode(object.welcome, message.welcome = $util.newBuffer($util.base64.length(object.welcome)), 0);
556
+ else if (object.welcome.length >= 0)
557
+ message.welcome = object.welcome;
558
+ if (object.groupInfoBundle != null) {
559
+ if (typeof object.groupInfoBundle !== "object")
560
+ throw TypeError(".mls.CommitBundle.groupInfoBundle: object expected");
561
+ message.groupInfoBundle = $root.mls.GroupInfoBundle.fromObject(object.groupInfoBundle);
562
+ }
563
+ return message;
564
+ };
565
+
566
+ /**
567
+ * Creates a plain object from a CommitBundle message. Also converts values to other types if specified.
568
+ * @function toObject
569
+ * @memberof mls.CommitBundle
570
+ * @static
571
+ * @param {mls.CommitBundle} message CommitBundle
572
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
573
+ * @returns {Object.<string,*>} Plain object
574
+ */
575
+ CommitBundle.toObject = function toObject(message, options) {
576
+ if (!options)
577
+ options = {};
578
+ var object = {};
579
+ if (options.defaults) {
580
+ if (options.bytes === String)
581
+ object.commit = "";
582
+ else {
583
+ object.commit = [];
584
+ if (options.bytes !== Array)
585
+ object.commit = $util.newBuffer(object.commit);
586
+ }
587
+ if (options.bytes === String)
588
+ object.welcome = "";
589
+ else {
590
+ object.welcome = [];
591
+ if (options.bytes !== Array)
592
+ object.welcome = $util.newBuffer(object.welcome);
593
+ }
594
+ object.groupInfoBundle = null;
595
+ }
596
+ if (message.commit != null && message.hasOwnProperty("commit"))
597
+ object.commit = options.bytes === String ? $util.base64.encode(message.commit, 0, message.commit.length) : options.bytes === Array ? Array.prototype.slice.call(message.commit) : message.commit;
598
+ if (message.welcome != null && message.hasOwnProperty("welcome"))
599
+ object.welcome = options.bytes === String ? $util.base64.encode(message.welcome, 0, message.welcome.length) : options.bytes === Array ? Array.prototype.slice.call(message.welcome) : message.welcome;
600
+ if (message.groupInfoBundle != null && message.hasOwnProperty("groupInfoBundle"))
601
+ object.groupInfoBundle = $root.mls.GroupInfoBundle.toObject(message.groupInfoBundle, options);
602
+ return object;
603
+ };
604
+
605
+ /**
606
+ * Converts this CommitBundle to JSON.
607
+ * @function toJSON
608
+ * @memberof mls.CommitBundle
609
+ * @instance
610
+ * @returns {Object.<string,*>} JSON object
611
+ */
612
+ CommitBundle.prototype.toJSON = function toJSON() {
613
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
614
+ };
615
+
616
+ /**
617
+ * Gets the default type url for CommitBundle
618
+ * @function getTypeUrl
619
+ * @memberof mls.CommitBundle
620
+ * @static
621
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
622
+ * @returns {string} The default type url
623
+ */
624
+ CommitBundle.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
625
+ if (typeUrlPrefix === undefined) {
626
+ typeUrlPrefix = "type.googleapis.com";
627
+ }
628
+ return typeUrlPrefix + "/mls.CommitBundle";
629
+ };
630
+
631
+ return CommitBundle;
632
+ })();
633
+
634
+ return mls;
635
+ })();
636
+
637
+ module.exports = $root;