|
292 | 292 | }, $__20, this);
|
293 | 293 | }));
|
294 | 294 | this.createSessionFromPreKeyBundle = sessionFactory.createSessionFromPreKeyBundle;
|
295 |
| - this.createSessionFromPreKeyWhisperMessage = sessionFactory.createSessionFromPreKeyWhisperMessage; |
296 | 295 | this.encryptMessage = sessionCipher.encryptMessage;
|
297 | 296 | this.decryptWhisperMessage = sessionCipher.decryptWhisperMessage;
|
298 |
| - this.decryptPreKeyWhisperMessage = sessionCipher.decryptPreKeyWhisperMessage; |
| 297 | + this.decryptPreKeyWhisperMessage = co.wrap($traceurRuntime.initGeneratorFunction(function $__21(session, preKeyWhisperMessageBytes) { |
| 298 | + var $__22, $__23, $__24; |
| 299 | + return $traceurRuntime.createGeneratorInstance(function ($ctx) { |
| 300 | + while (true) |
| 301 | + switch ($ctx.state) { |
| 302 | + case 0: |
| 303 | + $ctx.state = 2; |
| 304 | + return sessionFactory.createSessionFromPreKeyWhisperMessage(session, preKeyWhisperMessageBytes); |
| 305 | + case 2: |
| 306 | + session = $ctx.sent; |
| 307 | + $ctx.state = 4; |
| 308 | + break; |
| 309 | + 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; |
| 319 | + $ctx.state = 8; |
| 320 | + break; |
| 321 | + case 8: |
| 322 | + $ctx.returnValue = $__24; |
| 323 | + $ctx.state = -2; |
| 324 | + break; |
| 325 | + default: |
| 326 | + return $ctx.end(); |
| 327 | + } |
| 328 | + }, $__21, this); |
| 329 | + })); |
299 | 330 | Object.freeze(self);
|
300 | 331 | }
|
301 | 332 | var $__default = Axolotl;
|
|
959 | 990 | var ProtocolConstants = ($__ProtocolConstants__ = _require(9), $__ProtocolConstants__ && $__ProtocolConstants__.__esModule && $__ProtocolConstants__ || { default: $__ProtocolConstants__ }).default;
|
960 | 991 | var ArrayBufferUtils = ($__ArrayBufferUtils__ = _require(1), $__ArrayBufferUtils__ && $__ArrayBufferUtils__.__esModule && $__ArrayBufferUtils__ || { default: $__ArrayBufferUtils__ }).default;
|
961 | 992 | var SessionState = ($__SessionState__ = _require(14), $__SessionState__ && $__SessionState__.__esModule && $__SessionState__ || { default: $__SessionState__ }).default;
|
962 |
| - function Session(session) { |
963 |
| - var self = this; |
964 |
| - var states = []; |
| 993 | + var Session = function Session(session) { |
| 994 | + this.states = []; |
965 | 995 | if (session) {
|
966 |
| - for (var $__3 = session.states[$traceurRuntime.toProperty(Symbol.iterator)](), $__4 = void 0; !($__4 = $__3.next()).done;) { |
967 |
| - var state = $__4.value; |
| 996 | + for (var $__4 = session.states[$traceurRuntime.toProperty(Symbol.iterator)](), $__5 = void 0; !($__5 = $__4.next()).done;) { |
| 997 | + var state = $__5.value; |
968 | 998 | {
|
969 |
| - states.push(new SessionState(state)); |
| 999 | + this.states.push(new SessionState(state)); |
970 | 1000 | }
|
971 | 1001 | }
|
972 | 1002 | }
|
973 |
| - Object.defineProperty(self, 'states', { |
974 |
| - get: function () { |
975 |
| - return states; |
976 |
| - } |
977 |
| - }); |
978 |
| - self.mostRecentState = function () { |
979 |
| - return states[0]; |
980 |
| - }; |
981 |
| - self.addState = function (state) { |
982 |
| - states.unshift(state); |
983 |
| - if (states.length > ProtocolConstants.maximumSessionStatesPerIdentity) { |
984 |
| - states.pop(); |
| 1003 | + Object.seal(this); |
| 1004 | + }; |
| 1005 | + $traceurRuntime.createClass(Session, { |
| 1006 | + mostRecentState: function () { |
| 1007 | + return this.states[0]; |
| 1008 | + }, |
| 1009 | + addState: function (state) { |
| 1010 | + this.states.unshift(state); |
| 1011 | + if (this.states.length > ProtocolConstants.maximumSessionStatesPerIdentity) { |
| 1012 | + this.states.pop(); |
985 | 1013 | }
|
986 |
| - }; |
987 |
| - self.removeState = function (state) { |
988 |
| - var index = states.indexOf(state); |
989 |
| - states.splice(index, 1); |
990 |
| - }; |
991 |
| - Object.freeze(this); |
992 |
| - } |
| 1014 | + }, |
| 1015 | + removeState: function (state) { |
| 1016 | + var index = this.states.indexOf(state); |
| 1017 | + this.states.splice(index, 1); |
| 1018 | + } |
| 1019 | + }, {}); |
993 | 1020 | var $__default = Session;
|
994 | 1021 | },
|
995 | 1022 | function (module, exports) {
|
|
0 commit comments