core-3nweb-client-lib 0.24.0 → 0.24.1

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 (53) hide show
  1. package/build/ipc-via-protobuf/asmail-cap.js +17 -18
  2. package/build/ipc-via-protobuf/bytes.js +10 -11
  3. package/build/ipc-via-protobuf/connector.d.ts +2 -1
  4. package/build/ipc-via-protobuf/connector.js +4 -2
  5. package/build/ipc-via-protobuf/file.d.ts +1 -1
  6. package/build/ipc-via-protobuf/file.js +30 -31
  7. package/build/ipc-via-protobuf/fs.d.ts +1 -1
  8. package/build/ipc-via-protobuf/fs.js +37 -38
  9. package/build/ipc-via-protobuf/log-cap.js +4 -5
  10. package/build/ipc-via-protobuf/mailerid.js +5 -7
  11. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -2
  12. package/build/ipc-via-protobuf/protobuf-msg.js +9 -24
  13. package/build/ipc-via-protobuf/startup-cap.js +10 -11
  14. package/build/ipc-via-protobuf/storage-cap.js +7 -8
  15. package/build/lib-client/cryptor/cryptor-in-worker.js +7 -20
  16. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  17. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  18. package/build/lib-client/cryptor/in-proc-wasm.js +7 -20
  19. package/build/lib-client/{protobuf-loader.d.ts → protobuf-type.d.ts} +2 -4
  20. package/build/lib-client/{protobuf-loader.js → protobuf-type.js} +3 -43
  21. package/build/lib-index.d.ts +0 -1
  22. package/build/protos/asmail.proto.js +22296 -0
  23. package/build/protos/bytes.proto.js +3614 -0
  24. package/build/protos/common.proto.js +1863 -0
  25. package/build/protos/cryptor.proto.js +1667 -0
  26. package/build/protos/file.proto.js +7264 -0
  27. package/build/protos/fs.proto.js +17142 -0
  28. package/build/protos/ipc.proto.js +2349 -0
  29. package/build/protos/logger.proto.js +2112 -0
  30. package/build/protos/mailerid.proto.js +2249 -0
  31. package/build/protos/startup.proto.js +3291 -0
  32. package/build/protos/storage.proto.js +2689 -0
  33. package/package.json +2 -2
  34. package/{build/ipc-via-protobuf/protos → protos}/asmail.proto +0 -0
  35. package/{build/ipc-via-protobuf/protos → protos}/bytes.proto +0 -0
  36. package/{build/ipc-via-protobuf/protos → protos}/common.proto +0 -0
  37. package/{build/ipc-via-protobuf/protos → protos}/file.proto +0 -0
  38. package/{build/ipc-via-protobuf/protos → protos}/fs.proto +0 -0
  39. package/{build/ipc-via-protobuf/protos → protos}/ipc.proto +0 -0
  40. package/{build/ipc-via-protobuf/protos → protos}/logger.proto +0 -0
  41. package/{build/ipc-via-protobuf/protos → protos}/mailerid.proto +0 -0
  42. package/{build/ipc-via-protobuf/protos → protos}/startup.proto +0 -0
  43. package/{build/ipc-via-protobuf/protos → protos}/storage.proto +0 -0
  44. package/build/api-defs/asmail.d.ts +0 -292
  45. package/build/api-defs/common-caps.d.ts +0 -81
  46. package/build/api-defs/files.d.ts +0 -1037
  47. package/build/api-defs/mailerid.d.ts +0 -29
  48. package/build/api-defs/startup.d.ts +0 -121
  49. package/build/api-defs/storage.d.ts +0 -69
  50. package/build/api-defs/web3n.d.ts +0 -50
  51. package/build/ipc-via-protobuf/proto-defs.js +0 -1092
  52. package/build/lib-client/cryptor/proto-defs.js +0 -50
  53. package/build/lib-client/cryptor/protos/cryptor.proto +0 -45
