@novnc/novnc 1.6.0-ga8dfd6a → 1.6.0-gd49d2b3

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.
package/lib/base64.js CHANGED
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports["default"] = void 0;
8
8
  var Log = _interopRequireWildcard(require("./util/logging.js"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
11
10
  /* This Source Code Form is subject to the terms of the Mozilla Public
12
11
  * License, v. 2.0. If a copy of the MPL was not distributed with this
13
12
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package/lib/crypto/aes.js CHANGED
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.AESECBCipher = exports.AESEAXCipher = void 0;
7
7
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
9
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
9
10
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
11
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
12
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
@@ -28,19 +29,18 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
28
29
  }, {
29
30
  key: "_importKey",
30
31
  value: function () {
31
- var _importKey2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, extractable, keyUsages) {
32
- return _regeneratorRuntime().wrap(function _callee$(_context) {
33
- while (1) switch (_context.prev = _context.next) {
32
+ var _importKey2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(key, extractable, keyUsages) {
33
+ return _regenerator().w(function (_context) {
34
+ while (1) switch (_context.n) {
34
35
  case 0:
35
- _context.next = 2;
36
+ _context.n = 1;
36
37
  return window.crypto.subtle.importKey("raw", key, {
37
38
  name: "AES-CBC"
38
39
  }, extractable, keyUsages);
40
+ case 1:
41
+ this._key = _context.v;
39
42
  case 2:
40
- this._key = _context.sent;
41
- case 3:
42
- case "end":
43
- return _context.stop();
43
+ return _context.a(2);
44
44
  }
45
45
  }, _callee, this);
46
46
  }));
@@ -52,44 +52,41 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
52
52
  }, {
53
53
  key: "encrypt",
54
54
  value: function () {
55
- var _encrypt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_algorithm, plaintext) {
56
- var x, n, i, y;
57
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
58
- while (1) switch (_context2.prev = _context2.next) {
55
+ var _encrypt = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_algorithm, plaintext) {
56
+ var x, n, i, y, _t, _t2;
57
+ return _regenerator().w(function (_context2) {
58
+ while (1) switch (_context2.n) {
59
59
  case 0:
60
60
  x = new Uint8Array(plaintext);
61
61
  if (!(x.length % 16 !== 0 || this._key === null)) {
62
- _context2.next = 3;
62
+ _context2.n = 1;
63
63
  break;
64
64
  }
65
- return _context2.abrupt("return", null);
66
- case 3:
65
+ return _context2.a(2, null);
66
+ case 1:
67
67
  n = x.length / 16;
68
68
  i = 0;
69
- case 5:
69
+ case 2:
70
70
  if (!(i < n)) {
71
- _context2.next = 15;
71
+ _context2.n = 5;
72
72
  break;
73
73
  }
74
- _context2.t0 = Uint8Array;
75
- _context2.next = 9;
74
+ _t = Uint8Array;
75
+ _context2.n = 3;
76
76
  return window.crypto.subtle.encrypt({
77
77
  name: "AES-CBC",
78
78
  iv: new Uint8Array(16)
79
79
  }, this._key, x.slice(i * 16, i * 16 + 16));
80
- case 9:
81
- _context2.t1 = _context2.sent;
82
- y = new _context2.t0(_context2.t1).slice(0, 16);
80
+ case 3:
81
+ _t2 = _context2.v;
82
+ y = new _t(_t2).slice(0, 16);
83
83
  x.set(y, i * 16);
84
- case 12:
84
+ case 4:
85
85
  i++;
86
- _context2.next = 5;
86
+ _context2.n = 2;
87
87
  break;
88
- case 15:
89
- return _context2.abrupt("return", x);
90
- case 16:
91
- case "end":
92
- return _context2.stop();
88
+ case 5:
89
+ return _context2.a(2, x);
93
90
  }
94
91
  }, _callee2, this);
95
92
  }));
@@ -101,19 +98,16 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
101
98
  }], [{
102
99
  key: "importKey",
103
100
  value: function () {
104
- var _importKey3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, _algorithm, extractable, keyUsages) {
101
+ var _importKey3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key, _algorithm, extractable, keyUsages) {
105
102
  var cipher;
106
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
107
- while (1) switch (_context3.prev = _context3.next) {
103
+ return _regenerator().w(function (_context3) {
104
+ while (1) switch (_context3.n) {
108
105
  case 0:
109
106
  cipher = new AESECBCipher();
110
- _context3.next = 3;
107
+ _context3.n = 1;
111
108
  return cipher._importKey(key, extractable, keyUsages);
112
- case 3:
113
- return _context3.abrupt("return", cipher);
114
- case 4:
115
- case "end":
116
- return _context3.stop();
109
+ case 1:
110
+ return _context3.a(2, cipher);
117
111
  }
118
112
  }, _callee3);
119
113
  }));
@@ -145,26 +139,23 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
145
139
  }, {
146
140
  key: "_encryptBlock",
147
141
  value: function () {
148
- var _encryptBlock2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(block) {
142
+ var _encryptBlock2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(block) {
149
143
  var encrypted;
150
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
151
- while (1) switch (_context4.prev = _context4.next) {
144
+ return _regenerator().w(function (_context4) {
145
+ while (1) switch (_context4.n) {
152
146
  case 0:
153
- _context4.next = 2;
147
+ _context4.n = 1;
154
148
  return window.crypto.subtle.encrypt({
155
149
  name: "AES-CBC",
156
150
  iv: this._zeroBlock
157
151
  }, this._cbcKey, block);
158
- case 2:
159
- encrypted = _context4.sent;
160
- return _context4.abrupt("return", new Uint8Array(encrypted).slice(0, 16));
161
- case 4:
162
- case "end":
163
- return _context4.stop();
152
+ case 1:
153
+ encrypted = _context4.v;
154
+ return _context4.a(2, new Uint8Array(encrypted).slice(0, 16));
164
155
  }
165
156
  }, _callee4, this);
166
157
  }));
167
- function _encryptBlock(_x10) {
158
+ function _encryptBlock(_x0) {
168
159
  return _encryptBlock2.apply(this, arguments);
169
160
  }
170
161
  return _encryptBlock;
@@ -172,15 +163,15 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
172
163
  }, {
173
164
  key: "_initCMAC",
174
165
  value: function () {
175
- var _initCMAC2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
166
+ var _initCMAC2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
176
167
  var k1, k2, v, i, lut;
177
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
178
- while (1) switch (_context5.prev = _context5.next) {
168
+ return _regenerator().w(function (_context5) {
169
+ while (1) switch (_context5.n) {
179
170
  case 0:
180
- _context5.next = 2;
171
+ _context5.n = 1;
181
172
  return this._encryptBlock(this._zeroBlock);
182
- case 2:
183
- k1 = _context5.sent;
173
+ case 1:
174
+ k1 = _context5.v;
184
175
  k2 = new Uint8Array(16);
185
176
  v = k1[0] >>> 6;
186
177
  for (i = 0; i < 15; i++) {
@@ -193,9 +184,8 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
193
184
  k1[15] = k1[15] << 1 ^ lut[v >> 1];
194
185
  this._k1 = k1;
195
186
  this._k2 = k2;
196
- case 12:
197
- case "end":
198
- return _context5.stop();
187
+ case 2:
188
+ return _context5.a(2);
199
189
  }
200
190
  }, _callee5, this);
201
191
  }));
@@ -207,27 +197,24 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
207
197
  }, {
208
198
  key: "_encryptCTR",
209
199
  value: function () {
210
- var _encryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data, counter) {
200
+ var _encryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(data, counter) {
211
201
  var encrypted;
212
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
213
- while (1) switch (_context6.prev = _context6.next) {
202
+ return _regenerator().w(function (_context6) {
203
+ while (1) switch (_context6.n) {
214
204
  case 0:
215
- _context6.next = 2;
205
+ _context6.n = 1;
216
206
  return window.crypto.subtle.encrypt({
217
207
  name: "AES-CTR",
218
208
  counter: counter,
219
209
  length: 128
220
210
  }, this._ctrKey, data);
221
- case 2:
222
- encrypted = _context6.sent;
223
- return _context6.abrupt("return", new Uint8Array(encrypted));
224
- case 4:
225
- case "end":
226
- return _context6.stop();
211
+ case 1:
212
+ encrypted = _context6.v;
213
+ return _context6.a(2, new Uint8Array(encrypted));
227
214
  }
228
215
  }, _callee6, this);
229
216
  }));
230
- function _encryptCTR(_x11, _x12) {
217
+ function _encryptCTR(_x1, _x10) {
231
218
  return _encryptCTR2.apply(this, arguments);
232
219
  }
233
220
  return _encryptCTR;
@@ -235,27 +222,24 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
235
222
  }, {
236
223
  key: "_decryptCTR",
237
224
  value: function () {
238
- var _decryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data, counter) {
225
+ var _decryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(data, counter) {
239
226
  var decrypted;
240
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
241
- while (1) switch (_context7.prev = _context7.next) {
227
+ return _regenerator().w(function (_context7) {
228
+ while (1) switch (_context7.n) {
242
229
  case 0:
243
- _context7.next = 2;
230
+ _context7.n = 1;
244
231
  return window.crypto.subtle.decrypt({
245
232
  name: "AES-CTR",
246
233
  counter: counter,
247
234
  length: 128
248
235
  }, this._ctrKey, data);
249
- case 2:
250
- decrypted = _context7.sent;
251
- return _context7.abrupt("return", new Uint8Array(decrypted));
252
- case 4:
253
- case "end":
254
- return _context7.stop();
236
+ case 1:
237
+ decrypted = _context7.v;
238
+ return _context7.a(2, new Uint8Array(decrypted));
255
239
  }
256
240
  }, _callee7, this);
257
241
  }));
258
- function _decryptCTR(_x13, _x14) {
242
+ function _decryptCTR(_x11, _x12) {
259
243
  return _decryptCTR2.apply(this, arguments);
260
244
  }
261
245
  return _decryptCTR;
@@ -263,17 +247,17 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
263
247
  }, {
264
248
  key: "_computeCMAC",
265
249
  value: function () {
266
- var _computeCMAC2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(data, prefixBlock) {
250
+ var _computeCMAC2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(data, prefixBlock) {
267
251
  var n, m, r, cbcData, i, _i, cbcEncrypted, mac;
268
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
269
- while (1) switch (_context8.prev = _context8.next) {
252
+ return _regenerator().w(function (_context8) {
253
+ while (1) switch (_context8.n) {
270
254
  case 0:
271
255
  if (!(prefixBlock.length !== 16)) {
272
- _context8.next = 2;
256
+ _context8.n = 1;
273
257
  break;
274
258
  }
275
- return _context8.abrupt("return", null);
276
- case 2:
259
+ return _context8.a(2, null);
260
+ case 1:
277
261
  n = Math.floor(data.length / 16);
278
262
  m = Math.ceil(data.length / 16);
279
263
  r = data.length - n * 16;
@@ -290,23 +274,20 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
290
274
  cbcData[(n + 1) * 16 + _i] ^= this._k2[_i];
291
275
  }
292
276
  }
293
- _context8.next = 11;
277
+ _context8.n = 2;
294
278
  return window.crypto.subtle.encrypt({
295
279
  name: "AES-CBC",
296
280
  iv: this._zeroBlock
297
281
  }, this._cbcKey, cbcData);
298
- case 11:
299
- cbcEncrypted = _context8.sent;
282
+ case 2:
283
+ cbcEncrypted = _context8.v;
300
284
  cbcEncrypted = new Uint8Array(cbcEncrypted);
301
285
  mac = cbcEncrypted.slice(cbcEncrypted.length - 32, cbcEncrypted.length - 16);
302
- return _context8.abrupt("return", mac);
303
- case 15:
304
- case "end":
305
- return _context8.stop();
286
+ return _context8.a(2, mac);
306
287
  }
307
288
  }, _callee8, this);
308
289
  }));
309
- function _computeCMAC(_x15, _x16) {
290
+ function _computeCMAC(_x13, _x14) {
310
291
  return _computeCMAC2.apply(this, arguments);
311
292
  }
312
293
  return _computeCMAC;
@@ -314,32 +295,31 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
314
295
  }, {
315
296
  key: "_importKey",
316
297
  value: function () {
317
- var _importKey4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key) {
318
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
319
- while (1) switch (_context9.prev = _context9.next) {
298
+ var _importKey4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(key) {
299
+ return _regenerator().w(function (_context9) {
300
+ while (1) switch (_context9.n) {
320
301
  case 0:
321
302
  this._rawKey = key;
322
- _context9.next = 3;
303
+ _context9.n = 1;
323
304
  return window.crypto.subtle.importKey("raw", key, {
324
305
  name: "AES-CTR"
325
306
  }, false, ["encrypt", "decrypt"]);
326
- case 3:
327
- this._ctrKey = _context9.sent;
328
- _context9.next = 6;
307
+ case 1:
308
+ this._ctrKey = _context9.v;
309
+ _context9.n = 2;
329
310
  return window.crypto.subtle.importKey("raw", key, {
330
311
  name: "AES-CBC"
331
312
  }, false, ["encrypt"]);
332
- case 6:
333
- this._cbcKey = _context9.sent;
334
- _context9.next = 9;
313
+ case 2:
314
+ this._cbcKey = _context9.v;
315
+ _context9.n = 3;
335
316
  return this._initCMAC();
336
- case 9:
337
- case "end":
338
- return _context9.stop();
317
+ case 3:
318
+ return _context9.a(2);
339
319
  }
340
320
  }, _callee9, this);
341
321
  }));
342
- function _importKey(_x17) {
322
+ function _importKey(_x15) {
343
323
  return _importKey4.apply(this, arguments);
344
324
  }
345
325
  return _importKey;
@@ -347,43 +327,40 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
347
327
  }, {
348
328
  key: "encrypt",
349
329
  value: function () {
350
- var _encrypt2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(algorithm, message) {
330
+ var _encrypt2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(algorithm, message) {
351
331
  var ad, nonce, nCMAC, encrypted, adCMAC, mac, i, res;
352
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
353
- while (1) switch (_context10.prev = _context10.next) {
332
+ return _regenerator().w(function (_context0) {
333
+ while (1) switch (_context0.n) {
354
334
  case 0:
355
335
  ad = algorithm.additionalData;
356
336
  nonce = algorithm.iv;
357
- _context10.next = 4;
337
+ _context0.n = 1;
358
338
  return this._computeCMAC(nonce, this._prefixBlock0);
359
- case 4:
360
- nCMAC = _context10.sent;
361
- _context10.next = 7;
339
+ case 1:
340
+ nCMAC = _context0.v;
341
+ _context0.n = 2;
362
342
  return this._encryptCTR(message, nCMAC);
363
- case 7:
364
- encrypted = _context10.sent;
365
- _context10.next = 10;
343
+ case 2:
344
+ encrypted = _context0.v;
345
+ _context0.n = 3;
366
346
  return this._computeCMAC(ad, this._prefixBlock1);
367
- case 10:
368
- adCMAC = _context10.sent;
369
- _context10.next = 13;
347
+ case 3:
348
+ adCMAC = _context0.v;
349
+ _context0.n = 4;
370
350
  return this._computeCMAC(encrypted, this._prefixBlock2);
371
- case 13:
372
- mac = _context10.sent;
351
+ case 4:
352
+ mac = _context0.v;
373
353
  for (i = 0; i < 16; i++) {
374
354
  mac[i] ^= nCMAC[i] ^ adCMAC[i];
375
355
  }
376
356
  res = new Uint8Array(16 + encrypted.length);
377
357
  res.set(encrypted);
378
358
  res.set(mac, encrypted.length);
379
- return _context10.abrupt("return", res);
380
- case 19:
381
- case "end":
382
- return _context10.stop();
359
+ return _context0.a(2, res);
383
360
  }
384
- }, _callee10, this);
361
+ }, _callee0, this);
385
362
  }));
386
- function encrypt(_x18, _x19) {
363
+ function encrypt(_x16, _x17) {
387
364
  return _encrypt2.apply(this, arguments);
388
365
  }
389
366
  return encrypt;
@@ -391,64 +368,61 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
391
368
  }, {
392
369
  key: "decrypt",
393
370
  value: function () {
394
- var _decrypt = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(algorithm, data) {
371
+ var _decrypt = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(algorithm, data) {
395
372
  var encrypted, ad, nonce, mac, nCMAC, adCMAC, computedMac, i, _i2, res;
396
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
397
- while (1) switch (_context11.prev = _context11.next) {
373
+ return _regenerator().w(function (_context1) {
374
+ while (1) switch (_context1.n) {
398
375
  case 0:
399
376
  encrypted = data.slice(0, data.length - 16);
400
377
  ad = algorithm.additionalData;
401
378
  nonce = algorithm.iv;
402
379
  mac = data.slice(data.length - 16);
403
- _context11.next = 6;
380
+ _context1.n = 1;
404
381
  return this._computeCMAC(nonce, this._prefixBlock0);
405
- case 6:
406
- nCMAC = _context11.sent;
407
- _context11.next = 9;
382
+ case 1:
383
+ nCMAC = _context1.v;
384
+ _context1.n = 2;
408
385
  return this._computeCMAC(ad, this._prefixBlock1);
409
- case 9:
410
- adCMAC = _context11.sent;
411
- _context11.next = 12;
386
+ case 2:
387
+ adCMAC = _context1.v;
388
+ _context1.n = 3;
412
389
  return this._computeCMAC(encrypted, this._prefixBlock2);
413
- case 12:
414
- computedMac = _context11.sent;
390
+ case 3:
391
+ computedMac = _context1.v;
415
392
  for (i = 0; i < 16; i++) {
416
393
  computedMac[i] ^= nCMAC[i] ^ adCMAC[i];
417
394
  }
418
395
  if (!(computedMac.length !== mac.length)) {
419
- _context11.next = 16;
396
+ _context1.n = 4;
420
397
  break;
421
398
  }
422
- return _context11.abrupt("return", null);
423
- case 16:
399
+ return _context1.a(2, null);
400
+ case 4:
424
401
  _i2 = 0;
425
- case 17:
402
+ case 5:
426
403
  if (!(_i2 < mac.length)) {
427
- _context11.next = 23;
404
+ _context1.n = 7;
428
405
  break;
429
406
  }
430
407
  if (!(computedMac[_i2] !== mac[_i2])) {
431
- _context11.next = 20;
408
+ _context1.n = 6;
432
409
  break;
433
410
  }
434
- return _context11.abrupt("return", null);
435
- case 20:
411
+ return _context1.a(2, null);
412
+ case 6:
436
413
  _i2++;
437
- _context11.next = 17;
414
+ _context1.n = 5;
438
415
  break;
439
- case 23:
440
- _context11.next = 25;
416
+ case 7:
417
+ _context1.n = 8;
441
418
  return this._decryptCTR(encrypted, nCMAC);
442
- case 25:
443
- res = _context11.sent;
444
- return _context11.abrupt("return", res);
445
- case 27:
446
- case "end":
447
- return _context11.stop();
419
+ case 8:
420
+ res = _context1.v;
421
+ return _context1.a(2, res);
448
422
  }
449
- }, _callee11, this);
423
+ }, _callee1, this);
450
424
  }));
451
- function decrypt(_x20, _x21) {
425
+ function decrypt(_x18, _x19) {
452
426
  return _decrypt.apply(this, arguments);
453
427
  }
454
428
  return decrypt;
@@ -456,23 +430,20 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
456
430
  }], [{
457
431
  key: "importKey",
458
432
  value: function () {
459
- var _importKey5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key, _algorithm, _extractable, _keyUsages) {
433
+ var _importKey5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(key, _algorithm, _extractable, _keyUsages) {
460
434
  var cipher;
461
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
462
- while (1) switch (_context12.prev = _context12.next) {
435
+ return _regenerator().w(function (_context10) {
436
+ while (1) switch (_context10.n) {
463
437
  case 0:
464
438
  cipher = new AESEAXCipher();
465
- _context12.next = 3;
439
+ _context10.n = 1;
466
440
  return cipher._importKey(key);
467
- case 3:
468
- return _context12.abrupt("return", cipher);
469
- case 4:
470
- case "end":
471
- return _context12.stop();
441
+ case 1:
442
+ return _context10.a(2, cipher);
472
443
  }
473
- }, _callee12);
444
+ }, _callee10);
474
445
  }));
475
- function importKey(_x22, _x23, _x24, _x25) {
446
+ function importKey(_x20, _x21, _x22, _x23) {
476
447
  return _importKey5.apply(this, arguments);
477
448
  }
478
449
  return importKey;