|
146 | 146 | this.generateIdentityKeyPair = function () {
|
147 | 147 | return wrappedCrypto.generateKeyPair();
|
148 | 148 | };
|
149 |
| - this.generateRegistrationId = co.wrap($traceurRuntime.initGeneratorFunction(function $__7(extendedRange) { |
| 149 | + this.generateRegistrationId = co.wrap($traceurRuntime.initGeneratorFunction(function $__9(extendedRange) { |
150 | 150 | var upperLimit, bytes, number;
|
151 | 151 | return $traceurRuntime.createGeneratorInstance(function ($ctx) {
|
152 | 152 | while (true)
|
|
173 | 173 | default:
|
174 | 174 | return $ctx.end();
|
175 | 175 | }
|
176 |
| - }, $__7, this); |
| 176 | + }, $__9, this); |
177 | 177 | }));
|
178 |
| - this.generatePreKeys = co.wrap($traceurRuntime.initGeneratorFunction(function $__8(start, count) { |
179 |
| - var results, i, $__9, $__10, $__11, $__12, $__13, $__14; |
| 178 | + this.generatePreKeys = co.wrap($traceurRuntime.initGeneratorFunction(function $__10(start, count) { |
| 179 | + var results, i, $__11, $__12, $__13, $__14, $__15, $__16; |
180 | 180 | return $traceurRuntime.createGeneratorInstance(function ($ctx) {
|
181 | 181 | while (true)
|
182 | 182 | switch ($ctx.state) {
|
|
197 | 197 | $ctx.state = 11;
|
198 | 198 | break;
|
199 | 199 | case 5:
|
200 |
| - $__9 = results.push; |
201 |
| - $__10 = wrappedCrypto.generateKeyPair; |
202 |
| - $__11 = $__10.call(wrappedCrypto); |
| 200 | + $__11 = results.push; |
| 201 | + $__12 = wrappedCrypto.generateKeyPair; |
| 202 | + $__13 = $__12.call(wrappedCrypto); |
203 | 203 | $ctx.state = 6;
|
204 | 204 | break;
|
205 | 205 | case 6:
|
206 | 206 | $ctx.state = 2;
|
207 |
| - return $__11; |
| 207 | + return $__13; |
208 | 208 | case 2:
|
209 |
| - $__12 = $ctx.sent; |
| 209 | + $__14 = $ctx.sent; |
210 | 210 | $ctx.state = 4;
|
211 | 211 | break;
|
212 | 212 | case 4:
|
213 |
| - $__13 = { |
| 213 | + $__15 = { |
214 | 214 | id: (start + i) % 16777214 + 1,
|
215 |
| - keyPair: $__12 |
| 215 | + keyPair: $__14 |
216 | 216 | };
|
217 |
| - $__14 = $__9.call(results, $__13); |
| 217 | + $__16 = $__11.call(results, $__15); |
218 | 218 | $ctx.state = 8;
|
219 | 219 | break;
|
220 | 220 | case 9:
|
|
224 | 224 | default:
|
225 | 225 | return $ctx.end();
|
226 | 226 | }
|
227 |
| - }, $__8, this); |
| 227 | + }, $__10, this); |
228 | 228 | }));
|
229 |
| - this.generateLastResortPreKey = co.wrap($traceurRuntime.initGeneratorFunction(function $__15() { |
230 |
| - var $__16, $__17, $__18, $__19; |
| 229 | + this.generateLastResortPreKey = co.wrap($traceurRuntime.initGeneratorFunction(function $__17() { |
| 230 | + var $__18, $__19, $__20, $__21; |
231 | 231 | return $traceurRuntime.createGeneratorInstance(function ($ctx) {
|
232 | 232 | while (true)
|
233 | 233 | switch ($ctx.state) {
|
234 | 234 | case 0:
|
235 |
| - $__16 = wrappedCrypto.generateKeyPair; |
236 |
| - $__17 = $__16.call(wrappedCrypto); |
| 235 | + $__18 = wrappedCrypto.generateKeyPair; |
| 236 | + $__19 = $__18.call(wrappedCrypto); |
237 | 237 | $ctx.state = 6;
|
238 | 238 | break;
|
239 | 239 | case 6:
|
240 | 240 | $ctx.state = 2;
|
241 |
| - return $__17; |
| 241 | + return $__19; |
242 | 242 | case 2:
|
243 |
| - $__18 = $ctx.sent; |
| 243 | + $__20 = $ctx.sent; |
244 | 244 | $ctx.state = 4;
|
245 | 245 | break;
|
246 | 246 | case 4:
|
247 |
| - $__19 = { |
| 247 | + $__21 = { |
248 | 248 | id: 16777215,
|
249 |
| - keyPair: $__18 |
| 249 | + keyPair: $__20 |
250 | 250 | };
|
251 | 251 | $ctx.state = 8;
|
252 | 252 | break;
|
253 | 253 | case 8:
|
254 |
| - $ctx.returnValue = $__19; |
| 254 | + $ctx.returnValue = $__21; |
255 | 255 | $ctx.state = -2;
|
256 | 256 | break;
|
257 | 257 | default:
|
258 | 258 | return $ctx.end();
|
259 | 259 | }
|
260 |
| - }, $__15, this); |
| 260 | + }, $__17, this); |
261 | 261 | }));
|
262 |
| - this.generateSignedPreKey = co.wrap($traceurRuntime.initGeneratorFunction(function $__20(identityKeyPair, signedPreKeyId) { |
| 262 | + this.generateSignedPreKey = co.wrap($traceurRuntime.initGeneratorFunction(function $__22(identityKeyPair, signedPreKeyId) { |
263 | 263 | var keyPair, signature;
|
264 | 264 | return $traceurRuntime.createGeneratorInstance(function ($ctx) {
|
265 | 265 | while (true)
|
|
289 | 289 | default:
|
290 | 290 | return $ctx.end();
|
291 | 291 | }
|
292 |
| - }, $__20, this); |
| 292 | + }, $__22, this); |
293 | 293 | }));
|
294 | 294 | this.createSessionFromPreKeyBundle = sessionFactory.createSessionFromPreKeyBundle;
|
295 | 295 | this.encryptMessage = sessionCipher.encryptMessage;
|
296 | 296 | this.decryptWhisperMessage = sessionCipher.decryptWhisperMessage;
|
297 |
| - this.decryptPreKeyWhisperMessage = co.wrap($traceurRuntime.initGeneratorFunction(function $__21(session, preKeyWhisperMessageBytes) { |
298 |
| - var $__22, $__23, $__24; |
| 297 | + this.decryptPreKeyWhisperMessage = co.wrap($traceurRuntime.initGeneratorFunction(function $__23(session, preKeyWhisperMessageBytes) { |
| 298 | + var $__7, newSession, identityKey, registrationId, $__8, finalSession, message, $__24, $__25, $__26, $__27, $__28, $__29, $__30, $__31, $__32, $__33, $__34; |
299 | 299 | return $traceurRuntime.createGeneratorInstance(function ($ctx) {
|
300 | 300 | while (true)
|
301 | 301 | switch ($ctx.state) {
|
302 | 302 | case 0:
|
| 303 | + $__24 = sessionFactory.createSessionFromPreKeyWhisperMessage; |
| 304 | + $__25 = $__24.call(sessionFactory, session, preKeyWhisperMessageBytes); |
| 305 | + $ctx.state = 6; |
| 306 | + break; |
| 307 | + case 6: |
303 | 308 | $ctx.state = 2;
|
304 |
| - return sessionFactory.createSessionFromPreKeyWhisperMessage(session, preKeyWhisperMessageBytes); |
| 309 | + return $__25; |
305 | 310 | case 2:
|
306 |
| - session = $ctx.sent; |
| 311 | + $__26 = $ctx.sent; |
307 | 312 | $ctx.state = 4;
|
308 | 313 | break;
|
309 | 314 | case 4:
|
310 |
| - $__22 = sessionCipher.decryptPreKeyWhisperMessage; |
311 |
| - $__23 = $__22.call(sessionCipher, session, preKeyWhisperMessageBytes); |
312 |
| - $ctx.state = 10; |
313 |
| - break; |
314 |
| - case 10: |
315 |
| - $ctx.state = 6; |
316 |
| - return $__23; |
317 |
| - case 6: |
318 |
| - $__24 = $ctx.sent; |
| 315 | + $__7 = $__26; |
| 316 | + $__27 = $__7.session; |
| 317 | + newSession = $__27; |
| 318 | + $__28 = $__7.identityKey; |
| 319 | + identityKey = $__28; |
| 320 | + $__29 = $__7.registrationId; |
| 321 | + registrationId = $__29; |
319 | 322 | $ctx.state = 8;
|
320 | 323 | break;
|
321 | 324 | case 8:
|
322 |
| - $ctx.returnValue = $__24; |
| 325 | + $__30 = sessionCipher.decryptPreKeyWhisperMessage; |
| 326 | + $__31 = $__30.call(sessionCipher, newSession, preKeyWhisperMessageBytes); |
| 327 | + $ctx.state = 14; |
| 328 | + break; |
| 329 | + case 14: |
| 330 | + $ctx.state = 10; |
| 331 | + return $__31; |
| 332 | + case 10: |
| 333 | + $__32 = $ctx.sent; |
| 334 | + $ctx.state = 12; |
| 335 | + break; |
| 336 | + case 12: |
| 337 | + $__8 = $__32; |
| 338 | + $__33 = $__8.session; |
| 339 | + finalSession = $__33; |
| 340 | + $__34 = $__8.message; |
| 341 | + message = $__34; |
| 342 | + $ctx.state = 16; |
| 343 | + break; |
| 344 | + case 16: |
| 345 | + $ctx.returnValue = { |
| 346 | + message: message, |
| 347 | + session: finalSession, |
| 348 | + identityKey: identityKey, |
| 349 | + registrationId: registrationId |
| 350 | + }; |
323 | 351 | $ctx.state = -2;
|
324 | 352 | break;
|
325 | 353 | default:
|
326 | 354 | return $ctx.end();
|
327 | 355 | }
|
328 |
| - }, $__21, this); |
| 356 | + }, $__23, this); |
329 | 357 | }));
|
330 | 358 | Object.freeze(self);
|
331 | 359 | }
|
|
1698 | 1726 | $ctx.state = cachedSessionState.theirBaseKey && ArrayBufferUtils.areEqual(cachedSessionState.theirBaseKey, message.baseKey) ? 1 : 2;
|
1699 | 1727 | break;
|
1700 | 1728 | case 1:
|
1701 |
| - $ctx.returnValue = session; |
| 1729 | + $ctx.returnValue = { |
| 1730 | + session: session, |
| 1731 | + identityKey: message.identityKey, |
| 1732 | + registrationId: message.registrationId |
| 1733 | + }; |
1702 | 1734 | $ctx.state = -2;
|
1703 | 1735 | break;
|
1704 | 1736 | case 6:
|
|
1761 | 1793 | $ctx.state = 35;
|
1762 | 1794 | break;
|
1763 | 1795 | case 35:
|
1764 |
| - $ctx.returnValue = clonedSession; |
| 1796 | + $ctx.returnValue = { |
| 1797 | + session: clonedSession, |
| 1798 | + identityKey: message.identityKey, |
| 1799 | + registrationId: message.registrationId |
| 1800 | + }; |
1765 | 1801 | $ctx.state = -2;
|
1766 | 1802 | break;
|
1767 | 1803 | default:
|
|
0 commit comments