dcodeindra-baileyspro 2.3.9

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 (286) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2534 -0
  3. package/WAProto/Adv/Adv.d.ts +518 -0
  4. package/WAProto/Adv/Adv.js +1734 -0
  5. package/WAProto/Adv/Adv.proto +36 -0
  6. package/WAProto/BotMetadata/BotMetadata.d.ts +5745 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +16291 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +463 -0
  9. package/WAProto/Cert/Cert.d.ts +497 -0
  10. package/WAProto/Cert/Cert.js +1503 -0
  11. package/WAProto/Cert/Cert.proto +28 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +391 -0
  13. package/WAProto/ChatLockSettings/ChatLockSettings.js +1155 -0
  14. package/WAProto/ChatLockSettings/ChatLockSettings.proto +7 -0
  15. package/WAProto/CompanionReg/CompanionReg.d.ts +1055 -0
  16. package/WAProto/CompanionReg/CompanionReg.js +3532 -0
  17. package/WAProto/CompanionReg/CompanionReg.proto +89 -0
  18. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +187 -0
  19. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +520 -0
  20. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +14 -0
  21. package/WAProto/E2E/E2E.d.ts +28417 -0
  22. package/WAProto/E2E/E2E.js +98438 -0
  23. package/WAProto/E2E/E2E.proto +2289 -0
  24. package/WAProto/Ephemeral/Ephemeral.d.ts +95 -0
  25. package/WAProto/Ephemeral/Ephemeral.js +269 -0
  26. package/WAProto/Ephemeral/Ephemeral.proto +6 -0
  27. package/WAProto/HistorySync/HistorySync.d.ts +40728 -0
  28. package/WAProto/HistorySync/HistorySync.js +142980 -0
  29. package/WAProto/HistorySync/HistorySync.proto +207 -0
  30. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +189 -0
  31. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +585 -0
  32. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +11 -0
  33. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +461 -0
  34. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +1559 -0
  35. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +37 -0
  36. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +29294 -0
  37. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +101732 -0
  38. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +76 -0
  39. package/WAProto/MmsRetry/MmsRetry.d.ts +200 -0
  40. package/WAProto/MmsRetry/MmsRetry.js +586 -0
  41. package/WAProto/MmsRetry/MmsRetry.proto +17 -0
  42. package/WAProto/Protocol/Protocol.d.ts +218 -0
  43. package/WAProto/Protocol/Protocol.js +701 -0
  44. package/WAProto/Protocol/Protocol.proto +20 -0
  45. package/WAProto/Reporting/Reporting.d.ts +301 -0
  46. package/WAProto/Reporting/Reporting.js +989 -0
  47. package/WAProto/Reporting/Reporting.proto +19 -0
  48. package/WAProto/ServerSync/ServerSync.d.ts +1050 -0
  49. package/WAProto/ServerSync/ServerSync.js +3176 -0
  50. package/WAProto/ServerSync/ServerSync.proto +59 -0
  51. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +1507 -0
  52. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +4756 -0
  53. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +88 -0
  54. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +617 -0
  55. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1940 -0
  56. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +38 -0
  57. package/WAProto/StatusAttributions/StatusAttributions.d.ts +636 -0
  58. package/WAProto/StatusAttributions/StatusAttributions.js +2037 -0
  59. package/WAProto/StatusAttributions/StatusAttributions.proto +61 -0
  60. package/WAProto/SyncAction/SyncAction.d.ts +7227 -0
  61. package/WAProto/SyncAction/SyncAction.js +22271 -0
  62. package/WAProto/SyncAction/SyncAction.proto +423 -0
  63. package/WAProto/UserPassword/UserPassword.d.ts +298 -0
  64. package/WAProto/UserPassword/UserPassword.js +898 -0
  65. package/WAProto/UserPassword/UserPassword.proto +27 -0
  66. package/WAProto/VnameCert/VnameCert.d.ts +658 -0
  67. package/WAProto/VnameCert/VnameCert.js +2225 -0
  68. package/WAProto/VnameCert/VnameCert.proto +60 -0
  69. package/WAProto/Wa6/Wa6.d.ts +1613 -0
  70. package/WAProto/Wa6/Wa6.js +6299 -0
  71. package/WAProto/Wa6/Wa6.proto +229 -0
  72. package/WAProto/Web/Web.d.ts +31718 -0
  73. package/WAProto/Web/Web.js +113402 -0
  74. package/WAProto/Web/Web.proto +545 -0
  75. package/WAProto/index.d.ts +49 -0
  76. package/WAProto/index.js +28 -0
  77. package/WASignalGroup/GroupProtocol.js +1771 -0
  78. package/WASignalGroup/ciphertext_message.js +10 -0
  79. package/WASignalGroup/group_cipher.js +103 -0
  80. package/WASignalGroup/group_session_builder.js +39 -0
  81. package/WASignalGroup/index.js +5 -0
  82. package/WASignalGroup/keyhelper.js +17 -0
  83. package/WASignalGroup/protobufs.js +2 -0
  84. package/WASignalGroup/queue_job.js +64 -0
  85. package/WASignalGroup/sender_chain_key.js +38 -0
  86. package/WASignalGroup/sender_key_distribution_message.js +68 -0
  87. package/WASignalGroup/sender_key_message.js +79 -0
  88. package/WASignalGroup/sender_key_name.js +59 -0
  89. package/WASignalGroup/sender_key_record.js +47 -0
  90. package/WASignalGroup/sender_key_state.js +110 -0
  91. package/WASignalGroup/sender_message_key.js +30 -0
  92. package/check-node-version.js +10 -0
  93. package/lib/Defaults/baileys-version.json +3 -0
  94. package/lib/Defaults/index.d.ts +51 -0
  95. package/lib/Defaults/index.js +108 -0
  96. package/lib/Defaults/phonenumber-mcc.json +223 -0
  97. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  98. package/lib/Signal/Group/ciphertext-message.js +19 -0
  99. package/lib/Signal/Group/group-session-builder.d.ts +17 -0
  100. package/lib/Signal/Group/group-session-builder.js +72 -0
  101. package/lib/Signal/Group/group_cipher.d.ts +19 -0
  102. package/lib/Signal/Group/group_cipher.js +99 -0
  103. package/lib/Signal/Group/index.d.ts +11 -0
  104. package/lib/Signal/Group/index.js +61 -0
  105. package/lib/Signal/Group/keyhelper.d.ts +16 -0
  106. package/lib/Signal/Group/keyhelper.js +66 -0
  107. package/lib/Signal/Group/queue-job.d.ts +1 -0
  108. package/lib/Signal/Group/queue-job.js +64 -0
  109. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  110. package/lib/Signal/Group/sender-chain-key.js +39 -0
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  112. package/lib/Signal/Group/sender-key-distribution-message.js +71 -0
  113. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  114. package/lib/Signal/Group/sender-key-message.js +73 -0
  115. package/lib/Signal/Group/sender-key-name.d.ts +19 -0
  116. package/lib/Signal/Group/sender-key-name.js +59 -0
  117. package/lib/Signal/Group/sender-key-record.d.ts +32 -0
  118. package/lib/Signal/Group/sender-key-record.js +53 -0
  119. package/lib/Signal/Group/sender-key-record.ts +77 -0
  120. package/lib/Signal/Group/sender-key-state.d.ts +44 -0
  121. package/lib/Signal/Group/sender-key-state.js +104 -0
  122. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  123. package/lib/Signal/Group/sender-message-key.js +33 -0
  124. package/lib/Signal/libsignal.d.ts +3 -0
  125. package/lib/Signal/libsignal.js +153 -0
  126. package/lib/Socket/Client/index.d.ts +2 -0
  127. package/lib/Socket/Client/index.js +18 -0
  128. package/lib/Socket/Client/types.d.ts +15 -0
  129. package/lib/Socket/Client/types.js +14 -0
  130. package/lib/Socket/Client/websocket.d.ts +12 -0
  131. package/lib/Socket/Client/websocket.js +57 -0
  132. package/lib/Socket/business.d.ts +181 -0
  133. package/lib/Socket/business.js +259 -0
  134. package/lib/Socket/chats.d.ts +95 -0
  135. package/lib/Socket/chats.js +906 -0
  136. package/lib/Socket/community.d.ts +131 -0
  137. package/lib/Socket/community.js +369 -0
  138. package/lib/Socket/groups.d.ts +122 -0
  139. package/lib/Socket/groups.js +360 -0
  140. package/lib/Socket/index.d.ts +183 -0
  141. package/lib/Socket/index.js +10 -0
  142. package/lib/Socket/messages-recv.d.ts +170 -0
  143. package/lib/Socket/messages-recv.js +1074 -0
  144. package/lib/Socket/messages-send.d.ts +161 -0
  145. package/lib/Socket/messages-send.js +982 -0
  146. package/lib/Socket/newsletter.d.ts +140 -0
  147. package/lib/Socket/newsletter.js +242 -0
  148. package/lib/Socket/socket.d.ts +43 -0
  149. package/lib/Socket/socket.js +749 -0
  150. package/lib/Socket/usync.d.ts +36 -0
  151. package/lib/Socket/usync.js +71 -0
  152. package/lib/Store/index.d.ts +4 -0
  153. package/lib/Store/index.js +20 -0
  154. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  155. package/lib/Store/make-cache-manager-store.js +77 -0
  156. package/lib/Store/make-in-memory-store.d.ts +117 -0
  157. package/lib/Store/make-in-memory-store.js +420 -0
  158. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  159. package/lib/Store/make-ordered-dictionary.js +83 -0
  160. package/lib/Store/object-repository.d.ts +10 -0
  161. package/lib/Store/object-repository.js +28 -0
  162. package/lib/Types/Auth.d.ts +103 -0
  163. package/lib/Types/Auth.js +2 -0
  164. package/lib/Types/Call.d.ts +13 -0
  165. package/lib/Types/Call.js +2 -0
  166. package/lib/Types/Chat.d.ts +115 -0
  167. package/lib/Types/Chat.js +6 -0
  168. package/lib/Types/Contact.d.ts +35 -0
  169. package/lib/Types/Contact.js +2 -0
  170. package/lib/Types/Events.d.ts +208 -0
  171. package/lib/Types/Events.js +2 -0
  172. package/lib/Types/GroupMetadata.d.ts +81 -0
  173. package/lib/Types/GroupMetadata.js +2 -0
  174. package/lib/Types/Label.d.ts +46 -0
  175. package/lib/Types/Label.js +28 -0
  176. package/lib/Types/LabelAssociation.d.ts +29 -0
  177. package/lib/Types/LabelAssociation.js +10 -0
  178. package/lib/Types/Message.d.ts +480 -0
  179. package/lib/Types/Message.js +9 -0
  180. package/lib/Types/MexUpdates.d.ts +9 -0
  181. package/lib/Types/MexUpdates.js +18 -0
  182. package/lib/Types/Newsletter.d.ts +92 -0
  183. package/lib/Types/Newsletter.js +33 -0
  184. package/lib/Types/Product.d.ts +78 -0
  185. package/lib/Types/Product.js +2 -0
  186. package/lib/Types/Signal.d.ts +57 -0
  187. package/lib/Types/Signal.js +2 -0
  188. package/lib/Types/Socket.d.ts +116 -0
  189. package/lib/Types/Socket.js +2 -0
  190. package/lib/Types/State.d.ts +27 -0
  191. package/lib/Types/State.js +2 -0
  192. package/lib/Types/USync.d.ts +25 -0
  193. package/lib/Types/USync.js +2 -0
  194. package/lib/Types/index.d.ts +70 -0
  195. package/lib/Types/index.js +42 -0
  196. package/lib/Utils/auth-utils.d.ts +18 -0
  197. package/lib/Utils/auth-utils.js +198 -0
  198. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  199. package/lib/Utils/baileys-event-stream.js +64 -0
  200. package/lib/Utils/business.d.ts +22 -0
  201. package/lib/Utils/business.js +243 -0
  202. package/lib/Utils/chat-utils.d.ts +72 -0
  203. package/lib/Utils/chat-utils.js +762 -0
  204. package/lib/Utils/crypto.d.ts +40 -0
  205. package/lib/Utils/crypto.js +150 -0
  206. package/lib/Utils/decode-wa-message.d.ts +252 -0
  207. package/lib/Utils/decode-wa-message.js +232 -0
  208. package/lib/Utils/event-buffer.d.ts +35 -0
  209. package/lib/Utils/event-buffer.js +539 -0
  210. package/lib/Utils/generics.d.ts +96 -0
  211. package/lib/Utils/generics.js +553 -0
  212. package/lib/Utils/history.d.ts +29 -0
  213. package/lib/Utils/history.js +109 -0
  214. package/lib/Utils/index.d.ts +19 -0
  215. package/lib/Utils/index.js +35 -0
  216. package/lib/Utils/link-preview.d.ts +21 -0
  217. package/lib/Utils/link-preview.js +112 -0
  218. package/lib/Utils/logger.d.ts +11 -0
  219. package/lib/Utils/logger.js +7 -0
  220. package/lib/Utils/lt-hash.d.ts +12 -0
  221. package/lib/Utils/lt-hash.js +53 -0
  222. package/lib/Utils/make-mutex.d.ts +7 -0
  223. package/lib/Utils/make-mutex.js +45 -0
  224. package/lib/Utils/messages-media.d.ts +104 -0
  225. package/lib/Utils/messages-media.js +751 -0
  226. package/lib/Utils/messages.d.ts +80 -0
  227. package/lib/Utils/messages.js +1741 -0
  228. package/lib/Utils/noise-handler.d.ts +19 -0
  229. package/lib/Utils/noise-handler.js +150 -0
  230. package/lib/Utils/process-message.d.ts +41 -0
  231. package/lib/Utils/process-message.js +391 -0
  232. package/lib/Utils/signal.d.ts +33 -0
  233. package/lib/Utils/signal.js +154 -0
  234. package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
  235. package/lib/Utils/use-mongo-file-auth-state.js +75 -0
  236. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  237. package/lib/Utils/use-multi-file-auth-state.js +123 -0
  238. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  239. package/lib/Utils/use-single-file-auth-state.js +75 -0
  240. package/lib/Utils/validate-connection.d.ts +10 -0
  241. package/lib/Utils/validate-connection.js +174 -0
  242. package/lib/WABinary/constants.d.ts +27 -0
  243. package/lib/WABinary/constants.js +45 -0
  244. package/lib/WABinary/decode.d.ts +6 -0
  245. package/lib/WABinary/decode.js +255 -0
  246. package/lib/WABinary/encode.d.ts +2 -0
  247. package/lib/WABinary/encode.js +243 -0
  248. package/lib/WABinary/generic-utils.d.ts +16 -0
  249. package/lib/WABinary/generic-utils.js +125 -0
  250. package/lib/WABinary/index.d.ts +5 -0
  251. package/lib/WABinary/index.js +21 -0
  252. package/lib/WABinary/jid-utils.d.ts +34 -0
  253. package/lib/WABinary/jid-utils.js +73 -0
  254. package/lib/WABinary/types.d.ts +18 -0
  255. package/lib/WABinary/types.js +2 -0
  256. package/lib/WAM/BinaryInfo.d.ts +16 -0
  257. package/lib/WAM/BinaryInfo.js +14 -0
  258. package/lib/WAM/constants.d.ts +39 -0
  259. package/lib/WAM/constants.js +15362 -0
  260. package/lib/WAM/encode.d.ts +2 -0
  261. package/lib/WAM/encode.js +156 -0
  262. package/lib/WAM/index.d.ts +3 -0
  263. package/lib/WAM/index.js +19 -0
  264. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
  265. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -0
  266. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  267. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  268. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  269. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +58 -0
  270. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  271. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  272. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
  273. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
  274. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  275. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  276. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  277. package/lib/WAUSync/Protocols/index.js +22 -0
  278. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  279. package/lib/WAUSync/USyncQuery.js +88 -0
  280. package/lib/WAUSync/USyncUser.d.ts +12 -0
  281. package/lib/WAUSync/USyncUser.js +27 -0
  282. package/lib/WAUSync/index.d.ts +3 -0
  283. package/lib/WAUSync/index.js +19 -0
  284. package/lib/index.d.ts +13 -0
  285. package/lib/index.js +45 -0
  286. package/package.json +63 -0
