noxleys 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of noxleys might be problematic. Click here for more details.

Files changed (159) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +2577 -3
  3. package/WAProto/AICommon/AICommon.js +19396 -0
  4. package/WAProto/AICommon/AICommon.proto +820 -0
  5. package/WAProto/Adv/Adv.js +1137 -0
  6. package/WAProto/Adv/Adv.proto +42 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +8975 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +484 -0
  9. package/WAProto/Cert/Cert.js +893 -0
  10. package/WAProto/Cert/Cert.proto +30 -0
  11. package/WAProto/ChatLockSettings/ChatLockSettings.js +673 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.proto +9 -0
  13. package/WAProto/CompanionReg/CompanionReg.js +2457 -0
  14. package/WAProto/CompanionReg/CompanionReg.proto +103 -0
  15. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +846 -0
  16. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +38 -0
  17. package/WAProto/E2E/E2E.js +78728 -0
  18. package/WAProto/E2E/E2E.proto +1970 -0
  19. package/WAProto/Ephemeral/Ephemeral.js +143 -0
  20. package/WAProto/Ephemeral/Ephemeral.proto +7 -0
  21. package/WAProto/HistorySync/HistorySync.js +95931 -0
  22. package/WAProto/HistorySync/HistorySync.proto +229 -0
  23. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +414 -0
  24. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +13 -0
  25. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +980 -0
  26. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +38 -0
  27. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +81185 -0
  28. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +88 -0
  29. package/WAProto/MmsRetry/MmsRetry.js +310 -0
  30. package/WAProto/MmsRetry/MmsRetry.proto +19 -0
  31. package/WAProto/Protocol/Protocol.js +399 -0
  32. package/WAProto/Protocol/Protocol.proto +22 -0
  33. package/WAProto/Reporting/Reporting.js +535 -0
  34. package/WAProto/Reporting/Reporting.proto +22 -0
  35. package/WAProto/ServerSync/ServerSync.js +1830 -0
  36. package/WAProto/ServerSync/ServerSync.proto +70 -0
  37. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +3267 -0
  38. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +95 -0
  39. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1140 -0
  40. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +44 -0
  41. package/WAProto/StatusAttributions/StatusAttributions.js +1604 -0
  42. package/WAProto/StatusAttributions/StatusAttributions.proto +89 -0
  43. package/WAProto/SyncAction/SyncAction.js +17424 -0
  44. package/WAProto/SyncAction/SyncAction.proto +663 -0
  45. package/WAProto/UserPassword/UserPassword.js +544 -0
  46. package/WAProto/UserPassword/UserPassword.proto +28 -0
  47. package/WAProto/VnameCert/VnameCert.js +1466 -0
  48. package/WAProto/VnameCert/VnameCert.proto +65 -0
  49. package/WAProto/Wa6/Wa6.js +4601 -0
  50. package/WAProto/Wa6/Wa6.proto +241 -0
  51. package/WAProto/Web/Web.js +90819 -0
  52. package/WAProto/Web/Web.proto +605 -0
  53. package/WAProto/index.js +30 -0
  54. package/engine-requirements.js +9 -0
  55. package/lib/Defaults/connection.js +39 -0
  56. package/lib/Defaults/constants.js +50 -0
  57. package/lib/Defaults/history.js +13 -0
  58. package/lib/Defaults/index.js +36 -0
  59. package/lib/Defaults/media.js +43 -0
  60. package/lib/Defaults/phonenumber-mcc.json +223 -0
  61. package/lib/Defaults/prefix.js +12 -0
  62. package/lib/Defaults/vialeys-version.json +7 -0
  63. package/lib/Signal/Group/ciphertext-message.js +14 -0
  64. package/lib/Signal/Group/group-session-builder.js +46 -0
  65. package/lib/Signal/Group/group_cipher.js +104 -0
  66. package/lib/Signal/Group/index.js +42 -0
  67. package/lib/Signal/Group/keyhelper.js +21 -0
  68. package/lib/Signal/Group/sender-chain-key.js +34 -0
  69. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  70. package/lib/Signal/Group/sender-key-message.js +78 -0
  71. package/lib/Signal/Group/sender-key-name.js +49 -0
  72. package/lib/Signal/Group/sender-key-record.js +45 -0
  73. package/lib/Signal/Group/sender-key-state.js +100 -0
  74. package/lib/Signal/Group/sender-message-key.js +28 -0
  75. package/lib/Signal/libsignal.js +364 -0
  76. package/lib/Signal/lid-mapping.js +164 -0
  77. package/lib/Socket/Client/index.js +31 -0
  78. package/lib/Socket/Client/types.js +12 -0
  79. package/lib/Socket/Client/websocket.js +67 -0
  80. package/lib/Socket/business.js +291 -0
  81. package/lib/Socket/chats.js +874 -0
  82. package/lib/Socket/community.js +454 -0
  83. package/lib/Socket/groups.js +357 -0
  84. package/lib/Socket/index.js +12 -0
  85. package/lib/Socket/messages-recv.js +1349 -0
  86. package/lib/Socket/messages-send.js +1483 -0
  87. package/lib/Socket/mex.js +59 -0
  88. package/lib/Socket/newsletter.js +231 -0
  89. package/lib/Socket/socket.js +898 -0
  90. package/lib/Store/index.js +35 -0
  91. package/lib/Store/make-cache-manager-store.js +77 -0
  92. package/lib/Store/make-in-memory-store.js +423 -0
  93. package/lib/Store/make-ordered-dictionary.js +78 -0
  94. package/lib/Store/object-repository.js +26 -0
  95. package/lib/Types/Auth.js +2 -0
  96. package/lib/Types/Bussines.js +2 -0
  97. package/lib/Types/Call.js +2 -0
  98. package/lib/Types/Chat.js +10 -0
  99. package/lib/Types/Contact.js +2 -0
  100. package/lib/Types/Events.js +2 -0
  101. package/lib/Types/GroupMetadata.js +2 -0
  102. package/lib/Types/Label.js +25 -0
  103. package/lib/Types/LabelAssociation.js +4 -0
  104. package/lib/Types/Message.js +11 -0
  105. package/lib/Types/MexUpdates.js +15 -0
  106. package/lib/Types/Newsletter.js +32 -0
  107. package/lib/Types/Product.js +2 -0
  108. package/lib/Types/Signal.js +2 -0
  109. package/lib/Types/Socket.js +2 -0
  110. package/lib/Types/State.js +9 -0
  111. package/lib/Types/USync.js +2 -0
  112. package/lib/Types/index.js +59 -0
  113. package/lib/Utils/auth-utils.js +256 -0
  114. package/lib/Utils/browser-utils.js +29 -0
  115. package/lib/Utils/business.js +233 -0
  116. package/lib/Utils/chat-utils.js +896 -0
  117. package/lib/Utils/crypto.js +144 -0
  118. package/lib/Utils/decode-wa-message.js +305 -0
  119. package/lib/Utils/event-buffer.js +555 -0
  120. package/lib/Utils/generics.js +405 -0
  121. package/lib/Utils/history.js +100 -0
  122. package/lib/Utils/index.js +49 -0
  123. package/lib/Utils/link-preview.js +76 -0
  124. package/lib/Utils/logger.js +4 -0
  125. package/lib/Utils/lt-hash.js +45 -0
  126. package/lib/Utils/make-mutex.js +33 -0
  127. package/lib/Utils/message-retry-manager.js +134 -0
  128. package/lib/Utils/messages-media.js +806 -0
  129. package/lib/Utils/messages.js +1946 -0
  130. package/lib/Utils/noise-handler.js +157 -0
  131. package/lib/Utils/pre-key-manager.js +86 -0
  132. package/lib/Utils/process-message.js +814 -0
  133. package/lib/Utils/signal.js +183 -0
  134. package/lib/Utils/use-multi-file-auth-state.js +104 -0
  135. package/lib/Utils/validate-connection.js +229 -0
  136. package/lib/Utils/vialeys-event-stream.js +41 -0
  137. package/lib/WABinary/constants.js +1308 -0
  138. package/lib/WABinary/decode.js +233 -0
  139. package/lib/WABinary/encode.js +212 -0
  140. package/lib/WABinary/generic-utils.js +124 -0
  141. package/lib/WABinary/index.js +36 -0
  142. package/lib/WABinary/jid-utils.js +101 -0
  143. package/lib/WABinary/types.js +2 -0
  144. package/lib/WAM/BinaryInfo.js +12 -0
  145. package/lib/WAM/constants.js +20491 -0
  146. package/lib/WAM/encode.js +148 -0
  147. package/lib/WAM/index.js +34 -0
  148. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -0
  149. package/lib/WAUSync/Protocols/USyncContactProtocol.js +22 -0
  150. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +50 -0
  151. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +25 -0
  152. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -0
  153. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +32 -0
  154. package/lib/WAUSync/Protocols/index.js +37 -0
  155. package/lib/WAUSync/USyncQuery.js +92 -0
  156. package/lib/WAUSync/USyncUser.js +25 -0
  157. package/lib/WAUSync/index.js +34 -0
  158. package/lib/index.js +106 -0
  159. package/package.json +89 -4
