@wireapp/protocol-messaging 1.38.0 → 1.39.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/package.json +1 -1
- package/proto/mls.proto +50 -0
- package/web/mls.d.ts +59 -0
- package/web/mls.js +589 -0
package/package.json
CHANGED
package/proto/mls.proto
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Wire
|
|
3
|
+
* Copyright (C) 2021 Wire Swiss GmbH
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU General Public License
|
|
16
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
syntax = "proto2";
|
|
21
|
+
|
|
22
|
+
package mls;
|
|
23
|
+
|
|
24
|
+
option java_package = "com.wire.messages";
|
|
25
|
+
option java_outer_classname = "Mls";
|
|
26
|
+
option optimize_for = LITE_RUNTIME;
|
|
27
|
+
|
|
28
|
+
enum GroupInfoType {
|
|
29
|
+
PUBLIC_GROUP_STATE = 1;
|
|
30
|
+
GROUP_INFO = 2;
|
|
31
|
+
GROUP_INFO_JWE = 3;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
enum RatchetTreeType {
|
|
35
|
+
FULL = 1;
|
|
36
|
+
DELTA = 2;
|
|
37
|
+
REFERENCE = 3;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
message GroupInfoBundle {
|
|
41
|
+
required GroupInfoType group_info_type = 1;
|
|
42
|
+
required RatchetTreeType ratchet_tree_type = 2;
|
|
43
|
+
required bytes group_info = 3;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message CommitBundle {
|
|
47
|
+
required bytes commit = 1; // MlsMessage containing an MlsPlaintext Commit
|
|
48
|
+
optional bytes welcome = 2; // MlsMessage containing a Welcome
|
|
49
|
+
required GroupInfoBundle group_info_bundle = 3;
|
|
50
|
+
}
|
package/web/mls.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as $protobuf from "protobufjs";
|
|
2
|
+
export namespace mls {
|
|
3
|
+
|
|
4
|
+
enum GroupInfoType {
|
|
5
|
+
PUBLIC_GROUP_STATE = 1,
|
|
6
|
+
GROUP_INFO = 2,
|
|
7
|
+
GROUP_INFO_JWE = 3
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
enum RatchetTreeType {
|
|
11
|
+
FULL = 1,
|
|
12
|
+
DELTA = 2,
|
|
13
|
+
REFERENCE = 3
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface IGroupInfoBundle {
|
|
17
|
+
groupInfoType: mls.GroupInfoType;
|
|
18
|
+
ratchetTreeType: mls.RatchetTreeType;
|
|
19
|
+
groupInfo: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class GroupInfoBundle implements IGroupInfoBundle {
|
|
23
|
+
constructor(properties?: mls.IGroupInfoBundle);
|
|
24
|
+
public groupInfoType: mls.GroupInfoType;
|
|
25
|
+
public ratchetTreeType: mls.RatchetTreeType;
|
|
26
|
+
public groupInfo: Uint8Array;
|
|
27
|
+
public static create(properties?: mls.IGroupInfoBundle): mls.GroupInfoBundle;
|
|
28
|
+
public static encode(message: mls.IGroupInfoBundle, writer?: $protobuf.Writer): $protobuf.Writer;
|
|
29
|
+
public static encodeDelimited(message: mls.IGroupInfoBundle, writer?: $protobuf.Writer): $protobuf.Writer;
|
|
30
|
+
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): mls.GroupInfoBundle;
|
|
31
|
+
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): mls.GroupInfoBundle;
|
|
32
|
+
public static verify(message: { [k: string]: any }): (string|null);
|
|
33
|
+
public static fromObject(object: { [k: string]: any }): mls.GroupInfoBundle;
|
|
34
|
+
public static toObject(message: mls.GroupInfoBundle, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
35
|
+
public toJSON(): { [k: string]: any };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ICommitBundle {
|
|
39
|
+
commit: Uint8Array;
|
|
40
|
+
welcome?: (Uint8Array|null);
|
|
41
|
+
groupInfoBundle: mls.IGroupInfoBundle;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class CommitBundle implements ICommitBundle {
|
|
45
|
+
constructor(properties?: mls.ICommitBundle);
|
|
46
|
+
public commit: Uint8Array;
|
|
47
|
+
public welcome: Uint8Array;
|
|
48
|
+
public groupInfoBundle: mls.IGroupInfoBundle;
|
|
49
|
+
public static create(properties?: mls.ICommitBundle): mls.CommitBundle;
|
|
50
|
+
public static encode(message: mls.ICommitBundle, writer?: $protobuf.Writer): $protobuf.Writer;
|
|
51
|
+
public static encodeDelimited(message: mls.ICommitBundle, writer?: $protobuf.Writer): $protobuf.Writer;
|
|
52
|
+
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): mls.CommitBundle;
|
|
53
|
+
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): mls.CommitBundle;
|
|
54
|
+
public static verify(message: { [k: string]: any }): (string|null);
|
|
55
|
+
public static fromObject(object: { [k: string]: any }): mls.CommitBundle;
|
|
56
|
+
public static toObject(message: mls.CommitBundle, options?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
57
|
+
public toJSON(): { [k: string]: any };
|
|
58
|
+
}
|
|
59
|
+
}
|
package/web/mls.js
ADDED
|
@@ -0,0 +1,589 @@
|
|
|
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
|
+
case 2:
|
|
168
|
+
message.ratchetTreeType = reader.int32();
|
|
169
|
+
break;
|
|
170
|
+
case 3:
|
|
171
|
+
message.groupInfo = reader.bytes();
|
|
172
|
+
break;
|
|
173
|
+
default:
|
|
174
|
+
reader.skipType(tag & 7);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (!message.hasOwnProperty("groupInfoType"))
|
|
179
|
+
throw $util.ProtocolError("missing required 'groupInfoType'", { instance: message });
|
|
180
|
+
if (!message.hasOwnProperty("ratchetTreeType"))
|
|
181
|
+
throw $util.ProtocolError("missing required 'ratchetTreeType'", { instance: message });
|
|
182
|
+
if (!message.hasOwnProperty("groupInfo"))
|
|
183
|
+
throw $util.ProtocolError("missing required 'groupInfo'", { instance: message });
|
|
184
|
+
return message;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Decodes a GroupInfoBundle message from the specified reader or buffer, length delimited.
|
|
189
|
+
* @function decodeDelimited
|
|
190
|
+
* @memberof mls.GroupInfoBundle
|
|
191
|
+
* @static
|
|
192
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
193
|
+
* @returns {mls.GroupInfoBundle} GroupInfoBundle
|
|
194
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
195
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
196
|
+
*/
|
|
197
|
+
GroupInfoBundle.decodeDelimited = function decodeDelimited(reader) {
|
|
198
|
+
if (!(reader instanceof $Reader))
|
|
199
|
+
reader = new $Reader(reader);
|
|
200
|
+
return this.decode(reader, reader.uint32());
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Verifies a GroupInfoBundle message.
|
|
205
|
+
* @function verify
|
|
206
|
+
* @memberof mls.GroupInfoBundle
|
|
207
|
+
* @static
|
|
208
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
209
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
210
|
+
*/
|
|
211
|
+
GroupInfoBundle.verify = function verify(message) {
|
|
212
|
+
if (typeof message !== "object" || message === null)
|
|
213
|
+
return "object expected";
|
|
214
|
+
switch (message.groupInfoType) {
|
|
215
|
+
default:
|
|
216
|
+
return "groupInfoType: enum value expected";
|
|
217
|
+
case 1:
|
|
218
|
+
case 2:
|
|
219
|
+
case 3:
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
switch (message.ratchetTreeType) {
|
|
223
|
+
default:
|
|
224
|
+
return "ratchetTreeType: enum value expected";
|
|
225
|
+
case 1:
|
|
226
|
+
case 2:
|
|
227
|
+
case 3:
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
if (!(message.groupInfo && typeof message.groupInfo.length === "number" || $util.isString(message.groupInfo)))
|
|
231
|
+
return "groupInfo: buffer expected";
|
|
232
|
+
return null;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Creates a GroupInfoBundle message from a plain object. Also converts values to their respective internal types.
|
|
237
|
+
* @function fromObject
|
|
238
|
+
* @memberof mls.GroupInfoBundle
|
|
239
|
+
* @static
|
|
240
|
+
* @param {Object.<string,*>} object Plain object
|
|
241
|
+
* @returns {mls.GroupInfoBundle} GroupInfoBundle
|
|
242
|
+
*/
|
|
243
|
+
GroupInfoBundle.fromObject = function fromObject(object) {
|
|
244
|
+
if (object instanceof $root.mls.GroupInfoBundle)
|
|
245
|
+
return object;
|
|
246
|
+
var message = new $root.mls.GroupInfoBundle();
|
|
247
|
+
switch (object.groupInfoType) {
|
|
248
|
+
case "PUBLIC_GROUP_STATE":
|
|
249
|
+
case 1:
|
|
250
|
+
message.groupInfoType = 1;
|
|
251
|
+
break;
|
|
252
|
+
case "GROUP_INFO":
|
|
253
|
+
case 2:
|
|
254
|
+
message.groupInfoType = 2;
|
|
255
|
+
break;
|
|
256
|
+
case "GROUP_INFO_JWE":
|
|
257
|
+
case 3:
|
|
258
|
+
message.groupInfoType = 3;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
switch (object.ratchetTreeType) {
|
|
262
|
+
case "FULL":
|
|
263
|
+
case 1:
|
|
264
|
+
message.ratchetTreeType = 1;
|
|
265
|
+
break;
|
|
266
|
+
case "DELTA":
|
|
267
|
+
case 2:
|
|
268
|
+
message.ratchetTreeType = 2;
|
|
269
|
+
break;
|
|
270
|
+
case "REFERENCE":
|
|
271
|
+
case 3:
|
|
272
|
+
message.ratchetTreeType = 3;
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
if (object.groupInfo != null)
|
|
276
|
+
if (typeof object.groupInfo === "string")
|
|
277
|
+
$util.base64.decode(object.groupInfo, message.groupInfo = $util.newBuffer($util.base64.length(object.groupInfo)), 0);
|
|
278
|
+
else if (object.groupInfo.length)
|
|
279
|
+
message.groupInfo = object.groupInfo;
|
|
280
|
+
return message;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Creates a plain object from a GroupInfoBundle message. Also converts values to other types if specified.
|
|
285
|
+
* @function toObject
|
|
286
|
+
* @memberof mls.GroupInfoBundle
|
|
287
|
+
* @static
|
|
288
|
+
* @param {mls.GroupInfoBundle} message GroupInfoBundle
|
|
289
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
290
|
+
* @returns {Object.<string,*>} Plain object
|
|
291
|
+
*/
|
|
292
|
+
GroupInfoBundle.toObject = function toObject(message, options) {
|
|
293
|
+
if (!options)
|
|
294
|
+
options = {};
|
|
295
|
+
var object = {};
|
|
296
|
+
if (options.defaults) {
|
|
297
|
+
object.groupInfoType = options.enums === String ? "PUBLIC_GROUP_STATE" : 1;
|
|
298
|
+
object.ratchetTreeType = options.enums === String ? "FULL" : 1;
|
|
299
|
+
if (options.bytes === String)
|
|
300
|
+
object.groupInfo = "";
|
|
301
|
+
else {
|
|
302
|
+
object.groupInfo = [];
|
|
303
|
+
if (options.bytes !== Array)
|
|
304
|
+
object.groupInfo = $util.newBuffer(object.groupInfo);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (message.groupInfoType != null && message.hasOwnProperty("groupInfoType"))
|
|
308
|
+
object.groupInfoType = options.enums === String ? $root.mls.GroupInfoType[message.groupInfoType] : message.groupInfoType;
|
|
309
|
+
if (message.ratchetTreeType != null && message.hasOwnProperty("ratchetTreeType"))
|
|
310
|
+
object.ratchetTreeType = options.enums === String ? $root.mls.RatchetTreeType[message.ratchetTreeType] : message.ratchetTreeType;
|
|
311
|
+
if (message.groupInfo != null && message.hasOwnProperty("groupInfo"))
|
|
312
|
+
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;
|
|
313
|
+
return object;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Converts this GroupInfoBundle to JSON.
|
|
318
|
+
* @function toJSON
|
|
319
|
+
* @memberof mls.GroupInfoBundle
|
|
320
|
+
* @instance
|
|
321
|
+
* @returns {Object.<string,*>} JSON object
|
|
322
|
+
*/
|
|
323
|
+
GroupInfoBundle.prototype.toJSON = function toJSON() {
|
|
324
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
return GroupInfoBundle;
|
|
328
|
+
})();
|
|
329
|
+
|
|
330
|
+
mls.CommitBundle = (function() {
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Properties of a CommitBundle.
|
|
334
|
+
* @memberof mls
|
|
335
|
+
* @interface ICommitBundle
|
|
336
|
+
* @property {Uint8Array} commit CommitBundle commit
|
|
337
|
+
* @property {Uint8Array|null} [welcome] CommitBundle welcome
|
|
338
|
+
* @property {mls.IGroupInfoBundle} groupInfoBundle CommitBundle groupInfoBundle
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Constructs a new CommitBundle.
|
|
343
|
+
* @memberof mls
|
|
344
|
+
* @classdesc Represents a CommitBundle.
|
|
345
|
+
* @implements ICommitBundle
|
|
346
|
+
* @constructor
|
|
347
|
+
* @param {mls.ICommitBundle=} [properties] Properties to set
|
|
348
|
+
*/
|
|
349
|
+
function CommitBundle(properties) {
|
|
350
|
+
if (properties)
|
|
351
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
352
|
+
if (properties[keys[i]] != null)
|
|
353
|
+
this[keys[i]] = properties[keys[i]];
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* CommitBundle commit.
|
|
358
|
+
* @member {Uint8Array} commit
|
|
359
|
+
* @memberof mls.CommitBundle
|
|
360
|
+
* @instance
|
|
361
|
+
*/
|
|
362
|
+
CommitBundle.prototype.commit = $util.newBuffer([]);
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* CommitBundle welcome.
|
|
366
|
+
* @member {Uint8Array} welcome
|
|
367
|
+
* @memberof mls.CommitBundle
|
|
368
|
+
* @instance
|
|
369
|
+
*/
|
|
370
|
+
CommitBundle.prototype.welcome = $util.newBuffer([]);
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* CommitBundle groupInfoBundle.
|
|
374
|
+
* @member {mls.IGroupInfoBundle} groupInfoBundle
|
|
375
|
+
* @memberof mls.CommitBundle
|
|
376
|
+
* @instance
|
|
377
|
+
*/
|
|
378
|
+
CommitBundle.prototype.groupInfoBundle = null;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Creates a new CommitBundle instance using the specified properties.
|
|
382
|
+
* @function create
|
|
383
|
+
* @memberof mls.CommitBundle
|
|
384
|
+
* @static
|
|
385
|
+
* @param {mls.ICommitBundle=} [properties] Properties to set
|
|
386
|
+
* @returns {mls.CommitBundle} CommitBundle instance
|
|
387
|
+
*/
|
|
388
|
+
CommitBundle.create = function create(properties) {
|
|
389
|
+
return new CommitBundle(properties);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Encodes the specified CommitBundle message. Does not implicitly {@link mls.CommitBundle.verify|verify} messages.
|
|
394
|
+
* @function encode
|
|
395
|
+
* @memberof mls.CommitBundle
|
|
396
|
+
* @static
|
|
397
|
+
* @param {mls.ICommitBundle} message CommitBundle message or plain object to encode
|
|
398
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
399
|
+
* @returns {$protobuf.Writer} Writer
|
|
400
|
+
*/
|
|
401
|
+
CommitBundle.encode = function encode(message, writer) {
|
|
402
|
+
if (!writer)
|
|
403
|
+
writer = $Writer.create();
|
|
404
|
+
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.commit);
|
|
405
|
+
if (message.welcome != null && Object.hasOwnProperty.call(message, "welcome"))
|
|
406
|
+
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.welcome);
|
|
407
|
+
$root.mls.GroupInfoBundle.encode(message.groupInfoBundle, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
|
408
|
+
return writer;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Encodes the specified CommitBundle message, length delimited. Does not implicitly {@link mls.CommitBundle.verify|verify} messages.
|
|
413
|
+
* @function encodeDelimited
|
|
414
|
+
* @memberof mls.CommitBundle
|
|
415
|
+
* @static
|
|
416
|
+
* @param {mls.ICommitBundle} message CommitBundle message or plain object to encode
|
|
417
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
418
|
+
* @returns {$protobuf.Writer} Writer
|
|
419
|
+
*/
|
|
420
|
+
CommitBundle.encodeDelimited = function encodeDelimited(message, writer) {
|
|
421
|
+
return this.encode(message, writer).ldelim();
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Decodes a CommitBundle message from the specified reader or buffer.
|
|
426
|
+
* @function decode
|
|
427
|
+
* @memberof mls.CommitBundle
|
|
428
|
+
* @static
|
|
429
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
430
|
+
* @param {number} [length] Message length if known beforehand
|
|
431
|
+
* @returns {mls.CommitBundle} CommitBundle
|
|
432
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
433
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
434
|
+
*/
|
|
435
|
+
CommitBundle.decode = function decode(reader, length) {
|
|
436
|
+
if (!(reader instanceof $Reader))
|
|
437
|
+
reader = $Reader.create(reader);
|
|
438
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.mls.CommitBundle();
|
|
439
|
+
while (reader.pos < end) {
|
|
440
|
+
var tag = reader.uint32();
|
|
441
|
+
switch (tag >>> 3) {
|
|
442
|
+
case 1:
|
|
443
|
+
message.commit = reader.bytes();
|
|
444
|
+
break;
|
|
445
|
+
case 2:
|
|
446
|
+
message.welcome = reader.bytes();
|
|
447
|
+
break;
|
|
448
|
+
case 3:
|
|
449
|
+
message.groupInfoBundle = $root.mls.GroupInfoBundle.decode(reader, reader.uint32());
|
|
450
|
+
break;
|
|
451
|
+
default:
|
|
452
|
+
reader.skipType(tag & 7);
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (!message.hasOwnProperty("commit"))
|
|
457
|
+
throw $util.ProtocolError("missing required 'commit'", { instance: message });
|
|
458
|
+
if (!message.hasOwnProperty("groupInfoBundle"))
|
|
459
|
+
throw $util.ProtocolError("missing required 'groupInfoBundle'", { instance: message });
|
|
460
|
+
return message;
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Decodes a CommitBundle message from the specified reader or buffer, length delimited.
|
|
465
|
+
* @function decodeDelimited
|
|
466
|
+
* @memberof mls.CommitBundle
|
|
467
|
+
* @static
|
|
468
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
469
|
+
* @returns {mls.CommitBundle} CommitBundle
|
|
470
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
471
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
472
|
+
*/
|
|
473
|
+
CommitBundle.decodeDelimited = function decodeDelimited(reader) {
|
|
474
|
+
if (!(reader instanceof $Reader))
|
|
475
|
+
reader = new $Reader(reader);
|
|
476
|
+
return this.decode(reader, reader.uint32());
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Verifies a CommitBundle message.
|
|
481
|
+
* @function verify
|
|
482
|
+
* @memberof mls.CommitBundle
|
|
483
|
+
* @static
|
|
484
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
485
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
486
|
+
*/
|
|
487
|
+
CommitBundle.verify = function verify(message) {
|
|
488
|
+
if (typeof message !== "object" || message === null)
|
|
489
|
+
return "object expected";
|
|
490
|
+
if (!(message.commit && typeof message.commit.length === "number" || $util.isString(message.commit)))
|
|
491
|
+
return "commit: buffer expected";
|
|
492
|
+
if (message.welcome != null && message.hasOwnProperty("welcome"))
|
|
493
|
+
if (!(message.welcome && typeof message.welcome.length === "number" || $util.isString(message.welcome)))
|
|
494
|
+
return "welcome: buffer expected";
|
|
495
|
+
{
|
|
496
|
+
var error = $root.mls.GroupInfoBundle.verify(message.groupInfoBundle);
|
|
497
|
+
if (error)
|
|
498
|
+
return "groupInfoBundle." + error;
|
|
499
|
+
}
|
|
500
|
+
return null;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Creates a CommitBundle message from a plain object. Also converts values to their respective internal types.
|
|
505
|
+
* @function fromObject
|
|
506
|
+
* @memberof mls.CommitBundle
|
|
507
|
+
* @static
|
|
508
|
+
* @param {Object.<string,*>} object Plain object
|
|
509
|
+
* @returns {mls.CommitBundle} CommitBundle
|
|
510
|
+
*/
|
|
511
|
+
CommitBundle.fromObject = function fromObject(object) {
|
|
512
|
+
if (object instanceof $root.mls.CommitBundle)
|
|
513
|
+
return object;
|
|
514
|
+
var message = new $root.mls.CommitBundle();
|
|
515
|
+
if (object.commit != null)
|
|
516
|
+
if (typeof object.commit === "string")
|
|
517
|
+
$util.base64.decode(object.commit, message.commit = $util.newBuffer($util.base64.length(object.commit)), 0);
|
|
518
|
+
else if (object.commit.length)
|
|
519
|
+
message.commit = object.commit;
|
|
520
|
+
if (object.welcome != null)
|
|
521
|
+
if (typeof object.welcome === "string")
|
|
522
|
+
$util.base64.decode(object.welcome, message.welcome = $util.newBuffer($util.base64.length(object.welcome)), 0);
|
|
523
|
+
else if (object.welcome.length)
|
|
524
|
+
message.welcome = object.welcome;
|
|
525
|
+
if (object.groupInfoBundle != null) {
|
|
526
|
+
if (typeof object.groupInfoBundle !== "object")
|
|
527
|
+
throw TypeError(".mls.CommitBundle.groupInfoBundle: object expected");
|
|
528
|
+
message.groupInfoBundle = $root.mls.GroupInfoBundle.fromObject(object.groupInfoBundle);
|
|
529
|
+
}
|
|
530
|
+
return message;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Creates a plain object from a CommitBundle message. Also converts values to other types if specified.
|
|
535
|
+
* @function toObject
|
|
536
|
+
* @memberof mls.CommitBundle
|
|
537
|
+
* @static
|
|
538
|
+
* @param {mls.CommitBundle} message CommitBundle
|
|
539
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
540
|
+
* @returns {Object.<string,*>} Plain object
|
|
541
|
+
*/
|
|
542
|
+
CommitBundle.toObject = function toObject(message, options) {
|
|
543
|
+
if (!options)
|
|
544
|
+
options = {};
|
|
545
|
+
var object = {};
|
|
546
|
+
if (options.defaults) {
|
|
547
|
+
if (options.bytes === String)
|
|
548
|
+
object.commit = "";
|
|
549
|
+
else {
|
|
550
|
+
object.commit = [];
|
|
551
|
+
if (options.bytes !== Array)
|
|
552
|
+
object.commit = $util.newBuffer(object.commit);
|
|
553
|
+
}
|
|
554
|
+
if (options.bytes === String)
|
|
555
|
+
object.welcome = "";
|
|
556
|
+
else {
|
|
557
|
+
object.welcome = [];
|
|
558
|
+
if (options.bytes !== Array)
|
|
559
|
+
object.welcome = $util.newBuffer(object.welcome);
|
|
560
|
+
}
|
|
561
|
+
object.groupInfoBundle = null;
|
|
562
|
+
}
|
|
563
|
+
if (message.commit != null && message.hasOwnProperty("commit"))
|
|
564
|
+
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;
|
|
565
|
+
if (message.welcome != null && message.hasOwnProperty("welcome"))
|
|
566
|
+
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;
|
|
567
|
+
if (message.groupInfoBundle != null && message.hasOwnProperty("groupInfoBundle"))
|
|
568
|
+
object.groupInfoBundle = $root.mls.GroupInfoBundle.toObject(message.groupInfoBundle, options);
|
|
569
|
+
return object;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Converts this CommitBundle to JSON.
|
|
574
|
+
* @function toJSON
|
|
575
|
+
* @memberof mls.CommitBundle
|
|
576
|
+
* @instance
|
|
577
|
+
* @returns {Object.<string,*>} JSON object
|
|
578
|
+
*/
|
|
579
|
+
CommitBundle.prototype.toJSON = function toJSON() {
|
|
580
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
return CommitBundle;
|
|
584
|
+
})();
|
|
585
|
+
|
|
586
|
+
return mls;
|
|
587
|
+
})();
|
|
588
|
+
|
|
589
|
+
module.exports = $root;
|