@@ -0,0 +1,1667 @@
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.cryptor = (function() {
13
+
14
+ /**
15
+ * Namespace cryptor.
16
+ * @exports cryptor
17
+ * @namespace
18
+ */
19
+ var cryptor = {};
20
+
21
+ cryptor.Request = (function() {
22
+
23
+ /**
24
+ * Properties of a Request.
25
+ * @memberof cryptor
26
+ * @interface IRequest
27
+ * @property {number|null} [func] Request func
28
+ * @property {Array.<cryptor.IBytesVal>|null} [byteArgs] Request byteArgs
29
+ * @property {cryptor.Request.IScryptArgs|null} [scryptArgs] Request scryptArgs
30
+ */
31
+
32
+ /**
33
+ * Constructs a new Request.
34
+ * @memberof cryptor
35
+ * @classdesc Represents a Request.
36
+ * @implements IRequest
37
+ * @constructor
38
+ * @param {cryptor.IRequest=} [properties] Properties to set
39
+ */
40
+ function Request(properties) {
41
+ this.byteArgs = [];
42
+ if (properties)
43
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
44
+ if (properties[keys[i]] != null)
45
+ this[keys[i]] = properties[keys[i]];
46
+ }
47
+
48
+ /**
49
+ * Request func.
50
+ * @member {number} func
51
+ * @memberof cryptor.Request
52
+ * @instance
53
+ */
54
+ Request.prototype.func = 0;
55
+
56
+ /**
57
+ * Request byteArgs.
58
+ * @member {Array.<cryptor.IBytesVal>} byteArgs
59
+ * @memberof cryptor.Request
60
+ * @instance
61
+ */
62
+ Request.prototype.byteArgs = $util.emptyArray;
63
+
64
+ /**
65
+ * Request scryptArgs.
66
+ * @member {cryptor.Request.IScryptArgs|null|undefined} scryptArgs
67
+ * @memberof cryptor.Request
68
+ * @instance
69
+ */
70
+ Request.prototype.scryptArgs = null;
71
+
72
+ /**
73
+ * Creates a new Request instance using the specified properties.
74
+ * @function create
75
+ * @memberof cryptor.Request
76
+ * @static
77
+ * @param {cryptor.IRequest=} [properties] Properties to set
78
+ * @returns {cryptor.Request} Request instance
79
+ */
80
+ Request.create = function create(properties) {
81
+ return new Request(properties);
82
+ };
83
+
84
+ /**
85
+ * Encodes the specified Request message. Does not implicitly {@link cryptor.Request.verify|verify} messages.
86
+ * @function encode
87
+ * @memberof cryptor.Request
88
+ * @static
89
+ * @param {cryptor.IRequest} message Request message or plain object to encode
90
+ * @param {$protobuf.Writer} [writer] Writer to encode to
91
+ * @returns {$protobuf.Writer} Writer
92
+ */
93
+ Request.encode = function encode(message, writer) {
94
+ if (!writer)
95
+ writer = $Writer.create();
96
+ if (message.func != null && Object.hasOwnProperty.call(message, "func"))
97
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.func);
98
+ if (message.byteArgs != null && message.byteArgs.length)
99
+ for (var i = 0; i < message.byteArgs.length; ++i)
100
+ $root.cryptor.BytesVal.encode(message.byteArgs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
101
+ if (message.scryptArgs != null && Object.hasOwnProperty.call(message, "scryptArgs"))
102
+ $root.cryptor.Request.ScryptArgs.encode(message.scryptArgs, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
103
+ return writer;
104
+ };
105
+
106
+ /**
107
+ * Encodes the specified Request message, length delimited. Does not implicitly {@link cryptor.Request.verify|verify} messages.
108
+ * @function encodeDelimited
109
+ * @memberof cryptor.Request
110
+ * @static
111
+ * @param {cryptor.IRequest} message Request message or plain object to encode
112
+ * @param {$protobuf.Writer} [writer] Writer to encode to
113
+ * @returns {$protobuf.Writer} Writer
114
+ */
115
+ Request.encodeDelimited = function encodeDelimited(message, writer) {
116
+ return this.encode(message, writer).ldelim();
117
+ };
118
+
119
+ /**
120
+ * Decodes a Request message from the specified reader or buffer.
121
+ * @function decode
122
+ * @memberof cryptor.Request
123
+ * @static
124
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
125
+ * @param {number} [length] Message length if known beforehand
126
+ * @returns {cryptor.Request} Request
127
+ * @throws {Error} If the payload is not a reader or valid buffer
128
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
129
+ */
130
+ Request.decode = function decode(reader, length) {
131
+ if (!(reader instanceof $Reader))
132
+ reader = $Reader.create(reader);
133
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.Request();
134
+ while (reader.pos < end) {
135
+ var tag = reader.uint32();
136
+ switch (tag >>> 3) {
137
+ case 1:
138
+ message.func = reader.uint32();
139
+ break;
140
+ case 2:
141
+ if (!(message.byteArgs && message.byteArgs.length))
142
+ message.byteArgs = [];
143
+ message.byteArgs.push($root.cryptor.BytesVal.decode(reader, reader.uint32()));
144
+ break;
145
+ case 3:
146
+ message.scryptArgs = $root.cryptor.Request.ScryptArgs.decode(reader, reader.uint32());
147
+ break;
148
+ default:
149
+ reader.skipType(tag & 7);
150
+ break;
151
+ }
152
+ }
153
+ return message;
154
+ };
155
+
156
+ /**
157
+ * Decodes a Request message from the specified reader or buffer, length delimited.
158
+ * @function decodeDelimited
159
+ * @memberof cryptor.Request
160
+ * @static
161
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
162
+ * @returns {cryptor.Request} Request
163
+ * @throws {Error} If the payload is not a reader or valid buffer
164
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
165
+ */
166
+ Request.decodeDelimited = function decodeDelimited(reader) {
167
+ if (!(reader instanceof $Reader))
168
+ reader = new $Reader(reader);
169
+ return this.decode(reader, reader.uint32());
170
+ };
171
+
172
+ /**
173
+ * Verifies a Request message.
174
+ * @function verify
175
+ * @memberof cryptor.Request
176
+ * @static
177
+ * @param {Object.<string,*>} message Plain object to verify
178
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
179
+ */
180
+ Request.verify = function verify(message) {
181
+ if (typeof message !== "object" || message === null)
182
+ return "object expected";
183
+ if (message.func != null && message.hasOwnProperty("func"))
184
+ if (!$util.isInteger(message.func))
185
+ return "func: integer expected";
186
+ if (message.byteArgs != null && message.hasOwnProperty("byteArgs")) {
187
+ if (!Array.isArray(message.byteArgs))
188
+ return "byteArgs: array expected";
189
+ for (var i = 0; i < message.byteArgs.length; ++i) {
190
+ var error = $root.cryptor.BytesVal.verify(message.byteArgs[i]);
191
+ if (error)
192
+ return "byteArgs." + error;
193
+ }
194
+ }
195
+ if (message.scryptArgs != null && message.hasOwnProperty("scryptArgs")) {
196
+ var error = $root.cryptor.Request.ScryptArgs.verify(message.scryptArgs);
197
+ if (error)
198
+ return "scryptArgs." + error;
199
+ }
200
+ return null;
201
+ };
202
+
203
+ /**
204
+ * Creates a Request message from a plain object. Also converts values to their respective internal types.
205
+ * @function fromObject
206
+ * @memberof cryptor.Request
207
+ * @static
208
+ * @param {Object.<string,*>} object Plain object
209
+ * @returns {cryptor.Request} Request
210
+ */
211
+ Request.fromObject = function fromObject(object) {
212
+ if (object instanceof $root.cryptor.Request)
213
+ return object;
214
+ var message = new $root.cryptor.Request();
215
+ if (object.func != null)
216
+ message.func = object.func >>> 0;
217
+ if (object.byteArgs) {
218
+ if (!Array.isArray(object.byteArgs))
219
+ throw TypeError(".cryptor.Request.byteArgs: array expected");
220
+ message.byteArgs = [];
221
+ for (var i = 0; i < object.byteArgs.length; ++i) {
222
+ if (typeof object.byteArgs[i] !== "object")
223
+ throw TypeError(".cryptor.Request.byteArgs: object expected");
224
+ message.byteArgs[i] = $root.cryptor.BytesVal.fromObject(object.byteArgs[i]);
225
+ }
226
+ }
227
+ if (object.scryptArgs != null) {
228
+ if (typeof object.scryptArgs !== "object")
229
+ throw TypeError(".cryptor.Request.scryptArgs: object expected");
230
+ message.scryptArgs = $root.cryptor.Request.ScryptArgs.fromObject(object.scryptArgs);
231
+ }
232
+ return message;
233
+ };
234
+
235
+ /**
236
+ * Creates a plain object from a Request message. Also converts values to other types if specified.
237
+ * @function toObject
238
+ * @memberof cryptor.Request
239
+ * @static
240
+ * @param {cryptor.Request} message Request
241
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
242
+ * @returns {Object.<string,*>} Plain object
243
+ */
244
+ Request.toObject = function toObject(message, options) {
245
+ if (!options)
246
+ options = {};
247
+ var object = {};
248
+ if (options.arrays || options.defaults)
249
+ object.byteArgs = [];
250
+ if (options.defaults) {
251
+ object.func = 0;
252
+ object.scryptArgs = null;
253
+ }
254
+ if (message.func != null && message.hasOwnProperty("func"))
255
+ object.func = message.func;
256
+ if (message.byteArgs && message.byteArgs.length) {
257
+ object.byteArgs = [];
258
+ for (var j = 0; j < message.byteArgs.length; ++j)
259
+ object.byteArgs[j] = $root.cryptor.BytesVal.toObject(message.byteArgs[j], options);
260
+ }
261
+ if (message.scryptArgs != null && message.hasOwnProperty("scryptArgs"))
262
+ object.scryptArgs = $root.cryptor.Request.ScryptArgs.toObject(message.scryptArgs, options);
263
+ return object;
264
+ };
265
+
266
+ /**
267
+ * Converts this Request to JSON.
268
+ * @function toJSON
269
+ * @memberof cryptor.Request
270
+ * @instance
271
+ * @returns {Object.<string,*>} JSON object
272
+ */
273
+ Request.prototype.toJSON = function toJSON() {
274
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
275
+ };
276
+
277
+ Request.ScryptArgs = (function() {
278
+
279
+ /**
280
+ * Properties of a ScryptArgs.
281
+ * @memberof cryptor.Request
282
+ * @interface IScryptArgs
283
+ * @property {Uint8Array|null} [passwd] ScryptArgs passwd
284
+ * @property {Uint8Array|null} [salt] ScryptArgs salt
285
+ * @property {number|null} [logN] ScryptArgs logN
286
+ * @property {number|null} [r] ScryptArgs r
287
+ * @property {number|null} [p] ScryptArgs p
288
+ * @property {number|null} [dkLen] ScryptArgs dkLen
289
+ */
290
+
291
+ /**
292
+ * Constructs a new ScryptArgs.
293
+ * @memberof cryptor.Request
294
+ * @classdesc Represents a ScryptArgs.
295
+ * @implements IScryptArgs
296
+ * @constructor
297
+ * @param {cryptor.Request.IScryptArgs=} [properties] Properties to set
298
+ */
299
+ function ScryptArgs(properties) {
300
+ if (properties)
301
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
302
+ if (properties[keys[i]] != null)
303
+ this[keys[i]] = properties[keys[i]];
304
+ }
305
+
306
+ /**
307
+ * ScryptArgs passwd.
308
+ * @member {Uint8Array} passwd
309
+ * @memberof cryptor.Request.ScryptArgs
310
+ * @instance
311
+ */
312
+ ScryptArgs.prototype.passwd = $util.newBuffer([]);
313
+
314
+ /**
315
+ * ScryptArgs salt.
316
+ * @member {Uint8Array} salt
317
+ * @memberof cryptor.Request.ScryptArgs
318
+ * @instance
319
+ */
320
+ ScryptArgs.prototype.salt = $util.newBuffer([]);
321
+
322
+ /**
323
+ * ScryptArgs logN.
324
+ * @member {number} logN
325
+ * @memberof cryptor.Request.ScryptArgs
326
+ * @instance
327
+ */
328
+ ScryptArgs.prototype.logN = 0;
329
+
330
+ /**
331
+ * ScryptArgs r.
332
+ * @member {number} r
333
+ * @memberof cryptor.Request.ScryptArgs
334
+ * @instance
335
+ */
336
+ ScryptArgs.prototype.r = 0;
337
+
338
+ /**
339
+ * ScryptArgs p.
340
+ * @member {number} p
341
+ * @memberof cryptor.Request.ScryptArgs
342
+ * @instance
343
+ */
344
+ ScryptArgs.prototype.p = 0;
345
+
346
+ /**
347
+ * ScryptArgs dkLen.
348
+ * @member {number} dkLen
349
+ * @memberof cryptor.Request.ScryptArgs
350
+ * @instance
351
+ */
352
+ ScryptArgs.prototype.dkLen = 0;
353
+
354
+ /**
355
+ * Creates a new ScryptArgs instance using the specified properties.
356
+ * @function create
357
+ * @memberof cryptor.Request.ScryptArgs
358
+ * @static
359
+ * @param {cryptor.Request.IScryptArgs=} [properties] Properties to set
360
+ * @returns {cryptor.Request.ScryptArgs} ScryptArgs instance
361
+ */
362
+ ScryptArgs.create = function create(properties) {
363
+ return new ScryptArgs(properties);
364
+ };
365
+
366
+ /**
367
+ * Encodes the specified ScryptArgs message. Does not implicitly {@link cryptor.Request.ScryptArgs.verify|verify} messages.
368
+ * @function encode
369
+ * @memberof cryptor.Request.ScryptArgs
370
+ * @static
371
+ * @param {cryptor.Request.IScryptArgs} message ScryptArgs message or plain object to encode
372
+ * @param {$protobuf.Writer} [writer] Writer to encode to
373
+ * @returns {$protobuf.Writer} Writer
374
+ */
375
+ ScryptArgs.encode = function encode(message, writer) {
376
+ if (!writer)
377
+ writer = $Writer.create();
378
+ if (message.passwd != null && Object.hasOwnProperty.call(message, "passwd"))
379
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.passwd);
380
+ if (message.salt != null && Object.hasOwnProperty.call(message, "salt"))
381
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.salt);
382
+ if (message.logN != null && Object.hasOwnProperty.call(message, "logN"))
383
+ writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.logN);
384
+ if (message.r != null && Object.hasOwnProperty.call(message, "r"))
385
+ writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.r);
386
+ if (message.p != null && Object.hasOwnProperty.call(message, "p"))
387
+ writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.p);
388
+ if (message.dkLen != null && Object.hasOwnProperty.call(message, "dkLen"))
389
+ writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.dkLen);
390
+ return writer;
391
+ };
392
+
393
+ /**
394
+ * Encodes the specified ScryptArgs message, length delimited. Does not implicitly {@link cryptor.Request.ScryptArgs.verify|verify} messages.
395
+ * @function encodeDelimited
396
+ * @memberof cryptor.Request.ScryptArgs
397
+ * @static
398
+ * @param {cryptor.Request.IScryptArgs} message ScryptArgs message or plain object to encode
399
+ * @param {$protobuf.Writer} [writer] Writer to encode to
400
+ * @returns {$protobuf.Writer} Writer
401
+ */
402
+ ScryptArgs.encodeDelimited = function encodeDelimited(message, writer) {
403
+ return this.encode(message, writer).ldelim();
404
+ };
405
+
406
+ /**
407
+ * Decodes a ScryptArgs message from the specified reader or buffer.
408
+ * @function decode
409
+ * @memberof cryptor.Request.ScryptArgs
410
+ * @static
411
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
412
+ * @param {number} [length] Message length if known beforehand
413
+ * @returns {cryptor.Request.ScryptArgs} ScryptArgs
414
+ * @throws {Error} If the payload is not a reader or valid buffer
415
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
416
+ */
417
+ ScryptArgs.decode = function decode(reader, length) {
418
+ if (!(reader instanceof $Reader))
419
+ reader = $Reader.create(reader);
420
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.Request.ScryptArgs();
421
+ while (reader.pos < end) {
422
+ var tag = reader.uint32();
423
+ switch (tag >>> 3) {
424
+ case 1:
425
+ message.passwd = reader.bytes();
426
+ break;
427
+ case 2:
428
+ message.salt = reader.bytes();
429
+ break;
430
+ case 3:
431
+ message.logN = reader.uint32();
432
+ break;
433
+ case 4:
434
+ message.r = reader.uint32();
435
+ break;
436
+ case 5:
437
+ message.p = reader.uint32();
438
+ break;
439
+ case 6:
440
+ message.dkLen = reader.uint32();
441
+ break;
442
+ default:
443
+ reader.skipType(tag & 7);
444
+ break;
445
+ }
446
+ }
447
+ return message;
448
+ };
449
+
450
+ /**
451
+ * Decodes a ScryptArgs message from the specified reader or buffer, length delimited.
452
+ * @function decodeDelimited
453
+ * @memberof cryptor.Request.ScryptArgs
454
+ * @static
455
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
456
+ * @returns {cryptor.Request.ScryptArgs} ScryptArgs
457
+ * @throws {Error} If the payload is not a reader or valid buffer
458
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
459
+ */
460
+ ScryptArgs.decodeDelimited = function decodeDelimited(reader) {
461
+ if (!(reader instanceof $Reader))
462
+ reader = new $Reader(reader);
463
+ return this.decode(reader, reader.uint32());
464
+ };
465
+
466
+ /**
467
+ * Verifies a ScryptArgs message.
468
+ * @function verify
469
+ * @memberof cryptor.Request.ScryptArgs
470
+ * @static
471
+ * @param {Object.<string,*>} message Plain object to verify
472
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
473
+ */
474
+ ScryptArgs.verify = function verify(message) {
475
+ if (typeof message !== "object" || message === null)
476
+ return "object expected";
477
+ if (message.passwd != null && message.hasOwnProperty("passwd"))
478
+ if (!(message.passwd && typeof message.passwd.length === "number" || $util.isString(message.passwd)))
479
+ return "passwd: buffer expected";
480
+ if (message.salt != null && message.hasOwnProperty("salt"))
481
+ if (!(message.salt && typeof message.salt.length === "number" || $util.isString(message.salt)))
482
+ return "salt: buffer expected";
483
+ if (message.logN != null && message.hasOwnProperty("logN"))
484
+ if (!$util.isInteger(message.logN))
485
+ return "logN: integer expected";
486
+ if (message.r != null && message.hasOwnProperty("r"))
487
+ if (!$util.isInteger(message.r))
488
+ return "r: integer expected";
489
+ if (message.p != null && message.hasOwnProperty("p"))
490
+ if (!$util.isInteger(message.p))
491
+ return "p: integer expected";
492
+ if (message.dkLen != null && message.hasOwnProperty("dkLen"))
493
+ if (!$util.isInteger(message.dkLen))
494
+ return "dkLen: integer expected";
495
+ return null;
496
+ };
497
+
498
+ /**
499
+ * Creates a ScryptArgs message from a plain object. Also converts values to their respective internal types.
500
+ * @function fromObject
501
+ * @memberof cryptor.Request.ScryptArgs
502
+ * @static
503
+ * @param {Object.<string,*>} object Plain object
504
+ * @returns {cryptor.Request.ScryptArgs} ScryptArgs
505
+ */
506
+ ScryptArgs.fromObject = function fromObject(object) {
507
+ if (object instanceof $root.cryptor.Request.ScryptArgs)
508
+ return object;
509
+ var message = new $root.cryptor.Request.ScryptArgs();
510
+ if (object.passwd != null)
511
+ if (typeof object.passwd === "string")
512
+ $util.base64.decode(object.passwd, message.passwd = $util.newBuffer($util.base64.length(object.passwd)), 0);
513
+ else if (object.passwd.length)
514
+ message.passwd = object.passwd;
515
+ if (object.salt != null)
516
+ if (typeof object.salt === "string")
517
+ $util.base64.decode(object.salt, message.salt = $util.newBuffer($util.base64.length(object.salt)), 0);
518
+ else if (object.salt.length)
519
+ message.salt = object.salt;
520
+ if (object.logN != null)
521
+ message.logN = object.logN >>> 0;
522
+ if (object.r != null)
523
+ message.r = object.r >>> 0;
524
+ if (object.p != null)
525
+ message.p = object.p >>> 0;
526
+ if (object.dkLen != null)
527
+ message.dkLen = object.dkLen >>> 0;
528
+ return message;
529
+ };
530
+
531
+ /**
532
+ * Creates a plain object from a ScryptArgs message. Also converts values to other types if specified.
533
+ * @function toObject
534
+ * @memberof cryptor.Request.ScryptArgs
535
+ * @static
536
+ * @param {cryptor.Request.ScryptArgs} message ScryptArgs
537
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
538
+ * @returns {Object.<string,*>} Plain object
539
+ */
540
+ ScryptArgs.toObject = function toObject(message, options) {
541
+ if (!options)
542
+ options = {};
543
+ var object = {};
544
+ if (options.defaults) {
545
+ if (options.bytes === String)
546
+ object.passwd = "";
547
+ else {
548
+ object.passwd = [];
549
+ if (options.bytes !== Array)
550
+ object.passwd = $util.newBuffer(object.passwd);
551
+ }
552
+ if (options.bytes === String)
553
+ object.salt = "";
554
+ else {
555
+ object.salt = [];
556
+ if (options.bytes !== Array)
557
+ object.salt = $util.newBuffer(object.salt);
558
+ }
559
+ object.logN = 0;
560
+ object.r = 0;
561
+ object.p = 0;
562
+ object.dkLen = 0;
563
+ }
564
+ if (message.passwd != null && message.hasOwnProperty("passwd"))
565
+ object.passwd = options.bytes === String ? $util.base64.encode(message.passwd, 0, message.passwd.length) : options.bytes === Array ? Array.prototype.slice.call(message.passwd) : message.passwd;
566
+ if (message.salt != null && message.hasOwnProperty("salt"))
567
+ object.salt = options.bytes === String ? $util.base64.encode(message.salt, 0, message.salt.length) : options.bytes === Array ? Array.prototype.slice.call(message.salt) : message.salt;
568
+ if (message.logN != null && message.hasOwnProperty("logN"))
569
+ object.logN = message.logN;
570
+ if (message.r != null && message.hasOwnProperty("r"))
571
+ object.r = message.r;
572
+ if (message.p != null && message.hasOwnProperty("p"))
573
+ object.p = message.p;
574
+ if (message.dkLen != null && message.hasOwnProperty("dkLen"))
575
+ object.dkLen = message.dkLen;
576
+ return object;
577
+ };
578
+
579
+ /**
580
+ * Converts this ScryptArgs to JSON.
581
+ * @function toJSON
582
+ * @memberof cryptor.Request.ScryptArgs
583
+ * @instance
584
+ * @returns {Object.<string,*>} JSON object
585
+ */
586
+ ScryptArgs.prototype.toJSON = function toJSON() {
587
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
588
+ };
589
+
590
+ return ScryptArgs;
591
+ })();
592
+
593
+ return Request;
594
+ })();
595
+
596
+ cryptor.BytesVal = (function() {
597
+
598
+ /**
599
+ * Properties of a BytesVal.
600
+ * @memberof cryptor
601
+ * @interface IBytesVal
602
+ * @property {Uint8Array|null} [val] BytesVal val
603
+ */
604
+
605
+ /**
606
+ * Constructs a new BytesVal.
607
+ * @memberof cryptor
608
+ * @classdesc Represents a BytesVal.
609
+ * @implements IBytesVal
610
+ * @constructor
611
+ * @param {cryptor.IBytesVal=} [properties] Properties to set
612
+ */
613
+ function BytesVal(properties) {
614
+ if (properties)
615
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
616
+ if (properties[keys[i]] != null)
617
+ this[keys[i]] = properties[keys[i]];
618
+ }
619
+
620
+ /**
621
+ * BytesVal val.
622
+ * @member {Uint8Array} val
623
+ * @memberof cryptor.BytesVal
624
+ * @instance
625
+ */
626
+ BytesVal.prototype.val = $util.newBuffer([]);
627
+
628
+ /**
629
+ * Creates a new BytesVal instance using the specified properties.
630
+ * @function create
631
+ * @memberof cryptor.BytesVal
632
+ * @static
633
+ * @param {cryptor.IBytesVal=} [properties] Properties to set
634
+ * @returns {cryptor.BytesVal} BytesVal instance
635
+ */
636
+ BytesVal.create = function create(properties) {
637
+ return new BytesVal(properties);
638
+ };
639
+
640
+ /**
641
+ * Encodes the specified BytesVal message. Does not implicitly {@link cryptor.BytesVal.verify|verify} messages.
642
+ * @function encode
643
+ * @memberof cryptor.BytesVal
644
+ * @static
645
+ * @param {cryptor.IBytesVal} message BytesVal message or plain object to encode
646
+ * @param {$protobuf.Writer} [writer] Writer to encode to
647
+ * @returns {$protobuf.Writer} Writer
648
+ */
649
+ BytesVal.encode = function encode(message, writer) {
650
+ if (!writer)
651
+ writer = $Writer.create();
652
+ if (message.val != null && Object.hasOwnProperty.call(message, "val"))
653
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.val);
654
+ return writer;
655
+ };
656
+
657
+ /**
658
+ * Encodes the specified BytesVal message, length delimited. Does not implicitly {@link cryptor.BytesVal.verify|verify} messages.
659
+ * @function encodeDelimited
660
+ * @memberof cryptor.BytesVal
661
+ * @static
662
+ * @param {cryptor.IBytesVal} message BytesVal message or plain object to encode
663
+ * @param {$protobuf.Writer} [writer] Writer to encode to
664
+ * @returns {$protobuf.Writer} Writer
665
+ */
666
+ BytesVal.encodeDelimited = function encodeDelimited(message, writer) {
667
+ return this.encode(message, writer).ldelim();
668
+ };
669
+
670
+ /**
671
+ * Decodes a BytesVal message from the specified reader or buffer.
672
+ * @function decode
673
+ * @memberof cryptor.BytesVal
674
+ * @static
675
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
676
+ * @param {number} [length] Message length if known beforehand
677
+ * @returns {cryptor.BytesVal} BytesVal
678
+ * @throws {Error} If the payload is not a reader or valid buffer
679
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
680
+ */
681
+ BytesVal.decode = function decode(reader, length) {
682
+ if (!(reader instanceof $Reader))
683
+ reader = $Reader.create(reader);
684
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.BytesVal();
685
+ while (reader.pos < end) {
686
+ var tag = reader.uint32();
687
+ switch (tag >>> 3) {
688
+ case 1:
689
+ message.val = reader.bytes();
690
+ break;
691
+ default:
692
+ reader.skipType(tag & 7);
693
+ break;
694
+ }
695
+ }
696
+ return message;
697
+ };
698
+
699
+ /**
700
+ * Decodes a BytesVal message from the specified reader or buffer, length delimited.
701
+ * @function decodeDelimited
702
+ * @memberof cryptor.BytesVal
703
+ * @static
704
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
705
+ * @returns {cryptor.BytesVal} BytesVal
706
+ * @throws {Error} If the payload is not a reader or valid buffer
707
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
708
+ */
709
+ BytesVal.decodeDelimited = function decodeDelimited(reader) {
710
+ if (!(reader instanceof $Reader))
711
+ reader = new $Reader(reader);
712
+ return this.decode(reader, reader.uint32());
713
+ };
714
+
715
+ /**
716
+ * Verifies a BytesVal message.
717
+ * @function verify
718
+ * @memberof cryptor.BytesVal
719
+ * @static
720
+ * @param {Object.<string,*>} message Plain object to verify
721
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
722
+ */
723
+ BytesVal.verify = function verify(message) {
724
+ if (typeof message !== "object" || message === null)
725
+ return "object expected";
726
+ if (message.val != null && message.hasOwnProperty("val"))
727
+ if (!(message.val && typeof message.val.length === "number" || $util.isString(message.val)))
728
+ return "val: buffer expected";
729
+ return null;
730
+ };
731
+
732
+ /**
733
+ * Creates a BytesVal message from a plain object. Also converts values to their respective internal types.
734
+ * @function fromObject
735
+ * @memberof cryptor.BytesVal
736
+ * @static
737
+ * @param {Object.<string,*>} object Plain object
738
+ * @returns {cryptor.BytesVal} BytesVal
739
+ */
740
+ BytesVal.fromObject = function fromObject(object) {
741
+ if (object instanceof $root.cryptor.BytesVal)
742
+ return object;
743
+ var message = new $root.cryptor.BytesVal();
744
+ if (object.val != null)
745
+ if (typeof object.val === "string")
746
+ $util.base64.decode(object.val, message.val = $util.newBuffer($util.base64.length(object.val)), 0);
747
+ else if (object.val.length)
748
+ message.val = object.val;
749
+ return message;
750
+ };
751
+
752
+ /**
753
+ * Creates a plain object from a BytesVal message. Also converts values to other types if specified.
754
+ * @function toObject
755
+ * @memberof cryptor.BytesVal
756
+ * @static
757
+ * @param {cryptor.BytesVal} message BytesVal
758
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
759
+ * @returns {Object.<string,*>} Plain object
760
+ */
761
+ BytesVal.toObject = function toObject(message, options) {
762
+ if (!options)
763
+ options = {};
764
+ var object = {};
765
+ if (options.defaults)
766
+ if (options.bytes === String)
767
+ object.val = "";
768
+ else {
769
+ object.val = [];
770
+ if (options.bytes !== Array)
771
+ object.val = $util.newBuffer(object.val);
772
+ }
773
+ if (message.val != null && message.hasOwnProperty("val"))
774
+ object.val = options.bytes === String ? $util.base64.encode(message.val, 0, message.val.length) : options.bytes === Array ? Array.prototype.slice.call(message.val) : message.val;
775
+ return object;
776
+ };
777
+
778
+ /**
779
+ * Converts this BytesVal to JSON.
780
+ * @function toJSON
781
+ * @memberof cryptor.BytesVal
782
+ * @instance
783
+ * @returns {Object.<string,*>} JSON object
784
+ */
785
+ BytesVal.prototype.toJSON = function toJSON() {
786
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
787
+ };
788
+
789
+ return BytesVal;
790
+ })();
791
+
792
+ cryptor.Reply = (function() {
793
+
794
+ /**
795
+ * Properties of a Reply.
796
+ * @memberof cryptor
797
+ * @interface IReply
798
+ * @property {cryptor.IBytesVal|null} [res] Reply res
799
+ * @property {cryptor.IBytesVal|null} [interim] Reply interim
800
+ * @property {cryptor.Reply.IError|null} [err] Reply err
801
+ */
802
+
803
+ /**
804
+ * Constructs a new Reply.
805
+ * @memberof cryptor
806
+ * @classdesc Represents a Reply.
807
+ * @implements IReply
808
+ * @constructor
809
+ * @param {cryptor.IReply=} [properties] Properties to set
810
+ */
811
+ function Reply(properties) {
812
+ if (properties)
813
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
814
+ if (properties[keys[i]] != null)
815
+ this[keys[i]] = properties[keys[i]];
816
+ }
817
+
818
+ /**
819
+ * Reply res.
820
+ * @member {cryptor.IBytesVal|null|undefined} res
821
+ * @memberof cryptor.Reply
822
+ * @instance
823
+ */
824
+ Reply.prototype.res = null;
825
+
826
+ /**
827
+ * Reply interim.
828
+ * @member {cryptor.IBytesVal|null|undefined} interim
829
+ * @memberof cryptor.Reply
830
+ * @instance
831
+ */
832
+ Reply.prototype.interim = null;
833
+
834
+ /**
835
+ * Reply err.
836
+ * @member {cryptor.Reply.IError|null|undefined} err
837
+ * @memberof cryptor.Reply
838
+ * @instance
839
+ */
840
+ Reply.prototype.err = null;
841
+
842
+ /**
843
+ * Creates a new Reply instance using the specified properties.
844
+ * @function create
845
+ * @memberof cryptor.Reply
846
+ * @static
847
+ * @param {cryptor.IReply=} [properties] Properties to set
848
+ * @returns {cryptor.Reply} Reply instance
849
+ */
850
+ Reply.create = function create(properties) {
851
+ return new Reply(properties);
852
+ };
853
+
854
+ /**
855
+ * Encodes the specified Reply message. Does not implicitly {@link cryptor.Reply.verify|verify} messages.
856
+ * @function encode
857
+ * @memberof cryptor.Reply
858
+ * @static
859
+ * @param {cryptor.IReply} message Reply message or plain object to encode
860
+ * @param {$protobuf.Writer} [writer] Writer to encode to
861
+ * @returns {$protobuf.Writer} Writer
862
+ */
863
+ Reply.encode = function encode(message, writer) {
864
+ if (!writer)
865
+ writer = $Writer.create();
866
+ if (message.res != null && Object.hasOwnProperty.call(message, "res"))
867
+ $root.cryptor.BytesVal.encode(message.res, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
868
+ if (message.interim != null && Object.hasOwnProperty.call(message, "interim"))
869
+ $root.cryptor.BytesVal.encode(message.interim, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
870
+ if (message.err != null && Object.hasOwnProperty.call(message, "err"))
871
+ $root.cryptor.Reply.Error.encode(message.err, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
872
+ return writer;
873
+ };
874
+
875
+ /**
876
+ * Encodes the specified Reply message, length delimited. Does not implicitly {@link cryptor.Reply.verify|verify} messages.
877
+ * @function encodeDelimited
878
+ * @memberof cryptor.Reply
879
+ * @static
880
+ * @param {cryptor.IReply} message Reply message or plain object to encode
881
+ * @param {$protobuf.Writer} [writer] Writer to encode to
882
+ * @returns {$protobuf.Writer} Writer
883
+ */
884
+ Reply.encodeDelimited = function encodeDelimited(message, writer) {
885
+ return this.encode(message, writer).ldelim();
886
+ };
887
+
888
+ /**
889
+ * Decodes a Reply message from the specified reader or buffer.
890
+ * @function decode
891
+ * @memberof cryptor.Reply
892
+ * @static
893
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
894
+ * @param {number} [length] Message length if known beforehand
895
+ * @returns {cryptor.Reply} Reply
896
+ * @throws {Error} If the payload is not a reader or valid buffer
897
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
898
+ */
899
+ Reply.decode = function decode(reader, length) {
900
+ if (!(reader instanceof $Reader))
901
+ reader = $Reader.create(reader);
902
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.Reply();
903
+ while (reader.pos < end) {
904
+ var tag = reader.uint32();
905
+ switch (tag >>> 3) {
906
+ case 1:
907
+ message.res = $root.cryptor.BytesVal.decode(reader, reader.uint32());
908
+ break;
909
+ case 2:
910
+ message.interim = $root.cryptor.BytesVal.decode(reader, reader.uint32());
911
+ break;
912
+ case 3:
913
+ message.err = $root.cryptor.Reply.Error.decode(reader, reader.uint32());
914
+ break;
915
+ default:
916
+ reader.skipType(tag & 7);
917
+ break;
918
+ }
919
+ }
920
+ return message;
921
+ };
922
+
923
+ /**
924
+ * Decodes a Reply message from the specified reader or buffer, length delimited.
925
+ * @function decodeDelimited
926
+ * @memberof cryptor.Reply
927
+ * @static
928
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
929
+ * @returns {cryptor.Reply} Reply
930
+ * @throws {Error} If the payload is not a reader or valid buffer
931
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
932
+ */
933
+ Reply.decodeDelimited = function decodeDelimited(reader) {
934
+ if (!(reader instanceof $Reader))
935
+ reader = new $Reader(reader);
936
+ return this.decode(reader, reader.uint32());
937
+ };
938
+
939
+ /**
940
+ * Verifies a Reply message.
941
+ * @function verify
942
+ * @memberof cryptor.Reply
943
+ * @static
944
+ * @param {Object.<string,*>} message Plain object to verify
945
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
946
+ */
947
+ Reply.verify = function verify(message) {
948
+ if (typeof message !== "object" || message === null)
949
+ return "object expected";
950
+ if (message.res != null && message.hasOwnProperty("res")) {
951
+ var error = $root.cryptor.BytesVal.verify(message.res);
952
+ if (error)
953
+ return "res." + error;
954
+ }
955
+ if (message.interim != null && message.hasOwnProperty("interim")) {
956
+ var error = $root.cryptor.BytesVal.verify(message.interim);
957
+ if (error)
958
+ return "interim." + error;
959
+ }
960
+ if (message.err != null && message.hasOwnProperty("err")) {
961
+ var error = $root.cryptor.Reply.Error.verify(message.err);
962
+ if (error)
963
+ return "err." + error;
964
+ }
965
+ return null;
966
+ };
967
+
968
+ /**
969
+ * Creates a Reply message from a plain object. Also converts values to their respective internal types.
970
+ * @function fromObject
971
+ * @memberof cryptor.Reply
972
+ * @static
973
+ * @param {Object.<string,*>} object Plain object
974
+ * @returns {cryptor.Reply} Reply
975
+ */
976
+ Reply.fromObject = function fromObject(object) {
977
+ if (object instanceof $root.cryptor.Reply)
978
+ return object;
979
+ var message = new $root.cryptor.Reply();
980
+ if (object.res != null) {
981
+ if (typeof object.res !== "object")
982
+ throw TypeError(".cryptor.Reply.res: object expected");
983
+ message.res = $root.cryptor.BytesVal.fromObject(object.res);
984
+ }
985
+ if (object.interim != null) {
986
+ if (typeof object.interim !== "object")
987
+ throw TypeError(".cryptor.Reply.interim: object expected");
988
+ message.interim = $root.cryptor.BytesVal.fromObject(object.interim);
989
+ }
990
+ if (object.err != null) {
991
+ if (typeof object.err !== "object")
992
+ throw TypeError(".cryptor.Reply.err: object expected");
993
+ message.err = $root.cryptor.Reply.Error.fromObject(object.err);
994
+ }
995
+ return message;
996
+ };
997
+
998
+ /**
999
+ * Creates a plain object from a Reply message. Also converts values to other types if specified.
1000
+ * @function toObject
1001
+ * @memberof cryptor.Reply
1002
+ * @static
1003
+ * @param {cryptor.Reply} message Reply
1004
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1005
+ * @returns {Object.<string,*>} Plain object
1006
+ */
1007
+ Reply.toObject = function toObject(message, options) {
1008
+ if (!options)
1009
+ options = {};
1010
+ var object = {};
1011
+ if (options.defaults) {
1012
+ object.res = null;
1013
+ object.interim = null;
1014
+ object.err = null;
1015
+ }
1016
+ if (message.res != null && message.hasOwnProperty("res"))
1017
+ object.res = $root.cryptor.BytesVal.toObject(message.res, options);
1018
+ if (message.interim != null && message.hasOwnProperty("interim"))
1019
+ object.interim = $root.cryptor.BytesVal.toObject(message.interim, options);
1020
+ if (message.err != null && message.hasOwnProperty("err"))
1021
+ object.err = $root.cryptor.Reply.Error.toObject(message.err, options);
1022
+ return object;
1023
+ };
1024
+
1025
+ /**
1026
+ * Converts this Reply to JSON.
1027
+ * @function toJSON
1028
+ * @memberof cryptor.Reply
1029
+ * @instance
1030
+ * @returns {Object.<string,*>} JSON object
1031
+ */
1032
+ Reply.prototype.toJSON = function toJSON() {
1033
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1034
+ };
1035
+
1036
+ Reply.Error = (function() {
1037
+
1038
+ /**
1039
+ * Properties of an Error.
1040
+ * @memberof cryptor.Reply
1041
+ * @interface IError
1042
+ * @property {string|null} [condition] Error condition
1043
+ * @property {string|null} [message] Error message
1044
+ */
1045
+
1046
+ /**
1047
+ * Constructs a new Error.
1048
+ * @memberof cryptor.Reply
1049
+ * @classdesc Represents an Error.
1050
+ * @implements IError
1051
+ * @constructor
1052
+ * @param {cryptor.Reply.IError=} [properties] Properties to set
1053
+ */
1054
+ function Error(properties) {
1055
+ if (properties)
1056
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1057
+ if (properties[keys[i]] != null)
1058
+ this[keys[i]] = properties[keys[i]];
1059
+ }
1060
+
1061
+ /**
1062
+ * Error condition.
1063
+ * @member {string} condition
1064
+ * @memberof cryptor.Reply.Error
1065
+ * @instance
1066
+ */
1067
+ Error.prototype.condition = "";
1068
+
1069
+ /**
1070
+ * Error message.
1071
+ * @member {string} message
1072
+ * @memberof cryptor.Reply.Error
1073
+ * @instance
1074
+ */
1075
+ Error.prototype.message = "";
1076
+
1077
+ /**
1078
+ * Creates a new Error instance using the specified properties.
1079
+ * @function create
1080
+ * @memberof cryptor.Reply.Error
1081
+ * @static
1082
+ * @param {cryptor.Reply.IError=} [properties] Properties to set
1083
+ * @returns {cryptor.Reply.Error} Error instance
1084
+ */
1085
+ Error.create = function create(properties) {
1086
+ return new Error(properties);
1087
+ };
1088
+
1089
+ /**
1090
+ * Encodes the specified Error message. Does not implicitly {@link cryptor.Reply.Error.verify|verify} messages.
1091
+ * @function encode
1092
+ * @memberof cryptor.Reply.Error
1093
+ * @static
1094
+ * @param {cryptor.Reply.IError} message Error message or plain object to encode
1095
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1096
+ * @returns {$protobuf.Writer} Writer
1097
+ */
1098
+ Error.encode = function encode(message, writer) {
1099
+ if (!writer)
1100
+ writer = $Writer.create();
1101
+ if (message.condition != null && Object.hasOwnProperty.call(message, "condition"))
1102
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.condition);
1103
+ if (message.message != null && Object.hasOwnProperty.call(message, "message"))
1104
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.message);
1105
+ return writer;
1106
+ };
1107
+
1108
+ /**
1109
+ * Encodes the specified Error message, length delimited. Does not implicitly {@link cryptor.Reply.Error.verify|verify} messages.
1110
+ * @function encodeDelimited
1111
+ * @memberof cryptor.Reply.Error
1112
+ * @static
1113
+ * @param {cryptor.Reply.IError} message Error message or plain object to encode
1114
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1115
+ * @returns {$protobuf.Writer} Writer
1116
+ */
1117
+ Error.encodeDelimited = function encodeDelimited(message, writer) {
1118
+ return this.encode(message, writer).ldelim();
1119
+ };
1120
+
1121
+ /**
1122
+ * Decodes an Error message from the specified reader or buffer.
1123
+ * @function decode
1124
+ * @memberof cryptor.Reply.Error
1125
+ * @static
1126
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1127
+ * @param {number} [length] Message length if known beforehand
1128
+ * @returns {cryptor.Reply.Error} Error
1129
+ * @throws {Error} If the payload is not a reader or valid buffer
1130
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1131
+ */
1132
+ Error.decode = function decode(reader, length) {
1133
+ if (!(reader instanceof $Reader))
1134
+ reader = $Reader.create(reader);
1135
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.Reply.Error();
1136
+ while (reader.pos < end) {
1137
+ var tag = reader.uint32();
1138
+ switch (tag >>> 3) {
1139
+ case 1:
1140
+ message.condition = reader.string();
1141
+ break;
1142
+ case 2:
1143
+ message.message = reader.string();
1144
+ break;
1145
+ default:
1146
+ reader.skipType(tag & 7);
1147
+ break;
1148
+ }
1149
+ }
1150
+ return message;
1151
+ };
1152
+
1153
+ /**
1154
+ * Decodes an Error message from the specified reader or buffer, length delimited.
1155
+ * @function decodeDelimited
1156
+ * @memberof cryptor.Reply.Error
1157
+ * @static
1158
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1159
+ * @returns {cryptor.Reply.Error} Error
1160
+ * @throws {Error} If the payload is not a reader or valid buffer
1161
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1162
+ */
1163
+ Error.decodeDelimited = function decodeDelimited(reader) {
1164
+ if (!(reader instanceof $Reader))
1165
+ reader = new $Reader(reader);
1166
+ return this.decode(reader, reader.uint32());
1167
+ };
1168
+
1169
+ /**
1170
+ * Verifies an Error message.
1171
+ * @function verify
1172
+ * @memberof cryptor.Reply.Error
1173
+ * @static
1174
+ * @param {Object.<string,*>} message Plain object to verify
1175
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1176
+ */
1177
+ Error.verify = function verify(message) {
1178
+ if (typeof message !== "object" || message === null)
1179
+ return "object expected";
1180
+ if (message.condition != null && message.hasOwnProperty("condition"))
1181
+ if (!$util.isString(message.condition))
1182
+ return "condition: string expected";
1183
+ if (message.message != null && message.hasOwnProperty("message"))
1184
+ if (!$util.isString(message.message))
1185
+ return "message: string expected";
1186
+ return null;
1187
+ };
1188
+
1189
+ /**
1190
+ * Creates an Error message from a plain object. Also converts values to their respective internal types.
1191
+ * @function fromObject
1192
+ * @memberof cryptor.Reply.Error
1193
+ * @static
1194
+ * @param {Object.<string,*>} object Plain object
1195
+ * @returns {cryptor.Reply.Error} Error
1196
+ */
1197
+ Error.fromObject = function fromObject(object) {
1198
+ if (object instanceof $root.cryptor.Reply.Error)
1199
+ return object;
1200
+ var message = new $root.cryptor.Reply.Error();
1201
+ if (object.condition != null)
1202
+ message.condition = String(object.condition);
1203
+ if (object.message != null)
1204
+ message.message = String(object.message);
1205
+ return message;
1206
+ };
1207
+
1208
+ /**
1209
+ * Creates a plain object from an Error message. Also converts values to other types if specified.
1210
+ * @function toObject
1211
+ * @memberof cryptor.Reply.Error
1212
+ * @static
1213
+ * @param {cryptor.Reply.Error} message Error
1214
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1215
+ * @returns {Object.<string,*>} Plain object
1216
+ */
1217
+ Error.toObject = function toObject(message, options) {
1218
+ if (!options)
1219
+ options = {};
1220
+ var object = {};
1221
+ if (options.defaults) {
1222
+ object.condition = "";
1223
+ object.message = "";
1224
+ }
1225
+ if (message.condition != null && message.hasOwnProperty("condition"))
1226
+ object.condition = message.condition;
1227
+ if (message.message != null && message.hasOwnProperty("message"))
1228
+ object.message = message.message;
1229
+ return object;
1230
+ };
1231
+
1232
+ /**
1233
+ * Converts this Error to JSON.
1234
+ * @function toJSON
1235
+ * @memberof cryptor.Reply.Error
1236
+ * @instance
1237
+ * @returns {Object.<string,*>} JSON object
1238
+ */
1239
+ Error.prototype.toJSON = function toJSON() {
1240
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1241
+ };
1242
+
1243
+ return Error;
1244
+ })();
1245
+
1246
+ return Reply;
1247
+ })();
1248
+
1249
+ cryptor.BoolVal = (function() {
1250
+
1251
+ /**
1252
+ * Properties of a BoolVal.
1253
+ * @memberof cryptor
1254
+ * @interface IBoolVal
1255
+ * @property {boolean|null} [val] BoolVal val
1256
+ */
1257
+
1258
+ /**
1259
+ * Constructs a new BoolVal.
1260
+ * @memberof cryptor
1261
+ * @classdesc Represents a BoolVal.
1262
+ * @implements IBoolVal
1263
+ * @constructor
1264
+ * @param {cryptor.IBoolVal=} [properties] Properties to set
1265
+ */
1266
+ function BoolVal(properties) {
1267
+ if (properties)
1268
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1269
+ if (properties[keys[i]] != null)
1270
+ this[keys[i]] = properties[keys[i]];
1271
+ }
1272
+
1273
+ /**
1274
+ * BoolVal val.
1275
+ * @member {boolean} val
1276
+ * @memberof cryptor.BoolVal
1277
+ * @instance
1278
+ */
1279
+ BoolVal.prototype.val = false;
1280
+
1281
+ /**
1282
+ * Creates a new BoolVal instance using the specified properties.
1283
+ * @function create
1284
+ * @memberof cryptor.BoolVal
1285
+ * @static
1286
+ * @param {cryptor.IBoolVal=} [properties] Properties to set
1287
+ * @returns {cryptor.BoolVal} BoolVal instance
1288
+ */
1289
+ BoolVal.create = function create(properties) {
1290
+ return new BoolVal(properties);
1291
+ };
1292
+
1293
+ /**
1294
+ * Encodes the specified BoolVal message. Does not implicitly {@link cryptor.BoolVal.verify|verify} messages.
1295
+ * @function encode
1296
+ * @memberof cryptor.BoolVal
1297
+ * @static
1298
+ * @param {cryptor.IBoolVal} message BoolVal message or plain object to encode
1299
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1300
+ * @returns {$protobuf.Writer} Writer
1301
+ */
1302
+ BoolVal.encode = function encode(message, writer) {
1303
+ if (!writer)
1304
+ writer = $Writer.create();
1305
+ if (message.val != null && Object.hasOwnProperty.call(message, "val"))
1306
+ writer.uint32(/* id 1, wireType 0 =*/8).bool(message.val);
1307
+ return writer;
1308
+ };
1309
+
1310
+ /**
1311
+ * Encodes the specified BoolVal message, length delimited. Does not implicitly {@link cryptor.BoolVal.verify|verify} messages.
1312
+ * @function encodeDelimited
1313
+ * @memberof cryptor.BoolVal
1314
+ * @static
1315
+ * @param {cryptor.IBoolVal} message BoolVal message or plain object to encode
1316
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1317
+ * @returns {$protobuf.Writer} Writer
1318
+ */
1319
+ BoolVal.encodeDelimited = function encodeDelimited(message, writer) {
1320
+ return this.encode(message, writer).ldelim();
1321
+ };
1322
+
1323
+ /**
1324
+ * Decodes a BoolVal message from the specified reader or buffer.
1325
+ * @function decode
1326
+ * @memberof cryptor.BoolVal
1327
+ * @static
1328
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1329
+ * @param {number} [length] Message length if known beforehand
1330
+ * @returns {cryptor.BoolVal} BoolVal
1331
+ * @throws {Error} If the payload is not a reader or valid buffer
1332
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1333
+ */
1334
+ BoolVal.decode = function decode(reader, length) {
1335
+ if (!(reader instanceof $Reader))
1336
+ reader = $Reader.create(reader);
1337
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.BoolVal();
1338
+ while (reader.pos < end) {
1339
+ var tag = reader.uint32();
1340
+ switch (tag >>> 3) {
1341
+ case 1:
1342
+ message.val = reader.bool();
1343
+ break;
1344
+ default:
1345
+ reader.skipType(tag & 7);
1346
+ break;
1347
+ }
1348
+ }
1349
+ return message;
1350
+ };
1351
+
1352
+ /**
1353
+ * Decodes a BoolVal message from the specified reader or buffer, length delimited.
1354
+ * @function decodeDelimited
1355
+ * @memberof cryptor.BoolVal
1356
+ * @static
1357
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1358
+ * @returns {cryptor.BoolVal} BoolVal
1359
+ * @throws {Error} If the payload is not a reader or valid buffer
1360
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1361
+ */
1362
+ BoolVal.decodeDelimited = function decodeDelimited(reader) {
1363
+ if (!(reader instanceof $Reader))
1364
+ reader = new $Reader(reader);
1365
+ return this.decode(reader, reader.uint32());
1366
+ };
1367
+
1368
+ /**
1369
+ * Verifies a BoolVal message.
1370
+ * @function verify
1371
+ * @memberof cryptor.BoolVal
1372
+ * @static
1373
+ * @param {Object.<string,*>} message Plain object to verify
1374
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1375
+ */
1376
+ BoolVal.verify = function verify(message) {
1377
+ if (typeof message !== "object" || message === null)
1378
+ return "object expected";
1379
+ if (message.val != null && message.hasOwnProperty("val"))
1380
+ if (typeof message.val !== "boolean")
1381
+ return "val: boolean expected";
1382
+ return null;
1383
+ };
1384
+
1385
+ /**
1386
+ * Creates a BoolVal message from a plain object. Also converts values to their respective internal types.
1387
+ * @function fromObject
1388
+ * @memberof cryptor.BoolVal
1389
+ * @static
1390
+ * @param {Object.<string,*>} object Plain object
1391
+ * @returns {cryptor.BoolVal} BoolVal
1392
+ */
1393
+ BoolVal.fromObject = function fromObject(object) {
1394
+ if (object instanceof $root.cryptor.BoolVal)
1395
+ return object;
1396
+ var message = new $root.cryptor.BoolVal();
1397
+ if (object.val != null)
1398
+ message.val = Boolean(object.val);
1399
+ return message;
1400
+ };
1401
+
1402
+ /**
1403
+ * Creates a plain object from a BoolVal message. Also converts values to other types if specified.
1404
+ * @function toObject
1405
+ * @memberof cryptor.BoolVal
1406
+ * @static
1407
+ * @param {cryptor.BoolVal} message BoolVal
1408
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1409
+ * @returns {Object.<string,*>} Plain object
1410
+ */
1411
+ BoolVal.toObject = function toObject(message, options) {
1412
+ if (!options)
1413
+ options = {};
1414
+ var object = {};
1415
+ if (options.defaults)
1416
+ object.val = false;
1417
+ if (message.val != null && message.hasOwnProperty("val"))
1418
+ object.val = message.val;
1419
+ return object;
1420
+ };
1421
+
1422
+ /**
1423
+ * Converts this BoolVal to JSON.
1424
+ * @function toJSON
1425
+ * @memberof cryptor.BoolVal
1426
+ * @instance
1427
+ * @returns {Object.<string,*>} JSON object
1428
+ */
1429
+ BoolVal.prototype.toJSON = function toJSON() {
1430
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1431
+ };
1432
+
1433
+ return BoolVal;
1434
+ })();
1435
+
1436
+ cryptor.Keypair = (function() {
1437
+
1438
+ /**
1439
+ * Properties of a Keypair.
1440
+ * @memberof cryptor
1441
+ * @interface IKeypair
1442
+ * @property {Uint8Array|null} [skey] Keypair skey
1443
+ * @property {Uint8Array|null} [pkey] Keypair pkey
1444
+ */
1445
+
1446
+ /**
1447
+ * Constructs a new Keypair.
1448
+ * @memberof cryptor
1449
+ * @classdesc Represents a Keypair.
1450
+ * @implements IKeypair
1451
+ * @constructor
1452
+ * @param {cryptor.IKeypair=} [properties] Properties to set
1453
+ */
1454
+ function Keypair(properties) {
1455
+ if (properties)
1456
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1457
+ if (properties[keys[i]] != null)
1458
+ this[keys[i]] = properties[keys[i]];
1459
+ }
1460
+
1461
+ /**
1462
+ * Keypair skey.
1463
+ * @member {Uint8Array} skey
1464
+ * @memberof cryptor.Keypair
1465
+ * @instance
1466
+ */
1467
+ Keypair.prototype.skey = $util.newBuffer([]);
1468
+
1469
+ /**
1470
+ * Keypair pkey.
1471
+ * @member {Uint8Array} pkey
1472
+ * @memberof cryptor.Keypair
1473
+ * @instance
1474
+ */
1475
+ Keypair.prototype.pkey = $util.newBuffer([]);
1476
+
1477
+ /**
1478
+ * Creates a new Keypair instance using the specified properties.
1479
+ * @function create
1480
+ * @memberof cryptor.Keypair
1481
+ * @static
1482
+ * @param {cryptor.IKeypair=} [properties] Properties to set
1483
+ * @returns {cryptor.Keypair} Keypair instance
1484
+ */
1485
+ Keypair.create = function create(properties) {
1486
+ return new Keypair(properties);
1487
+ };
1488
+
1489
+ /**
1490
+ * Encodes the specified Keypair message. Does not implicitly {@link cryptor.Keypair.verify|verify} messages.
1491
+ * @function encode
1492
+ * @memberof cryptor.Keypair
1493
+ * @static
1494
+ * @param {cryptor.IKeypair} message Keypair message or plain object to encode
1495
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1496
+ * @returns {$protobuf.Writer} Writer
1497
+ */
1498
+ Keypair.encode = function encode(message, writer) {
1499
+ if (!writer)
1500
+ writer = $Writer.create();
1501
+ if (message.skey != null && Object.hasOwnProperty.call(message, "skey"))
1502
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.skey);
1503
+ if (message.pkey != null && Object.hasOwnProperty.call(message, "pkey"))
1504
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.pkey);
1505
+ return writer;
1506
+ };
1507
+
1508
+ /**
1509
+ * Encodes the specified Keypair message, length delimited. Does not implicitly {@link cryptor.Keypair.verify|verify} messages.
1510
+ * @function encodeDelimited
1511
+ * @memberof cryptor.Keypair
1512
+ * @static
1513
+ * @param {cryptor.IKeypair} message Keypair message or plain object to encode
1514
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1515
+ * @returns {$protobuf.Writer} Writer
1516
+ */
1517
+ Keypair.encodeDelimited = function encodeDelimited(message, writer) {
1518
+ return this.encode(message, writer).ldelim();
1519
+ };
1520
+
1521
+ /**
1522
+ * Decodes a Keypair message from the specified reader or buffer.
1523
+ * @function decode
1524
+ * @memberof cryptor.Keypair
1525
+ * @static
1526
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1527
+ * @param {number} [length] Message length if known beforehand
1528
+ * @returns {cryptor.Keypair} Keypair
1529
+ * @throws {Error} If the payload is not a reader or valid buffer
1530
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1531
+ */
1532
+ Keypair.decode = function decode(reader, length) {
1533
+ if (!(reader instanceof $Reader))
1534
+ reader = $Reader.create(reader);
1535
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cryptor.Keypair();
1536
+ while (reader.pos < end) {
1537
+ var tag = reader.uint32();
1538
+ switch (tag >>> 3) {
1539
+ case 1:
1540
+ message.skey = reader.bytes();
1541
+ break;
1542
+ case 2:
1543
+ message.pkey = reader.bytes();
1544
+ break;
1545
+ default:
1546
+ reader.skipType(tag & 7);
1547
+ break;
1548
+ }
1549
+ }
1550
+ return message;
1551
+ };
1552
+
1553
+ /**
1554
+ * Decodes a Keypair message from the specified reader or buffer, length delimited.
1555
+ * @function decodeDelimited
1556
+ * @memberof cryptor.Keypair
1557
+ * @static
1558
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1559
+ * @returns {cryptor.Keypair} Keypair
1560
+ * @throws {Error} If the payload is not a reader or valid buffer
1561
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1562
+ */
1563
+ Keypair.decodeDelimited = function decodeDelimited(reader) {
1564
+ if (!(reader instanceof $Reader))
1565
+ reader = new $Reader(reader);
1566
+ return this.decode(reader, reader.uint32());
1567
+ };
1568
+
1569
+ /**
1570
+ * Verifies a Keypair message.
1571
+ * @function verify
1572
+ * @memberof cryptor.Keypair
1573
+ * @static
1574
+ * @param {Object.<string,*>} message Plain object to verify
1575
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1576
+ */
1577
+ Keypair.verify = function verify(message) {
1578
+ if (typeof message !== "object" || message === null)
1579
+ return "object expected";
1580
+ if (message.skey != null && message.hasOwnProperty("skey"))
1581
+ if (!(message.skey && typeof message.skey.length === "number" || $util.isString(message.skey)))
1582
+ return "skey: buffer expected";
1583
+ if (message.pkey != null && message.hasOwnProperty("pkey"))
1584
+ if (!(message.pkey && typeof message.pkey.length === "number" || $util.isString(message.pkey)))
1585
+ return "pkey: buffer expected";
1586
+ return null;
1587
+ };
1588
+
1589
+ /**
1590
+ * Creates a Keypair message from a plain object. Also converts values to their respective internal types.
1591
+ * @function fromObject
1592
+ * @memberof cryptor.Keypair
1593
+ * @static
1594
+ * @param {Object.<string,*>} object Plain object
1595
+ * @returns {cryptor.Keypair} Keypair
1596
+ */
1597
+ Keypair.fromObject = function fromObject(object) {
1598
+ if (object instanceof $root.cryptor.Keypair)
1599
+ return object;
1600
+ var message = new $root.cryptor.Keypair();
1601
+ if (object.skey != null)
1602
+ if (typeof object.skey === "string")
1603
+ $util.base64.decode(object.skey, message.skey = $util.newBuffer($util.base64.length(object.skey)), 0);
1604
+ else if (object.skey.length)
1605
+ message.skey = object.skey;
1606
+ if (object.pkey != null)
1607
+ if (typeof object.pkey === "string")
1608
+ $util.base64.decode(object.pkey, message.pkey = $util.newBuffer($util.base64.length(object.pkey)), 0);
1609
+ else if (object.pkey.length)
1610
+ message.pkey = object.pkey;
1611
+ return message;
1612
+ };
1613
+
1614
+ /**
1615
+ * Creates a plain object from a Keypair message. Also converts values to other types if specified.
1616
+ * @function toObject
1617
+ * @memberof cryptor.Keypair
1618
+ * @static
1619
+ * @param {cryptor.Keypair} message Keypair
1620
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1621
+ * @returns {Object.<string,*>} Plain object
1622
+ */
1623
+ Keypair.toObject = function toObject(message, options) {
1624
+ if (!options)
1625
+ options = {};
1626
+ var object = {};
1627
+ if (options.defaults) {
1628
+ if (options.bytes === String)
1629
+ object.skey = "";
1630
+ else {
1631
+ object.skey = [];
1632
+ if (options.bytes !== Array)
1633
+ object.skey = $util.newBuffer(object.skey);
1634
+ }
1635
+ if (options.bytes === String)
1636
+ object.pkey = "";
1637
+ else {
1638
+ object.pkey = [];
1639
+ if (options.bytes !== Array)
1640
+ object.pkey = $util.newBuffer(object.pkey);
1641
+ }
1642
+ }
1643
+ if (message.skey != null && message.hasOwnProperty("skey"))
1644
+ object.skey = options.bytes === String ? $util.base64.encode(message.skey, 0, message.skey.length) : options.bytes === Array ? Array.prototype.slice.call(message.skey) : message.skey;
1645
+ if (message.pkey != null && message.hasOwnProperty("pkey"))
1646
+ object.pkey = options.bytes === String ? $util.base64.encode(message.pkey, 0, message.pkey.length) : options.bytes === Array ? Array.prototype.slice.call(message.pkey) : message.pkey;
1647
+ return object;
1648
+ };
1649
+
1650
+ /**
1651
+ * Converts this Keypair to JSON.
1652
+ * @function toJSON
1653
+ * @memberof cryptor.Keypair
1654
+ * @instance
1655
+ * @returns {Object.<string,*>} JSON object
1656
+ */
1657
+ Keypair.prototype.toJSON = function toJSON() {
1658
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1659
+ };
1660
+
1661
+ return Keypair;
1662
+ })();
1663
+
1664
+ return cryptor;
1665
+ })();
1666
+
1667
+ module.exports = $root;