@@ -0,0 +1,4756 @@
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
+ var $protobuf = require("protobufjs/minimal");
4
+ // Common aliases
5
+ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
6
+ // Exported root namespace
7
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
8
+ $root.SignalLocalStorageProtocol = (function() {
9
+ /**
10
+ * Namespace SignalLocalStorageProtocol.
11
+ * @exports SignalLocalStorageProtocol
12
+ * @namespace
13
+ */
14
+ var SignalLocalStorageProtocol = {};
15
+ SignalLocalStorageProtocol.SenderKeyRecordStructure = (function() {
16
+ /**
17
+ * Properties of a SenderKeyRecordStructure.
18
+ * @memberof SignalLocalStorageProtocol
19
+ * @interface ISenderKeyRecordStructure
20
+ * @property {Array.<SignalLocalStorageProtocol.ISenderKeyStateStructure>|null} [senderKeyStates] SenderKeyRecordStructure senderKeyStates
21
+ */
22
+ /**
23
+ * Constructs a new SenderKeyRecordStructure.
24
+ * @memberof SignalLocalStorageProtocol
25
+ * @classdesc Represents a SenderKeyRecordStructure.
26
+ * @implements ISenderKeyRecordStructure
27
+ * @constructor
28
+ * @param {SignalLocalStorageProtocol.ISenderKeyRecordStructure=} [properties] Properties to set
29
+ */
30
+ function SenderKeyRecordStructure(properties) {
31
+ this.senderKeyStates = [];
32
+ if (properties)
33
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
34
+ if (properties[keys[i]] != null)
35
+ this[keys[i]] = properties[keys[i]];
36
+ }
37
+ /**
38
+ * SenderKeyRecordStructure senderKeyStates.
39
+ * @member {Array.<SignalLocalStorageProtocol.ISenderKeyStateStructure>} senderKeyStates
40
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
41
+ * @instance
42
+ */
43
+ SenderKeyRecordStructure.prototype.senderKeyStates = $util.emptyArray;
44
+ /**
45
+ * Creates a new SenderKeyRecordStructure instance using the specified properties.
46
+ * @function create
47
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
48
+ * @static
49
+ * @param {SignalLocalStorageProtocol.ISenderKeyRecordStructure=} [properties] Properties to set
50
+ * @returns {SignalLocalStorageProtocol.SenderKeyRecordStructure} SenderKeyRecordStructure instance
51
+ */
52
+ SenderKeyRecordStructure.create = function create(properties) {
53
+ return new SenderKeyRecordStructure(properties);
54
+ };
55
+ /**
56
+ * Encodes the specified SenderKeyRecordStructure message. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyRecordStructure.verify|verify} messages.
57
+ * @function encode
58
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
59
+ * @static
60
+ * @param {SignalLocalStorageProtocol.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode
61
+ * @param {$protobuf.Writer} [writer] Writer to encode to
62
+ * @returns {$protobuf.Writer} Writer
63
+ */
64
+ SenderKeyRecordStructure.encode = function encode(message, writer) {
65
+ if (!writer)
66
+ writer = $Writer.create();
67
+ if (message.senderKeyStates != null && message.senderKeyStates.length)
68
+ for (var i = 0; i < message.senderKeyStates.length; ++i)
69
+ $root.SignalLocalStorageProtocol.SenderKeyStateStructure.encode(message.senderKeyStates[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
70
+ return writer;
71
+ };
72
+ /**
73
+ * Encodes the specified SenderKeyRecordStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyRecordStructure.verify|verify} messages.
74
+ * @function encodeDelimited
75
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
76
+ * @static
77
+ * @param {SignalLocalStorageProtocol.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode
78
+ * @param {$protobuf.Writer} [writer] Writer to encode to
79
+ * @returns {$protobuf.Writer} Writer
80
+ */
81
+ SenderKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) {
82
+ return this.encode(message, writer).ldelim();
83
+ };
84
+ /**
85
+ * Decodes a SenderKeyRecordStructure message from the specified reader or buffer.
86
+ * @function decode
87
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
88
+ * @static
89
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
90
+ * @param {number} [length] Message length if known beforehand
91
+ * @returns {SignalLocalStorageProtocol.SenderKeyRecordStructure} SenderKeyRecordStructure
92
+ * @throws {Error} If the payload is not a reader or valid buffer
93
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
94
+ */
95
+ SenderKeyRecordStructure.decode = function decode(reader, length, error) {
96
+ if (!(reader instanceof $Reader))
97
+ reader = $Reader.create(reader);
98
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SenderKeyRecordStructure();
99
+ while (reader.pos < end) {
100
+ var tag = reader.uint32();
101
+ if (tag === error)
102
+ break;
103
+ switch (tag >>> 3) {
104
+ case 1: {
105
+ if (!(message.senderKeyStates && message.senderKeyStates.length))
106
+ message.senderKeyStates = [];
107
+ message.senderKeyStates.push($root.SignalLocalStorageProtocol.SenderKeyStateStructure.decode(reader, reader.uint32()));
108
+ break;
109
+ }
110
+ default:
111
+ reader.skipType(tag & 7);
112
+ break;
113
+ }
114
+ }
115
+ return message;
116
+ };
117
+ /**
118
+ * Decodes a SenderKeyRecordStructure message from the specified reader or buffer, length delimited.
119
+ * @function decodeDelimited
120
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
121
+ * @static
122
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
123
+ * @returns {SignalLocalStorageProtocol.SenderKeyRecordStructure} SenderKeyRecordStructure
124
+ * @throws {Error} If the payload is not a reader or valid buffer
125
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
126
+ */
127
+ SenderKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) {
128
+ if (!(reader instanceof $Reader))
129
+ reader = new $Reader(reader);
130
+ return this.decode(reader, reader.uint32());
131
+ };
132
+ /**
133
+ * Verifies a SenderKeyRecordStructure message.
134
+ * @function verify
135
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
136
+ * @static
137
+ * @param {Object.<string,*>} message Plain object to verify
138
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
139
+ */
140
+ SenderKeyRecordStructure.verify = function verify(message) {
141
+ if (typeof message !== "object" || message === null)
142
+ return "object expected";
143
+ if (message.senderKeyStates != null && message.hasOwnProperty("senderKeyStates")) {
144
+ if (!Array.isArray(message.senderKeyStates))
145
+ return "senderKeyStates: array expected";
146
+ for (var i = 0; i < message.senderKeyStates.length; ++i) {
147
+ var error = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.verify(message.senderKeyStates[i]);
148
+ if (error)
149
+ return "senderKeyStates." + error;
150
+ }
151
+ }
152
+ return null;
153
+ };
154
+ /**
155
+ * Creates a SenderKeyRecordStructure message from a plain object. Also converts values to their respective internal types.
156
+ * @function fromObject
157
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
158
+ * @static
159
+ * @param {Object.<string,*>} object Plain object
160
+ * @returns {SignalLocalStorageProtocol.SenderKeyRecordStructure} SenderKeyRecordStructure
161
+ */
162
+ SenderKeyRecordStructure.fromObject = function fromObject(object) {
163
+ if (object instanceof $root.SignalLocalStorageProtocol.SenderKeyRecordStructure)
164
+ return object;
165
+ var message = new $root.SignalLocalStorageProtocol.SenderKeyRecordStructure();
166
+ if (object.senderKeyStates) {
167
+ if (!Array.isArray(object.senderKeyStates))
168
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyRecordStructure.senderKeyStates: array expected");
169
+ message.senderKeyStates = [];
170
+ for (var i = 0; i < object.senderKeyStates.length; ++i) {
171
+ if (typeof object.senderKeyStates[i] !== "object")
172
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyRecordStructure.senderKeyStates: object expected");
173
+ message.senderKeyStates[i] = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.fromObject(object.senderKeyStates[i]);
174
+ }
175
+ }
176
+ return message;
177
+ };
178
+ /**
179
+ * Creates a plain object from a SenderKeyRecordStructure message. Also converts values to other types if specified.
180
+ * @function toObject
181
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
182
+ * @static
183
+ * @param {SignalLocalStorageProtocol.SenderKeyRecordStructure} message SenderKeyRecordStructure
184
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
185
+ * @returns {Object.<string,*>} Plain object
186
+ */
187
+ SenderKeyRecordStructure.toObject = function toObject(message, options) {
188
+ if (!options)
189
+ options = {};
190
+ var object = {};
191
+ if (options.arrays || options.defaults)
192
+ object.senderKeyStates = [];
193
+ if (message.senderKeyStates && message.senderKeyStates.length) {
194
+ object.senderKeyStates = [];
195
+ for (var j = 0; j < message.senderKeyStates.length; ++j)
196
+ object.senderKeyStates[j] = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.toObject(message.senderKeyStates[j], options);
197
+ }
198
+ return object;
199
+ };
200
+ /**
201
+ * Converts this SenderKeyRecordStructure to JSON.
202
+ * @function toJSON
203
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
204
+ * @instance
205
+ * @returns {Object.<string,*>} JSON object
206
+ */
207
+ SenderKeyRecordStructure.prototype.toJSON = function toJSON() {
208
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
209
+ };
210
+ /**
211
+ * Gets the default type url for SenderKeyRecordStructure
212
+ * @function getTypeUrl
213
+ * @memberof SignalLocalStorageProtocol.SenderKeyRecordStructure
214
+ * @static
215
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
216
+ * @returns {string} The default type url
217
+ */
218
+ SenderKeyRecordStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
219
+ if (typeUrlPrefix === undefined) {
220
+ typeUrlPrefix = "type.googleapis.com";
221
+ }
222
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SenderKeyRecordStructure";
223
+ };
224
+ return SenderKeyRecordStructure;
225
+ })();
226
+ SignalLocalStorageProtocol.SenderKeyStateStructure = (function() {
227
+ /**
228
+ * Properties of a SenderKeyStateStructure.
229
+ * @memberof SignalLocalStorageProtocol
230
+ * @interface ISenderKeyStateStructure
231
+ * @property {number|null} [senderKeyId] SenderKeyStateStructure senderKeyId
232
+ * @property {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey|null} [senderChainKey] SenderKeyStateStructure senderChainKey
233
+ * @property {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey|null} [senderSigningKey] SenderKeyStateStructure senderSigningKey
234
+ * @property {Array.<SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey>|null} [senderMessageKeys] SenderKeyStateStructure senderMessageKeys
235
+ */
236
+ /**
237
+ * Constructs a new SenderKeyStateStructure.
238
+ * @memberof SignalLocalStorageProtocol
239
+ * @classdesc Represents a SenderKeyStateStructure.
240
+ * @implements ISenderKeyStateStructure
241
+ * @constructor
242
+ * @param {SignalLocalStorageProtocol.ISenderKeyStateStructure=} [properties] Properties to set
243
+ */
244
+ function SenderKeyStateStructure(properties) {
245
+ this.senderMessageKeys = [];
246
+ if (properties)
247
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
248
+ if (properties[keys[i]] != null)
249
+ this[keys[i]] = properties[keys[i]];
250
+ }
251
+ /**
252
+ * SenderKeyStateStructure senderKeyId.
253
+ * @member {number|null|undefined} senderKeyId
254
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
255
+ * @instance
256
+ */
257
+ SenderKeyStateStructure.prototype.senderKeyId = null;
258
+ /**
259
+ * SenderKeyStateStructure senderChainKey.
260
+ * @member {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey|null|undefined} senderChainKey
261
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
262
+ * @instance
263
+ */
264
+ SenderKeyStateStructure.prototype.senderChainKey = null;
265
+ /**
266
+ * SenderKeyStateStructure senderSigningKey.
267
+ * @member {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey|null|undefined} senderSigningKey
268
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
269
+ * @instance
270
+ */
271
+ SenderKeyStateStructure.prototype.senderSigningKey = null;
272
+ /**
273
+ * SenderKeyStateStructure senderMessageKeys.
274
+ * @member {Array.<SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey>} senderMessageKeys
275
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
276
+ * @instance
277
+ */
278
+ SenderKeyStateStructure.prototype.senderMessageKeys = $util.emptyArray;
279
+ // OneOf field names bound to virtual getters and setters
280
+ var $oneOfFields;
281
+ /**
282
+ * SenderKeyStateStructure _senderKeyId.
283
+ * @member {"senderKeyId"|undefined} _senderKeyId
284
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
285
+ * @instance
286
+ */
287
+ Object.defineProperty(SenderKeyStateStructure.prototype, "_senderKeyId", {
288
+ get: $util.oneOfGetter($oneOfFields = ["senderKeyId"]),
289
+ set: $util.oneOfSetter($oneOfFields)
290
+ });
291
+ /**
292
+ * SenderKeyStateStructure _senderChainKey.
293
+ * @member {"senderChainKey"|undefined} _senderChainKey
294
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
295
+ * @instance
296
+ */
297
+ Object.defineProperty(SenderKeyStateStructure.prototype, "_senderChainKey", {
298
+ get: $util.oneOfGetter($oneOfFields = ["senderChainKey"]),
299
+ set: $util.oneOfSetter($oneOfFields)
300
+ });
301
+ /**
302
+ * SenderKeyStateStructure _senderSigningKey.
303
+ * @member {"senderSigningKey"|undefined} _senderSigningKey
304
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
305
+ * @instance
306
+ */
307
+ Object.defineProperty(SenderKeyStateStructure.prototype, "_senderSigningKey", {
308
+ get: $util.oneOfGetter($oneOfFields = ["senderSigningKey"]),
309
+ set: $util.oneOfSetter($oneOfFields)
310
+ });
311
+ /**
312
+ * Creates a new SenderKeyStateStructure instance using the specified properties.
313
+ * @function create
314
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
315
+ * @static
316
+ * @param {SignalLocalStorageProtocol.ISenderKeyStateStructure=} [properties] Properties to set
317
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure} SenderKeyStateStructure instance
318
+ */
319
+ SenderKeyStateStructure.create = function create(properties) {
320
+ return new SenderKeyStateStructure(properties);
321
+ };
322
+ /**
323
+ * Encodes the specified SenderKeyStateStructure message. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.verify|verify} messages.
324
+ * @function encode
325
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
326
+ * @static
327
+ * @param {SignalLocalStorageProtocol.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode
328
+ * @param {$protobuf.Writer} [writer] Writer to encode to
329
+ * @returns {$protobuf.Writer} Writer
330
+ */
331
+ SenderKeyStateStructure.encode = function encode(message, writer) {
332
+ if (!writer)
333
+ writer = $Writer.create();
334
+ if (message.senderKeyId != null && Object.hasOwnProperty.call(message, "senderKeyId"))
335
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.senderKeyId);
336
+ if (message.senderChainKey != null && Object.hasOwnProperty.call(message, "senderChainKey"))
337
+ $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.encode(message.senderChainKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
338
+ if (message.senderSigningKey != null && Object.hasOwnProperty.call(message, "senderSigningKey"))
339
+ $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.encode(message.senderSigningKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
340
+ if (message.senderMessageKeys != null && message.senderMessageKeys.length)
341
+ for (var i = 0; i < message.senderMessageKeys.length; ++i)
342
+ $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.encode(message.senderMessageKeys[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
343
+ return writer;
344
+ };
345
+ /**
346
+ * Encodes the specified SenderKeyStateStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.verify|verify} messages.
347
+ * @function encodeDelimited
348
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
349
+ * @static
350
+ * @param {SignalLocalStorageProtocol.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode
351
+ * @param {$protobuf.Writer} [writer] Writer to encode to
352
+ * @returns {$protobuf.Writer} Writer
353
+ */
354
+ SenderKeyStateStructure.encodeDelimited = function encodeDelimited(message, writer) {
355
+ return this.encode(message, writer).ldelim();
356
+ };
357
+ /**
358
+ * Decodes a SenderKeyStateStructure message from the specified reader or buffer.
359
+ * @function decode
360
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
361
+ * @static
362
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
363
+ * @param {number} [length] Message length if known beforehand
364
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure} SenderKeyStateStructure
365
+ * @throws {Error} If the payload is not a reader or valid buffer
366
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
367
+ */
368
+ SenderKeyStateStructure.decode = function decode(reader, length, error) {
369
+ if (!(reader instanceof $Reader))
370
+ reader = $Reader.create(reader);
371
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure();
372
+ while (reader.pos < end) {
373
+ var tag = reader.uint32();
374
+ if (tag === error)
375
+ break;
376
+ switch (tag >>> 3) {
377
+ case 1: {
378
+ message.senderKeyId = reader.uint32();
379
+ break;
380
+ }
381
+ case 2: {
382
+ message.senderChainKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.decode(reader, reader.uint32());
383
+ break;
384
+ }
385
+ case 3: {
386
+ message.senderSigningKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.decode(reader, reader.uint32());
387
+ break;
388
+ }
389
+ case 4: {
390
+ if (!(message.senderMessageKeys && message.senderMessageKeys.length))
391
+ message.senderMessageKeys = [];
392
+ message.senderMessageKeys.push($root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.decode(reader, reader.uint32()));
393
+ break;
394
+ }
395
+ default:
396
+ reader.skipType(tag & 7);
397
+ break;
398
+ }
399
+ }
400
+ return message;
401
+ };
402
+ /**
403
+ * Decodes a SenderKeyStateStructure message from the specified reader or buffer, length delimited.
404
+ * @function decodeDelimited
405
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
406
+ * @static
407
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
408
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure} SenderKeyStateStructure
409
+ * @throws {Error} If the payload is not a reader or valid buffer
410
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
411
+ */
412
+ SenderKeyStateStructure.decodeDelimited = function decodeDelimited(reader) {
413
+ if (!(reader instanceof $Reader))
414
+ reader = new $Reader(reader);
415
+ return this.decode(reader, reader.uint32());
416
+ };
417
+ /**
418
+ * Verifies a SenderKeyStateStructure message.
419
+ * @function verify
420
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
421
+ * @static
422
+ * @param {Object.<string,*>} message Plain object to verify
423
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
424
+ */
425
+ SenderKeyStateStructure.verify = function verify(message) {
426
+ if (typeof message !== "object" || message === null)
427
+ return "object expected";
428
+ var properties = {};
429
+ if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) {
430
+ properties._senderKeyId = 1;
431
+ if (!$util.isInteger(message.senderKeyId))
432
+ return "senderKeyId: integer expected";
433
+ }
434
+ if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) {
435
+ properties._senderChainKey = 1;
436
+ {
437
+ var error = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.verify(message.senderChainKey);
438
+ if (error)
439
+ return "senderChainKey." + error;
440
+ }
441
+ }
442
+ if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) {
443
+ properties._senderSigningKey = 1;
444
+ {
445
+ var error = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.verify(message.senderSigningKey);
446
+ if (error)
447
+ return "senderSigningKey." + error;
448
+ }
449
+ }
450
+ if (message.senderMessageKeys != null && message.hasOwnProperty("senderMessageKeys")) {
451
+ if (!Array.isArray(message.senderMessageKeys))
452
+ return "senderMessageKeys: array expected";
453
+ for (var i = 0; i < message.senderMessageKeys.length; ++i) {
454
+ var error = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.verify(message.senderMessageKeys[i]);
455
+ if (error)
456
+ return "senderMessageKeys." + error;
457
+ }
458
+ }
459
+ return null;
460
+ };
461
+ /**
462
+ * Creates a SenderKeyStateStructure message from a plain object. Also converts values to their respective internal types.
463
+ * @function fromObject
464
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
465
+ * @static
466
+ * @param {Object.<string,*>} object Plain object
467
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure} SenderKeyStateStructure
468
+ */
469
+ SenderKeyStateStructure.fromObject = function fromObject(object) {
470
+ if (object instanceof $root.SignalLocalStorageProtocol.SenderKeyStateStructure)
471
+ return object;
472
+ var message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure();
473
+ if (object.senderKeyId != null)
474
+ message.senderKeyId = object.senderKeyId >>> 0;
475
+ if (object.senderChainKey != null) {
476
+ if (typeof object.senderChainKey !== "object")
477
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyStateStructure.senderChainKey: object expected");
478
+ message.senderChainKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.fromObject(object.senderChainKey);
479
+ }
480
+ if (object.senderSigningKey != null) {
481
+ if (typeof object.senderSigningKey !== "object")
482
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyStateStructure.senderSigningKey: object expected");
483
+ message.senderSigningKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.fromObject(object.senderSigningKey);
484
+ }
485
+ if (object.senderMessageKeys) {
486
+ if (!Array.isArray(object.senderMessageKeys))
487
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyStateStructure.senderMessageKeys: array expected");
488
+ message.senderMessageKeys = [];
489
+ for (var i = 0; i < object.senderMessageKeys.length; ++i) {
490
+ if (typeof object.senderMessageKeys[i] !== "object")
491
+ throw TypeError(".SignalLocalStorageProtocol.SenderKeyStateStructure.senderMessageKeys: object expected");
492
+ message.senderMessageKeys[i] = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.fromObject(object.senderMessageKeys[i]);
493
+ }
494
+ }
495
+ return message;
496
+ };
497
+ /**
498
+ * Creates a plain object from a SenderKeyStateStructure message. Also converts values to other types if specified.
499
+ * @function toObject
500
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
501
+ * @static
502
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure} message SenderKeyStateStructure
503
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
504
+ * @returns {Object.<string,*>} Plain object
505
+ */
506
+ SenderKeyStateStructure.toObject = function toObject(message, options) {
507
+ if (!options)
508
+ options = {};
509
+ var object = {};
510
+ if (options.arrays || options.defaults)
511
+ object.senderMessageKeys = [];
512
+ if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) {
513
+ object.senderKeyId = message.senderKeyId;
514
+ if (options.oneofs)
515
+ object._senderKeyId = "senderKeyId";
516
+ }
517
+ if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) {
518
+ object.senderChainKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.toObject(message.senderChainKey, options);
519
+ if (options.oneofs)
520
+ object._senderChainKey = "senderChainKey";
521
+ }
522
+ if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) {
523
+ object.senderSigningKey = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.toObject(message.senderSigningKey, options);
524
+ if (options.oneofs)
525
+ object._senderSigningKey = "senderSigningKey";
526
+ }
527
+ if (message.senderMessageKeys && message.senderMessageKeys.length) {
528
+ object.senderMessageKeys = [];
529
+ for (var j = 0; j < message.senderMessageKeys.length; ++j)
530
+ object.senderMessageKeys[j] = $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.toObject(message.senderMessageKeys[j], options);
531
+ }
532
+ return object;
533
+ };
534
+ /**
535
+ * Converts this SenderKeyStateStructure to JSON.
536
+ * @function toJSON
537
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
538
+ * @instance
539
+ * @returns {Object.<string,*>} JSON object
540
+ */
541
+ SenderKeyStateStructure.prototype.toJSON = function toJSON() {
542
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
543
+ };
544
+ /**
545
+ * Gets the default type url for SenderKeyStateStructure
546
+ * @function getTypeUrl
547
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
548
+ * @static
549
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
550
+ * @returns {string} The default type url
551
+ */
552
+ SenderKeyStateStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
553
+ if (typeUrlPrefix === undefined) {
554
+ typeUrlPrefix = "type.googleapis.com";
555
+ }
556
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SenderKeyStateStructure";
557
+ };
558
+ SenderKeyStateStructure.SenderChainKey = (function() {
559
+ /**
560
+ * Properties of a SenderChainKey.
561
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
562
+ * @interface ISenderChainKey
563
+ * @property {number|null} [iteration] SenderChainKey iteration
564
+ * @property {Uint8Array|null} [seed] SenderChainKey seed
565
+ */
566
+ /**
567
+ * Constructs a new SenderChainKey.
568
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
569
+ * @classdesc Represents a SenderChainKey.
570
+ * @implements ISenderChainKey
571
+ * @constructor
572
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey=} [properties] Properties to set
573
+ */
574
+ function SenderChainKey(properties) {
575
+ if (properties)
576
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
577
+ if (properties[keys[i]] != null)
578
+ this[keys[i]] = properties[keys[i]];
579
+ }
580
+ /**
581
+ * SenderChainKey iteration.
582
+ * @member {number|null|undefined} iteration
583
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
584
+ * @instance
585
+ */
586
+ SenderChainKey.prototype.iteration = null;
587
+ /**
588
+ * SenderChainKey seed.
589
+ * @member {Uint8Array|null|undefined} seed
590
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
591
+ * @instance
592
+ */
593
+ SenderChainKey.prototype.seed = null;
594
+ // OneOf field names bound to virtual getters and setters
595
+ var $oneOfFields;
596
+ /**
597
+ * SenderChainKey _iteration.
598
+ * @member {"iteration"|undefined} _iteration
599
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
600
+ * @instance
601
+ */
602
+ Object.defineProperty(SenderChainKey.prototype, "_iteration", {
603
+ get: $util.oneOfGetter($oneOfFields = ["iteration"]),
604
+ set: $util.oneOfSetter($oneOfFields)
605
+ });
606
+ /**
607
+ * SenderChainKey _seed.
608
+ * @member {"seed"|undefined} _seed
609
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
610
+ * @instance
611
+ */
612
+ Object.defineProperty(SenderChainKey.prototype, "_seed", {
613
+ get: $util.oneOfGetter($oneOfFields = ["seed"]),
614
+ set: $util.oneOfSetter($oneOfFields)
615
+ });
616
+ /**
617
+ * Creates a new SenderChainKey instance using the specified properties.
618
+ * @function create
619
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
620
+ * @static
621
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey=} [properties] Properties to set
622
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey} SenderChainKey instance
623
+ */
624
+ SenderChainKey.create = function create(properties) {
625
+ return new SenderChainKey(properties);
626
+ };
627
+ /**
628
+ * Encodes the specified SenderChainKey message. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.verify|verify} messages.
629
+ * @function encode
630
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
631
+ * @static
632
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey} message SenderChainKey message or plain object to encode
633
+ * @param {$protobuf.Writer} [writer] Writer to encode to
634
+ * @returns {$protobuf.Writer} Writer
635
+ */
636
+ SenderChainKey.encode = function encode(message, writer) {
637
+ if (!writer)
638
+ writer = $Writer.create();
639
+ if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration"))
640
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration);
641
+ if (message.seed != null && Object.hasOwnProperty.call(message, "seed"))
642
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed);
643
+ return writer;
644
+ };
645
+ /**
646
+ * Encodes the specified SenderChainKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey.verify|verify} messages.
647
+ * @function encodeDelimited
648
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
649
+ * @static
650
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderChainKey} message SenderChainKey message or plain object to encode
651
+ * @param {$protobuf.Writer} [writer] Writer to encode to
652
+ * @returns {$protobuf.Writer} Writer
653
+ */
654
+ SenderChainKey.encodeDelimited = function encodeDelimited(message, writer) {
655
+ return this.encode(message, writer).ldelim();
656
+ };
657
+ /**
658
+ * Decodes a SenderChainKey message from the specified reader or buffer.
659
+ * @function decode
660
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
661
+ * @static
662
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
663
+ * @param {number} [length] Message length if known beforehand
664
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey} SenderChainKey
665
+ * @throws {Error} If the payload is not a reader or valid buffer
666
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
667
+ */
668
+ SenderChainKey.decode = function decode(reader, length, error) {
669
+ if (!(reader instanceof $Reader))
670
+ reader = $Reader.create(reader);
671
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey();
672
+ while (reader.pos < end) {
673
+ var tag = reader.uint32();
674
+ if (tag === error)
675
+ break;
676
+ switch (tag >>> 3) {
677
+ case 1: {
678
+ message.iteration = reader.uint32();
679
+ break;
680
+ }
681
+ case 2: {
682
+ message.seed = reader.bytes();
683
+ break;
684
+ }
685
+ default:
686
+ reader.skipType(tag & 7);
687
+ break;
688
+ }
689
+ }
690
+ return message;
691
+ };
692
+ /**
693
+ * Decodes a SenderChainKey message from the specified reader or buffer, length delimited.
694
+ * @function decodeDelimited
695
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
696
+ * @static
697
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
698
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey} SenderChainKey
699
+ * @throws {Error} If the payload is not a reader or valid buffer
700
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
701
+ */
702
+ SenderChainKey.decodeDelimited = function decodeDelimited(reader) {
703
+ if (!(reader instanceof $Reader))
704
+ reader = new $Reader(reader);
705
+ return this.decode(reader, reader.uint32());
706
+ };
707
+ /**
708
+ * Verifies a SenderChainKey message.
709
+ * @function verify
710
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
711
+ * @static
712
+ * @param {Object.<string,*>} message Plain object to verify
713
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
714
+ */
715
+ SenderChainKey.verify = function verify(message) {
716
+ if (typeof message !== "object" || message === null)
717
+ return "object expected";
718
+ var properties = {};
719
+ if (message.iteration != null && message.hasOwnProperty("iteration")) {
720
+ properties._iteration = 1;
721
+ if (!$util.isInteger(message.iteration))
722
+ return "iteration: integer expected";
723
+ }
724
+ if (message.seed != null && message.hasOwnProperty("seed")) {
725
+ properties._seed = 1;
726
+ if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed)))
727
+ return "seed: buffer expected";
728
+ }
729
+ return null;
730
+ };
731
+ /**
732
+ * Creates a SenderChainKey message from a plain object. Also converts values to their respective internal types.
733
+ * @function fromObject
734
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
735
+ * @static
736
+ * @param {Object.<string,*>} object Plain object
737
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey} SenderChainKey
738
+ */
739
+ SenderChainKey.fromObject = function fromObject(object) {
740
+ if (object instanceof $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey)
741
+ return object;
742
+ var message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey();
743
+ if (object.iteration != null)
744
+ message.iteration = object.iteration >>> 0;
745
+ if (object.seed != null)
746
+ if (typeof object.seed === "string")
747
+ $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0);
748
+ else if (object.seed.length >= 0)
749
+ message.seed = object.seed;
750
+ return message;
751
+ };
752
+ /**
753
+ * Creates a plain object from a SenderChainKey message. Also converts values to other types if specified.
754
+ * @function toObject
755
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
756
+ * @static
757
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey} message SenderChainKey
758
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
759
+ * @returns {Object.<string,*>} Plain object
760
+ */
761
+ SenderChainKey.toObject = function toObject(message, options) {
762
+ if (!options)
763
+ options = {};
764
+ var object = {};
765
+ if (message.iteration != null && message.hasOwnProperty("iteration")) {
766
+ object.iteration = message.iteration;
767
+ if (options.oneofs)
768
+ object._iteration = "iteration";
769
+ }
770
+ if (message.seed != null && message.hasOwnProperty("seed")) {
771
+ object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed;
772
+ if (options.oneofs)
773
+ object._seed = "seed";
774
+ }
775
+ return object;
776
+ };
777
+ /**
778
+ * Converts this SenderChainKey to JSON.
779
+ * @function toJSON
780
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
781
+ * @instance
782
+ * @returns {Object.<string,*>} JSON object
783
+ */
784
+ SenderChainKey.prototype.toJSON = function toJSON() {
785
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
786
+ };
787
+ /**
788
+ * Gets the default type url for SenderChainKey
789
+ * @function getTypeUrl
790
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey
791
+ * @static
792
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
793
+ * @returns {string} The default type url
794
+ */
795
+ SenderChainKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
796
+ if (typeUrlPrefix === undefined) {
797
+ typeUrlPrefix = "type.googleapis.com";
798
+ }
799
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SenderKeyStateStructure.SenderChainKey";
800
+ };
801
+ return SenderChainKey;
802
+ })();
803
+ SenderKeyStateStructure.SenderMessageKey = (function() {
804
+ /**
805
+ * Properties of a SenderMessageKey.
806
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
807
+ * @interface ISenderMessageKey
808
+ * @property {number|null} [iteration] SenderMessageKey iteration
809
+ * @property {Uint8Array|null} [seed] SenderMessageKey seed
810
+ */
811
+ /**
812
+ * Constructs a new SenderMessageKey.
813
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
814
+ * @classdesc Represents a SenderMessageKey.
815
+ * @implements ISenderMessageKey
816
+ * @constructor
817
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey=} [properties] Properties to set
818
+ */
819
+ function SenderMessageKey(properties) {
820
+ if (properties)
821
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
822
+ if (properties[keys[i]] != null)
823
+ this[keys[i]] = properties[keys[i]];
824
+ }
825
+ /**
826
+ * SenderMessageKey iteration.
827
+ * @member {number|null|undefined} iteration
828
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
829
+ * @instance
830
+ */
831
+ SenderMessageKey.prototype.iteration = null;
832
+ /**
833
+ * SenderMessageKey seed.
834
+ * @member {Uint8Array|null|undefined} seed
835
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
836
+ * @instance
837
+ */
838
+ SenderMessageKey.prototype.seed = null;
839
+ // OneOf field names bound to virtual getters and setters
840
+ var $oneOfFields;
841
+ /**
842
+ * SenderMessageKey _iteration.
843
+ * @member {"iteration"|undefined} _iteration
844
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
845
+ * @instance
846
+ */
847
+ Object.defineProperty(SenderMessageKey.prototype, "_iteration", {
848
+ get: $util.oneOfGetter($oneOfFields = ["iteration"]),
849
+ set: $util.oneOfSetter($oneOfFields)
850
+ });
851
+ /**
852
+ * SenderMessageKey _seed.
853
+ * @member {"seed"|undefined} _seed
854
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
855
+ * @instance
856
+ */
857
+ Object.defineProperty(SenderMessageKey.prototype, "_seed", {
858
+ get: $util.oneOfGetter($oneOfFields = ["seed"]),
859
+ set: $util.oneOfSetter($oneOfFields)
860
+ });
861
+ /**
862
+ * Creates a new SenderMessageKey instance using the specified properties.
863
+ * @function create
864
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
865
+ * @static
866
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey=} [properties] Properties to set
867
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey instance
868
+ */
869
+ SenderMessageKey.create = function create(properties) {
870
+ return new SenderMessageKey(properties);
871
+ };
872
+ /**
873
+ * Encodes the specified SenderMessageKey message. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages.
874
+ * @function encode
875
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
876
+ * @static
877
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey} message SenderMessageKey message or plain object to encode
878
+ * @param {$protobuf.Writer} [writer] Writer to encode to
879
+ * @returns {$protobuf.Writer} Writer
880
+ */
881
+ SenderMessageKey.encode = function encode(message, writer) {
882
+ if (!writer)
883
+ writer = $Writer.create();
884
+ if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration"))
885
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration);
886
+ if (message.seed != null && Object.hasOwnProperty.call(message, "seed"))
887
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed);
888
+ return writer;
889
+ };
890
+ /**
891
+ * Encodes the specified SenderMessageKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages.
892
+ * @function encodeDelimited
893
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
894
+ * @static
895
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderMessageKey} message SenderMessageKey message or plain object to encode
896
+ * @param {$protobuf.Writer} [writer] Writer to encode to
897
+ * @returns {$protobuf.Writer} Writer
898
+ */
899
+ SenderMessageKey.encodeDelimited = function encodeDelimited(message, writer) {
900
+ return this.encode(message, writer).ldelim();
901
+ };
902
+ /**
903
+ * Decodes a SenderMessageKey message from the specified reader or buffer.
904
+ * @function decode
905
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
906
+ * @static
907
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
908
+ * @param {number} [length] Message length if known beforehand
909
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey
910
+ * @throws {Error} If the payload is not a reader or valid buffer
911
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
912
+ */
913
+ SenderMessageKey.decode = function decode(reader, length, error) {
914
+ if (!(reader instanceof $Reader))
915
+ reader = $Reader.create(reader);
916
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey();
917
+ while (reader.pos < end) {
918
+ var tag = reader.uint32();
919
+ if (tag === error)
920
+ break;
921
+ switch (tag >>> 3) {
922
+ case 1: {
923
+ message.iteration = reader.uint32();
924
+ break;
925
+ }
926
+ case 2: {
927
+ message.seed = reader.bytes();
928
+ break;
929
+ }
930
+ default:
931
+ reader.skipType(tag & 7);
932
+ break;
933
+ }
934
+ }
935
+ return message;
936
+ };
937
+ /**
938
+ * Decodes a SenderMessageKey message from the specified reader or buffer, length delimited.
939
+ * @function decodeDelimited
940
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
941
+ * @static
942
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
943
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey
944
+ * @throws {Error} If the payload is not a reader or valid buffer
945
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
946
+ */
947
+ SenderMessageKey.decodeDelimited = function decodeDelimited(reader) {
948
+ if (!(reader instanceof $Reader))
949
+ reader = new $Reader(reader);
950
+ return this.decode(reader, reader.uint32());
951
+ };
952
+ /**
953
+ * Verifies a SenderMessageKey message.
954
+ * @function verify
955
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
956
+ * @static
957
+ * @param {Object.<string,*>} message Plain object to verify
958
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
959
+ */
960
+ SenderMessageKey.verify = function verify(message) {
961
+ if (typeof message !== "object" || message === null)
962
+ return "object expected";
963
+ var properties = {};
964
+ if (message.iteration != null && message.hasOwnProperty("iteration")) {
965
+ properties._iteration = 1;
966
+ if (!$util.isInteger(message.iteration))
967
+ return "iteration: integer expected";
968
+ }
969
+ if (message.seed != null && message.hasOwnProperty("seed")) {
970
+ properties._seed = 1;
971
+ if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed)))
972
+ return "seed: buffer expected";
973
+ }
974
+ return null;
975
+ };
976
+ /**
977
+ * Creates a SenderMessageKey message from a plain object. Also converts values to their respective internal types.
978
+ * @function fromObject
979
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
980
+ * @static
981
+ * @param {Object.<string,*>} object Plain object
982
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey
983
+ */
984
+ SenderMessageKey.fromObject = function fromObject(object) {
985
+ if (object instanceof $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey)
986
+ return object;
987
+ var message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey();
988
+ if (object.iteration != null)
989
+ message.iteration = object.iteration >>> 0;
990
+ if (object.seed != null)
991
+ if (typeof object.seed === "string")
992
+ $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0);
993
+ else if (object.seed.length >= 0)
994
+ message.seed = object.seed;
995
+ return message;
996
+ };
997
+ /**
998
+ * Creates a plain object from a SenderMessageKey message. Also converts values to other types if specified.
999
+ * @function toObject
1000
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
1001
+ * @static
1002
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey} message SenderMessageKey
1003
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1004
+ * @returns {Object.<string,*>} Plain object
1005
+ */
1006
+ SenderMessageKey.toObject = function toObject(message, options) {
1007
+ if (!options)
1008
+ options = {};
1009
+ var object = {};
1010
+ if (message.iteration != null && message.hasOwnProperty("iteration")) {
1011
+ object.iteration = message.iteration;
1012
+ if (options.oneofs)
1013
+ object._iteration = "iteration";
1014
+ }
1015
+ if (message.seed != null && message.hasOwnProperty("seed")) {
1016
+ object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed;
1017
+ if (options.oneofs)
1018
+ object._seed = "seed";
1019
+ }
1020
+ return object;
1021
+ };
1022
+ /**
1023
+ * Converts this SenderMessageKey to JSON.
1024
+ * @function toJSON
1025
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
1026
+ * @instance
1027
+ * @returns {Object.<string,*>} JSON object
1028
+ */
1029
+ SenderMessageKey.prototype.toJSON = function toJSON() {
1030
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1031
+ };
1032
+ /**
1033
+ * Gets the default type url for SenderMessageKey
1034
+ * @function getTypeUrl
1035
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey
1036
+ * @static
1037
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1038
+ * @returns {string} The default type url
1039
+ */
1040
+ SenderMessageKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1041
+ if (typeUrlPrefix === undefined) {
1042
+ typeUrlPrefix = "type.googleapis.com";
1043
+ }
1044
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SenderKeyStateStructure.SenderMessageKey";
1045
+ };
1046
+ return SenderMessageKey;
1047
+ })();
1048
+ SenderKeyStateStructure.SenderSigningKey = (function() {
1049
+ /**
1050
+ * Properties of a SenderSigningKey.
1051
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
1052
+ * @interface ISenderSigningKey
1053
+ * @property {Uint8Array|null} ["public"] SenderSigningKey public
1054
+ * @property {Uint8Array|null} ["private"] SenderSigningKey private
1055
+ */
1056
+ /**
1057
+ * Constructs a new SenderSigningKey.
1058
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure
1059
+ * @classdesc Represents a SenderSigningKey.
1060
+ * @implements ISenderSigningKey
1061
+ * @constructor
1062
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey=} [properties] Properties to set
1063
+ */
1064
+ function SenderSigningKey(properties) {
1065
+ if (properties)
1066
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1067
+ if (properties[keys[i]] != null)
1068
+ this[keys[i]] = properties[keys[i]];
1069
+ }
1070
+ /**
1071
+ * SenderSigningKey public.
1072
+ * @member {Uint8Array|null|undefined} public
1073
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1074
+ * @instance
1075
+ */
1076
+ SenderSigningKey.prototype["public"] = null;
1077
+ /**
1078
+ * SenderSigningKey private.
1079
+ * @member {Uint8Array|null|undefined} private
1080
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1081
+ * @instance
1082
+ */
1083
+ SenderSigningKey.prototype["private"] = null;
1084
+ // OneOf field names bound to virtual getters and setters
1085
+ var $oneOfFields;
1086
+ /**
1087
+ * SenderSigningKey _public.
1088
+ * @member {"public"|undefined} _public
1089
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1090
+ * @instance
1091
+ */
1092
+ Object.defineProperty(SenderSigningKey.prototype, "_public", {
1093
+ get: $util.oneOfGetter($oneOfFields = ["public"]),
1094
+ set: $util.oneOfSetter($oneOfFields)
1095
+ });
1096
+ /**
1097
+ * SenderSigningKey _private.
1098
+ * @member {"private"|undefined} _private
1099
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1100
+ * @instance
1101
+ */
1102
+ Object.defineProperty(SenderSigningKey.prototype, "_private", {
1103
+ get: $util.oneOfGetter($oneOfFields = ["private"]),
1104
+ set: $util.oneOfSetter($oneOfFields)
1105
+ });
1106
+ /**
1107
+ * Creates a new SenderSigningKey instance using the specified properties.
1108
+ * @function create
1109
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1110
+ * @static
1111
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey=} [properties] Properties to set
1112
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey instance
1113
+ */
1114
+ SenderSigningKey.create = function create(properties) {
1115
+ return new SenderSigningKey(properties);
1116
+ };
1117
+ /**
1118
+ * Encodes the specified SenderSigningKey message. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages.
1119
+ * @function encode
1120
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1121
+ * @static
1122
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey} message SenderSigningKey message or plain object to encode
1123
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1124
+ * @returns {$protobuf.Writer} Writer
1125
+ */
1126
+ SenderSigningKey.encode = function encode(message, writer) {
1127
+ if (!writer)
1128
+ writer = $Writer.create();
1129
+ if (message["public"] != null && Object.hasOwnProperty.call(message, "public"))
1130
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message["public"]);
1131
+ if (message["private"] != null && Object.hasOwnProperty.call(message, "private"))
1132
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message["private"]);
1133
+ return writer;
1134
+ };
1135
+ /**
1136
+ * Encodes the specified SenderSigningKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages.
1137
+ * @function encodeDelimited
1138
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1139
+ * @static
1140
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.ISenderSigningKey} message SenderSigningKey message or plain object to encode
1141
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1142
+ * @returns {$protobuf.Writer} Writer
1143
+ */
1144
+ SenderSigningKey.encodeDelimited = function encodeDelimited(message, writer) {
1145
+ return this.encode(message, writer).ldelim();
1146
+ };
1147
+ /**
1148
+ * Decodes a SenderSigningKey message from the specified reader or buffer.
1149
+ * @function decode
1150
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1151
+ * @static
1152
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1153
+ * @param {number} [length] Message length if known beforehand
1154
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey
1155
+ * @throws {Error} If the payload is not a reader or valid buffer
1156
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1157
+ */
1158
+ SenderSigningKey.decode = function decode(reader, length, error) {
1159
+ if (!(reader instanceof $Reader))
1160
+ reader = $Reader.create(reader);
1161
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey();
1162
+ while (reader.pos < end) {
1163
+ var tag = reader.uint32();
1164
+ if (tag === error)
1165
+ break;
1166
+ switch (tag >>> 3) {
1167
+ case 1: {
1168
+ message["public"] = reader.bytes();
1169
+ break;
1170
+ }
1171
+ case 2: {
1172
+ message["private"] = reader.bytes();
1173
+ break;
1174
+ }
1175
+ default:
1176
+ reader.skipType(tag & 7);
1177
+ break;
1178
+ }
1179
+ }
1180
+ return message;
1181
+ };
1182
+ /**
1183
+ * Decodes a SenderSigningKey message from the specified reader or buffer, length delimited.
1184
+ * @function decodeDelimited
1185
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1186
+ * @static
1187
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1188
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey
1189
+ * @throws {Error} If the payload is not a reader or valid buffer
1190
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1191
+ */
1192
+ SenderSigningKey.decodeDelimited = function decodeDelimited(reader) {
1193
+ if (!(reader instanceof $Reader))
1194
+ reader = new $Reader(reader);
1195
+ return this.decode(reader, reader.uint32());
1196
+ };
1197
+ /**
1198
+ * Verifies a SenderSigningKey message.
1199
+ * @function verify
1200
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1201
+ * @static
1202
+ * @param {Object.<string,*>} message Plain object to verify
1203
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1204
+ */
1205
+ SenderSigningKey.verify = function verify(message) {
1206
+ if (typeof message !== "object" || message === null)
1207
+ return "object expected";
1208
+ var properties = {};
1209
+ if (message["public"] != null && message.hasOwnProperty("public")) {
1210
+ properties._public = 1;
1211
+ if (!(message["public"] && typeof message["public"].length === "number" || $util.isString(message["public"])))
1212
+ return "public: buffer expected";
1213
+ }
1214
+ if (message["private"] != null && message.hasOwnProperty("private")) {
1215
+ properties._private = 1;
1216
+ if (!(message["private"] && typeof message["private"].length === "number" || $util.isString(message["private"])))
1217
+ return "private: buffer expected";
1218
+ }
1219
+ return null;
1220
+ };
1221
+ /**
1222
+ * Creates a SenderSigningKey message from a plain object. Also converts values to their respective internal types.
1223
+ * @function fromObject
1224
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1225
+ * @static
1226
+ * @param {Object.<string,*>} object Plain object
1227
+ * @returns {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey
1228
+ */
1229
+ SenderSigningKey.fromObject = function fromObject(object) {
1230
+ if (object instanceof $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey)
1231
+ return object;
1232
+ var message = new $root.SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey();
1233
+ if (object["public"] != null)
1234
+ if (typeof object["public"] === "string")
1235
+ $util.base64.decode(object["public"], message["public"] = $util.newBuffer($util.base64.length(object["public"])), 0);
1236
+ else if (object["public"].length >= 0)
1237
+ message["public"] = object["public"];
1238
+ if (object["private"] != null)
1239
+ if (typeof object["private"] === "string")
1240
+ $util.base64.decode(object["private"], message["private"] = $util.newBuffer($util.base64.length(object["private"])), 0);
1241
+ else if (object["private"].length >= 0)
1242
+ message["private"] = object["private"];
1243
+ return message;
1244
+ };
1245
+ /**
1246
+ * Creates a plain object from a SenderSigningKey message. Also converts values to other types if specified.
1247
+ * @function toObject
1248
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1249
+ * @static
1250
+ * @param {SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey} message SenderSigningKey
1251
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1252
+ * @returns {Object.<string,*>} Plain object
1253
+ */
1254
+ SenderSigningKey.toObject = function toObject(message, options) {
1255
+ if (!options)
1256
+ options = {};
1257
+ var object = {};
1258
+ if (message["public"] != null && message.hasOwnProperty("public")) {
1259
+ object["public"] = options.bytes === String ? $util.base64.encode(message["public"], 0, message["public"].length) : options.bytes === Array ? Array.prototype.slice.call(message["public"]) : message["public"];
1260
+ if (options.oneofs)
1261
+ object._public = "public";
1262
+ }
1263
+ if (message["private"] != null && message.hasOwnProperty("private")) {
1264
+ object["private"] = options.bytes === String ? $util.base64.encode(message["private"], 0, message["private"].length) : options.bytes === Array ? Array.prototype.slice.call(message["private"]) : message["private"];
1265
+ if (options.oneofs)
1266
+ object._private = "private";
1267
+ }
1268
+ return object;
1269
+ };
1270
+ /**
1271
+ * Converts this SenderSigningKey to JSON.
1272
+ * @function toJSON
1273
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1274
+ * @instance
1275
+ * @returns {Object.<string,*>} JSON object
1276
+ */
1277
+ SenderSigningKey.prototype.toJSON = function toJSON() {
1278
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1279
+ };
1280
+ /**
1281
+ * Gets the default type url for SenderSigningKey
1282
+ * @function getTypeUrl
1283
+ * @memberof SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey
1284
+ * @static
1285
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1286
+ * @returns {string} The default type url
1287
+ */
1288
+ SenderSigningKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1289
+ if (typeUrlPrefix === undefined) {
1290
+ typeUrlPrefix = "type.googleapis.com";
1291
+ }
1292
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SenderKeyStateStructure.SenderSigningKey";
1293
+ };
1294
+ return SenderSigningKey;
1295
+ })();
1296
+ return SenderKeyStateStructure;
1297
+ })();
1298
+ SignalLocalStorageProtocol.IdentityKeyPairStructure = (function() {
1299
+ /**
1300
+ * Properties of an IdentityKeyPairStructure.
1301
+ * @memberof SignalLocalStorageProtocol
1302
+ * @interface IIdentityKeyPairStructure
1303
+ * @property {Uint8Array|null} [publicKey] IdentityKeyPairStructure publicKey
1304
+ * @property {Uint8Array|null} [privateKey] IdentityKeyPairStructure privateKey
1305
+ */
1306
+ /**
1307
+ * Constructs a new IdentityKeyPairStructure.
1308
+ * @memberof SignalLocalStorageProtocol
1309
+ * @classdesc Represents an IdentityKeyPairStructure.
1310
+ * @implements IIdentityKeyPairStructure
1311
+ * @constructor
1312
+ * @param {SignalLocalStorageProtocol.IIdentityKeyPairStructure=} [properties] Properties to set
1313
+ */
1314
+ function IdentityKeyPairStructure(properties) {
1315
+ if (properties)
1316
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1317
+ if (properties[keys[i]] != null)
1318
+ this[keys[i]] = properties[keys[i]];
1319
+ }
1320
+ /**
1321
+ * IdentityKeyPairStructure publicKey.
1322
+ * @member {Uint8Array|null|undefined} publicKey
1323
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1324
+ * @instance
1325
+ */
1326
+ IdentityKeyPairStructure.prototype.publicKey = null;
1327
+ /**
1328
+ * IdentityKeyPairStructure privateKey.
1329
+ * @member {Uint8Array|null|undefined} privateKey
1330
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1331
+ * @instance
1332
+ */
1333
+ IdentityKeyPairStructure.prototype.privateKey = null;
1334
+ // OneOf field names bound to virtual getters and setters
1335
+ var $oneOfFields;
1336
+ /**
1337
+ * IdentityKeyPairStructure _publicKey.
1338
+ * @member {"publicKey"|undefined} _publicKey
1339
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1340
+ * @instance
1341
+ */
1342
+ Object.defineProperty(IdentityKeyPairStructure.prototype, "_publicKey", {
1343
+ get: $util.oneOfGetter($oneOfFields = ["publicKey"]),
1344
+ set: $util.oneOfSetter($oneOfFields)
1345
+ });
1346
+ /**
1347
+ * IdentityKeyPairStructure _privateKey.
1348
+ * @member {"privateKey"|undefined} _privateKey
1349
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1350
+ * @instance
1351
+ */
1352
+ Object.defineProperty(IdentityKeyPairStructure.prototype, "_privateKey", {
1353
+ get: $util.oneOfGetter($oneOfFields = ["privateKey"]),
1354
+ set: $util.oneOfSetter($oneOfFields)
1355
+ });
1356
+ /**
1357
+ * Creates a new IdentityKeyPairStructure instance using the specified properties.
1358
+ * @function create
1359
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1360
+ * @static
1361
+ * @param {SignalLocalStorageProtocol.IIdentityKeyPairStructure=} [properties] Properties to set
1362
+ * @returns {SignalLocalStorageProtocol.IdentityKeyPairStructure} IdentityKeyPairStructure instance
1363
+ */
1364
+ IdentityKeyPairStructure.create = function create(properties) {
1365
+ return new IdentityKeyPairStructure(properties);
1366
+ };
1367
+ /**
1368
+ * Encodes the specified IdentityKeyPairStructure message. Does not implicitly {@link SignalLocalStorageProtocol.IdentityKeyPairStructure.verify|verify} messages.
1369
+ * @function encode
1370
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1371
+ * @static
1372
+ * @param {SignalLocalStorageProtocol.IIdentityKeyPairStructure} message IdentityKeyPairStructure message or plain object to encode
1373
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1374
+ * @returns {$protobuf.Writer} Writer
1375
+ */
1376
+ IdentityKeyPairStructure.encode = function encode(message, writer) {
1377
+ if (!writer)
1378
+ writer = $Writer.create();
1379
+ if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey"))
1380
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKey);
1381
+ if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey"))
1382
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.privateKey);
1383
+ return writer;
1384
+ };
1385
+ /**
1386
+ * Encodes the specified IdentityKeyPairStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.IdentityKeyPairStructure.verify|verify} messages.
1387
+ * @function encodeDelimited
1388
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1389
+ * @static
1390
+ * @param {SignalLocalStorageProtocol.IIdentityKeyPairStructure} message IdentityKeyPairStructure message or plain object to encode
1391
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1392
+ * @returns {$protobuf.Writer} Writer
1393
+ */
1394
+ IdentityKeyPairStructure.encodeDelimited = function encodeDelimited(message, writer) {
1395
+ return this.encode(message, writer).ldelim();
1396
+ };
1397
+ /**
1398
+ * Decodes an IdentityKeyPairStructure message from the specified reader or buffer.
1399
+ * @function decode
1400
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1401
+ * @static
1402
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1403
+ * @param {number} [length] Message length if known beforehand
1404
+ * @returns {SignalLocalStorageProtocol.IdentityKeyPairStructure} IdentityKeyPairStructure
1405
+ * @throws {Error} If the payload is not a reader or valid buffer
1406
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1407
+ */
1408
+ IdentityKeyPairStructure.decode = function decode(reader, length, error) {
1409
+ if (!(reader instanceof $Reader))
1410
+ reader = $Reader.create(reader);
1411
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.IdentityKeyPairStructure();
1412
+ while (reader.pos < end) {
1413
+ var tag = reader.uint32();
1414
+ if (tag === error)
1415
+ break;
1416
+ switch (tag >>> 3) {
1417
+ case 1: {
1418
+ message.publicKey = reader.bytes();
1419
+ break;
1420
+ }
1421
+ case 2: {
1422
+ message.privateKey = reader.bytes();
1423
+ break;
1424
+ }
1425
+ default:
1426
+ reader.skipType(tag & 7);
1427
+ break;
1428
+ }
1429
+ }
1430
+ return message;
1431
+ };
1432
+ /**
1433
+ * Decodes an IdentityKeyPairStructure message from the specified reader or buffer, length delimited.
1434
+ * @function decodeDelimited
1435
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1436
+ * @static
1437
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1438
+ * @returns {SignalLocalStorageProtocol.IdentityKeyPairStructure} IdentityKeyPairStructure
1439
+ * @throws {Error} If the payload is not a reader or valid buffer
1440
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1441
+ */
1442
+ IdentityKeyPairStructure.decodeDelimited = function decodeDelimited(reader) {
1443
+ if (!(reader instanceof $Reader))
1444
+ reader = new $Reader(reader);
1445
+ return this.decode(reader, reader.uint32());
1446
+ };
1447
+ /**
1448
+ * Verifies an IdentityKeyPairStructure message.
1449
+ * @function verify
1450
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1451
+ * @static
1452
+ * @param {Object.<string,*>} message Plain object to verify
1453
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1454
+ */
1455
+ IdentityKeyPairStructure.verify = function verify(message) {
1456
+ if (typeof message !== "object" || message === null)
1457
+ return "object expected";
1458
+ var properties = {};
1459
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
1460
+ properties._publicKey = 1;
1461
+ if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey)))
1462
+ return "publicKey: buffer expected";
1463
+ }
1464
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
1465
+ properties._privateKey = 1;
1466
+ if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey)))
1467
+ return "privateKey: buffer expected";
1468
+ }
1469
+ return null;
1470
+ };
1471
+ /**
1472
+ * Creates an IdentityKeyPairStructure message from a plain object. Also converts values to their respective internal types.
1473
+ * @function fromObject
1474
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1475
+ * @static
1476
+ * @param {Object.<string,*>} object Plain object
1477
+ * @returns {SignalLocalStorageProtocol.IdentityKeyPairStructure} IdentityKeyPairStructure
1478
+ */
1479
+ IdentityKeyPairStructure.fromObject = function fromObject(object) {
1480
+ if (object instanceof $root.SignalLocalStorageProtocol.IdentityKeyPairStructure)
1481
+ return object;
1482
+ var message = new $root.SignalLocalStorageProtocol.IdentityKeyPairStructure();
1483
+ if (object.publicKey != null)
1484
+ if (typeof object.publicKey === "string")
1485
+ $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0);
1486
+ else if (object.publicKey.length >= 0)
1487
+ message.publicKey = object.publicKey;
1488
+ if (object.privateKey != null)
1489
+ if (typeof object.privateKey === "string")
1490
+ $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0);
1491
+ else if (object.privateKey.length >= 0)
1492
+ message.privateKey = object.privateKey;
1493
+ return message;
1494
+ };
1495
+ /**
1496
+ * Creates a plain object from an IdentityKeyPairStructure message. Also converts values to other types if specified.
1497
+ * @function toObject
1498
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1499
+ * @static
1500
+ * @param {SignalLocalStorageProtocol.IdentityKeyPairStructure} message IdentityKeyPairStructure
1501
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1502
+ * @returns {Object.<string,*>} Plain object
1503
+ */
1504
+ IdentityKeyPairStructure.toObject = function toObject(message, options) {
1505
+ if (!options)
1506
+ options = {};
1507
+ var object = {};
1508
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
1509
+ object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey;
1510
+ if (options.oneofs)
1511
+ object._publicKey = "publicKey";
1512
+ }
1513
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
1514
+ object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey;
1515
+ if (options.oneofs)
1516
+ object._privateKey = "privateKey";
1517
+ }
1518
+ return object;
1519
+ };
1520
+ /**
1521
+ * Converts this IdentityKeyPairStructure to JSON.
1522
+ * @function toJSON
1523
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1524
+ * @instance
1525
+ * @returns {Object.<string,*>} JSON object
1526
+ */
1527
+ IdentityKeyPairStructure.prototype.toJSON = function toJSON() {
1528
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1529
+ };
1530
+ /**
1531
+ * Gets the default type url for IdentityKeyPairStructure
1532
+ * @function getTypeUrl
1533
+ * @memberof SignalLocalStorageProtocol.IdentityKeyPairStructure
1534
+ * @static
1535
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1536
+ * @returns {string} The default type url
1537
+ */
1538
+ IdentityKeyPairStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1539
+ if (typeUrlPrefix === undefined) {
1540
+ typeUrlPrefix = "type.googleapis.com";
1541
+ }
1542
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.IdentityKeyPairStructure";
1543
+ };
1544
+ return IdentityKeyPairStructure;
1545
+ })();
1546
+ SignalLocalStorageProtocol.SignedPreKeyRecordStructure = (function() {
1547
+ /**
1548
+ * Properties of a SignedPreKeyRecordStructure.
1549
+ * @memberof SignalLocalStorageProtocol
1550
+ * @interface ISignedPreKeyRecordStructure
1551
+ * @property {number|null} [id] SignedPreKeyRecordStructure id
1552
+ * @property {Uint8Array|null} [publicKey] SignedPreKeyRecordStructure publicKey
1553
+ * @property {Uint8Array|null} [privateKey] SignedPreKeyRecordStructure privateKey
1554
+ * @property {Uint8Array|null} [signature] SignedPreKeyRecordStructure signature
1555
+ * @property {number|Long|null} [timestamp] SignedPreKeyRecordStructure timestamp
1556
+ */
1557
+ /**
1558
+ * Constructs a new SignedPreKeyRecordStructure.
1559
+ * @memberof SignalLocalStorageProtocol
1560
+ * @classdesc Represents a SignedPreKeyRecordStructure.
1561
+ * @implements ISignedPreKeyRecordStructure
1562
+ * @constructor
1563
+ * @param {SignalLocalStorageProtocol.ISignedPreKeyRecordStructure=} [properties] Properties to set
1564
+ */
1565
+ function SignedPreKeyRecordStructure(properties) {
1566
+ if (properties)
1567
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1568
+ if (properties[keys[i]] != null)
1569
+ this[keys[i]] = properties[keys[i]];
1570
+ }
1571
+ /**
1572
+ * SignedPreKeyRecordStructure id.
1573
+ * @member {number|null|undefined} id
1574
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1575
+ * @instance
1576
+ */
1577
+ SignedPreKeyRecordStructure.prototype.id = null;
1578
+ /**
1579
+ * SignedPreKeyRecordStructure publicKey.
1580
+ * @member {Uint8Array|null|undefined} publicKey
1581
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1582
+ * @instance
1583
+ */
1584
+ SignedPreKeyRecordStructure.prototype.publicKey = null;
1585
+ /**
1586
+ * SignedPreKeyRecordStructure privateKey.
1587
+ * @member {Uint8Array|null|undefined} privateKey
1588
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1589
+ * @instance
1590
+ */
1591
+ SignedPreKeyRecordStructure.prototype.privateKey = null;
1592
+ /**
1593
+ * SignedPreKeyRecordStructure signature.
1594
+ * @member {Uint8Array|null|undefined} signature
1595
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1596
+ * @instance
1597
+ */
1598
+ SignedPreKeyRecordStructure.prototype.signature = null;
1599
+ /**
1600
+ * SignedPreKeyRecordStructure timestamp.
1601
+ * @member {number|Long|null|undefined} timestamp
1602
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1603
+ * @instance
1604
+ */
1605
+ SignedPreKeyRecordStructure.prototype.timestamp = null;
1606
+ // OneOf field names bound to virtual getters and setters
1607
+ var $oneOfFields;
1608
+ /**
1609
+ * SignedPreKeyRecordStructure _id.
1610
+ * @member {"id"|undefined} _id
1611
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1612
+ * @instance
1613
+ */
1614
+ Object.defineProperty(SignedPreKeyRecordStructure.prototype, "_id", {
1615
+ get: $util.oneOfGetter($oneOfFields = ["id"]),
1616
+ set: $util.oneOfSetter($oneOfFields)
1617
+ });
1618
+ /**
1619
+ * SignedPreKeyRecordStructure _publicKey.
1620
+ * @member {"publicKey"|undefined} _publicKey
1621
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1622
+ * @instance
1623
+ */
1624
+ Object.defineProperty(SignedPreKeyRecordStructure.prototype, "_publicKey", {
1625
+ get: $util.oneOfGetter($oneOfFields = ["publicKey"]),
1626
+ set: $util.oneOfSetter($oneOfFields)
1627
+ });
1628
+ /**
1629
+ * SignedPreKeyRecordStructure _privateKey.
1630
+ * @member {"privateKey"|undefined} _privateKey
1631
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1632
+ * @instance
1633
+ */
1634
+ Object.defineProperty(SignedPreKeyRecordStructure.prototype, "_privateKey", {
1635
+ get: $util.oneOfGetter($oneOfFields = ["privateKey"]),
1636
+ set: $util.oneOfSetter($oneOfFields)
1637
+ });
1638
+ /**
1639
+ * SignedPreKeyRecordStructure _signature.
1640
+ * @member {"signature"|undefined} _signature
1641
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1642
+ * @instance
1643
+ */
1644
+ Object.defineProperty(SignedPreKeyRecordStructure.prototype, "_signature", {
1645
+ get: $util.oneOfGetter($oneOfFields = ["signature"]),
1646
+ set: $util.oneOfSetter($oneOfFields)
1647
+ });
1648
+ /**
1649
+ * SignedPreKeyRecordStructure _timestamp.
1650
+ * @member {"timestamp"|undefined} _timestamp
1651
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1652
+ * @instance
1653
+ */
1654
+ Object.defineProperty(SignedPreKeyRecordStructure.prototype, "_timestamp", {
1655
+ get: $util.oneOfGetter($oneOfFields = ["timestamp"]),
1656
+ set: $util.oneOfSetter($oneOfFields)
1657
+ });
1658
+ /**
1659
+ * Creates a new SignedPreKeyRecordStructure instance using the specified properties.
1660
+ * @function create
1661
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1662
+ * @static
1663
+ * @param {SignalLocalStorageProtocol.ISignedPreKeyRecordStructure=} [properties] Properties to set
1664
+ * @returns {SignalLocalStorageProtocol.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure instance
1665
+ */
1666
+ SignedPreKeyRecordStructure.create = function create(properties) {
1667
+ return new SignedPreKeyRecordStructure(properties);
1668
+ };
1669
+ /**
1670
+ * Encodes the specified SignedPreKeyRecordStructure message. Does not implicitly {@link SignalLocalStorageProtocol.SignedPreKeyRecordStructure.verify|verify} messages.
1671
+ * @function encode
1672
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1673
+ * @static
1674
+ * @param {SignalLocalStorageProtocol.ISignedPreKeyRecordStructure} message SignedPreKeyRecordStructure message or plain object to encode
1675
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1676
+ * @returns {$protobuf.Writer} Writer
1677
+ */
1678
+ SignedPreKeyRecordStructure.encode = function encode(message, writer) {
1679
+ if (!writer)
1680
+ writer = $Writer.create();
1681
+ if (message.id != null && Object.hasOwnProperty.call(message, "id"))
1682
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id);
1683
+ if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey"))
1684
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.publicKey);
1685
+ if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey"))
1686
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.privateKey);
1687
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
1688
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.signature);
1689
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
1690
+ writer.uint32(/* id 5, wireType 1 =*/41).fixed64(message.timestamp);
1691
+ return writer;
1692
+ };
1693
+ /**
1694
+ * Encodes the specified SignedPreKeyRecordStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SignedPreKeyRecordStructure.verify|verify} messages.
1695
+ * @function encodeDelimited
1696
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1697
+ * @static
1698
+ * @param {SignalLocalStorageProtocol.ISignedPreKeyRecordStructure} message SignedPreKeyRecordStructure message or plain object to encode
1699
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1700
+ * @returns {$protobuf.Writer} Writer
1701
+ */
1702
+ SignedPreKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) {
1703
+ return this.encode(message, writer).ldelim();
1704
+ };
1705
+ /**
1706
+ * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer.
1707
+ * @function decode
1708
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1709
+ * @static
1710
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1711
+ * @param {number} [length] Message length if known beforehand
1712
+ * @returns {SignalLocalStorageProtocol.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure
1713
+ * @throws {Error} If the payload is not a reader or valid buffer
1714
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1715
+ */
1716
+ SignedPreKeyRecordStructure.decode = function decode(reader, length, error) {
1717
+ if (!(reader instanceof $Reader))
1718
+ reader = $Reader.create(reader);
1719
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SignedPreKeyRecordStructure();
1720
+ while (reader.pos < end) {
1721
+ var tag = reader.uint32();
1722
+ if (tag === error)
1723
+ break;
1724
+ switch (tag >>> 3) {
1725
+ case 1: {
1726
+ message.id = reader.uint32();
1727
+ break;
1728
+ }
1729
+ case 2: {
1730
+ message.publicKey = reader.bytes();
1731
+ break;
1732
+ }
1733
+ case 3: {
1734
+ message.privateKey = reader.bytes();
1735
+ break;
1736
+ }
1737
+ case 4: {
1738
+ message.signature = reader.bytes();
1739
+ break;
1740
+ }
1741
+ case 5: {
1742
+ message.timestamp = reader.fixed64();
1743
+ break;
1744
+ }
1745
+ default:
1746
+ reader.skipType(tag & 7);
1747
+ break;
1748
+ }
1749
+ }
1750
+ return message;
1751
+ };
1752
+ /**
1753
+ * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer, length delimited.
1754
+ * @function decodeDelimited
1755
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1756
+ * @static
1757
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1758
+ * @returns {SignalLocalStorageProtocol.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure
1759
+ * @throws {Error} If the payload is not a reader or valid buffer
1760
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1761
+ */
1762
+ SignedPreKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) {
1763
+ if (!(reader instanceof $Reader))
1764
+ reader = new $Reader(reader);
1765
+ return this.decode(reader, reader.uint32());
1766
+ };
1767
+ /**
1768
+ * Verifies a SignedPreKeyRecordStructure message.
1769
+ * @function verify
1770
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1771
+ * @static
1772
+ * @param {Object.<string,*>} message Plain object to verify
1773
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1774
+ */
1775
+ SignedPreKeyRecordStructure.verify = function verify(message) {
1776
+ if (typeof message !== "object" || message === null)
1777
+ return "object expected";
1778
+ var properties = {};
1779
+ if (message.id != null && message.hasOwnProperty("id")) {
1780
+ properties._id = 1;
1781
+ if (!$util.isInteger(message.id))
1782
+ return "id: integer expected";
1783
+ }
1784
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
1785
+ properties._publicKey = 1;
1786
+ if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey)))
1787
+ return "publicKey: buffer expected";
1788
+ }
1789
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
1790
+ properties._privateKey = 1;
1791
+ if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey)))
1792
+ return "privateKey: buffer expected";
1793
+ }
1794
+ if (message.signature != null && message.hasOwnProperty("signature")) {
1795
+ properties._signature = 1;
1796
+ if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature)))
1797
+ return "signature: buffer expected";
1798
+ }
1799
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
1800
+ properties._timestamp = 1;
1801
+ if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high)))
1802
+ return "timestamp: integer|Long expected";
1803
+ }
1804
+ return null;
1805
+ };
1806
+ /**
1807
+ * Creates a SignedPreKeyRecordStructure message from a plain object. Also converts values to their respective internal types.
1808
+ * @function fromObject
1809
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1810
+ * @static
1811
+ * @param {Object.<string,*>} object Plain object
1812
+ * @returns {SignalLocalStorageProtocol.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure
1813
+ */
1814
+ SignedPreKeyRecordStructure.fromObject = function fromObject(object) {
1815
+ if (object instanceof $root.SignalLocalStorageProtocol.SignedPreKeyRecordStructure)
1816
+ return object;
1817
+ var message = new $root.SignalLocalStorageProtocol.SignedPreKeyRecordStructure();
1818
+ if (object.id != null)
1819
+ message.id = object.id >>> 0;
1820
+ if (object.publicKey != null)
1821
+ if (typeof object.publicKey === "string")
1822
+ $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0);
1823
+ else if (object.publicKey.length >= 0)
1824
+ message.publicKey = object.publicKey;
1825
+ if (object.privateKey != null)
1826
+ if (typeof object.privateKey === "string")
1827
+ $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0);
1828
+ else if (object.privateKey.length >= 0)
1829
+ message.privateKey = object.privateKey;
1830
+ if (object.signature != null)
1831
+ if (typeof object.signature === "string")
1832
+ $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0);
1833
+ else if (object.signature.length >= 0)
1834
+ message.signature = object.signature;
1835
+ if (object.timestamp != null)
1836
+ if ($util.Long)
1837
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false;
1838
+ else if (typeof object.timestamp === "string")
1839
+ message.timestamp = parseInt(object.timestamp, 10);
1840
+ else if (typeof object.timestamp === "number")
1841
+ message.timestamp = object.timestamp;
1842
+ else if (typeof object.timestamp === "object")
1843
+ message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber();
1844
+ return message;
1845
+ };
1846
+ /**
1847
+ * Creates a plain object from a SignedPreKeyRecordStructure message. Also converts values to other types if specified.
1848
+ * @function toObject
1849
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1850
+ * @static
1851
+ * @param {SignalLocalStorageProtocol.SignedPreKeyRecordStructure} message SignedPreKeyRecordStructure
1852
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1853
+ * @returns {Object.<string,*>} Plain object
1854
+ */
1855
+ SignedPreKeyRecordStructure.toObject = function toObject(message, options) {
1856
+ if (!options)
1857
+ options = {};
1858
+ var object = {};
1859
+ if (message.id != null && message.hasOwnProperty("id")) {
1860
+ object.id = message.id;
1861
+ if (options.oneofs)
1862
+ object._id = "id";
1863
+ }
1864
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
1865
+ object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey;
1866
+ if (options.oneofs)
1867
+ object._publicKey = "publicKey";
1868
+ }
1869
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
1870
+ object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey;
1871
+ if (options.oneofs)
1872
+ object._privateKey = "privateKey";
1873
+ }
1874
+ if (message.signature != null && message.hasOwnProperty("signature")) {
1875
+ object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature;
1876
+ if (options.oneofs)
1877
+ object._signature = "signature";
1878
+ }
1879
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
1880
+ if (typeof message.timestamp === "number")
1881
+ object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp;
1882
+ else
1883
+ object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp;
1884
+ if (options.oneofs)
1885
+ object._timestamp = "timestamp";
1886
+ }
1887
+ return object;
1888
+ };
1889
+ /**
1890
+ * Converts this SignedPreKeyRecordStructure to JSON.
1891
+ * @function toJSON
1892
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1893
+ * @instance
1894
+ * @returns {Object.<string,*>} JSON object
1895
+ */
1896
+ SignedPreKeyRecordStructure.prototype.toJSON = function toJSON() {
1897
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1898
+ };
1899
+ /**
1900
+ * Gets the default type url for SignedPreKeyRecordStructure
1901
+ * @function getTypeUrl
1902
+ * @memberof SignalLocalStorageProtocol.SignedPreKeyRecordStructure
1903
+ * @static
1904
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1905
+ * @returns {string} The default type url
1906
+ */
1907
+ SignedPreKeyRecordStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1908
+ if (typeUrlPrefix === undefined) {
1909
+ typeUrlPrefix = "type.googleapis.com";
1910
+ }
1911
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SignedPreKeyRecordStructure";
1912
+ };
1913
+ return SignedPreKeyRecordStructure;
1914
+ })();
1915
+ SignalLocalStorageProtocol.PreKeyRecordStructure = (function() {
1916
+ /**
1917
+ * Properties of a PreKeyRecordStructure.
1918
+ * @memberof SignalLocalStorageProtocol
1919
+ * @interface IPreKeyRecordStructure
1920
+ * @property {number|null} [id] PreKeyRecordStructure id
1921
+ * @property {Uint8Array|null} [publicKey] PreKeyRecordStructure publicKey
1922
+ * @property {Uint8Array|null} [privateKey] PreKeyRecordStructure privateKey
1923
+ */
1924
+ /**
1925
+ * Constructs a new PreKeyRecordStructure.
1926
+ * @memberof SignalLocalStorageProtocol
1927
+ * @classdesc Represents a PreKeyRecordStructure.
1928
+ * @implements IPreKeyRecordStructure
1929
+ * @constructor
1930
+ * @param {SignalLocalStorageProtocol.IPreKeyRecordStructure=} [properties] Properties to set
1931
+ */
1932
+ function PreKeyRecordStructure(properties) {
1933
+ if (properties)
1934
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1935
+ if (properties[keys[i]] != null)
1936
+ this[keys[i]] = properties[keys[i]];
1937
+ }
1938
+ /**
1939
+ * PreKeyRecordStructure id.
1940
+ * @member {number|null|undefined} id
1941
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1942
+ * @instance
1943
+ */
1944
+ PreKeyRecordStructure.prototype.id = null;
1945
+ /**
1946
+ * PreKeyRecordStructure publicKey.
1947
+ * @member {Uint8Array|null|undefined} publicKey
1948
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1949
+ * @instance
1950
+ */
1951
+ PreKeyRecordStructure.prototype.publicKey = null;
1952
+ /**
1953
+ * PreKeyRecordStructure privateKey.
1954
+ * @member {Uint8Array|null|undefined} privateKey
1955
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1956
+ * @instance
1957
+ */
1958
+ PreKeyRecordStructure.prototype.privateKey = null;
1959
+ // OneOf field names bound to virtual getters and setters
1960
+ var $oneOfFields;
1961
+ /**
1962
+ * PreKeyRecordStructure _id.
1963
+ * @member {"id"|undefined} _id
1964
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1965
+ * @instance
1966
+ */
1967
+ Object.defineProperty(PreKeyRecordStructure.prototype, "_id", {
1968
+ get: $util.oneOfGetter($oneOfFields = ["id"]),
1969
+ set: $util.oneOfSetter($oneOfFields)
1970
+ });
1971
+ /**
1972
+ * PreKeyRecordStructure _publicKey.
1973
+ * @member {"publicKey"|undefined} _publicKey
1974
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1975
+ * @instance
1976
+ */
1977
+ Object.defineProperty(PreKeyRecordStructure.prototype, "_publicKey", {
1978
+ get: $util.oneOfGetter($oneOfFields = ["publicKey"]),
1979
+ set: $util.oneOfSetter($oneOfFields)
1980
+ });
1981
+ /**
1982
+ * PreKeyRecordStructure _privateKey.
1983
+ * @member {"privateKey"|undefined} _privateKey
1984
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1985
+ * @instance
1986
+ */
1987
+ Object.defineProperty(PreKeyRecordStructure.prototype, "_privateKey", {
1988
+ get: $util.oneOfGetter($oneOfFields = ["privateKey"]),
1989
+ set: $util.oneOfSetter($oneOfFields)
1990
+ });
1991
+ /**
1992
+ * Creates a new PreKeyRecordStructure instance using the specified properties.
1993
+ * @function create
1994
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
1995
+ * @static
1996
+ * @param {SignalLocalStorageProtocol.IPreKeyRecordStructure=} [properties] Properties to set
1997
+ * @returns {SignalLocalStorageProtocol.PreKeyRecordStructure} PreKeyRecordStructure instance
1998
+ */
1999
+ PreKeyRecordStructure.create = function create(properties) {
2000
+ return new PreKeyRecordStructure(properties);
2001
+ };
2002
+ /**
2003
+ * Encodes the specified PreKeyRecordStructure message. Does not implicitly {@link SignalLocalStorageProtocol.PreKeyRecordStructure.verify|verify} messages.
2004
+ * @function encode
2005
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2006
+ * @static
2007
+ * @param {SignalLocalStorageProtocol.IPreKeyRecordStructure} message PreKeyRecordStructure message or plain object to encode
2008
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2009
+ * @returns {$protobuf.Writer} Writer
2010
+ */
2011
+ PreKeyRecordStructure.encode = function encode(message, writer) {
2012
+ if (!writer)
2013
+ writer = $Writer.create();
2014
+ if (message.id != null && Object.hasOwnProperty.call(message, "id"))
2015
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id);
2016
+ if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey"))
2017
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.publicKey);
2018
+ if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey"))
2019
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.privateKey);
2020
+ return writer;
2021
+ };
2022
+ /**
2023
+ * Encodes the specified PreKeyRecordStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.PreKeyRecordStructure.verify|verify} messages.
2024
+ * @function encodeDelimited
2025
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2026
+ * @static
2027
+ * @param {SignalLocalStorageProtocol.IPreKeyRecordStructure} message PreKeyRecordStructure message or plain object to encode
2028
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2029
+ * @returns {$protobuf.Writer} Writer
2030
+ */
2031
+ PreKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) {
2032
+ return this.encode(message, writer).ldelim();
2033
+ };
2034
+ /**
2035
+ * Decodes a PreKeyRecordStructure message from the specified reader or buffer.
2036
+ * @function decode
2037
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2038
+ * @static
2039
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2040
+ * @param {number} [length] Message length if known beforehand
2041
+ * @returns {SignalLocalStorageProtocol.PreKeyRecordStructure} PreKeyRecordStructure
2042
+ * @throws {Error} If the payload is not a reader or valid buffer
2043
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2044
+ */
2045
+ PreKeyRecordStructure.decode = function decode(reader, length, error) {
2046
+ if (!(reader instanceof $Reader))
2047
+ reader = $Reader.create(reader);
2048
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.PreKeyRecordStructure();
2049
+ while (reader.pos < end) {
2050
+ var tag = reader.uint32();
2051
+ if (tag === error)
2052
+ break;
2053
+ switch (tag >>> 3) {
2054
+ case 1: {
2055
+ message.id = reader.uint32();
2056
+ break;
2057
+ }
2058
+ case 2: {
2059
+ message.publicKey = reader.bytes();
2060
+ break;
2061
+ }
2062
+ case 3: {
2063
+ message.privateKey = reader.bytes();
2064
+ break;
2065
+ }
2066
+ default:
2067
+ reader.skipType(tag & 7);
2068
+ break;
2069
+ }
2070
+ }
2071
+ return message;
2072
+ };
2073
+ /**
2074
+ * Decodes a PreKeyRecordStructure message from the specified reader or buffer, length delimited.
2075
+ * @function decodeDelimited
2076
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2077
+ * @static
2078
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2079
+ * @returns {SignalLocalStorageProtocol.PreKeyRecordStructure} PreKeyRecordStructure
2080
+ * @throws {Error} If the payload is not a reader or valid buffer
2081
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2082
+ */
2083
+ PreKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) {
2084
+ if (!(reader instanceof $Reader))
2085
+ reader = new $Reader(reader);
2086
+ return this.decode(reader, reader.uint32());
2087
+ };
2088
+ /**
2089
+ * Verifies a PreKeyRecordStructure message.
2090
+ * @function verify
2091
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2092
+ * @static
2093
+ * @param {Object.<string,*>} message Plain object to verify
2094
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2095
+ */
2096
+ PreKeyRecordStructure.verify = function verify(message) {
2097
+ if (typeof message !== "object" || message === null)
2098
+ return "object expected";
2099
+ var properties = {};
2100
+ if (message.id != null && message.hasOwnProperty("id")) {
2101
+ properties._id = 1;
2102
+ if (!$util.isInteger(message.id))
2103
+ return "id: integer expected";
2104
+ }
2105
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
2106
+ properties._publicKey = 1;
2107
+ if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey)))
2108
+ return "publicKey: buffer expected";
2109
+ }
2110
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
2111
+ properties._privateKey = 1;
2112
+ if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey)))
2113
+ return "privateKey: buffer expected";
2114
+ }
2115
+ return null;
2116
+ };
2117
+ /**
2118
+ * Creates a PreKeyRecordStructure message from a plain object. Also converts values to their respective internal types.
2119
+ * @function fromObject
2120
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2121
+ * @static
2122
+ * @param {Object.<string,*>} object Plain object
2123
+ * @returns {SignalLocalStorageProtocol.PreKeyRecordStructure} PreKeyRecordStructure
2124
+ */
2125
+ PreKeyRecordStructure.fromObject = function fromObject(object) {
2126
+ if (object instanceof $root.SignalLocalStorageProtocol.PreKeyRecordStructure)
2127
+ return object;
2128
+ var message = new $root.SignalLocalStorageProtocol.PreKeyRecordStructure();
2129
+ if (object.id != null)
2130
+ message.id = object.id >>> 0;
2131
+ if (object.publicKey != null)
2132
+ if (typeof object.publicKey === "string")
2133
+ $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0);
2134
+ else if (object.publicKey.length >= 0)
2135
+ message.publicKey = object.publicKey;
2136
+ if (object.privateKey != null)
2137
+ if (typeof object.privateKey === "string")
2138
+ $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0);
2139
+ else if (object.privateKey.length >= 0)
2140
+ message.privateKey = object.privateKey;
2141
+ return message;
2142
+ };
2143
+ /**
2144
+ * Creates a plain object from a PreKeyRecordStructure message. Also converts values to other types if specified.
2145
+ * @function toObject
2146
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2147
+ * @static
2148
+ * @param {SignalLocalStorageProtocol.PreKeyRecordStructure} message PreKeyRecordStructure
2149
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2150
+ * @returns {Object.<string,*>} Plain object
2151
+ */
2152
+ PreKeyRecordStructure.toObject = function toObject(message, options) {
2153
+ if (!options)
2154
+ options = {};
2155
+ var object = {};
2156
+ if (message.id != null && message.hasOwnProperty("id")) {
2157
+ object.id = message.id;
2158
+ if (options.oneofs)
2159
+ object._id = "id";
2160
+ }
2161
+ if (message.publicKey != null && message.hasOwnProperty("publicKey")) {
2162
+ object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey;
2163
+ if (options.oneofs)
2164
+ object._publicKey = "publicKey";
2165
+ }
2166
+ if (message.privateKey != null && message.hasOwnProperty("privateKey")) {
2167
+ object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey;
2168
+ if (options.oneofs)
2169
+ object._privateKey = "privateKey";
2170
+ }
2171
+ return object;
2172
+ };
2173
+ /**
2174
+ * Converts this PreKeyRecordStructure to JSON.
2175
+ * @function toJSON
2176
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2177
+ * @instance
2178
+ * @returns {Object.<string,*>} JSON object
2179
+ */
2180
+ PreKeyRecordStructure.prototype.toJSON = function toJSON() {
2181
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2182
+ };
2183
+ /**
2184
+ * Gets the default type url for PreKeyRecordStructure
2185
+ * @function getTypeUrl
2186
+ * @memberof SignalLocalStorageProtocol.PreKeyRecordStructure
2187
+ * @static
2188
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2189
+ * @returns {string} The default type url
2190
+ */
2191
+ PreKeyRecordStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2192
+ if (typeUrlPrefix === undefined) {
2193
+ typeUrlPrefix = "type.googleapis.com";
2194
+ }
2195
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.PreKeyRecordStructure";
2196
+ };
2197
+ return PreKeyRecordStructure;
2198
+ })();
2199
+ SignalLocalStorageProtocol.RecordStructure = (function() {
2200
+ /**
2201
+ * Properties of a RecordStructure.
2202
+ * @memberof SignalLocalStorageProtocol
2203
+ * @interface IRecordStructure
2204
+ * @property {SignalLocalStorageProtocol.ISessionStructure|null} [currentSession] RecordStructure currentSession
2205
+ * @property {Array.<SignalLocalStorageProtocol.ISessionStructure>|null} [previousSessions] RecordStructure previousSessions
2206
+ */
2207
+ /**
2208
+ * Constructs a new RecordStructure.
2209
+ * @memberof SignalLocalStorageProtocol
2210
+ * @classdesc Represents a RecordStructure.
2211
+ * @implements IRecordStructure
2212
+ * @constructor
2213
+ * @param {SignalLocalStorageProtocol.IRecordStructure=} [properties] Properties to set
2214
+ */
2215
+ function RecordStructure(properties) {
2216
+ this.previousSessions = [];
2217
+ if (properties)
2218
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2219
+ if (properties[keys[i]] != null)
2220
+ this[keys[i]] = properties[keys[i]];
2221
+ }
2222
+ /**
2223
+ * RecordStructure currentSession.
2224
+ * @member {SignalLocalStorageProtocol.ISessionStructure|null|undefined} currentSession
2225
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2226
+ * @instance
2227
+ */
2228
+ RecordStructure.prototype.currentSession = null;
2229
+ /**
2230
+ * RecordStructure previousSessions.
2231
+ * @member {Array.<SignalLocalStorageProtocol.ISessionStructure>} previousSessions
2232
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2233
+ * @instance
2234
+ */
2235
+ RecordStructure.prototype.previousSessions = $util.emptyArray;
2236
+ // OneOf field names bound to virtual getters and setters
2237
+ var $oneOfFields;
2238
+ /**
2239
+ * RecordStructure _currentSession.
2240
+ * @member {"currentSession"|undefined} _currentSession
2241
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2242
+ * @instance
2243
+ */
2244
+ Object.defineProperty(RecordStructure.prototype, "_currentSession", {
2245
+ get: $util.oneOfGetter($oneOfFields = ["currentSession"]),
2246
+ set: $util.oneOfSetter($oneOfFields)
2247
+ });
2248
+ /**
2249
+ * Creates a new RecordStructure instance using the specified properties.
2250
+ * @function create
2251
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2252
+ * @static
2253
+ * @param {SignalLocalStorageProtocol.IRecordStructure=} [properties] Properties to set
2254
+ * @returns {SignalLocalStorageProtocol.RecordStructure} RecordStructure instance
2255
+ */
2256
+ RecordStructure.create = function create(properties) {
2257
+ return new RecordStructure(properties);
2258
+ };
2259
+ /**
2260
+ * Encodes the specified RecordStructure message. Does not implicitly {@link SignalLocalStorageProtocol.RecordStructure.verify|verify} messages.
2261
+ * @function encode
2262
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2263
+ * @static
2264
+ * @param {SignalLocalStorageProtocol.IRecordStructure} message RecordStructure message or plain object to encode
2265
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2266
+ * @returns {$protobuf.Writer} Writer
2267
+ */
2268
+ RecordStructure.encode = function encode(message, writer) {
2269
+ if (!writer)
2270
+ writer = $Writer.create();
2271
+ if (message.currentSession != null && Object.hasOwnProperty.call(message, "currentSession"))
2272
+ $root.SignalLocalStorageProtocol.SessionStructure.encode(message.currentSession, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
2273
+ if (message.previousSessions != null && message.previousSessions.length)
2274
+ for (var i = 0; i < message.previousSessions.length; ++i)
2275
+ $root.SignalLocalStorageProtocol.SessionStructure.encode(message.previousSessions[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
2276
+ return writer;
2277
+ };
2278
+ /**
2279
+ * Encodes the specified RecordStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.RecordStructure.verify|verify} messages.
2280
+ * @function encodeDelimited
2281
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2282
+ * @static
2283
+ * @param {SignalLocalStorageProtocol.IRecordStructure} message RecordStructure message or plain object to encode
2284
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2285
+ * @returns {$protobuf.Writer} Writer
2286
+ */
2287
+ RecordStructure.encodeDelimited = function encodeDelimited(message, writer) {
2288
+ return this.encode(message, writer).ldelim();
2289
+ };
2290
+ /**
2291
+ * Decodes a RecordStructure message from the specified reader or buffer.
2292
+ * @function decode
2293
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2294
+ * @static
2295
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2296
+ * @param {number} [length] Message length if known beforehand
2297
+ * @returns {SignalLocalStorageProtocol.RecordStructure} RecordStructure
2298
+ * @throws {Error} If the payload is not a reader or valid buffer
2299
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2300
+ */
2301
+ RecordStructure.decode = function decode(reader, length, error) {
2302
+ if (!(reader instanceof $Reader))
2303
+ reader = $Reader.create(reader);
2304
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.RecordStructure();
2305
+ while (reader.pos < end) {
2306
+ var tag = reader.uint32();
2307
+ if (tag === error)
2308
+ break;
2309
+ switch (tag >>> 3) {
2310
+ case 1: {
2311
+ message.currentSession = $root.SignalLocalStorageProtocol.SessionStructure.decode(reader, reader.uint32());
2312
+ break;
2313
+ }
2314
+ case 2: {
2315
+ if (!(message.previousSessions && message.previousSessions.length))
2316
+ message.previousSessions = [];
2317
+ message.previousSessions.push($root.SignalLocalStorageProtocol.SessionStructure.decode(reader, reader.uint32()));
2318
+ break;
2319
+ }
2320
+ default:
2321
+ reader.skipType(tag & 7);
2322
+ break;
2323
+ }
2324
+ }
2325
+ return message;
2326
+ };
2327
+ /**
2328
+ * Decodes a RecordStructure message from the specified reader or buffer, length delimited.
2329
+ * @function decodeDelimited
2330
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2331
+ * @static
2332
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2333
+ * @returns {SignalLocalStorageProtocol.RecordStructure} RecordStructure
2334
+ * @throws {Error} If the payload is not a reader or valid buffer
2335
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2336
+ */
2337
+ RecordStructure.decodeDelimited = function decodeDelimited(reader) {
2338
+ if (!(reader instanceof $Reader))
2339
+ reader = new $Reader(reader);
2340
+ return this.decode(reader, reader.uint32());
2341
+ };
2342
+ /**
2343
+ * Verifies a RecordStructure message.
2344
+ * @function verify
2345
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2346
+ * @static
2347
+ * @param {Object.<string,*>} message Plain object to verify
2348
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2349
+ */
2350
+ RecordStructure.verify = function verify(message) {
2351
+ if (typeof message !== "object" || message === null)
2352
+ return "object expected";
2353
+ var properties = {};
2354
+ if (message.currentSession != null && message.hasOwnProperty("currentSession")) {
2355
+ properties._currentSession = 1;
2356
+ {
2357
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.verify(message.currentSession);
2358
+ if (error)
2359
+ return "currentSession." + error;
2360
+ }
2361
+ }
2362
+ if (message.previousSessions != null && message.hasOwnProperty("previousSessions")) {
2363
+ if (!Array.isArray(message.previousSessions))
2364
+ return "previousSessions: array expected";
2365
+ for (var i = 0; i < message.previousSessions.length; ++i) {
2366
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.verify(message.previousSessions[i]);
2367
+ if (error)
2368
+ return "previousSessions." + error;
2369
+ }
2370
+ }
2371
+ return null;
2372
+ };
2373
+ /**
2374
+ * Creates a RecordStructure message from a plain object. Also converts values to their respective internal types.
2375
+ * @function fromObject
2376
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2377
+ * @static
2378
+ * @param {Object.<string,*>} object Plain object
2379
+ * @returns {SignalLocalStorageProtocol.RecordStructure} RecordStructure
2380
+ */
2381
+ RecordStructure.fromObject = function fromObject(object) {
2382
+ if (object instanceof $root.SignalLocalStorageProtocol.RecordStructure)
2383
+ return object;
2384
+ var message = new $root.SignalLocalStorageProtocol.RecordStructure();
2385
+ if (object.currentSession != null) {
2386
+ if (typeof object.currentSession !== "object")
2387
+ throw TypeError(".SignalLocalStorageProtocol.RecordStructure.currentSession: object expected");
2388
+ message.currentSession = $root.SignalLocalStorageProtocol.SessionStructure.fromObject(object.currentSession);
2389
+ }
2390
+ if (object.previousSessions) {
2391
+ if (!Array.isArray(object.previousSessions))
2392
+ throw TypeError(".SignalLocalStorageProtocol.RecordStructure.previousSessions: array expected");
2393
+ message.previousSessions = [];
2394
+ for (var i = 0; i < object.previousSessions.length; ++i) {
2395
+ if (typeof object.previousSessions[i] !== "object")
2396
+ throw TypeError(".SignalLocalStorageProtocol.RecordStructure.previousSessions: object expected");
2397
+ message.previousSessions[i] = $root.SignalLocalStorageProtocol.SessionStructure.fromObject(object.previousSessions[i]);
2398
+ }
2399
+ }
2400
+ return message;
2401
+ };
2402
+ /**
2403
+ * Creates a plain object from a RecordStructure message. Also converts values to other types if specified.
2404
+ * @function toObject
2405
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2406
+ * @static
2407
+ * @param {SignalLocalStorageProtocol.RecordStructure} message RecordStructure
2408
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2409
+ * @returns {Object.<string,*>} Plain object
2410
+ */
2411
+ RecordStructure.toObject = function toObject(message, options) {
2412
+ if (!options)
2413
+ options = {};
2414
+ var object = {};
2415
+ if (options.arrays || options.defaults)
2416
+ object.previousSessions = [];
2417
+ if (message.currentSession != null && message.hasOwnProperty("currentSession")) {
2418
+ object.currentSession = $root.SignalLocalStorageProtocol.SessionStructure.toObject(message.currentSession, options);
2419
+ if (options.oneofs)
2420
+ object._currentSession = "currentSession";
2421
+ }
2422
+ if (message.previousSessions && message.previousSessions.length) {
2423
+ object.previousSessions = [];
2424
+ for (var j = 0; j < message.previousSessions.length; ++j)
2425
+ object.previousSessions[j] = $root.SignalLocalStorageProtocol.SessionStructure.toObject(message.previousSessions[j], options);
2426
+ }
2427
+ return object;
2428
+ };
2429
+ /**
2430
+ * Converts this RecordStructure to JSON.
2431
+ * @function toJSON
2432
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2433
+ * @instance
2434
+ * @returns {Object.<string,*>} JSON object
2435
+ */
2436
+ RecordStructure.prototype.toJSON = function toJSON() {
2437
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2438
+ };
2439
+ /**
2440
+ * Gets the default type url for RecordStructure
2441
+ * @function getTypeUrl
2442
+ * @memberof SignalLocalStorageProtocol.RecordStructure
2443
+ * @static
2444
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2445
+ * @returns {string} The default type url
2446
+ */
2447
+ RecordStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2448
+ if (typeUrlPrefix === undefined) {
2449
+ typeUrlPrefix = "type.googleapis.com";
2450
+ }
2451
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.RecordStructure";
2452
+ };
2453
+ return RecordStructure;
2454
+ })();
2455
+ SignalLocalStorageProtocol.SessionStructure = (function() {
2456
+ /**
2457
+ * Properties of a SessionStructure.
2458
+ * @memberof SignalLocalStorageProtocol
2459
+ * @interface ISessionStructure
2460
+ * @property {number|null} [sessionVersion] SessionStructure sessionVersion
2461
+ * @property {Uint8Array|null} [localIdentityPublic] SessionStructure localIdentityPublic
2462
+ * @property {Uint8Array|null} [remoteIdentityPublic] SessionStructure remoteIdentityPublic
2463
+ * @property {Uint8Array|null} [rootKey] SessionStructure rootKey
2464
+ * @property {number|null} [previousCounter] SessionStructure previousCounter
2465
+ * @property {SignalLocalStorageProtocol.SessionStructure.IChain|null} [senderChain] SessionStructure senderChain
2466
+ * @property {Array.<SignalLocalStorageProtocol.SessionStructure.IChain>|null} [receiverChains] SessionStructure receiverChains
2467
+ * @property {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange|null} [pendingKeyExchange] SessionStructure pendingKeyExchange
2468
+ * @property {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey|null} [pendingPreKey] SessionStructure pendingPreKey
2469
+ * @property {number|null} [remoteRegistrationId] SessionStructure remoteRegistrationId
2470
+ * @property {number|null} [localRegistrationId] SessionStructure localRegistrationId
2471
+ * @property {boolean|null} [needsRefresh] SessionStructure needsRefresh
2472
+ * @property {Uint8Array|null} [aliceBaseKey] SessionStructure aliceBaseKey
2473
+ */
2474
+ /**
2475
+ * Constructs a new SessionStructure.
2476
+ * @memberof SignalLocalStorageProtocol
2477
+ * @classdesc Represents a SessionStructure.
2478
+ * @implements ISessionStructure
2479
+ * @constructor
2480
+ * @param {SignalLocalStorageProtocol.ISessionStructure=} [properties] Properties to set
2481
+ */
2482
+ function SessionStructure(properties) {
2483
+ this.receiverChains = [];
2484
+ if (properties)
2485
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2486
+ if (properties[keys[i]] != null)
2487
+ this[keys[i]] = properties[keys[i]];
2488
+ }
2489
+ /**
2490
+ * SessionStructure sessionVersion.
2491
+ * @member {number|null|undefined} sessionVersion
2492
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2493
+ * @instance
2494
+ */
2495
+ SessionStructure.prototype.sessionVersion = null;
2496
+ /**
2497
+ * SessionStructure localIdentityPublic.
2498
+ * @member {Uint8Array|null|undefined} localIdentityPublic
2499
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2500
+ * @instance
2501
+ */
2502
+ SessionStructure.prototype.localIdentityPublic = null;
2503
+ /**
2504
+ * SessionStructure remoteIdentityPublic.
2505
+ * @member {Uint8Array|null|undefined} remoteIdentityPublic
2506
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2507
+ * @instance
2508
+ */
2509
+ SessionStructure.prototype.remoteIdentityPublic = null;
2510
+ /**
2511
+ * SessionStructure rootKey.
2512
+ * @member {Uint8Array|null|undefined} rootKey
2513
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2514
+ * @instance
2515
+ */
2516
+ SessionStructure.prototype.rootKey = null;
2517
+ /**
2518
+ * SessionStructure previousCounter.
2519
+ * @member {number|null|undefined} previousCounter
2520
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2521
+ * @instance
2522
+ */
2523
+ SessionStructure.prototype.previousCounter = null;
2524
+ /**
2525
+ * SessionStructure senderChain.
2526
+ * @member {SignalLocalStorageProtocol.SessionStructure.IChain|null|undefined} senderChain
2527
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2528
+ * @instance
2529
+ */
2530
+ SessionStructure.prototype.senderChain = null;
2531
+ /**
2532
+ * SessionStructure receiverChains.
2533
+ * @member {Array.<SignalLocalStorageProtocol.SessionStructure.IChain>} receiverChains
2534
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2535
+ * @instance
2536
+ */
2537
+ SessionStructure.prototype.receiverChains = $util.emptyArray;
2538
+ /**
2539
+ * SessionStructure pendingKeyExchange.
2540
+ * @member {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange|null|undefined} pendingKeyExchange
2541
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2542
+ * @instance
2543
+ */
2544
+ SessionStructure.prototype.pendingKeyExchange = null;
2545
+ /**
2546
+ * SessionStructure pendingPreKey.
2547
+ * @member {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey|null|undefined} pendingPreKey
2548
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2549
+ * @instance
2550
+ */
2551
+ SessionStructure.prototype.pendingPreKey = null;
2552
+ /**
2553
+ * SessionStructure remoteRegistrationId.
2554
+ * @member {number|null|undefined} remoteRegistrationId
2555
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2556
+ * @instance
2557
+ */
2558
+ SessionStructure.prototype.remoteRegistrationId = null;
2559
+ /**
2560
+ * SessionStructure localRegistrationId.
2561
+ * @member {number|null|undefined} localRegistrationId
2562
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2563
+ * @instance
2564
+ */
2565
+ SessionStructure.prototype.localRegistrationId = null;
2566
+ /**
2567
+ * SessionStructure needsRefresh.
2568
+ * @member {boolean|null|undefined} needsRefresh
2569
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2570
+ * @instance
2571
+ */
2572
+ SessionStructure.prototype.needsRefresh = null;
2573
+ /**
2574
+ * SessionStructure aliceBaseKey.
2575
+ * @member {Uint8Array|null|undefined} aliceBaseKey
2576
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2577
+ * @instance
2578
+ */
2579
+ SessionStructure.prototype.aliceBaseKey = null;
2580
+ // OneOf field names bound to virtual getters and setters
2581
+ var $oneOfFields;
2582
+ /**
2583
+ * SessionStructure _sessionVersion.
2584
+ * @member {"sessionVersion"|undefined} _sessionVersion
2585
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2586
+ * @instance
2587
+ */
2588
+ Object.defineProperty(SessionStructure.prototype, "_sessionVersion", {
2589
+ get: $util.oneOfGetter($oneOfFields = ["sessionVersion"]),
2590
+ set: $util.oneOfSetter($oneOfFields)
2591
+ });
2592
+ /**
2593
+ * SessionStructure _localIdentityPublic.
2594
+ * @member {"localIdentityPublic"|undefined} _localIdentityPublic
2595
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2596
+ * @instance
2597
+ */
2598
+ Object.defineProperty(SessionStructure.prototype, "_localIdentityPublic", {
2599
+ get: $util.oneOfGetter($oneOfFields = ["localIdentityPublic"]),
2600
+ set: $util.oneOfSetter($oneOfFields)
2601
+ });
2602
+ /**
2603
+ * SessionStructure _remoteIdentityPublic.
2604
+ * @member {"remoteIdentityPublic"|undefined} _remoteIdentityPublic
2605
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2606
+ * @instance
2607
+ */
2608
+ Object.defineProperty(SessionStructure.prototype, "_remoteIdentityPublic", {
2609
+ get: $util.oneOfGetter($oneOfFields = ["remoteIdentityPublic"]),
2610
+ set: $util.oneOfSetter($oneOfFields)
2611
+ });
2612
+ /**
2613
+ * SessionStructure _rootKey.
2614
+ * @member {"rootKey"|undefined} _rootKey
2615
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2616
+ * @instance
2617
+ */
2618
+ Object.defineProperty(SessionStructure.prototype, "_rootKey", {
2619
+ get: $util.oneOfGetter($oneOfFields = ["rootKey"]),
2620
+ set: $util.oneOfSetter($oneOfFields)
2621
+ });
2622
+ /**
2623
+ * SessionStructure _previousCounter.
2624
+ * @member {"previousCounter"|undefined} _previousCounter
2625
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2626
+ * @instance
2627
+ */
2628
+ Object.defineProperty(SessionStructure.prototype, "_previousCounter", {
2629
+ get: $util.oneOfGetter($oneOfFields = ["previousCounter"]),
2630
+ set: $util.oneOfSetter($oneOfFields)
2631
+ });
2632
+ /**
2633
+ * SessionStructure _senderChain.
2634
+ * @member {"senderChain"|undefined} _senderChain
2635
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2636
+ * @instance
2637
+ */
2638
+ Object.defineProperty(SessionStructure.prototype, "_senderChain", {
2639
+ get: $util.oneOfGetter($oneOfFields = ["senderChain"]),
2640
+ set: $util.oneOfSetter($oneOfFields)
2641
+ });
2642
+ /**
2643
+ * SessionStructure _pendingKeyExchange.
2644
+ * @member {"pendingKeyExchange"|undefined} _pendingKeyExchange
2645
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2646
+ * @instance
2647
+ */
2648
+ Object.defineProperty(SessionStructure.prototype, "_pendingKeyExchange", {
2649
+ get: $util.oneOfGetter($oneOfFields = ["pendingKeyExchange"]),
2650
+ set: $util.oneOfSetter($oneOfFields)
2651
+ });
2652
+ /**
2653
+ * SessionStructure _pendingPreKey.
2654
+ * @member {"pendingPreKey"|undefined} _pendingPreKey
2655
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2656
+ * @instance
2657
+ */
2658
+ Object.defineProperty(SessionStructure.prototype, "_pendingPreKey", {
2659
+ get: $util.oneOfGetter($oneOfFields = ["pendingPreKey"]),
2660
+ set: $util.oneOfSetter($oneOfFields)
2661
+ });
2662
+ /**
2663
+ * SessionStructure _remoteRegistrationId.
2664
+ * @member {"remoteRegistrationId"|undefined} _remoteRegistrationId
2665
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2666
+ * @instance
2667
+ */
2668
+ Object.defineProperty(SessionStructure.prototype, "_remoteRegistrationId", {
2669
+ get: $util.oneOfGetter($oneOfFields = ["remoteRegistrationId"]),
2670
+ set: $util.oneOfSetter($oneOfFields)
2671
+ });
2672
+ /**
2673
+ * SessionStructure _localRegistrationId.
2674
+ * @member {"localRegistrationId"|undefined} _localRegistrationId
2675
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2676
+ * @instance
2677
+ */
2678
+ Object.defineProperty(SessionStructure.prototype, "_localRegistrationId", {
2679
+ get: $util.oneOfGetter($oneOfFields = ["localRegistrationId"]),
2680
+ set: $util.oneOfSetter($oneOfFields)
2681
+ });
2682
+ /**
2683
+ * SessionStructure _needsRefresh.
2684
+ * @member {"needsRefresh"|undefined} _needsRefresh
2685
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2686
+ * @instance
2687
+ */
2688
+ Object.defineProperty(SessionStructure.prototype, "_needsRefresh", {
2689
+ get: $util.oneOfGetter($oneOfFields = ["needsRefresh"]),
2690
+ set: $util.oneOfSetter($oneOfFields)
2691
+ });
2692
+ /**
2693
+ * SessionStructure _aliceBaseKey.
2694
+ * @member {"aliceBaseKey"|undefined} _aliceBaseKey
2695
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2696
+ * @instance
2697
+ */
2698
+ Object.defineProperty(SessionStructure.prototype, "_aliceBaseKey", {
2699
+ get: $util.oneOfGetter($oneOfFields = ["aliceBaseKey"]),
2700
+ set: $util.oneOfSetter($oneOfFields)
2701
+ });
2702
+ /**
2703
+ * Creates a new SessionStructure instance using the specified properties.
2704
+ * @function create
2705
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2706
+ * @static
2707
+ * @param {SignalLocalStorageProtocol.ISessionStructure=} [properties] Properties to set
2708
+ * @returns {SignalLocalStorageProtocol.SessionStructure} SessionStructure instance
2709
+ */
2710
+ SessionStructure.create = function create(properties) {
2711
+ return new SessionStructure(properties);
2712
+ };
2713
+ /**
2714
+ * Encodes the specified SessionStructure message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.verify|verify} messages.
2715
+ * @function encode
2716
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2717
+ * @static
2718
+ * @param {SignalLocalStorageProtocol.ISessionStructure} message SessionStructure message or plain object to encode
2719
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2720
+ * @returns {$protobuf.Writer} Writer
2721
+ */
2722
+ SessionStructure.encode = function encode(message, writer) {
2723
+ if (!writer)
2724
+ writer = $Writer.create();
2725
+ if (message.sessionVersion != null && Object.hasOwnProperty.call(message, "sessionVersion"))
2726
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.sessionVersion);
2727
+ if (message.localIdentityPublic != null && Object.hasOwnProperty.call(message, "localIdentityPublic"))
2728
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.localIdentityPublic);
2729
+ if (message.remoteIdentityPublic != null && Object.hasOwnProperty.call(message, "remoteIdentityPublic"))
2730
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.remoteIdentityPublic);
2731
+ if (message.rootKey != null && Object.hasOwnProperty.call(message, "rootKey"))
2732
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.rootKey);
2733
+ if (message.previousCounter != null && Object.hasOwnProperty.call(message, "previousCounter"))
2734
+ writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.previousCounter);
2735
+ if (message.senderChain != null && Object.hasOwnProperty.call(message, "senderChain"))
2736
+ $root.SignalLocalStorageProtocol.SessionStructure.Chain.encode(message.senderChain, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
2737
+ if (message.receiverChains != null && message.receiverChains.length)
2738
+ for (var i = 0; i < message.receiverChains.length; ++i)
2739
+ $root.SignalLocalStorageProtocol.SessionStructure.Chain.encode(message.receiverChains[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
2740
+ if (message.pendingKeyExchange != null && Object.hasOwnProperty.call(message, "pendingKeyExchange"))
2741
+ $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.encode(message.pendingKeyExchange, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
2742
+ if (message.pendingPreKey != null && Object.hasOwnProperty.call(message, "pendingPreKey"))
2743
+ $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey.encode(message.pendingPreKey, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
2744
+ if (message.remoteRegistrationId != null && Object.hasOwnProperty.call(message, "remoteRegistrationId"))
2745
+ writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.remoteRegistrationId);
2746
+ if (message.localRegistrationId != null && Object.hasOwnProperty.call(message, "localRegistrationId"))
2747
+ writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.localRegistrationId);
2748
+ if (message.needsRefresh != null && Object.hasOwnProperty.call(message, "needsRefresh"))
2749
+ writer.uint32(/* id 12, wireType 0 =*/96).bool(message.needsRefresh);
2750
+ if (message.aliceBaseKey != null && Object.hasOwnProperty.call(message, "aliceBaseKey"))
2751
+ writer.uint32(/* id 13, wireType 2 =*/106).bytes(message.aliceBaseKey);
2752
+ return writer;
2753
+ };
2754
+ /**
2755
+ * Encodes the specified SessionStructure message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.verify|verify} messages.
2756
+ * @function encodeDelimited
2757
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2758
+ * @static
2759
+ * @param {SignalLocalStorageProtocol.ISessionStructure} message SessionStructure message or plain object to encode
2760
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2761
+ * @returns {$protobuf.Writer} Writer
2762
+ */
2763
+ SessionStructure.encodeDelimited = function encodeDelimited(message, writer) {
2764
+ return this.encode(message, writer).ldelim();
2765
+ };
2766
+ /**
2767
+ * Decodes a SessionStructure message from the specified reader or buffer.
2768
+ * @function decode
2769
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2770
+ * @static
2771
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2772
+ * @param {number} [length] Message length if known beforehand
2773
+ * @returns {SignalLocalStorageProtocol.SessionStructure} SessionStructure
2774
+ * @throws {Error} If the payload is not a reader or valid buffer
2775
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2776
+ */
2777
+ SessionStructure.decode = function decode(reader, length, error) {
2778
+ if (!(reader instanceof $Reader))
2779
+ reader = $Reader.create(reader);
2780
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure();
2781
+ while (reader.pos < end) {
2782
+ var tag = reader.uint32();
2783
+ if (tag === error)
2784
+ break;
2785
+ switch (tag >>> 3) {
2786
+ case 1: {
2787
+ message.sessionVersion = reader.uint32();
2788
+ break;
2789
+ }
2790
+ case 2: {
2791
+ message.localIdentityPublic = reader.bytes();
2792
+ break;
2793
+ }
2794
+ case 3: {
2795
+ message.remoteIdentityPublic = reader.bytes();
2796
+ break;
2797
+ }
2798
+ case 4: {
2799
+ message.rootKey = reader.bytes();
2800
+ break;
2801
+ }
2802
+ case 5: {
2803
+ message.previousCounter = reader.uint32();
2804
+ break;
2805
+ }
2806
+ case 6: {
2807
+ message.senderChain = $root.SignalLocalStorageProtocol.SessionStructure.Chain.decode(reader, reader.uint32());
2808
+ break;
2809
+ }
2810
+ case 7: {
2811
+ if (!(message.receiverChains && message.receiverChains.length))
2812
+ message.receiverChains = [];
2813
+ message.receiverChains.push($root.SignalLocalStorageProtocol.SessionStructure.Chain.decode(reader, reader.uint32()));
2814
+ break;
2815
+ }
2816
+ case 8: {
2817
+ message.pendingKeyExchange = $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.decode(reader, reader.uint32());
2818
+ break;
2819
+ }
2820
+ case 9: {
2821
+ message.pendingPreKey = $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey.decode(reader, reader.uint32());
2822
+ break;
2823
+ }
2824
+ case 10: {
2825
+ message.remoteRegistrationId = reader.uint32();
2826
+ break;
2827
+ }
2828
+ case 11: {
2829
+ message.localRegistrationId = reader.uint32();
2830
+ break;
2831
+ }
2832
+ case 12: {
2833
+ message.needsRefresh = reader.bool();
2834
+ break;
2835
+ }
2836
+ case 13: {
2837
+ message.aliceBaseKey = reader.bytes();
2838
+ break;
2839
+ }
2840
+ default:
2841
+ reader.skipType(tag & 7);
2842
+ break;
2843
+ }
2844
+ }
2845
+ return message;
2846
+ };
2847
+ /**
2848
+ * Decodes a SessionStructure message from the specified reader or buffer, length delimited.
2849
+ * @function decodeDelimited
2850
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2851
+ * @static
2852
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2853
+ * @returns {SignalLocalStorageProtocol.SessionStructure} SessionStructure
2854
+ * @throws {Error} If the payload is not a reader or valid buffer
2855
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2856
+ */
2857
+ SessionStructure.decodeDelimited = function decodeDelimited(reader) {
2858
+ if (!(reader instanceof $Reader))
2859
+ reader = new $Reader(reader);
2860
+ return this.decode(reader, reader.uint32());
2861
+ };
2862
+ /**
2863
+ * Verifies a SessionStructure message.
2864
+ * @function verify
2865
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2866
+ * @static
2867
+ * @param {Object.<string,*>} message Plain object to verify
2868
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2869
+ */
2870
+ SessionStructure.verify = function verify(message) {
2871
+ if (typeof message !== "object" || message === null)
2872
+ return "object expected";
2873
+ var properties = {};
2874
+ if (message.sessionVersion != null && message.hasOwnProperty("sessionVersion")) {
2875
+ properties._sessionVersion = 1;
2876
+ if (!$util.isInteger(message.sessionVersion))
2877
+ return "sessionVersion: integer expected";
2878
+ }
2879
+ if (message.localIdentityPublic != null && message.hasOwnProperty("localIdentityPublic")) {
2880
+ properties._localIdentityPublic = 1;
2881
+ if (!(message.localIdentityPublic && typeof message.localIdentityPublic.length === "number" || $util.isString(message.localIdentityPublic)))
2882
+ return "localIdentityPublic: buffer expected";
2883
+ }
2884
+ if (message.remoteIdentityPublic != null && message.hasOwnProperty("remoteIdentityPublic")) {
2885
+ properties._remoteIdentityPublic = 1;
2886
+ if (!(message.remoteIdentityPublic && typeof message.remoteIdentityPublic.length === "number" || $util.isString(message.remoteIdentityPublic)))
2887
+ return "remoteIdentityPublic: buffer expected";
2888
+ }
2889
+ if (message.rootKey != null && message.hasOwnProperty("rootKey")) {
2890
+ properties._rootKey = 1;
2891
+ if (!(message.rootKey && typeof message.rootKey.length === "number" || $util.isString(message.rootKey)))
2892
+ return "rootKey: buffer expected";
2893
+ }
2894
+ if (message.previousCounter != null && message.hasOwnProperty("previousCounter")) {
2895
+ properties._previousCounter = 1;
2896
+ if (!$util.isInteger(message.previousCounter))
2897
+ return "previousCounter: integer expected";
2898
+ }
2899
+ if (message.senderChain != null && message.hasOwnProperty("senderChain")) {
2900
+ properties._senderChain = 1;
2901
+ {
2902
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.Chain.verify(message.senderChain);
2903
+ if (error)
2904
+ return "senderChain." + error;
2905
+ }
2906
+ }
2907
+ if (message.receiverChains != null && message.hasOwnProperty("receiverChains")) {
2908
+ if (!Array.isArray(message.receiverChains))
2909
+ return "receiverChains: array expected";
2910
+ for (var i = 0; i < message.receiverChains.length; ++i) {
2911
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.Chain.verify(message.receiverChains[i]);
2912
+ if (error)
2913
+ return "receiverChains." + error;
2914
+ }
2915
+ }
2916
+ if (message.pendingKeyExchange != null && message.hasOwnProperty("pendingKeyExchange")) {
2917
+ properties._pendingKeyExchange = 1;
2918
+ {
2919
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.verify(message.pendingKeyExchange);
2920
+ if (error)
2921
+ return "pendingKeyExchange." + error;
2922
+ }
2923
+ }
2924
+ if (message.pendingPreKey != null && message.hasOwnProperty("pendingPreKey")) {
2925
+ properties._pendingPreKey = 1;
2926
+ {
2927
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey.verify(message.pendingPreKey);
2928
+ if (error)
2929
+ return "pendingPreKey." + error;
2930
+ }
2931
+ }
2932
+ if (message.remoteRegistrationId != null && message.hasOwnProperty("remoteRegistrationId")) {
2933
+ properties._remoteRegistrationId = 1;
2934
+ if (!$util.isInteger(message.remoteRegistrationId))
2935
+ return "remoteRegistrationId: integer expected";
2936
+ }
2937
+ if (message.localRegistrationId != null && message.hasOwnProperty("localRegistrationId")) {
2938
+ properties._localRegistrationId = 1;
2939
+ if (!$util.isInteger(message.localRegistrationId))
2940
+ return "localRegistrationId: integer expected";
2941
+ }
2942
+ if (message.needsRefresh != null && message.hasOwnProperty("needsRefresh")) {
2943
+ properties._needsRefresh = 1;
2944
+ if (typeof message.needsRefresh !== "boolean")
2945
+ return "needsRefresh: boolean expected";
2946
+ }
2947
+ if (message.aliceBaseKey != null && message.hasOwnProperty("aliceBaseKey")) {
2948
+ properties._aliceBaseKey = 1;
2949
+ if (!(message.aliceBaseKey && typeof message.aliceBaseKey.length === "number" || $util.isString(message.aliceBaseKey)))
2950
+ return "aliceBaseKey: buffer expected";
2951
+ }
2952
+ return null;
2953
+ };
2954
+ /**
2955
+ * Creates a SessionStructure message from a plain object. Also converts values to their respective internal types.
2956
+ * @function fromObject
2957
+ * @memberof SignalLocalStorageProtocol.SessionStructure
2958
+ * @static
2959
+ * @param {Object.<string,*>} object Plain object
2960
+ * @returns {SignalLocalStorageProtocol.SessionStructure} SessionStructure
2961
+ */
2962
+ SessionStructure.fromObject = function fromObject(object) {
2963
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure)
2964
+ return object;
2965
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure();
2966
+ if (object.sessionVersion != null)
2967
+ message.sessionVersion = object.sessionVersion >>> 0;
2968
+ if (object.localIdentityPublic != null)
2969
+ if (typeof object.localIdentityPublic === "string")
2970
+ $util.base64.decode(object.localIdentityPublic, message.localIdentityPublic = $util.newBuffer($util.base64.length(object.localIdentityPublic)), 0);
2971
+ else if (object.localIdentityPublic.length >= 0)
2972
+ message.localIdentityPublic = object.localIdentityPublic;
2973
+ if (object.remoteIdentityPublic != null)
2974
+ if (typeof object.remoteIdentityPublic === "string")
2975
+ $util.base64.decode(object.remoteIdentityPublic, message.remoteIdentityPublic = $util.newBuffer($util.base64.length(object.remoteIdentityPublic)), 0);
2976
+ else if (object.remoteIdentityPublic.length >= 0)
2977
+ message.remoteIdentityPublic = object.remoteIdentityPublic;
2978
+ if (object.rootKey != null)
2979
+ if (typeof object.rootKey === "string")
2980
+ $util.base64.decode(object.rootKey, message.rootKey = $util.newBuffer($util.base64.length(object.rootKey)), 0);
2981
+ else if (object.rootKey.length >= 0)
2982
+ message.rootKey = object.rootKey;
2983
+ if (object.previousCounter != null)
2984
+ message.previousCounter = object.previousCounter >>> 0;
2985
+ if (object.senderChain != null) {
2986
+ if (typeof object.senderChain !== "object")
2987
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.senderChain: object expected");
2988
+ message.senderChain = $root.SignalLocalStorageProtocol.SessionStructure.Chain.fromObject(object.senderChain);
2989
+ }
2990
+ if (object.receiverChains) {
2991
+ if (!Array.isArray(object.receiverChains))
2992
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.receiverChains: array expected");
2993
+ message.receiverChains = [];
2994
+ for (var i = 0; i < object.receiverChains.length; ++i) {
2995
+ if (typeof object.receiverChains[i] !== "object")
2996
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.receiverChains: object expected");
2997
+ message.receiverChains[i] = $root.SignalLocalStorageProtocol.SessionStructure.Chain.fromObject(object.receiverChains[i]);
2998
+ }
2999
+ }
3000
+ if (object.pendingKeyExchange != null) {
3001
+ if (typeof object.pendingKeyExchange !== "object")
3002
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.pendingKeyExchange: object expected");
3003
+ message.pendingKeyExchange = $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.fromObject(object.pendingKeyExchange);
3004
+ }
3005
+ if (object.pendingPreKey != null) {
3006
+ if (typeof object.pendingPreKey !== "object")
3007
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.pendingPreKey: object expected");
3008
+ message.pendingPreKey = $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey.fromObject(object.pendingPreKey);
3009
+ }
3010
+ if (object.remoteRegistrationId != null)
3011
+ message.remoteRegistrationId = object.remoteRegistrationId >>> 0;
3012
+ if (object.localRegistrationId != null)
3013
+ message.localRegistrationId = object.localRegistrationId >>> 0;
3014
+ if (object.needsRefresh != null)
3015
+ message.needsRefresh = Boolean(object.needsRefresh);
3016
+ if (object.aliceBaseKey != null)
3017
+ if (typeof object.aliceBaseKey === "string")
3018
+ $util.base64.decode(object.aliceBaseKey, message.aliceBaseKey = $util.newBuffer($util.base64.length(object.aliceBaseKey)), 0);
3019
+ else if (object.aliceBaseKey.length >= 0)
3020
+ message.aliceBaseKey = object.aliceBaseKey;
3021
+ return message;
3022
+ };
3023
+ /**
3024
+ * Creates a plain object from a SessionStructure message. Also converts values to other types if specified.
3025
+ * @function toObject
3026
+ * @memberof SignalLocalStorageProtocol.SessionStructure
3027
+ * @static
3028
+ * @param {SignalLocalStorageProtocol.SessionStructure} message SessionStructure
3029
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3030
+ * @returns {Object.<string,*>} Plain object
3031
+ */
3032
+ SessionStructure.toObject = function toObject(message, options) {
3033
+ if (!options)
3034
+ options = {};
3035
+ var object = {};
3036
+ if (options.arrays || options.defaults)
3037
+ object.receiverChains = [];
3038
+ if (message.sessionVersion != null && message.hasOwnProperty("sessionVersion")) {
3039
+ object.sessionVersion = message.sessionVersion;
3040
+ if (options.oneofs)
3041
+ object._sessionVersion = "sessionVersion";
3042
+ }
3043
+ if (message.localIdentityPublic != null && message.hasOwnProperty("localIdentityPublic")) {
3044
+ object.localIdentityPublic = options.bytes === String ? $util.base64.encode(message.localIdentityPublic, 0, message.localIdentityPublic.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityPublic) : message.localIdentityPublic;
3045
+ if (options.oneofs)
3046
+ object._localIdentityPublic = "localIdentityPublic";
3047
+ }
3048
+ if (message.remoteIdentityPublic != null && message.hasOwnProperty("remoteIdentityPublic")) {
3049
+ object.remoteIdentityPublic = options.bytes === String ? $util.base64.encode(message.remoteIdentityPublic, 0, message.remoteIdentityPublic.length) : options.bytes === Array ? Array.prototype.slice.call(message.remoteIdentityPublic) : message.remoteIdentityPublic;
3050
+ if (options.oneofs)
3051
+ object._remoteIdentityPublic = "remoteIdentityPublic";
3052
+ }
3053
+ if (message.rootKey != null && message.hasOwnProperty("rootKey")) {
3054
+ object.rootKey = options.bytes === String ? $util.base64.encode(message.rootKey, 0, message.rootKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.rootKey) : message.rootKey;
3055
+ if (options.oneofs)
3056
+ object._rootKey = "rootKey";
3057
+ }
3058
+ if (message.previousCounter != null && message.hasOwnProperty("previousCounter")) {
3059
+ object.previousCounter = message.previousCounter;
3060
+ if (options.oneofs)
3061
+ object._previousCounter = "previousCounter";
3062
+ }
3063
+ if (message.senderChain != null && message.hasOwnProperty("senderChain")) {
3064
+ object.senderChain = $root.SignalLocalStorageProtocol.SessionStructure.Chain.toObject(message.senderChain, options);
3065
+ if (options.oneofs)
3066
+ object._senderChain = "senderChain";
3067
+ }
3068
+ if (message.receiverChains && message.receiverChains.length) {
3069
+ object.receiverChains = [];
3070
+ for (var j = 0; j < message.receiverChains.length; ++j)
3071
+ object.receiverChains[j] = $root.SignalLocalStorageProtocol.SessionStructure.Chain.toObject(message.receiverChains[j], options);
3072
+ }
3073
+ if (message.pendingKeyExchange != null && message.hasOwnProperty("pendingKeyExchange")) {
3074
+ object.pendingKeyExchange = $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.toObject(message.pendingKeyExchange, options);
3075
+ if (options.oneofs)
3076
+ object._pendingKeyExchange = "pendingKeyExchange";
3077
+ }
3078
+ if (message.pendingPreKey != null && message.hasOwnProperty("pendingPreKey")) {
3079
+ object.pendingPreKey = $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey.toObject(message.pendingPreKey, options);
3080
+ if (options.oneofs)
3081
+ object._pendingPreKey = "pendingPreKey";
3082
+ }
3083
+ if (message.remoteRegistrationId != null && message.hasOwnProperty("remoteRegistrationId")) {
3084
+ object.remoteRegistrationId = message.remoteRegistrationId;
3085
+ if (options.oneofs)
3086
+ object._remoteRegistrationId = "remoteRegistrationId";
3087
+ }
3088
+ if (message.localRegistrationId != null && message.hasOwnProperty("localRegistrationId")) {
3089
+ object.localRegistrationId = message.localRegistrationId;
3090
+ if (options.oneofs)
3091
+ object._localRegistrationId = "localRegistrationId";
3092
+ }
3093
+ if (message.needsRefresh != null && message.hasOwnProperty("needsRefresh")) {
3094
+ object.needsRefresh = message.needsRefresh;
3095
+ if (options.oneofs)
3096
+ object._needsRefresh = "needsRefresh";
3097
+ }
3098
+ if (message.aliceBaseKey != null && message.hasOwnProperty("aliceBaseKey")) {
3099
+ object.aliceBaseKey = options.bytes === String ? $util.base64.encode(message.aliceBaseKey, 0, message.aliceBaseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.aliceBaseKey) : message.aliceBaseKey;
3100
+ if (options.oneofs)
3101
+ object._aliceBaseKey = "aliceBaseKey";
3102
+ }
3103
+ return object;
3104
+ };
3105
+ /**
3106
+ * Converts this SessionStructure to JSON.
3107
+ * @function toJSON
3108
+ * @memberof SignalLocalStorageProtocol.SessionStructure
3109
+ * @instance
3110
+ * @returns {Object.<string,*>} JSON object
3111
+ */
3112
+ SessionStructure.prototype.toJSON = function toJSON() {
3113
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3114
+ };
3115
+ /**
3116
+ * Gets the default type url for SessionStructure
3117
+ * @function getTypeUrl
3118
+ * @memberof SignalLocalStorageProtocol.SessionStructure
3119
+ * @static
3120
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3121
+ * @returns {string} The default type url
3122
+ */
3123
+ SessionStructure.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3124
+ if (typeUrlPrefix === undefined) {
3125
+ typeUrlPrefix = "type.googleapis.com";
3126
+ }
3127
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure";
3128
+ };
3129
+ SessionStructure.Chain = (function() {
3130
+ /**
3131
+ * Properties of a Chain.
3132
+ * @memberof SignalLocalStorageProtocol.SessionStructure
3133
+ * @interface IChain
3134
+ * @property {Uint8Array|null} [senderRatchetKey] Chain senderRatchetKey
3135
+ * @property {Uint8Array|null} [senderRatchetKeyPrivate] Chain senderRatchetKeyPrivate
3136
+ * @property {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey|null} [chainKey] Chain chainKey
3137
+ * @property {Array.<SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey>|null} [messageKeys] Chain messageKeys
3138
+ */
3139
+ /**
3140
+ * Constructs a new Chain.
3141
+ * @memberof SignalLocalStorageProtocol.SessionStructure
3142
+ * @classdesc Represents a Chain.
3143
+ * @implements IChain
3144
+ * @constructor
3145
+ * @param {SignalLocalStorageProtocol.SessionStructure.IChain=} [properties] Properties to set
3146
+ */
3147
+ function Chain(properties) {
3148
+ this.messageKeys = [];
3149
+ if (properties)
3150
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3151
+ if (properties[keys[i]] != null)
3152
+ this[keys[i]] = properties[keys[i]];
3153
+ }
3154
+ /**
3155
+ * Chain senderRatchetKey.
3156
+ * @member {Uint8Array|null|undefined} senderRatchetKey
3157
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3158
+ * @instance
3159
+ */
3160
+ Chain.prototype.senderRatchetKey = null;
3161
+ /**
3162
+ * Chain senderRatchetKeyPrivate.
3163
+ * @member {Uint8Array|null|undefined} senderRatchetKeyPrivate
3164
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3165
+ * @instance
3166
+ */
3167
+ Chain.prototype.senderRatchetKeyPrivate = null;
3168
+ /**
3169
+ * Chain chainKey.
3170
+ * @member {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey|null|undefined} chainKey
3171
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3172
+ * @instance
3173
+ */
3174
+ Chain.prototype.chainKey = null;
3175
+ /**
3176
+ * Chain messageKeys.
3177
+ * @member {Array.<SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey>} messageKeys
3178
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3179
+ * @instance
3180
+ */
3181
+ Chain.prototype.messageKeys = $util.emptyArray;
3182
+ // OneOf field names bound to virtual getters and setters
3183
+ var $oneOfFields;
3184
+ /**
3185
+ * Chain _senderRatchetKey.
3186
+ * @member {"senderRatchetKey"|undefined} _senderRatchetKey
3187
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3188
+ * @instance
3189
+ */
3190
+ Object.defineProperty(Chain.prototype, "_senderRatchetKey", {
3191
+ get: $util.oneOfGetter($oneOfFields = ["senderRatchetKey"]),
3192
+ set: $util.oneOfSetter($oneOfFields)
3193
+ });
3194
+ /**
3195
+ * Chain _senderRatchetKeyPrivate.
3196
+ * @member {"senderRatchetKeyPrivate"|undefined} _senderRatchetKeyPrivate
3197
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3198
+ * @instance
3199
+ */
3200
+ Object.defineProperty(Chain.prototype, "_senderRatchetKeyPrivate", {
3201
+ get: $util.oneOfGetter($oneOfFields = ["senderRatchetKeyPrivate"]),
3202
+ set: $util.oneOfSetter($oneOfFields)
3203
+ });
3204
+ /**
3205
+ * Chain _chainKey.
3206
+ * @member {"chainKey"|undefined} _chainKey
3207
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3208
+ * @instance
3209
+ */
3210
+ Object.defineProperty(Chain.prototype, "_chainKey", {
3211
+ get: $util.oneOfGetter($oneOfFields = ["chainKey"]),
3212
+ set: $util.oneOfSetter($oneOfFields)
3213
+ });
3214
+ /**
3215
+ * Creates a new Chain instance using the specified properties.
3216
+ * @function create
3217
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3218
+ * @static
3219
+ * @param {SignalLocalStorageProtocol.SessionStructure.IChain=} [properties] Properties to set
3220
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain} Chain instance
3221
+ */
3222
+ Chain.create = function create(properties) {
3223
+ return new Chain(properties);
3224
+ };
3225
+ /**
3226
+ * Encodes the specified Chain message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.verify|verify} messages.
3227
+ * @function encode
3228
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3229
+ * @static
3230
+ * @param {SignalLocalStorageProtocol.SessionStructure.IChain} message Chain message or plain object to encode
3231
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3232
+ * @returns {$protobuf.Writer} Writer
3233
+ */
3234
+ Chain.encode = function encode(message, writer) {
3235
+ if (!writer)
3236
+ writer = $Writer.create();
3237
+ if (message.senderRatchetKey != null && Object.hasOwnProperty.call(message, "senderRatchetKey"))
3238
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.senderRatchetKey);
3239
+ if (message.senderRatchetKeyPrivate != null && Object.hasOwnProperty.call(message, "senderRatchetKeyPrivate"))
3240
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.senderRatchetKeyPrivate);
3241
+ if (message.chainKey != null && Object.hasOwnProperty.call(message, "chainKey"))
3242
+ $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.encode(message.chainKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
3243
+ if (message.messageKeys != null && message.messageKeys.length)
3244
+ for (var i = 0; i < message.messageKeys.length; ++i)
3245
+ $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.encode(message.messageKeys[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
3246
+ return writer;
3247
+ };
3248
+ /**
3249
+ * Encodes the specified Chain message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.verify|verify} messages.
3250
+ * @function encodeDelimited
3251
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3252
+ * @static
3253
+ * @param {SignalLocalStorageProtocol.SessionStructure.IChain} message Chain message or plain object to encode
3254
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3255
+ * @returns {$protobuf.Writer} Writer
3256
+ */
3257
+ Chain.encodeDelimited = function encodeDelimited(message, writer) {
3258
+ return this.encode(message, writer).ldelim();
3259
+ };
3260
+ /**
3261
+ * Decodes a Chain message from the specified reader or buffer.
3262
+ * @function decode
3263
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3264
+ * @static
3265
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3266
+ * @param {number} [length] Message length if known beforehand
3267
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain} Chain
3268
+ * @throws {Error} If the payload is not a reader or valid buffer
3269
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3270
+ */
3271
+ Chain.decode = function decode(reader, length, error) {
3272
+ if (!(reader instanceof $Reader))
3273
+ reader = $Reader.create(reader);
3274
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain();
3275
+ while (reader.pos < end) {
3276
+ var tag = reader.uint32();
3277
+ if (tag === error)
3278
+ break;
3279
+ switch (tag >>> 3) {
3280
+ case 1: {
3281
+ message.senderRatchetKey = reader.bytes();
3282
+ break;
3283
+ }
3284
+ case 2: {
3285
+ message.senderRatchetKeyPrivate = reader.bytes();
3286
+ break;
3287
+ }
3288
+ case 3: {
3289
+ message.chainKey = $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.decode(reader, reader.uint32());
3290
+ break;
3291
+ }
3292
+ case 4: {
3293
+ if (!(message.messageKeys && message.messageKeys.length))
3294
+ message.messageKeys = [];
3295
+ message.messageKeys.push($root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.decode(reader, reader.uint32()));
3296
+ break;
3297
+ }
3298
+ default:
3299
+ reader.skipType(tag & 7);
3300
+ break;
3301
+ }
3302
+ }
3303
+ return message;
3304
+ };
3305
+ /**
3306
+ * Decodes a Chain message from the specified reader or buffer, length delimited.
3307
+ * @function decodeDelimited
3308
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3309
+ * @static
3310
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3311
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain} Chain
3312
+ * @throws {Error} If the payload is not a reader or valid buffer
3313
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3314
+ */
3315
+ Chain.decodeDelimited = function decodeDelimited(reader) {
3316
+ if (!(reader instanceof $Reader))
3317
+ reader = new $Reader(reader);
3318
+ return this.decode(reader, reader.uint32());
3319
+ };
3320
+ /**
3321
+ * Verifies a Chain message.
3322
+ * @function verify
3323
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3324
+ * @static
3325
+ * @param {Object.<string,*>} message Plain object to verify
3326
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3327
+ */
3328
+ Chain.verify = function verify(message) {
3329
+ if (typeof message !== "object" || message === null)
3330
+ return "object expected";
3331
+ var properties = {};
3332
+ if (message.senderRatchetKey != null && message.hasOwnProperty("senderRatchetKey")) {
3333
+ properties._senderRatchetKey = 1;
3334
+ if (!(message.senderRatchetKey && typeof message.senderRatchetKey.length === "number" || $util.isString(message.senderRatchetKey)))
3335
+ return "senderRatchetKey: buffer expected";
3336
+ }
3337
+ if (message.senderRatchetKeyPrivate != null && message.hasOwnProperty("senderRatchetKeyPrivate")) {
3338
+ properties._senderRatchetKeyPrivate = 1;
3339
+ if (!(message.senderRatchetKeyPrivate && typeof message.senderRatchetKeyPrivate.length === "number" || $util.isString(message.senderRatchetKeyPrivate)))
3340
+ return "senderRatchetKeyPrivate: buffer expected";
3341
+ }
3342
+ if (message.chainKey != null && message.hasOwnProperty("chainKey")) {
3343
+ properties._chainKey = 1;
3344
+ {
3345
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.verify(message.chainKey);
3346
+ if (error)
3347
+ return "chainKey." + error;
3348
+ }
3349
+ }
3350
+ if (message.messageKeys != null && message.hasOwnProperty("messageKeys")) {
3351
+ if (!Array.isArray(message.messageKeys))
3352
+ return "messageKeys: array expected";
3353
+ for (var i = 0; i < message.messageKeys.length; ++i) {
3354
+ var error = $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.verify(message.messageKeys[i]);
3355
+ if (error)
3356
+ return "messageKeys." + error;
3357
+ }
3358
+ }
3359
+ return null;
3360
+ };
3361
+ /**
3362
+ * Creates a Chain message from a plain object. Also converts values to their respective internal types.
3363
+ * @function fromObject
3364
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3365
+ * @static
3366
+ * @param {Object.<string,*>} object Plain object
3367
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain} Chain
3368
+ */
3369
+ Chain.fromObject = function fromObject(object) {
3370
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure.Chain)
3371
+ return object;
3372
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain();
3373
+ if (object.senderRatchetKey != null)
3374
+ if (typeof object.senderRatchetKey === "string")
3375
+ $util.base64.decode(object.senderRatchetKey, message.senderRatchetKey = $util.newBuffer($util.base64.length(object.senderRatchetKey)), 0);
3376
+ else if (object.senderRatchetKey.length >= 0)
3377
+ message.senderRatchetKey = object.senderRatchetKey;
3378
+ if (object.senderRatchetKeyPrivate != null)
3379
+ if (typeof object.senderRatchetKeyPrivate === "string")
3380
+ $util.base64.decode(object.senderRatchetKeyPrivate, message.senderRatchetKeyPrivate = $util.newBuffer($util.base64.length(object.senderRatchetKeyPrivate)), 0);
3381
+ else if (object.senderRatchetKeyPrivate.length >= 0)
3382
+ message.senderRatchetKeyPrivate = object.senderRatchetKeyPrivate;
3383
+ if (object.chainKey != null) {
3384
+ if (typeof object.chainKey !== "object")
3385
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.Chain.chainKey: object expected");
3386
+ message.chainKey = $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.fromObject(object.chainKey);
3387
+ }
3388
+ if (object.messageKeys) {
3389
+ if (!Array.isArray(object.messageKeys))
3390
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.Chain.messageKeys: array expected");
3391
+ message.messageKeys = [];
3392
+ for (var i = 0; i < object.messageKeys.length; ++i) {
3393
+ if (typeof object.messageKeys[i] !== "object")
3394
+ throw TypeError(".SignalLocalStorageProtocol.SessionStructure.Chain.messageKeys: object expected");
3395
+ message.messageKeys[i] = $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.fromObject(object.messageKeys[i]);
3396
+ }
3397
+ }
3398
+ return message;
3399
+ };
3400
+ /**
3401
+ * Creates a plain object from a Chain message. Also converts values to other types if specified.
3402
+ * @function toObject
3403
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3404
+ * @static
3405
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain} message Chain
3406
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3407
+ * @returns {Object.<string,*>} Plain object
3408
+ */
3409
+ Chain.toObject = function toObject(message, options) {
3410
+ if (!options)
3411
+ options = {};
3412
+ var object = {};
3413
+ if (options.arrays || options.defaults)
3414
+ object.messageKeys = [];
3415
+ if (message.senderRatchetKey != null && message.hasOwnProperty("senderRatchetKey")) {
3416
+ object.senderRatchetKey = options.bytes === String ? $util.base64.encode(message.senderRatchetKey, 0, message.senderRatchetKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.senderRatchetKey) : message.senderRatchetKey;
3417
+ if (options.oneofs)
3418
+ object._senderRatchetKey = "senderRatchetKey";
3419
+ }
3420
+ if (message.senderRatchetKeyPrivate != null && message.hasOwnProperty("senderRatchetKeyPrivate")) {
3421
+ object.senderRatchetKeyPrivate = options.bytes === String ? $util.base64.encode(message.senderRatchetKeyPrivate, 0, message.senderRatchetKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.senderRatchetKeyPrivate) : message.senderRatchetKeyPrivate;
3422
+ if (options.oneofs)
3423
+ object._senderRatchetKeyPrivate = "senderRatchetKeyPrivate";
3424
+ }
3425
+ if (message.chainKey != null && message.hasOwnProperty("chainKey")) {
3426
+ object.chainKey = $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.toObject(message.chainKey, options);
3427
+ if (options.oneofs)
3428
+ object._chainKey = "chainKey";
3429
+ }
3430
+ if (message.messageKeys && message.messageKeys.length) {
3431
+ object.messageKeys = [];
3432
+ for (var j = 0; j < message.messageKeys.length; ++j)
3433
+ object.messageKeys[j] = $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.toObject(message.messageKeys[j], options);
3434
+ }
3435
+ return object;
3436
+ };
3437
+ /**
3438
+ * Converts this Chain to JSON.
3439
+ * @function toJSON
3440
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3441
+ * @instance
3442
+ * @returns {Object.<string,*>} JSON object
3443
+ */
3444
+ Chain.prototype.toJSON = function toJSON() {
3445
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3446
+ };
3447
+ /**
3448
+ * Gets the default type url for Chain
3449
+ * @function getTypeUrl
3450
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3451
+ * @static
3452
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3453
+ * @returns {string} The default type url
3454
+ */
3455
+ Chain.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3456
+ if (typeUrlPrefix === undefined) {
3457
+ typeUrlPrefix = "type.googleapis.com";
3458
+ }
3459
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure.Chain";
3460
+ };
3461
+ Chain.ChainKey = (function() {
3462
+ /**
3463
+ * Properties of a ChainKey.
3464
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3465
+ * @interface IChainKey
3466
+ * @property {number|null} [index] ChainKey index
3467
+ * @property {Uint8Array|null} [key] ChainKey key
3468
+ */
3469
+ /**
3470
+ * Constructs a new ChainKey.
3471
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3472
+ * @classdesc Represents a ChainKey.
3473
+ * @implements IChainKey
3474
+ * @constructor
3475
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey=} [properties] Properties to set
3476
+ */
3477
+ function ChainKey(properties) {
3478
+ if (properties)
3479
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3480
+ if (properties[keys[i]] != null)
3481
+ this[keys[i]] = properties[keys[i]];
3482
+ }
3483
+ /**
3484
+ * ChainKey index.
3485
+ * @member {number|null|undefined} index
3486
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3487
+ * @instance
3488
+ */
3489
+ ChainKey.prototype.index = null;
3490
+ /**
3491
+ * ChainKey key.
3492
+ * @member {Uint8Array|null|undefined} key
3493
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3494
+ * @instance
3495
+ */
3496
+ ChainKey.prototype.key = null;
3497
+ // OneOf field names bound to virtual getters and setters
3498
+ var $oneOfFields;
3499
+ /**
3500
+ * ChainKey _index.
3501
+ * @member {"index"|undefined} _index
3502
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3503
+ * @instance
3504
+ */
3505
+ Object.defineProperty(ChainKey.prototype, "_index", {
3506
+ get: $util.oneOfGetter($oneOfFields = ["index"]),
3507
+ set: $util.oneOfSetter($oneOfFields)
3508
+ });
3509
+ /**
3510
+ * ChainKey _key.
3511
+ * @member {"key"|undefined} _key
3512
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3513
+ * @instance
3514
+ */
3515
+ Object.defineProperty(ChainKey.prototype, "_key", {
3516
+ get: $util.oneOfGetter($oneOfFields = ["key"]),
3517
+ set: $util.oneOfSetter($oneOfFields)
3518
+ });
3519
+ /**
3520
+ * Creates a new ChainKey instance using the specified properties.
3521
+ * @function create
3522
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3523
+ * @static
3524
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey=} [properties] Properties to set
3525
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey} ChainKey instance
3526
+ */
3527
+ ChainKey.create = function create(properties) {
3528
+ return new ChainKey(properties);
3529
+ };
3530
+ /**
3531
+ * Encodes the specified ChainKey message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.verify|verify} messages.
3532
+ * @function encode
3533
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3534
+ * @static
3535
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey} message ChainKey message or plain object to encode
3536
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3537
+ * @returns {$protobuf.Writer} Writer
3538
+ */
3539
+ ChainKey.encode = function encode(message, writer) {
3540
+ if (!writer)
3541
+ writer = $Writer.create();
3542
+ if (message.index != null && Object.hasOwnProperty.call(message, "index"))
3543
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index);
3544
+ if (message.key != null && Object.hasOwnProperty.call(message, "key"))
3545
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.key);
3546
+ return writer;
3547
+ };
3548
+ /**
3549
+ * Encodes the specified ChainKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey.verify|verify} messages.
3550
+ * @function encodeDelimited
3551
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3552
+ * @static
3553
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IChainKey} message ChainKey message or plain object to encode
3554
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3555
+ * @returns {$protobuf.Writer} Writer
3556
+ */
3557
+ ChainKey.encodeDelimited = function encodeDelimited(message, writer) {
3558
+ return this.encode(message, writer).ldelim();
3559
+ };
3560
+ /**
3561
+ * Decodes a ChainKey message from the specified reader or buffer.
3562
+ * @function decode
3563
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3564
+ * @static
3565
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3566
+ * @param {number} [length] Message length if known beforehand
3567
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey} ChainKey
3568
+ * @throws {Error} If the payload is not a reader or valid buffer
3569
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3570
+ */
3571
+ ChainKey.decode = function decode(reader, length, error) {
3572
+ if (!(reader instanceof $Reader))
3573
+ reader = $Reader.create(reader);
3574
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey();
3575
+ while (reader.pos < end) {
3576
+ var tag = reader.uint32();
3577
+ if (tag === error)
3578
+ break;
3579
+ switch (tag >>> 3) {
3580
+ case 1: {
3581
+ message.index = reader.uint32();
3582
+ break;
3583
+ }
3584
+ case 2: {
3585
+ message.key = reader.bytes();
3586
+ break;
3587
+ }
3588
+ default:
3589
+ reader.skipType(tag & 7);
3590
+ break;
3591
+ }
3592
+ }
3593
+ return message;
3594
+ };
3595
+ /**
3596
+ * Decodes a ChainKey message from the specified reader or buffer, length delimited.
3597
+ * @function decodeDelimited
3598
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3599
+ * @static
3600
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3601
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey} ChainKey
3602
+ * @throws {Error} If the payload is not a reader or valid buffer
3603
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3604
+ */
3605
+ ChainKey.decodeDelimited = function decodeDelimited(reader) {
3606
+ if (!(reader instanceof $Reader))
3607
+ reader = new $Reader(reader);
3608
+ return this.decode(reader, reader.uint32());
3609
+ };
3610
+ /**
3611
+ * Verifies a ChainKey message.
3612
+ * @function verify
3613
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3614
+ * @static
3615
+ * @param {Object.<string,*>} message Plain object to verify
3616
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3617
+ */
3618
+ ChainKey.verify = function verify(message) {
3619
+ if (typeof message !== "object" || message === null)
3620
+ return "object expected";
3621
+ var properties = {};
3622
+ if (message.index != null && message.hasOwnProperty("index")) {
3623
+ properties._index = 1;
3624
+ if (!$util.isInteger(message.index))
3625
+ return "index: integer expected";
3626
+ }
3627
+ if (message.key != null && message.hasOwnProperty("key")) {
3628
+ properties._key = 1;
3629
+ if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key)))
3630
+ return "key: buffer expected";
3631
+ }
3632
+ return null;
3633
+ };
3634
+ /**
3635
+ * Creates a ChainKey message from a plain object. Also converts values to their respective internal types.
3636
+ * @function fromObject
3637
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3638
+ * @static
3639
+ * @param {Object.<string,*>} object Plain object
3640
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey} ChainKey
3641
+ */
3642
+ ChainKey.fromObject = function fromObject(object) {
3643
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey)
3644
+ return object;
3645
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey();
3646
+ if (object.index != null)
3647
+ message.index = object.index >>> 0;
3648
+ if (object.key != null)
3649
+ if (typeof object.key === "string")
3650
+ $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0);
3651
+ else if (object.key.length >= 0)
3652
+ message.key = object.key;
3653
+ return message;
3654
+ };
3655
+ /**
3656
+ * Creates a plain object from a ChainKey message. Also converts values to other types if specified.
3657
+ * @function toObject
3658
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3659
+ * @static
3660
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey} message ChainKey
3661
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3662
+ * @returns {Object.<string,*>} Plain object
3663
+ */
3664
+ ChainKey.toObject = function toObject(message, options) {
3665
+ if (!options)
3666
+ options = {};
3667
+ var object = {};
3668
+ if (message.index != null && message.hasOwnProperty("index")) {
3669
+ object.index = message.index;
3670
+ if (options.oneofs)
3671
+ object._index = "index";
3672
+ }
3673
+ if (message.key != null && message.hasOwnProperty("key")) {
3674
+ object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key;
3675
+ if (options.oneofs)
3676
+ object._key = "key";
3677
+ }
3678
+ return object;
3679
+ };
3680
+ /**
3681
+ * Converts this ChainKey to JSON.
3682
+ * @function toJSON
3683
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3684
+ * @instance
3685
+ * @returns {Object.<string,*>} JSON object
3686
+ */
3687
+ ChainKey.prototype.toJSON = function toJSON() {
3688
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3689
+ };
3690
+ /**
3691
+ * Gets the default type url for ChainKey
3692
+ * @function getTypeUrl
3693
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey
3694
+ * @static
3695
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3696
+ * @returns {string} The default type url
3697
+ */
3698
+ ChainKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3699
+ if (typeUrlPrefix === undefined) {
3700
+ typeUrlPrefix = "type.googleapis.com";
3701
+ }
3702
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure.Chain.ChainKey";
3703
+ };
3704
+ return ChainKey;
3705
+ })();
3706
+ Chain.MessageKey = (function() {
3707
+ /**
3708
+ * Properties of a MessageKey.
3709
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3710
+ * @interface IMessageKey
3711
+ * @property {number|null} [index] MessageKey index
3712
+ * @property {Uint8Array|null} [cipherKey] MessageKey cipherKey
3713
+ * @property {Uint8Array|null} [macKey] MessageKey macKey
3714
+ * @property {Uint8Array|null} [iv] MessageKey iv
3715
+ */
3716
+ /**
3717
+ * Constructs a new MessageKey.
3718
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain
3719
+ * @classdesc Represents a MessageKey.
3720
+ * @implements IMessageKey
3721
+ * @constructor
3722
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey=} [properties] Properties to set
3723
+ */
3724
+ function MessageKey(properties) {
3725
+ if (properties)
3726
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3727
+ if (properties[keys[i]] != null)
3728
+ this[keys[i]] = properties[keys[i]];
3729
+ }
3730
+ /**
3731
+ * MessageKey index.
3732
+ * @member {number|null|undefined} index
3733
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3734
+ * @instance
3735
+ */
3736
+ MessageKey.prototype.index = null;
3737
+ /**
3738
+ * MessageKey cipherKey.
3739
+ * @member {Uint8Array|null|undefined} cipherKey
3740
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3741
+ * @instance
3742
+ */
3743
+ MessageKey.prototype.cipherKey = null;
3744
+ /**
3745
+ * MessageKey macKey.
3746
+ * @member {Uint8Array|null|undefined} macKey
3747
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3748
+ * @instance
3749
+ */
3750
+ MessageKey.prototype.macKey = null;
3751
+ /**
3752
+ * MessageKey iv.
3753
+ * @member {Uint8Array|null|undefined} iv
3754
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3755
+ * @instance
3756
+ */
3757
+ MessageKey.prototype.iv = null;
3758
+ // OneOf field names bound to virtual getters and setters
3759
+ var $oneOfFields;
3760
+ /**
3761
+ * MessageKey _index.
3762
+ * @member {"index"|undefined} _index
3763
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3764
+ * @instance
3765
+ */
3766
+ Object.defineProperty(MessageKey.prototype, "_index", {
3767
+ get: $util.oneOfGetter($oneOfFields = ["index"]),
3768
+ set: $util.oneOfSetter($oneOfFields)
3769
+ });
3770
+ /**
3771
+ * MessageKey _cipherKey.
3772
+ * @member {"cipherKey"|undefined} _cipherKey
3773
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3774
+ * @instance
3775
+ */
3776
+ Object.defineProperty(MessageKey.prototype, "_cipherKey", {
3777
+ get: $util.oneOfGetter($oneOfFields = ["cipherKey"]),
3778
+ set: $util.oneOfSetter($oneOfFields)
3779
+ });
3780
+ /**
3781
+ * MessageKey _macKey.
3782
+ * @member {"macKey"|undefined} _macKey
3783
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3784
+ * @instance
3785
+ */
3786
+ Object.defineProperty(MessageKey.prototype, "_macKey", {
3787
+ get: $util.oneOfGetter($oneOfFields = ["macKey"]),
3788
+ set: $util.oneOfSetter($oneOfFields)
3789
+ });
3790
+ /**
3791
+ * MessageKey _iv.
3792
+ * @member {"iv"|undefined} _iv
3793
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3794
+ * @instance
3795
+ */
3796
+ Object.defineProperty(MessageKey.prototype, "_iv", {
3797
+ get: $util.oneOfGetter($oneOfFields = ["iv"]),
3798
+ set: $util.oneOfSetter($oneOfFields)
3799
+ });
3800
+ /**
3801
+ * Creates a new MessageKey instance using the specified properties.
3802
+ * @function create
3803
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3804
+ * @static
3805
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey=} [properties] Properties to set
3806
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey} MessageKey instance
3807
+ */
3808
+ MessageKey.create = function create(properties) {
3809
+ return new MessageKey(properties);
3810
+ };
3811
+ /**
3812
+ * Encodes the specified MessageKey message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.verify|verify} messages.
3813
+ * @function encode
3814
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3815
+ * @static
3816
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey} message MessageKey message or plain object to encode
3817
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3818
+ * @returns {$protobuf.Writer} Writer
3819
+ */
3820
+ MessageKey.encode = function encode(message, writer) {
3821
+ if (!writer)
3822
+ writer = $Writer.create();
3823
+ if (message.index != null && Object.hasOwnProperty.call(message, "index"))
3824
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index);
3825
+ if (message.cipherKey != null && Object.hasOwnProperty.call(message, "cipherKey"))
3826
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.cipherKey);
3827
+ if (message.macKey != null && Object.hasOwnProperty.call(message, "macKey"))
3828
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.macKey);
3829
+ if (message.iv != null && Object.hasOwnProperty.call(message, "iv"))
3830
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.iv);
3831
+ return writer;
3832
+ };
3833
+ /**
3834
+ * Encodes the specified MessageKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey.verify|verify} messages.
3835
+ * @function encodeDelimited
3836
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3837
+ * @static
3838
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.IMessageKey} message MessageKey message or plain object to encode
3839
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3840
+ * @returns {$protobuf.Writer} Writer
3841
+ */
3842
+ MessageKey.encodeDelimited = function encodeDelimited(message, writer) {
3843
+ return this.encode(message, writer).ldelim();
3844
+ };
3845
+ /**
3846
+ * Decodes a MessageKey message from the specified reader or buffer.
3847
+ * @function decode
3848
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3849
+ * @static
3850
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3851
+ * @param {number} [length] Message length if known beforehand
3852
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey} MessageKey
3853
+ * @throws {Error} If the payload is not a reader or valid buffer
3854
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3855
+ */
3856
+ MessageKey.decode = function decode(reader, length, error) {
3857
+ if (!(reader instanceof $Reader))
3858
+ reader = $Reader.create(reader);
3859
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey();
3860
+ while (reader.pos < end) {
3861
+ var tag = reader.uint32();
3862
+ if (tag === error)
3863
+ break;
3864
+ switch (tag >>> 3) {
3865
+ case 1: {
3866
+ message.index = reader.uint32();
3867
+ break;
3868
+ }
3869
+ case 2: {
3870
+ message.cipherKey = reader.bytes();
3871
+ break;
3872
+ }
3873
+ case 3: {
3874
+ message.macKey = reader.bytes();
3875
+ break;
3876
+ }
3877
+ case 4: {
3878
+ message.iv = reader.bytes();
3879
+ break;
3880
+ }
3881
+ default:
3882
+ reader.skipType(tag & 7);
3883
+ break;
3884
+ }
3885
+ }
3886
+ return message;
3887
+ };
3888
+ /**
3889
+ * Decodes a MessageKey message from the specified reader or buffer, length delimited.
3890
+ * @function decodeDelimited
3891
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3892
+ * @static
3893
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3894
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey} MessageKey
3895
+ * @throws {Error} If the payload is not a reader or valid buffer
3896
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3897
+ */
3898
+ MessageKey.decodeDelimited = function decodeDelimited(reader) {
3899
+ if (!(reader instanceof $Reader))
3900
+ reader = new $Reader(reader);
3901
+ return this.decode(reader, reader.uint32());
3902
+ };
3903
+ /**
3904
+ * Verifies a MessageKey message.
3905
+ * @function verify
3906
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3907
+ * @static
3908
+ * @param {Object.<string,*>} message Plain object to verify
3909
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3910
+ */
3911
+ MessageKey.verify = function verify(message) {
3912
+ if (typeof message !== "object" || message === null)
3913
+ return "object expected";
3914
+ var properties = {};
3915
+ if (message.index != null && message.hasOwnProperty("index")) {
3916
+ properties._index = 1;
3917
+ if (!$util.isInteger(message.index))
3918
+ return "index: integer expected";
3919
+ }
3920
+ if (message.cipherKey != null && message.hasOwnProperty("cipherKey")) {
3921
+ properties._cipherKey = 1;
3922
+ if (!(message.cipherKey && typeof message.cipherKey.length === "number" || $util.isString(message.cipherKey)))
3923
+ return "cipherKey: buffer expected";
3924
+ }
3925
+ if (message.macKey != null && message.hasOwnProperty("macKey")) {
3926
+ properties._macKey = 1;
3927
+ if (!(message.macKey && typeof message.macKey.length === "number" || $util.isString(message.macKey)))
3928
+ return "macKey: buffer expected";
3929
+ }
3930
+ if (message.iv != null && message.hasOwnProperty("iv")) {
3931
+ properties._iv = 1;
3932
+ if (!(message.iv && typeof message.iv.length === "number" || $util.isString(message.iv)))
3933
+ return "iv: buffer expected";
3934
+ }
3935
+ return null;
3936
+ };
3937
+ /**
3938
+ * Creates a MessageKey message from a plain object. Also converts values to their respective internal types.
3939
+ * @function fromObject
3940
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3941
+ * @static
3942
+ * @param {Object.<string,*>} object Plain object
3943
+ * @returns {SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey} MessageKey
3944
+ */
3945
+ MessageKey.fromObject = function fromObject(object) {
3946
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey)
3947
+ return object;
3948
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey();
3949
+ if (object.index != null)
3950
+ message.index = object.index >>> 0;
3951
+ if (object.cipherKey != null)
3952
+ if (typeof object.cipherKey === "string")
3953
+ $util.base64.decode(object.cipherKey, message.cipherKey = $util.newBuffer($util.base64.length(object.cipherKey)), 0);
3954
+ else if (object.cipherKey.length >= 0)
3955
+ message.cipherKey = object.cipherKey;
3956
+ if (object.macKey != null)
3957
+ if (typeof object.macKey === "string")
3958
+ $util.base64.decode(object.macKey, message.macKey = $util.newBuffer($util.base64.length(object.macKey)), 0);
3959
+ else if (object.macKey.length >= 0)
3960
+ message.macKey = object.macKey;
3961
+ if (object.iv != null)
3962
+ if (typeof object.iv === "string")
3963
+ $util.base64.decode(object.iv, message.iv = $util.newBuffer($util.base64.length(object.iv)), 0);
3964
+ else if (object.iv.length >= 0)
3965
+ message.iv = object.iv;
3966
+ return message;
3967
+ };
3968
+ /**
3969
+ * Creates a plain object from a MessageKey message. Also converts values to other types if specified.
3970
+ * @function toObject
3971
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
3972
+ * @static
3973
+ * @param {SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey} message MessageKey
3974
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3975
+ * @returns {Object.<string,*>} Plain object
3976
+ */
3977
+ MessageKey.toObject = function toObject(message, options) {
3978
+ if (!options)
3979
+ options = {};
3980
+ var object = {};
3981
+ if (message.index != null && message.hasOwnProperty("index")) {
3982
+ object.index = message.index;
3983
+ if (options.oneofs)
3984
+ object._index = "index";
3985
+ }
3986
+ if (message.cipherKey != null && message.hasOwnProperty("cipherKey")) {
3987
+ object.cipherKey = options.bytes === String ? $util.base64.encode(message.cipherKey, 0, message.cipherKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.cipherKey) : message.cipherKey;
3988
+ if (options.oneofs)
3989
+ object._cipherKey = "cipherKey";
3990
+ }
3991
+ if (message.macKey != null && message.hasOwnProperty("macKey")) {
3992
+ object.macKey = options.bytes === String ? $util.base64.encode(message.macKey, 0, message.macKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.macKey) : message.macKey;
3993
+ if (options.oneofs)
3994
+ object._macKey = "macKey";
3995
+ }
3996
+ if (message.iv != null && message.hasOwnProperty("iv")) {
3997
+ object.iv = options.bytes === String ? $util.base64.encode(message.iv, 0, message.iv.length) : options.bytes === Array ? Array.prototype.slice.call(message.iv) : message.iv;
3998
+ if (options.oneofs)
3999
+ object._iv = "iv";
4000
+ }
4001
+ return object;
4002
+ };
4003
+ /**
4004
+ * Converts this MessageKey to JSON.
4005
+ * @function toJSON
4006
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
4007
+ * @instance
4008
+ * @returns {Object.<string,*>} JSON object
4009
+ */
4010
+ MessageKey.prototype.toJSON = function toJSON() {
4011
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4012
+ };
4013
+ /**
4014
+ * Gets the default type url for MessageKey
4015
+ * @function getTypeUrl
4016
+ * @memberof SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey
4017
+ * @static
4018
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4019
+ * @returns {string} The default type url
4020
+ */
4021
+ MessageKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4022
+ if (typeUrlPrefix === undefined) {
4023
+ typeUrlPrefix = "type.googleapis.com";
4024
+ }
4025
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure.Chain.MessageKey";
4026
+ };
4027
+ return MessageKey;
4028
+ })();
4029
+ return Chain;
4030
+ })();
4031
+ SessionStructure.PendingKeyExchange = (function() {
4032
+ /**
4033
+ * Properties of a PendingKeyExchange.
4034
+ * @memberof SignalLocalStorageProtocol.SessionStructure
4035
+ * @interface IPendingKeyExchange
4036
+ * @property {number|null} [sequence] PendingKeyExchange sequence
4037
+ * @property {Uint8Array|null} [localBaseKey] PendingKeyExchange localBaseKey
4038
+ * @property {Uint8Array|null} [localBaseKeyPrivate] PendingKeyExchange localBaseKeyPrivate
4039
+ * @property {Uint8Array|null} [localRatchetKey] PendingKeyExchange localRatchetKey
4040
+ * @property {Uint8Array|null} [localRatchetKeyPrivate] PendingKeyExchange localRatchetKeyPrivate
4041
+ * @property {Uint8Array|null} [localIdentityKey] PendingKeyExchange localIdentityKey
4042
+ * @property {Uint8Array|null} [localIdentityKeyPrivate] PendingKeyExchange localIdentityKeyPrivate
4043
+ */
4044
+ /**
4045
+ * Constructs a new PendingKeyExchange.
4046
+ * @memberof SignalLocalStorageProtocol.SessionStructure
4047
+ * @classdesc Represents a PendingKeyExchange.
4048
+ * @implements IPendingKeyExchange
4049
+ * @constructor
4050
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange=} [properties] Properties to set
4051
+ */
4052
+ function PendingKeyExchange(properties) {
4053
+ if (properties)
4054
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4055
+ if (properties[keys[i]] != null)
4056
+ this[keys[i]] = properties[keys[i]];
4057
+ }
4058
+ /**
4059
+ * PendingKeyExchange sequence.
4060
+ * @member {number|null|undefined} sequence
4061
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4062
+ * @instance
4063
+ */
4064
+ PendingKeyExchange.prototype.sequence = null;
4065
+ /**
4066
+ * PendingKeyExchange localBaseKey.
4067
+ * @member {Uint8Array|null|undefined} localBaseKey
4068
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4069
+ * @instance
4070
+ */
4071
+ PendingKeyExchange.prototype.localBaseKey = null;
4072
+ /**
4073
+ * PendingKeyExchange localBaseKeyPrivate.
4074
+ * @member {Uint8Array|null|undefined} localBaseKeyPrivate
4075
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4076
+ * @instance
4077
+ */
4078
+ PendingKeyExchange.prototype.localBaseKeyPrivate = null;
4079
+ /**
4080
+ * PendingKeyExchange localRatchetKey.
4081
+ * @member {Uint8Array|null|undefined} localRatchetKey
4082
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4083
+ * @instance
4084
+ */
4085
+ PendingKeyExchange.prototype.localRatchetKey = null;
4086
+ /**
4087
+ * PendingKeyExchange localRatchetKeyPrivate.
4088
+ * @member {Uint8Array|null|undefined} localRatchetKeyPrivate
4089
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4090
+ * @instance
4091
+ */
4092
+ PendingKeyExchange.prototype.localRatchetKeyPrivate = null;
4093
+ /**
4094
+ * PendingKeyExchange localIdentityKey.
4095
+ * @member {Uint8Array|null|undefined} localIdentityKey
4096
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4097
+ * @instance
4098
+ */
4099
+ PendingKeyExchange.prototype.localIdentityKey = null;
4100
+ /**
4101
+ * PendingKeyExchange localIdentityKeyPrivate.
4102
+ * @member {Uint8Array|null|undefined} localIdentityKeyPrivate
4103
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4104
+ * @instance
4105
+ */
4106
+ PendingKeyExchange.prototype.localIdentityKeyPrivate = null;
4107
+ // OneOf field names bound to virtual getters and setters
4108
+ var $oneOfFields;
4109
+ /**
4110
+ * PendingKeyExchange _sequence.
4111
+ * @member {"sequence"|undefined} _sequence
4112
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4113
+ * @instance
4114
+ */
4115
+ Object.defineProperty(PendingKeyExchange.prototype, "_sequence", {
4116
+ get: $util.oneOfGetter($oneOfFields = ["sequence"]),
4117
+ set: $util.oneOfSetter($oneOfFields)
4118
+ });
4119
+ /**
4120
+ * PendingKeyExchange _localBaseKey.
4121
+ * @member {"localBaseKey"|undefined} _localBaseKey
4122
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4123
+ * @instance
4124
+ */
4125
+ Object.defineProperty(PendingKeyExchange.prototype, "_localBaseKey", {
4126
+ get: $util.oneOfGetter($oneOfFields = ["localBaseKey"]),
4127
+ set: $util.oneOfSetter($oneOfFields)
4128
+ });
4129
+ /**
4130
+ * PendingKeyExchange _localBaseKeyPrivate.
4131
+ * @member {"localBaseKeyPrivate"|undefined} _localBaseKeyPrivate
4132
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4133
+ * @instance
4134
+ */
4135
+ Object.defineProperty(PendingKeyExchange.prototype, "_localBaseKeyPrivate", {
4136
+ get: $util.oneOfGetter($oneOfFields = ["localBaseKeyPrivate"]),
4137
+ set: $util.oneOfSetter($oneOfFields)
4138
+ });
4139
+ /**
4140
+ * PendingKeyExchange _localRatchetKey.
4141
+ * @member {"localRatchetKey"|undefined} _localRatchetKey
4142
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4143
+ * @instance
4144
+ */
4145
+ Object.defineProperty(PendingKeyExchange.prototype, "_localRatchetKey", {
4146
+ get: $util.oneOfGetter($oneOfFields = ["localRatchetKey"]),
4147
+ set: $util.oneOfSetter($oneOfFields)
4148
+ });
4149
+ /**
4150
+ * PendingKeyExchange _localRatchetKeyPrivate.
4151
+ * @member {"localRatchetKeyPrivate"|undefined} _localRatchetKeyPrivate
4152
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4153
+ * @instance
4154
+ */
4155
+ Object.defineProperty(PendingKeyExchange.prototype, "_localRatchetKeyPrivate", {
4156
+ get: $util.oneOfGetter($oneOfFields = ["localRatchetKeyPrivate"]),
4157
+ set: $util.oneOfSetter($oneOfFields)
4158
+ });
4159
+ /**
4160
+ * PendingKeyExchange _localIdentityKey.
4161
+ * @member {"localIdentityKey"|undefined} _localIdentityKey
4162
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4163
+ * @instance
4164
+ */
4165
+ Object.defineProperty(PendingKeyExchange.prototype, "_localIdentityKey", {
4166
+ get: $util.oneOfGetter($oneOfFields = ["localIdentityKey"]),
4167
+ set: $util.oneOfSetter($oneOfFields)
4168
+ });
4169
+ /**
4170
+ * PendingKeyExchange _localIdentityKeyPrivate.
4171
+ * @member {"localIdentityKeyPrivate"|undefined} _localIdentityKeyPrivate
4172
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4173
+ * @instance
4174
+ */
4175
+ Object.defineProperty(PendingKeyExchange.prototype, "_localIdentityKeyPrivate", {
4176
+ get: $util.oneOfGetter($oneOfFields = ["localIdentityKeyPrivate"]),
4177
+ set: $util.oneOfSetter($oneOfFields)
4178
+ });
4179
+ /**
4180
+ * Creates a new PendingKeyExchange instance using the specified properties.
4181
+ * @function create
4182
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4183
+ * @static
4184
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange=} [properties] Properties to set
4185
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange} PendingKeyExchange instance
4186
+ */
4187
+ PendingKeyExchange.create = function create(properties) {
4188
+ return new PendingKeyExchange(properties);
4189
+ };
4190
+ /**
4191
+ * Encodes the specified PendingKeyExchange message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.verify|verify} messages.
4192
+ * @function encode
4193
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4194
+ * @static
4195
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange} message PendingKeyExchange message or plain object to encode
4196
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4197
+ * @returns {$protobuf.Writer} Writer
4198
+ */
4199
+ PendingKeyExchange.encode = function encode(message, writer) {
4200
+ if (!writer)
4201
+ writer = $Writer.create();
4202
+ if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence"))
4203
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.sequence);
4204
+ if (message.localBaseKey != null && Object.hasOwnProperty.call(message, "localBaseKey"))
4205
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.localBaseKey);
4206
+ if (message.localBaseKeyPrivate != null && Object.hasOwnProperty.call(message, "localBaseKeyPrivate"))
4207
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.localBaseKeyPrivate);
4208
+ if (message.localRatchetKey != null && Object.hasOwnProperty.call(message, "localRatchetKey"))
4209
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.localRatchetKey);
4210
+ if (message.localRatchetKeyPrivate != null && Object.hasOwnProperty.call(message, "localRatchetKeyPrivate"))
4211
+ writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.localRatchetKeyPrivate);
4212
+ if (message.localIdentityKey != null && Object.hasOwnProperty.call(message, "localIdentityKey"))
4213
+ writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.localIdentityKey);
4214
+ if (message.localIdentityKeyPrivate != null && Object.hasOwnProperty.call(message, "localIdentityKeyPrivate"))
4215
+ writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.localIdentityKeyPrivate);
4216
+ return writer;
4217
+ };
4218
+ /**
4219
+ * Encodes the specified PendingKeyExchange message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange.verify|verify} messages.
4220
+ * @function encodeDelimited
4221
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4222
+ * @static
4223
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingKeyExchange} message PendingKeyExchange message or plain object to encode
4224
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4225
+ * @returns {$protobuf.Writer} Writer
4226
+ */
4227
+ PendingKeyExchange.encodeDelimited = function encodeDelimited(message, writer) {
4228
+ return this.encode(message, writer).ldelim();
4229
+ };
4230
+ /**
4231
+ * Decodes a PendingKeyExchange message from the specified reader or buffer.
4232
+ * @function decode
4233
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4234
+ * @static
4235
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4236
+ * @param {number} [length] Message length if known beforehand
4237
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange} PendingKeyExchange
4238
+ * @throws {Error} If the payload is not a reader or valid buffer
4239
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4240
+ */
4241
+ PendingKeyExchange.decode = function decode(reader, length, error) {
4242
+ if (!(reader instanceof $Reader))
4243
+ reader = $Reader.create(reader);
4244
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange();
4245
+ while (reader.pos < end) {
4246
+ var tag = reader.uint32();
4247
+ if (tag === error)
4248
+ break;
4249
+ switch (tag >>> 3) {
4250
+ case 1: {
4251
+ message.sequence = reader.uint32();
4252
+ break;
4253
+ }
4254
+ case 2: {
4255
+ message.localBaseKey = reader.bytes();
4256
+ break;
4257
+ }
4258
+ case 3: {
4259
+ message.localBaseKeyPrivate = reader.bytes();
4260
+ break;
4261
+ }
4262
+ case 4: {
4263
+ message.localRatchetKey = reader.bytes();
4264
+ break;
4265
+ }
4266
+ case 5: {
4267
+ message.localRatchetKeyPrivate = reader.bytes();
4268
+ break;
4269
+ }
4270
+ case 7: {
4271
+ message.localIdentityKey = reader.bytes();
4272
+ break;
4273
+ }
4274
+ case 8: {
4275
+ message.localIdentityKeyPrivate = reader.bytes();
4276
+ break;
4277
+ }
4278
+ default:
4279
+ reader.skipType(tag & 7);
4280
+ break;
4281
+ }
4282
+ }
4283
+ return message;
4284
+ };
4285
+ /**
4286
+ * Decodes a PendingKeyExchange message from the specified reader or buffer, length delimited.
4287
+ * @function decodeDelimited
4288
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4289
+ * @static
4290
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4291
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange} PendingKeyExchange
4292
+ * @throws {Error} If the payload is not a reader or valid buffer
4293
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4294
+ */
4295
+ PendingKeyExchange.decodeDelimited = function decodeDelimited(reader) {
4296
+ if (!(reader instanceof $Reader))
4297
+ reader = new $Reader(reader);
4298
+ return this.decode(reader, reader.uint32());
4299
+ };
4300
+ /**
4301
+ * Verifies a PendingKeyExchange message.
4302
+ * @function verify
4303
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4304
+ * @static
4305
+ * @param {Object.<string,*>} message Plain object to verify
4306
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
4307
+ */
4308
+ PendingKeyExchange.verify = function verify(message) {
4309
+ if (typeof message !== "object" || message === null)
4310
+ return "object expected";
4311
+ var properties = {};
4312
+ if (message.sequence != null && message.hasOwnProperty("sequence")) {
4313
+ properties._sequence = 1;
4314
+ if (!$util.isInteger(message.sequence))
4315
+ return "sequence: integer expected";
4316
+ }
4317
+ if (message.localBaseKey != null && message.hasOwnProperty("localBaseKey")) {
4318
+ properties._localBaseKey = 1;
4319
+ if (!(message.localBaseKey && typeof message.localBaseKey.length === "number" || $util.isString(message.localBaseKey)))
4320
+ return "localBaseKey: buffer expected";
4321
+ }
4322
+ if (message.localBaseKeyPrivate != null && message.hasOwnProperty("localBaseKeyPrivate")) {
4323
+ properties._localBaseKeyPrivate = 1;
4324
+ if (!(message.localBaseKeyPrivate && typeof message.localBaseKeyPrivate.length === "number" || $util.isString(message.localBaseKeyPrivate)))
4325
+ return "localBaseKeyPrivate: buffer expected";
4326
+ }
4327
+ if (message.localRatchetKey != null && message.hasOwnProperty("localRatchetKey")) {
4328
+ properties._localRatchetKey = 1;
4329
+ if (!(message.localRatchetKey && typeof message.localRatchetKey.length === "number" || $util.isString(message.localRatchetKey)))
4330
+ return "localRatchetKey: buffer expected";
4331
+ }
4332
+ if (message.localRatchetKeyPrivate != null && message.hasOwnProperty("localRatchetKeyPrivate")) {
4333
+ properties._localRatchetKeyPrivate = 1;
4334
+ if (!(message.localRatchetKeyPrivate && typeof message.localRatchetKeyPrivate.length === "number" || $util.isString(message.localRatchetKeyPrivate)))
4335
+ return "localRatchetKeyPrivate: buffer expected";
4336
+ }
4337
+ if (message.localIdentityKey != null && message.hasOwnProperty("localIdentityKey")) {
4338
+ properties._localIdentityKey = 1;
4339
+ if (!(message.localIdentityKey && typeof message.localIdentityKey.length === "number" || $util.isString(message.localIdentityKey)))
4340
+ return "localIdentityKey: buffer expected";
4341
+ }
4342
+ if (message.localIdentityKeyPrivate != null && message.hasOwnProperty("localIdentityKeyPrivate")) {
4343
+ properties._localIdentityKeyPrivate = 1;
4344
+ if (!(message.localIdentityKeyPrivate && typeof message.localIdentityKeyPrivate.length === "number" || $util.isString(message.localIdentityKeyPrivate)))
4345
+ return "localIdentityKeyPrivate: buffer expected";
4346
+ }
4347
+ return null;
4348
+ };
4349
+ /**
4350
+ * Creates a PendingKeyExchange message from a plain object. Also converts values to their respective internal types.
4351
+ * @function fromObject
4352
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4353
+ * @static
4354
+ * @param {Object.<string,*>} object Plain object
4355
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange} PendingKeyExchange
4356
+ */
4357
+ PendingKeyExchange.fromObject = function fromObject(object) {
4358
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange)
4359
+ return object;
4360
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange();
4361
+ if (object.sequence != null)
4362
+ message.sequence = object.sequence >>> 0;
4363
+ if (object.localBaseKey != null)
4364
+ if (typeof object.localBaseKey === "string")
4365
+ $util.base64.decode(object.localBaseKey, message.localBaseKey = $util.newBuffer($util.base64.length(object.localBaseKey)), 0);
4366
+ else if (object.localBaseKey.length >= 0)
4367
+ message.localBaseKey = object.localBaseKey;
4368
+ if (object.localBaseKeyPrivate != null)
4369
+ if (typeof object.localBaseKeyPrivate === "string")
4370
+ $util.base64.decode(object.localBaseKeyPrivate, message.localBaseKeyPrivate = $util.newBuffer($util.base64.length(object.localBaseKeyPrivate)), 0);
4371
+ else if (object.localBaseKeyPrivate.length >= 0)
4372
+ message.localBaseKeyPrivate = object.localBaseKeyPrivate;
4373
+ if (object.localRatchetKey != null)
4374
+ if (typeof object.localRatchetKey === "string")
4375
+ $util.base64.decode(object.localRatchetKey, message.localRatchetKey = $util.newBuffer($util.base64.length(object.localRatchetKey)), 0);
4376
+ else if (object.localRatchetKey.length >= 0)
4377
+ message.localRatchetKey = object.localRatchetKey;
4378
+ if (object.localRatchetKeyPrivate != null)
4379
+ if (typeof object.localRatchetKeyPrivate === "string")
4380
+ $util.base64.decode(object.localRatchetKeyPrivate, message.localRatchetKeyPrivate = $util.newBuffer($util.base64.length(object.localRatchetKeyPrivate)), 0);
4381
+ else if (object.localRatchetKeyPrivate.length >= 0)
4382
+ message.localRatchetKeyPrivate = object.localRatchetKeyPrivate;
4383
+ if (object.localIdentityKey != null)
4384
+ if (typeof object.localIdentityKey === "string")
4385
+ $util.base64.decode(object.localIdentityKey, message.localIdentityKey = $util.newBuffer($util.base64.length(object.localIdentityKey)), 0);
4386
+ else if (object.localIdentityKey.length >= 0)
4387
+ message.localIdentityKey = object.localIdentityKey;
4388
+ if (object.localIdentityKeyPrivate != null)
4389
+ if (typeof object.localIdentityKeyPrivate === "string")
4390
+ $util.base64.decode(object.localIdentityKeyPrivate, message.localIdentityKeyPrivate = $util.newBuffer($util.base64.length(object.localIdentityKeyPrivate)), 0);
4391
+ else if (object.localIdentityKeyPrivate.length >= 0)
4392
+ message.localIdentityKeyPrivate = object.localIdentityKeyPrivate;
4393
+ return message;
4394
+ };
4395
+ /**
4396
+ * Creates a plain object from a PendingKeyExchange message. Also converts values to other types if specified.
4397
+ * @function toObject
4398
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4399
+ * @static
4400
+ * @param {SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange} message PendingKeyExchange
4401
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
4402
+ * @returns {Object.<string,*>} Plain object
4403
+ */
4404
+ PendingKeyExchange.toObject = function toObject(message, options) {
4405
+ if (!options)
4406
+ options = {};
4407
+ var object = {};
4408
+ if (message.sequence != null && message.hasOwnProperty("sequence")) {
4409
+ object.sequence = message.sequence;
4410
+ if (options.oneofs)
4411
+ object._sequence = "sequence";
4412
+ }
4413
+ if (message.localBaseKey != null && message.hasOwnProperty("localBaseKey")) {
4414
+ object.localBaseKey = options.bytes === String ? $util.base64.encode(message.localBaseKey, 0, message.localBaseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localBaseKey) : message.localBaseKey;
4415
+ if (options.oneofs)
4416
+ object._localBaseKey = "localBaseKey";
4417
+ }
4418
+ if (message.localBaseKeyPrivate != null && message.hasOwnProperty("localBaseKeyPrivate")) {
4419
+ object.localBaseKeyPrivate = options.bytes === String ? $util.base64.encode(message.localBaseKeyPrivate, 0, message.localBaseKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localBaseKeyPrivate) : message.localBaseKeyPrivate;
4420
+ if (options.oneofs)
4421
+ object._localBaseKeyPrivate = "localBaseKeyPrivate";
4422
+ }
4423
+ if (message.localRatchetKey != null && message.hasOwnProperty("localRatchetKey")) {
4424
+ object.localRatchetKey = options.bytes === String ? $util.base64.encode(message.localRatchetKey, 0, message.localRatchetKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localRatchetKey) : message.localRatchetKey;
4425
+ if (options.oneofs)
4426
+ object._localRatchetKey = "localRatchetKey";
4427
+ }
4428
+ if (message.localRatchetKeyPrivate != null && message.hasOwnProperty("localRatchetKeyPrivate")) {
4429
+ object.localRatchetKeyPrivate = options.bytes === String ? $util.base64.encode(message.localRatchetKeyPrivate, 0, message.localRatchetKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localRatchetKeyPrivate) : message.localRatchetKeyPrivate;
4430
+ if (options.oneofs)
4431
+ object._localRatchetKeyPrivate = "localRatchetKeyPrivate";
4432
+ }
4433
+ if (message.localIdentityKey != null && message.hasOwnProperty("localIdentityKey")) {
4434
+ object.localIdentityKey = options.bytes === String ? $util.base64.encode(message.localIdentityKey, 0, message.localIdentityKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityKey) : message.localIdentityKey;
4435
+ if (options.oneofs)
4436
+ object._localIdentityKey = "localIdentityKey";
4437
+ }
4438
+ if (message.localIdentityKeyPrivate != null && message.hasOwnProperty("localIdentityKeyPrivate")) {
4439
+ object.localIdentityKeyPrivate = options.bytes === String ? $util.base64.encode(message.localIdentityKeyPrivate, 0, message.localIdentityKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityKeyPrivate) : message.localIdentityKeyPrivate;
4440
+ if (options.oneofs)
4441
+ object._localIdentityKeyPrivate = "localIdentityKeyPrivate";
4442
+ }
4443
+ return object;
4444
+ };
4445
+ /**
4446
+ * Converts this PendingKeyExchange to JSON.
4447
+ * @function toJSON
4448
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4449
+ * @instance
4450
+ * @returns {Object.<string,*>} JSON object
4451
+ */
4452
+ PendingKeyExchange.prototype.toJSON = function toJSON() {
4453
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4454
+ };
4455
+ /**
4456
+ * Gets the default type url for PendingKeyExchange
4457
+ * @function getTypeUrl
4458
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange
4459
+ * @static
4460
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4461
+ * @returns {string} The default type url
4462
+ */
4463
+ PendingKeyExchange.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4464
+ if (typeUrlPrefix === undefined) {
4465
+ typeUrlPrefix = "type.googleapis.com";
4466
+ }
4467
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure.PendingKeyExchange";
4468
+ };
4469
+ return PendingKeyExchange;
4470
+ })();
4471
+ SessionStructure.PendingPreKey = (function() {
4472
+ /**
4473
+ * Properties of a PendingPreKey.
4474
+ * @memberof SignalLocalStorageProtocol.SessionStructure
4475
+ * @interface IPendingPreKey
4476
+ * @property {number|null} [preKeyId] PendingPreKey preKeyId
4477
+ * @property {number|null} [signedPreKeyId] PendingPreKey signedPreKeyId
4478
+ * @property {Uint8Array|null} [baseKey] PendingPreKey baseKey
4479
+ */
4480
+ /**
4481
+ * Constructs a new PendingPreKey.
4482
+ * @memberof SignalLocalStorageProtocol.SessionStructure
4483
+ * @classdesc Represents a PendingPreKey.
4484
+ * @implements IPendingPreKey
4485
+ * @constructor
4486
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey=} [properties] Properties to set
4487
+ */
4488
+ function PendingPreKey(properties) {
4489
+ if (properties)
4490
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
4491
+ if (properties[keys[i]] != null)
4492
+ this[keys[i]] = properties[keys[i]];
4493
+ }
4494
+ /**
4495
+ * PendingPreKey preKeyId.
4496
+ * @member {number|null|undefined} preKeyId
4497
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4498
+ * @instance
4499
+ */
4500
+ PendingPreKey.prototype.preKeyId = null;
4501
+ /**
4502
+ * PendingPreKey signedPreKeyId.
4503
+ * @member {number|null|undefined} signedPreKeyId
4504
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4505
+ * @instance
4506
+ */
4507
+ PendingPreKey.prototype.signedPreKeyId = null;
4508
+ /**
4509
+ * PendingPreKey baseKey.
4510
+ * @member {Uint8Array|null|undefined} baseKey
4511
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4512
+ * @instance
4513
+ */
4514
+ PendingPreKey.prototype.baseKey = null;
4515
+ // OneOf field names bound to virtual getters and setters
4516
+ var $oneOfFields;
4517
+ /**
4518
+ * PendingPreKey _preKeyId.
4519
+ * @member {"preKeyId"|undefined} _preKeyId
4520
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4521
+ * @instance
4522
+ */
4523
+ Object.defineProperty(PendingPreKey.prototype, "_preKeyId", {
4524
+ get: $util.oneOfGetter($oneOfFields = ["preKeyId"]),
4525
+ set: $util.oneOfSetter($oneOfFields)
4526
+ });
4527
+ /**
4528
+ * PendingPreKey _signedPreKeyId.
4529
+ * @member {"signedPreKeyId"|undefined} _signedPreKeyId
4530
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4531
+ * @instance
4532
+ */
4533
+ Object.defineProperty(PendingPreKey.prototype, "_signedPreKeyId", {
4534
+ get: $util.oneOfGetter($oneOfFields = ["signedPreKeyId"]),
4535
+ set: $util.oneOfSetter($oneOfFields)
4536
+ });
4537
+ /**
4538
+ * PendingPreKey _baseKey.
4539
+ * @member {"baseKey"|undefined} _baseKey
4540
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4541
+ * @instance
4542
+ */
4543
+ Object.defineProperty(PendingPreKey.prototype, "_baseKey", {
4544
+ get: $util.oneOfGetter($oneOfFields = ["baseKey"]),
4545
+ set: $util.oneOfSetter($oneOfFields)
4546
+ });
4547
+ /**
4548
+ * Creates a new PendingPreKey instance using the specified properties.
4549
+ * @function create
4550
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4551
+ * @static
4552
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey=} [properties] Properties to set
4553
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingPreKey} PendingPreKey instance
4554
+ */
4555
+ PendingPreKey.create = function create(properties) {
4556
+ return new PendingPreKey(properties);
4557
+ };
4558
+ /**
4559
+ * Encodes the specified PendingPreKey message. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.PendingPreKey.verify|verify} messages.
4560
+ * @function encode
4561
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4562
+ * @static
4563
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey} message PendingPreKey message or plain object to encode
4564
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4565
+ * @returns {$protobuf.Writer} Writer
4566
+ */
4567
+ PendingPreKey.encode = function encode(message, writer) {
4568
+ if (!writer)
4569
+ writer = $Writer.create();
4570
+ if (message.preKeyId != null && Object.hasOwnProperty.call(message, "preKeyId"))
4571
+ writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.preKeyId);
4572
+ if (message.baseKey != null && Object.hasOwnProperty.call(message, "baseKey"))
4573
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.baseKey);
4574
+ if (message.signedPreKeyId != null && Object.hasOwnProperty.call(message, "signedPreKeyId"))
4575
+ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.signedPreKeyId);
4576
+ return writer;
4577
+ };
4578
+ /**
4579
+ * Encodes the specified PendingPreKey message, length delimited. Does not implicitly {@link SignalLocalStorageProtocol.SessionStructure.PendingPreKey.verify|verify} messages.
4580
+ * @function encodeDelimited
4581
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4582
+ * @static
4583
+ * @param {SignalLocalStorageProtocol.SessionStructure.IPendingPreKey} message PendingPreKey message or plain object to encode
4584
+ * @param {$protobuf.Writer} [writer] Writer to encode to
4585
+ * @returns {$protobuf.Writer} Writer
4586
+ */
4587
+ PendingPreKey.encodeDelimited = function encodeDelimited(message, writer) {
4588
+ return this.encode(message, writer).ldelim();
4589
+ };
4590
+ /**
4591
+ * Decodes a PendingPreKey message from the specified reader or buffer.
4592
+ * @function decode
4593
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4594
+ * @static
4595
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4596
+ * @param {number} [length] Message length if known beforehand
4597
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingPreKey} PendingPreKey
4598
+ * @throws {Error} If the payload is not a reader or valid buffer
4599
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4600
+ */
4601
+ PendingPreKey.decode = function decode(reader, length, error) {
4602
+ if (!(reader instanceof $Reader))
4603
+ reader = $Reader.create(reader);
4604
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey();
4605
+ while (reader.pos < end) {
4606
+ var tag = reader.uint32();
4607
+ if (tag === error)
4608
+ break;
4609
+ switch (tag >>> 3) {
4610
+ case 1: {
4611
+ message.preKeyId = reader.uint32();
4612
+ break;
4613
+ }
4614
+ case 3: {
4615
+ message.signedPreKeyId = reader.int32();
4616
+ break;
4617
+ }
4618
+ case 2: {
4619
+ message.baseKey = reader.bytes();
4620
+ break;
4621
+ }
4622
+ default:
4623
+ reader.skipType(tag & 7);
4624
+ break;
4625
+ }
4626
+ }
4627
+ return message;
4628
+ };
4629
+ /**
4630
+ * Decodes a PendingPreKey message from the specified reader or buffer, length delimited.
4631
+ * @function decodeDelimited
4632
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4633
+ * @static
4634
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
4635
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingPreKey} PendingPreKey
4636
+ * @throws {Error} If the payload is not a reader or valid buffer
4637
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
4638
+ */
4639
+ PendingPreKey.decodeDelimited = function decodeDelimited(reader) {
4640
+ if (!(reader instanceof $Reader))
4641
+ reader = new $Reader(reader);
4642
+ return this.decode(reader, reader.uint32());
4643
+ };
4644
+ /**
4645
+ * Verifies a PendingPreKey message.
4646
+ * @function verify
4647
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4648
+ * @static
4649
+ * @param {Object.<string,*>} message Plain object to verify
4650
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
4651
+ */
4652
+ PendingPreKey.verify = function verify(message) {
4653
+ if (typeof message !== "object" || message === null)
4654
+ return "object expected";
4655
+ var properties = {};
4656
+ if (message.preKeyId != null && message.hasOwnProperty("preKeyId")) {
4657
+ properties._preKeyId = 1;
4658
+ if (!$util.isInteger(message.preKeyId))
4659
+ return "preKeyId: integer expected";
4660
+ }
4661
+ if (message.signedPreKeyId != null && message.hasOwnProperty("signedPreKeyId")) {
4662
+ properties._signedPreKeyId = 1;
4663
+ if (!$util.isInteger(message.signedPreKeyId))
4664
+ return "signedPreKeyId: integer expected";
4665
+ }
4666
+ if (message.baseKey != null && message.hasOwnProperty("baseKey")) {
4667
+ properties._baseKey = 1;
4668
+ if (!(message.baseKey && typeof message.baseKey.length === "number" || $util.isString(message.baseKey)))
4669
+ return "baseKey: buffer expected";
4670
+ }
4671
+ return null;
4672
+ };
4673
+ /**
4674
+ * Creates a PendingPreKey message from a plain object. Also converts values to their respective internal types.
4675
+ * @function fromObject
4676
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4677
+ * @static
4678
+ * @param {Object.<string,*>} object Plain object
4679
+ * @returns {SignalLocalStorageProtocol.SessionStructure.PendingPreKey} PendingPreKey
4680
+ */
4681
+ PendingPreKey.fromObject = function fromObject(object) {
4682
+ if (object instanceof $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey)
4683
+ return object;
4684
+ var message = new $root.SignalLocalStorageProtocol.SessionStructure.PendingPreKey();
4685
+ if (object.preKeyId != null)
4686
+ message.preKeyId = object.preKeyId >>> 0;
4687
+ if (object.signedPreKeyId != null)
4688
+ message.signedPreKeyId = object.signedPreKeyId | 0;
4689
+ if (object.baseKey != null)
4690
+ if (typeof object.baseKey === "string")
4691
+ $util.base64.decode(object.baseKey, message.baseKey = $util.newBuffer($util.base64.length(object.baseKey)), 0);
4692
+ else if (object.baseKey.length >= 0)
4693
+ message.baseKey = object.baseKey;
4694
+ return message;
4695
+ };
4696
+ /**
4697
+ * Creates a plain object from a PendingPreKey message. Also converts values to other types if specified.
4698
+ * @function toObject
4699
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4700
+ * @static
4701
+ * @param {SignalLocalStorageProtocol.SessionStructure.PendingPreKey} message PendingPreKey
4702
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
4703
+ * @returns {Object.<string,*>} Plain object
4704
+ */
4705
+ PendingPreKey.toObject = function toObject(message, options) {
4706
+ if (!options)
4707
+ options = {};
4708
+ var object = {};
4709
+ if (message.preKeyId != null && message.hasOwnProperty("preKeyId")) {
4710
+ object.preKeyId = message.preKeyId;
4711
+ if (options.oneofs)
4712
+ object._preKeyId = "preKeyId";
4713
+ }
4714
+ if (message.baseKey != null && message.hasOwnProperty("baseKey")) {
4715
+ object.baseKey = options.bytes === String ? $util.base64.encode(message.baseKey, 0, message.baseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.baseKey) : message.baseKey;
4716
+ if (options.oneofs)
4717
+ object._baseKey = "baseKey";
4718
+ }
4719
+ if (message.signedPreKeyId != null && message.hasOwnProperty("signedPreKeyId")) {
4720
+ object.signedPreKeyId = message.signedPreKeyId;
4721
+ if (options.oneofs)
4722
+ object._signedPreKeyId = "signedPreKeyId";
4723
+ }
4724
+ return object;
4725
+ };
4726
+ /**
4727
+ * Converts this PendingPreKey to JSON.
4728
+ * @function toJSON
4729
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4730
+ * @instance
4731
+ * @returns {Object.<string,*>} JSON object
4732
+ */
4733
+ PendingPreKey.prototype.toJSON = function toJSON() {
4734
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
4735
+ };
4736
+ /**
4737
+ * Gets the default type url for PendingPreKey
4738
+ * @function getTypeUrl
4739
+ * @memberof SignalLocalStorageProtocol.SessionStructure.PendingPreKey
4740
+ * @static
4741
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
4742
+ * @returns {string} The default type url
4743
+ */
4744
+ PendingPreKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
4745
+ if (typeUrlPrefix === undefined) {
4746
+ typeUrlPrefix = "type.googleapis.com";
4747
+ }
4748
+ return typeUrlPrefix + "/SignalLocalStorageProtocol.SessionStructure.PendingPreKey";
4749
+ };
4750
+ return PendingPreKey;
4751
+ })();
4752
+ return SessionStructure;
4753
+ })();
4754
+ return SignalLocalStorageProtocol;
4755
+ })();
4756
+ module.exports = $root;