@@ -0,0 +1,893 @@
1
+ "use strict";
2
+ var $protobuf = require("protobufjs/minimal");
3
+ var $Reader = $protobuf.Reader,
4
+ $Writer = $protobuf.Writer,
5
+ $util = $protobuf.util;
6
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
7
+ $root.Cert = (function () {
8
+ var Cert = {};
9
+ Cert.CertChain = (function () {
10
+ function CertChain(properties) {
11
+ if (properties)
12
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
13
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
14
+ }
15
+ CertChain.prototype.leaf = null;
16
+ CertChain.prototype.intermediate = null;
17
+ var $oneOfFields;
18
+ Object.defineProperty(CertChain.prototype, "_leaf", {
19
+ get: $util.oneOfGetter(($oneOfFields = ["leaf"])),
20
+ set: $util.oneOfSetter($oneOfFields),
21
+ });
22
+ Object.defineProperty(CertChain.prototype, "_intermediate", {
23
+ get: $util.oneOfGetter(($oneOfFields = ["intermediate"])),
24
+ set: $util.oneOfSetter($oneOfFields),
25
+ });
26
+ CertChain.create = function create(properties) {
27
+ return new CertChain(properties);
28
+ };
29
+ CertChain.encode = function encode(message, writer) {
30
+ if (!writer) writer = $Writer.create();
31
+ if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf"))
32
+ $root.Cert.CertChain.NoiseCertificate.encode(
33
+ message.leaf,
34
+ writer.uint32(10).fork()
35
+ ).ldelim();
36
+ if (message.intermediate != null && Object.hasOwnProperty.call(message, "intermediate"))
37
+ $root.Cert.CertChain.NoiseCertificate.encode(
38
+ message.intermediate,
39
+ writer.uint32(18).fork()
40
+ ).ldelim();
41
+ return writer;
42
+ };
43
+ CertChain.encodeDelimited = function encodeDelimited(message, writer) {
44
+ return this.encode(message, writer).ldelim();
45
+ };
46
+ CertChain.decode = function decode(reader, length, error) {
47
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
48
+ var end = length === undefined ? reader.len : reader.pos + length,
49
+ message = new $root.Cert.CertChain();
50
+ while (reader.pos < end) {
51
+ var tag = reader.uint32();
52
+ if (tag === error) break;
53
+ switch (tag >>> 3) {
54
+ case 1: {
55
+ message.leaf = $root.Cert.CertChain.NoiseCertificate.decode(
56
+ reader,
57
+ reader.uint32()
58
+ );
59
+ break;
60
+ }
61
+ case 2: {
62
+ message.intermediate = $root.Cert.CertChain.NoiseCertificate.decode(
63
+ reader,
64
+ reader.uint32()
65
+ );
66
+ break;
67
+ }
68
+ default:
69
+ reader.skipType(tag & 7);
70
+ break;
71
+ }
72
+ }
73
+ return message;
74
+ };
75
+ CertChain.decodeDelimited = function decodeDelimited(reader) {
76
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
77
+ return this.decode(reader, reader.uint32());
78
+ };
79
+ CertChain.verify = function verify(message) {
80
+ if (typeof message !== "object" || message === null) return "object expected";
81
+ var properties = {};
82
+ if (message.leaf != null && message.hasOwnProperty("leaf")) {
83
+ properties._leaf = 1;
84
+ {
85
+ var error = $root.Cert.CertChain.NoiseCertificate.verify(message.leaf);
86
+ if (error) return "leaf." + error;
87
+ }
88
+ }
89
+ if (message.intermediate != null && message.hasOwnProperty("intermediate")) {
90
+ properties._intermediate = 1;
91
+ {
92
+ var error = $root.Cert.CertChain.NoiseCertificate.verify(message.intermediate);
93
+ if (error) return "intermediate." + error;
94
+ }
95
+ }
96
+ return null;
97
+ };
98
+ CertChain.fromObject = function fromObject(object) {
99
+ if (object instanceof $root.Cert.CertChain) return object;
100
+ var message = new $root.Cert.CertChain();
101
+ if (object.leaf != null) {
102
+ if (typeof object.leaf !== "object")
103
+ throw TypeError(".Cert.CertChain.leaf: object expected");
104
+ message.leaf = $root.Cert.CertChain.NoiseCertificate.fromObject(object.leaf);
105
+ }
106
+ if (object.intermediate != null) {
107
+ if (typeof object.intermediate !== "object")
108
+ throw TypeError(".Cert.CertChain.intermediate: object expected");
109
+ message.intermediate = $root.Cert.CertChain.NoiseCertificate.fromObject(
110
+ object.intermediate
111
+ );
112
+ }
113
+ return message;
114
+ };
115
+ CertChain.toObject = function toObject(message, options) {
116
+ if (!options) options = {};
117
+ var object = {};
118
+ if (message.leaf != null && message.hasOwnProperty("leaf")) {
119
+ object.leaf = $root.Cert.CertChain.NoiseCertificate.toObject(message.leaf, options);
120
+ if (options.oneofs) object._leaf = "leaf";
121
+ }
122
+ if (message.intermediate != null && message.hasOwnProperty("intermediate")) {
123
+ object.intermediate = $root.Cert.CertChain.NoiseCertificate.toObject(
124
+ message.intermediate,
125
+ options
126
+ );
127
+ if (options.oneofs) object._intermediate = "intermediate";
128
+ }
129
+ return object;
130
+ };
131
+ CertChain.prototype.toJSON = function toJSON() {
132
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
133
+ };
134
+ CertChain.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
135
+ if (typeUrlPrefix === undefined) {
136
+ typeUrlPrefix = "type.googleapis.com";
137
+ }
138
+ return typeUrlPrefix + "/Cert.CertChain";
139
+ };
140
+ CertChain.NoiseCertificate = (function () {
141
+ function NoiseCertificate(properties) {
142
+ if (properties)
143
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
144
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
145
+ }
146
+ NoiseCertificate.prototype.details = null;
147
+ NoiseCertificate.prototype.signature = null;
148
+ var $oneOfFields;
149
+ Object.defineProperty(NoiseCertificate.prototype, "_details", {
150
+ get: $util.oneOfGetter(($oneOfFields = ["details"])),
151
+ set: $util.oneOfSetter($oneOfFields),
152
+ });
153
+ Object.defineProperty(NoiseCertificate.prototype, "_signature", {
154
+ get: $util.oneOfGetter(($oneOfFields = ["signature"])),
155
+ set: $util.oneOfSetter($oneOfFields),
156
+ });
157
+ NoiseCertificate.create = function create(properties) {
158
+ return new NoiseCertificate(properties);
159
+ };
160
+ NoiseCertificate.encode = function encode(message, writer) {
161
+ if (!writer) writer = $Writer.create();
162
+ if (message.details != null && Object.hasOwnProperty.call(message, "details"))
163
+ writer.uint32(10).bytes(message.details);
164
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
165
+ writer.uint32(18).bytes(message.signature);
166
+ return writer;
167
+ };
168
+ NoiseCertificate.encodeDelimited = function encodeDelimited(message, writer) {
169
+ return this.encode(message, writer).ldelim();
170
+ };
171
+ NoiseCertificate.decode = function decode(reader, length, error) {
172
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
173
+ var end = length === undefined ? reader.len : reader.pos + length,
174
+ message = new $root.Cert.CertChain.NoiseCertificate();
175
+ while (reader.pos < end) {
176
+ var tag = reader.uint32();
177
+ if (tag === error) break;
178
+ switch (tag >>> 3) {
179
+ case 1: {
180
+ message.details = reader.bytes();
181
+ break;
182
+ }
183
+ case 2: {
184
+ message.signature = reader.bytes();
185
+ break;
186
+ }
187
+ default:
188
+ reader.skipType(tag & 7);
189
+ break;
190
+ }
191
+ }
192
+ return message;
193
+ };
194
+ NoiseCertificate.decodeDelimited = function decodeDelimited(reader) {
195
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
196
+ return this.decode(reader, reader.uint32());
197
+ };
198
+ NoiseCertificate.verify = function verify(message) {
199
+ if (typeof message !== "object" || message === null) return "object expected";
200
+ var properties = {};
201
+ if (message.details != null && message.hasOwnProperty("details")) {
202
+ properties._details = 1;
203
+ if (
204
+ !(
205
+ (message.details && typeof message.details.length === "number") ||
206
+ $util.isString(message.details)
207
+ )
208
+ )
209
+ return "details: buffer expected";
210
+ }
211
+ if (message.signature != null && message.hasOwnProperty("signature")) {
212
+ properties._signature = 1;
213
+ if (
214
+ !(
215
+ (message.signature && typeof message.signature.length === "number") ||
216
+ $util.isString(message.signature)
217
+ )
218
+ )
219
+ return "signature: buffer expected";
220
+ }
221
+ return null;
222
+ };
223
+ NoiseCertificate.fromObject = function fromObject(object) {
224
+ if (object instanceof $root.Cert.CertChain.NoiseCertificate) return object;
225
+ var message = new $root.Cert.CertChain.NoiseCertificate();
226
+ if (object.details != null)
227
+ if (typeof object.details === "string")
228
+ $util.base64.decode(
229
+ object.details,
230
+ (message.details = $util.newBuffer(
231
+ $util.base64.length(object.details)
232
+ )),
233
+ 0
234
+ );
235
+ else if (object.details.length >= 0) message.details = object.details;
236
+ if (object.signature != null)
237
+ if (typeof object.signature === "string")
238
+ $util.base64.decode(
239
+ object.signature,
240
+ (message.signature = $util.newBuffer(
241
+ $util.base64.length(object.signature)
242
+ )),
243
+ 0
244
+ );
245
+ else if (object.signature.length >= 0) message.signature = object.signature;
246
+ return message;
247
+ };
248
+ NoiseCertificate.toObject = function toObject(message, options) {
249
+ if (!options) options = {};
250
+ var object = {};
251
+ if (message.details != null && message.hasOwnProperty("details")) {
252
+ object.details =
253
+ options.bytes === String
254
+ ? $util.base64.encode(message.details, 0, message.details.length)
255
+ : options.bytes === Array
256
+ ? Array.prototype.slice.call(message.details)
257
+ : message.details;
258
+ if (options.oneofs) object._details = "details";
259
+ }
260
+ if (message.signature != null && message.hasOwnProperty("signature")) {
261
+ object.signature =
262
+ options.bytes === String
263
+ ? $util.base64.encode(message.signature, 0, message.signature.length)
264
+ : options.bytes === Array
265
+ ? Array.prototype.slice.call(message.signature)
266
+ : message.signature;
267
+ if (options.oneofs) object._signature = "signature";
268
+ }
269
+ return object;
270
+ };
271
+ NoiseCertificate.prototype.toJSON = function toJSON() {
272
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
273
+ };
274
+ NoiseCertificate.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
275
+ if (typeUrlPrefix === undefined) {
276
+ typeUrlPrefix = "type.googleapis.com";
277
+ }
278
+ return typeUrlPrefix + "/Cert.CertChain.NoiseCertificate";
279
+ };
280
+ NoiseCertificate.Details = (function () {
281
+ function Details(properties) {
282
+ if (properties)
283
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
284
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
285
+ }
286
+ Details.prototype.serial = null;
287
+ Details.prototype.issuerSerial = null;
288
+ Details.prototype.key = null;
289
+ Details.prototype.notBefore = null;
290
+ Details.prototype.notAfter = null;
291
+ var $oneOfFields;
292
+ Object.defineProperty(Details.prototype, "_serial", {
293
+ get: $util.oneOfGetter(($oneOfFields = ["serial"])),
294
+ set: $util.oneOfSetter($oneOfFields),
295
+ });
296
+ Object.defineProperty(Details.prototype, "_issuerSerial", {
297
+ get: $util.oneOfGetter(($oneOfFields = ["issuerSerial"])),
298
+ set: $util.oneOfSetter($oneOfFields),
299
+ });
300
+ Object.defineProperty(Details.prototype, "_key", {
301
+ get: $util.oneOfGetter(($oneOfFields = ["key"])),
302
+ set: $util.oneOfSetter($oneOfFields),
303
+ });
304
+ Object.defineProperty(Details.prototype, "_notBefore", {
305
+ get: $util.oneOfGetter(($oneOfFields = ["notBefore"])),
306
+ set: $util.oneOfSetter($oneOfFields),
307
+ });
308
+ Object.defineProperty(Details.prototype, "_notAfter", {
309
+ get: $util.oneOfGetter(($oneOfFields = ["notAfter"])),
310
+ set: $util.oneOfSetter($oneOfFields),
311
+ });
312
+ Details.create = function create(properties) {
313
+ return new Details(properties);
314
+ };
315
+ Details.encode = function encode(message, writer) {
316
+ if (!writer) writer = $Writer.create();
317
+ if (message.serial != null && Object.hasOwnProperty.call(message, "serial"))
318
+ writer.uint32(8).uint32(message.serial);
319
+ if (
320
+ message.issuerSerial != null &&
321
+ Object.hasOwnProperty.call(message, "issuerSerial")
322
+ )
323
+ writer.uint32(16).uint32(message.issuerSerial);
324
+ if (message.key != null && Object.hasOwnProperty.call(message, "key"))
325
+ writer.uint32(26).bytes(message.key);
326
+ if (
327
+ message.notBefore != null &&
328
+ Object.hasOwnProperty.call(message, "notBefore")
329
+ )
330
+ writer.uint32(32).uint64(message.notBefore);
331
+ if (message.notAfter != null && Object.hasOwnProperty.call(message, "notAfter"))
332
+ writer.uint32(40).uint64(message.notAfter);
333
+ return writer;
334
+ };
335
+ Details.encodeDelimited = function encodeDelimited(message, writer) {
336
+ return this.encode(message, writer).ldelim();
337
+ };
338
+ Details.decode = function decode(reader, length, error) {
339
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
340
+ var end = length === undefined ? reader.len : reader.pos + length,
341
+ message = new $root.Cert.CertChain.NoiseCertificate.Details();
342
+ while (reader.pos < end) {
343
+ var tag = reader.uint32();
344
+ if (tag === error) break;
345
+ switch (tag >>> 3) {
346
+ case 1: {
347
+ message.serial = reader.uint32();
348
+ break;
349
+ }
350
+ case 2: {
351
+ message.issuerSerial = reader.uint32();
352
+ break;
353
+ }
354
+ case 3: {
355
+ message.key = reader.bytes();
356
+ break;
357
+ }
358
+ case 4: {
359
+ message.notBefore = reader.uint64();
360
+ break;
361
+ }
362
+ case 5: {
363
+ message.notAfter = reader.uint64();
364
+ break;
365
+ }
366
+ default:
367
+ reader.skipType(tag & 7);
368
+ break;
369
+ }
370
+ }
371
+ return message;
372
+ };
373
+ Details.decodeDelimited = function decodeDelimited(reader) {
374
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
375
+ return this.decode(reader, reader.uint32());
376
+ };
377
+ Details.verify = function verify(message) {
378
+ if (typeof message !== "object" || message === null) return "object expected";
379
+ var properties = {};
380
+ if (message.serial != null && message.hasOwnProperty("serial")) {
381
+ properties._serial = 1;
382
+ if (!$util.isInteger(message.serial)) return "serial: integer expected";
383
+ }
384
+ if (message.issuerSerial != null && message.hasOwnProperty("issuerSerial")) {
385
+ properties._issuerSerial = 1;
386
+ if (!$util.isInteger(message.issuerSerial))
387
+ return "issuerSerial: integer expected";
388
+ }
389
+ if (message.key != null && message.hasOwnProperty("key")) {
390
+ properties._key = 1;
391
+ if (
392
+ !(
393
+ (message.key && typeof message.key.length === "number") ||
394
+ $util.isString(message.key)
395
+ )
396
+ )
397
+ return "key: buffer expected";
398
+ }
399
+ if (message.notBefore != null && message.hasOwnProperty("notBefore")) {
400
+ properties._notBefore = 1;
401
+ if (
402
+ !$util.isInteger(message.notBefore) &&
403
+ !(
404
+ message.notBefore &&
405
+ $util.isInteger(message.notBefore.low) &&
406
+ $util.isInteger(message.notBefore.high)
407
+ )
408
+ )
409
+ return "notBefore: integer|Long expected";
410
+ }
411
+ if (message.notAfter != null && message.hasOwnProperty("notAfter")) {
412
+ properties._notAfter = 1;
413
+ if (
414
+ !$util.isInteger(message.notAfter) &&
415
+ !(
416
+ message.notAfter &&
417
+ $util.isInteger(message.notAfter.low) &&
418
+ $util.isInteger(message.notAfter.high)
419
+ )
420
+ )
421
+ return "notAfter: integer|Long expected";
422
+ }
423
+ return null;
424
+ };
425
+ Details.fromObject = function fromObject(object) {
426
+ if (object instanceof $root.Cert.CertChain.NoiseCertificate.Details)
427
+ return object;
428
+ var message = new $root.Cert.CertChain.NoiseCertificate.Details();
429
+ if (object.serial != null) message.serial = object.serial >>> 0;
430
+ if (object.issuerSerial != null)
431
+ message.issuerSerial = object.issuerSerial >>> 0;
432
+ if (object.key != null)
433
+ if (typeof object.key === "string")
434
+ $util.base64.decode(
435
+ object.key,
436
+ (message.key = $util.newBuffer($util.base64.length(object.key))),
437
+ 0
438
+ );
439
+ else if (object.key.length >= 0) message.key = object.key;
440
+ if (object.notBefore != null)
441
+ if ($util.Long)
442
+ (message.notBefore = $util.Long.fromValue(object.notBefore)).unsigned =
443
+ true;
444
+ else if (typeof object.notBefore === "string")
445
+ message.notBefore = parseInt(object.notBefore, 10);
446
+ else if (typeof object.notBefore === "number")
447
+ message.notBefore = object.notBefore;
448
+ else if (typeof object.notBefore === "object")
449
+ message.notBefore = new $util.LongBits(
450
+ object.notBefore.low >>> 0,
451
+ object.notBefore.high >>> 0
452
+ ).toNumber(true);
453
+ if (object.notAfter != null)
454
+ if ($util.Long)
455
+ (message.notAfter = $util.Long.fromValue(object.notAfter)).unsigned =
456
+ true;
457
+ else if (typeof object.notAfter === "string")
458
+ message.notAfter = parseInt(object.notAfter, 10);
459
+ else if (typeof object.notAfter === "number")
460
+ message.notAfter = object.notAfter;
461
+ else if (typeof object.notAfter === "object")
462
+ message.notAfter = new $util.LongBits(
463
+ object.notAfter.low >>> 0,
464
+ object.notAfter.high >>> 0
465
+ ).toNumber(true);
466
+ return message;
467
+ };
468
+ Details.toObject = function toObject(message, options) {
469
+ if (!options) options = {};
470
+ var object = {};
471
+ if (message.serial != null && message.hasOwnProperty("serial")) {
472
+ object.serial = message.serial;
473
+ if (options.oneofs) object._serial = "serial";
474
+ }
475
+ if (message.issuerSerial != null && message.hasOwnProperty("issuerSerial")) {
476
+ object.issuerSerial = message.issuerSerial;
477
+ if (options.oneofs) object._issuerSerial = "issuerSerial";
478
+ }
479
+ if (message.key != null && message.hasOwnProperty("key")) {
480
+ object.key =
481
+ options.bytes === String
482
+ ? $util.base64.encode(message.key, 0, message.key.length)
483
+ : options.bytes === Array
484
+ ? Array.prototype.slice.call(message.key)
485
+ : message.key;
486
+ if (options.oneofs) object._key = "key";
487
+ }
488
+ if (message.notBefore != null && message.hasOwnProperty("notBefore")) {
489
+ if (typeof message.notBefore === "number")
490
+ object.notBefore =
491
+ options.longs === String
492
+ ? String(message.notBefore)
493
+ : message.notBefore;
494
+ else
495
+ object.notBefore =
496
+ options.longs === String
497
+ ? $util.Long.prototype.toString.call(message.notBefore)
498
+ : options.longs === Number
499
+ ? new $util.LongBits(
500
+ message.notBefore.low >>> 0,
501
+ message.notBefore.high >>> 0
502
+ ).toNumber(true)
503
+ : message.notBefore;
504
+ if (options.oneofs) object._notBefore = "notBefore";
505
+ }
506
+ if (message.notAfter != null && message.hasOwnProperty("notAfter")) {
507
+ if (typeof message.notAfter === "number")
508
+ object.notAfter =
509
+ options.longs === String
510
+ ? String(message.notAfter)
511
+ : message.notAfter;
512
+ else
513
+ object.notAfter =
514
+ options.longs === String
515
+ ? $util.Long.prototype.toString.call(message.notAfter)
516
+ : options.longs === Number
517
+ ? new $util.LongBits(
518
+ message.notAfter.low >>> 0,
519
+ message.notAfter.high >>> 0
520
+ ).toNumber(true)
521
+ : message.notAfter;
522
+ if (options.oneofs) object._notAfter = "notAfter";
523
+ }
524
+ return object;
525
+ };
526
+ Details.prototype.toJSON = function toJSON() {
527
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
528
+ };
529
+ Details.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
530
+ if (typeUrlPrefix === undefined) {
531
+ typeUrlPrefix = "type.googleapis.com";
532
+ }
533
+ return typeUrlPrefix + "/Cert.CertChain.NoiseCertificate.Details";
534
+ };
535
+ return Details;
536
+ })();
537
+ return NoiseCertificate;
538
+ })();
539
+ return CertChain;
540
+ })();
541
+ Cert.NoiseCertificate = (function () {
542
+ function NoiseCertificate(properties) {
543
+ if (properties)
544
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
545
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
546
+ }
547
+ NoiseCertificate.prototype.details = null;
548
+ NoiseCertificate.prototype.signature = null;
549
+ var $oneOfFields;
550
+ Object.defineProperty(NoiseCertificate.prototype, "_details", {
551
+ get: $util.oneOfGetter(($oneOfFields = ["details"])),
552
+ set: $util.oneOfSetter($oneOfFields),
553
+ });
554
+ Object.defineProperty(NoiseCertificate.prototype, "_signature", {
555
+ get: $util.oneOfGetter(($oneOfFields = ["signature"])),
556
+ set: $util.oneOfSetter($oneOfFields),
557
+ });
558
+ NoiseCertificate.create = function create(properties) {
559
+ return new NoiseCertificate(properties);
560
+ };
561
+ NoiseCertificate.encode = function encode(message, writer) {
562
+ if (!writer) writer = $Writer.create();
563
+ if (message.details != null && Object.hasOwnProperty.call(message, "details"))
564
+ writer.uint32(10).bytes(message.details);
565
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
566
+ writer.uint32(18).bytes(message.signature);
567
+ return writer;
568
+ };
569
+ NoiseCertificate.encodeDelimited = function encodeDelimited(message, writer) {
570
+ return this.encode(message, writer).ldelim();
571
+ };
572
+ NoiseCertificate.decode = function decode(reader, length, error) {
573
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
574
+ var end = length === undefined ? reader.len : reader.pos + length,
575
+ message = new $root.Cert.NoiseCertificate();
576
+ while (reader.pos < end) {
577
+ var tag = reader.uint32();
578
+ if (tag === error) break;
579
+ switch (tag >>> 3) {
580
+ case 1: {
581
+ message.details = reader.bytes();
582
+ break;
583
+ }
584
+ case 2: {
585
+ message.signature = reader.bytes();
586
+ break;
587
+ }
588
+ default:
589
+ reader.skipType(tag & 7);
590
+ break;
591
+ }
592
+ }
593
+ return message;
594
+ };
595
+ NoiseCertificate.decodeDelimited = function decodeDelimited(reader) {
596
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
597
+ return this.decode(reader, reader.uint32());
598
+ };
599
+ NoiseCertificate.verify = function verify(message) {
600
+ if (typeof message !== "object" || message === null) return "object expected";
601
+ var properties = {};
602
+ if (message.details != null && message.hasOwnProperty("details")) {
603
+ properties._details = 1;
604
+ if (
605
+ !(
606
+ (message.details && typeof message.details.length === "number") ||
607
+ $util.isString(message.details)
608
+ )
609
+ )
610
+ return "details: buffer expected";
611
+ }
612
+ if (message.signature != null && message.hasOwnProperty("signature")) {
613
+ properties._signature = 1;
614
+ if (
615
+ !(
616
+ (message.signature && typeof message.signature.length === "number") ||
617
+ $util.isString(message.signature)
618
+ )
619
+ )
620
+ return "signature: buffer expected";
621
+ }
622
+ return null;
623
+ };
624
+ NoiseCertificate.fromObject = function fromObject(object) {
625
+ if (object instanceof $root.Cert.NoiseCertificate) return object;
626
+ var message = new $root.Cert.NoiseCertificate();
627
+ if (object.details != null)
628
+ if (typeof object.details === "string")
629
+ $util.base64.decode(
630
+ object.details,
631
+ (message.details = $util.newBuffer($util.base64.length(object.details))),
632
+ 0
633
+ );
634
+ else if (object.details.length >= 0) message.details = object.details;
635
+ if (object.signature != null)
636
+ if (typeof object.signature === "string")
637
+ $util.base64.decode(
638
+ object.signature,
639
+ (message.signature = $util.newBuffer(
640
+ $util.base64.length(object.signature)
641
+ )),
642
+ 0
643
+ );
644
+ else if (object.signature.length >= 0) message.signature = object.signature;
645
+ return message;
646
+ };
647
+ NoiseCertificate.toObject = function toObject(message, options) {
648
+ if (!options) options = {};
649
+ var object = {};
650
+ if (message.details != null && message.hasOwnProperty("details")) {
651
+ object.details =
652
+ options.bytes === String
653
+ ? $util.base64.encode(message.details, 0, message.details.length)
654
+ : options.bytes === Array
655
+ ? Array.prototype.slice.call(message.details)
656
+ : message.details;
657
+ if (options.oneofs) object._details = "details";
658
+ }
659
+ if (message.signature != null && message.hasOwnProperty("signature")) {
660
+ object.signature =
661
+ options.bytes === String
662
+ ? $util.base64.encode(message.signature, 0, message.signature.length)
663
+ : options.bytes === Array
664
+ ? Array.prototype.slice.call(message.signature)
665
+ : message.signature;
666
+ if (options.oneofs) object._signature = "signature";
667
+ }
668
+ return object;
669
+ };
670
+ NoiseCertificate.prototype.toJSON = function toJSON() {
671
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
672
+ };
673
+ NoiseCertificate.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
674
+ if (typeUrlPrefix === undefined) {
675
+ typeUrlPrefix = "type.googleapis.com";
676
+ }
677
+ return typeUrlPrefix + "/Cert.NoiseCertificate";
678
+ };
679
+ NoiseCertificate.Details = (function () {
680
+ function Details(properties) {
681
+ if (properties)
682
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
683
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
684
+ }
685
+ Details.prototype.serial = null;
686
+ Details.prototype.issuer = null;
687
+ Details.prototype.expires = null;
688
+ Details.prototype.subject = null;
689
+ Details.prototype.key = null;
690
+ var $oneOfFields;
691
+ Object.defineProperty(Details.prototype, "_serial", {
692
+ get: $util.oneOfGetter(($oneOfFields = ["serial"])),
693
+ set: $util.oneOfSetter($oneOfFields),
694
+ });
695
+ Object.defineProperty(Details.prototype, "_issuer", {
696
+ get: $util.oneOfGetter(($oneOfFields = ["issuer"])),
697
+ set: $util.oneOfSetter($oneOfFields),
698
+ });
699
+ Object.defineProperty(Details.prototype, "_expires", {
700
+ get: $util.oneOfGetter(($oneOfFields = ["expires"])),
701
+ set: $util.oneOfSetter($oneOfFields),
702
+ });
703
+ Object.defineProperty(Details.prototype, "_subject", {
704
+ get: $util.oneOfGetter(($oneOfFields = ["subject"])),
705
+ set: $util.oneOfSetter($oneOfFields),
706
+ });
707
+ Object.defineProperty(Details.prototype, "_key", {
708
+ get: $util.oneOfGetter(($oneOfFields = ["key"])),
709
+ set: $util.oneOfSetter($oneOfFields),
710
+ });
711
+ Details.create = function create(properties) {
712
+ return new Details(properties);
713
+ };
714
+ Details.encode = function encode(message, writer) {
715
+ if (!writer) writer = $Writer.create();
716
+ if (message.serial != null && Object.hasOwnProperty.call(message, "serial"))
717
+ writer.uint32(8).uint32(message.serial);
718
+ if (message.issuer != null && Object.hasOwnProperty.call(message, "issuer"))
719
+ writer.uint32(18).string(message.issuer);
720
+ if (message.expires != null && Object.hasOwnProperty.call(message, "expires"))
721
+ writer.uint32(24).uint64(message.expires);
722
+ if (message.subject != null && Object.hasOwnProperty.call(message, "subject"))
723
+ writer.uint32(34).string(message.subject);
724
+ if (message.key != null && Object.hasOwnProperty.call(message, "key"))
725
+ writer.uint32(42).bytes(message.key);
726
+ return writer;
727
+ };
728
+ Details.encodeDelimited = function encodeDelimited(message, writer) {
729
+ return this.encode(message, writer).ldelim();
730
+ };
731
+ Details.decode = function decode(reader, length, error) {
732
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
733
+ var end = length === undefined ? reader.len : reader.pos + length,
734
+ message = new $root.Cert.NoiseCertificate.Details();
735
+ while (reader.pos < end) {
736
+ var tag = reader.uint32();
737
+ if (tag === error) break;
738
+ switch (tag >>> 3) {
739
+ case 1: {
740
+ message.serial = reader.uint32();
741
+ break;
742
+ }
743
+ case 2: {
744
+ message.issuer = reader.string();
745
+ break;
746
+ }
747
+ case 3: {
748
+ message.expires = reader.uint64();
749
+ break;
750
+ }
751
+ case 4: {
752
+ message.subject = reader.string();
753
+ break;
754
+ }
755
+ case 5: {
756
+ message.key = reader.bytes();
757
+ break;
758
+ }
759
+ default:
760
+ reader.skipType(tag & 7);
761
+ break;
762
+ }
763
+ }
764
+ return message;
765
+ };
766
+ Details.decodeDelimited = function decodeDelimited(reader) {
767
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
768
+ return this.decode(reader, reader.uint32());
769
+ };
770
+ Details.verify = function verify(message) {
771
+ if (typeof message !== "object" || message === null) return "object expected";
772
+ var properties = {};
773
+ if (message.serial != null && message.hasOwnProperty("serial")) {
774
+ properties._serial = 1;
775
+ if (!$util.isInteger(message.serial)) return "serial: integer expected";
776
+ }
777
+ if (message.issuer != null && message.hasOwnProperty("issuer")) {
778
+ properties._issuer = 1;
779
+ if (!$util.isString(message.issuer)) return "issuer: string expected";
780
+ }
781
+ if (message.expires != null && message.hasOwnProperty("expires")) {
782
+ properties._expires = 1;
783
+ if (
784
+ !$util.isInteger(message.expires) &&
785
+ !(
786
+ message.expires &&
787
+ $util.isInteger(message.expires.low) &&
788
+ $util.isInteger(message.expires.high)
789
+ )
790
+ )
791
+ return "expires: integer|Long expected";
792
+ }
793
+ if (message.subject != null && message.hasOwnProperty("subject")) {
794
+ properties._subject = 1;
795
+ if (!$util.isString(message.subject)) return "subject: string expected";
796
+ }
797
+ if (message.key != null && message.hasOwnProperty("key")) {
798
+ properties._key = 1;
799
+ if (
800
+ !(
801
+ (message.key && typeof message.key.length === "number") ||
802
+ $util.isString(message.key)
803
+ )
804
+ )
805
+ return "key: buffer expected";
806
+ }
807
+ return null;
808
+ };
809
+ Details.fromObject = function fromObject(object) {
810
+ if (object instanceof $root.Cert.NoiseCertificate.Details) return object;
811
+ var message = new $root.Cert.NoiseCertificate.Details();
812
+ if (object.serial != null) message.serial = object.serial >>> 0;
813
+ if (object.issuer != null) message.issuer = String(object.issuer);
814
+ if (object.expires != null)
815
+ if ($util.Long)
816
+ (message.expires = $util.Long.fromValue(object.expires)).unsigned = true;
817
+ else if (typeof object.expires === "string")
818
+ message.expires = parseInt(object.expires, 10);
819
+ else if (typeof object.expires === "number") message.expires = object.expires;
820
+ else if (typeof object.expires === "object")
821
+ message.expires = new $util.LongBits(
822
+ object.expires.low >>> 0,
823
+ object.expires.high >>> 0
824
+ ).toNumber(true);
825
+ if (object.subject != null) message.subject = String(object.subject);
826
+ if (object.key != null)
827
+ if (typeof object.key === "string")
828
+ $util.base64.decode(
829
+ object.key,
830
+ (message.key = $util.newBuffer($util.base64.length(object.key))),
831
+ 0
832
+ );
833
+ else if (object.key.length >= 0) message.key = object.key;
834
+ return message;
835
+ };
836
+ Details.toObject = function toObject(message, options) {
837
+ if (!options) options = {};
838
+ var object = {};
839
+ if (message.serial != null && message.hasOwnProperty("serial")) {
840
+ object.serial = message.serial;
841
+ if (options.oneofs) object._serial = "serial";
842
+ }
843
+ if (message.issuer != null && message.hasOwnProperty("issuer")) {
844
+ object.issuer = message.issuer;
845
+ if (options.oneofs) object._issuer = "issuer";
846
+ }
847
+ if (message.expires != null && message.hasOwnProperty("expires")) {
848
+ if (typeof message.expires === "number")
849
+ object.expires =
850
+ options.longs === String ? String(message.expires) : message.expires;
851
+ else
852
+ object.expires =
853
+ options.longs === String
854
+ ? $util.Long.prototype.toString.call(message.expires)
855
+ : options.longs === Number
856
+ ? new $util.LongBits(
857
+ message.expires.low >>> 0,
858
+ message.expires.high >>> 0
859
+ ).toNumber(true)
860
+ : message.expires;
861
+ if (options.oneofs) object._expires = "expires";
862
+ }
863
+ if (message.subject != null && message.hasOwnProperty("subject")) {
864
+ object.subject = message.subject;
865
+ if (options.oneofs) object._subject = "subject";
866
+ }
867
+ if (message.key != null && message.hasOwnProperty("key")) {
868
+ object.key =
869
+ options.bytes === String
870
+ ? $util.base64.encode(message.key, 0, message.key.length)
871
+ : options.bytes === Array
872
+ ? Array.prototype.slice.call(message.key)
873
+ : message.key;
874
+ if (options.oneofs) object._key = "key";
875
+ }
876
+ return object;
877
+ };
878
+ Details.prototype.toJSON = function toJSON() {
879
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
880
+ };
881
+ Details.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
882
+ if (typeUrlPrefix === undefined) {
883
+ typeUrlPrefix = "type.googleapis.com";
884
+ }
885
+ return typeUrlPrefix + "/Cert.NoiseCertificate.Details";
886
+ };
887
+ return Details;
888
+ })();
889
+ return NoiseCertificate;
890
+ })();
891
+ return Cert;
892
+ })();
893
+ module.exports = $root;