@novnc/novnc 1.3.0 → 1.4.0-beta
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/AUTHORS +2 -2
- package/LICENSE.txt +1 -1
- package/README.md +23 -7
- package/core/decoders/jpeg.js +141 -0
- package/core/decoders/raw.js +1 -1
- package/core/decoders/zrle.js +185 -0
- package/core/des.js +1 -1
- package/core/display.js +12 -0
- package/core/encodings.js +4 -0
- package/core/input/keyboard.js +10 -0
- package/core/ra2.js +567 -0
- package/core/rfb.js +469 -84
- package/core/util/browser.js +56 -7
- package/core/util/cursor.js +4 -0
- package/core/util/md5.js +79 -0
- package/docs/API.md +318 -157
- package/lib/base64.js +20 -34
- package/lib/decoders/copyrect.js +5 -12
- package/lib/decoders/hextile.js +17 -47
- package/lib/decoders/jpeg.js +149 -0
- package/lib/decoders/raw.js +10 -23
- package/lib/decoders/rre.js +5 -16
- package/lib/decoders/tight.js +13 -79
- package/lib/decoders/tightpng.js +8 -28
- package/lib/decoders/zrle.js +188 -0
- package/lib/deflator.js +9 -23
- package/lib/des.js +24 -37
- package/lib/display.js +62 -108
- package/lib/encodings.js +7 -8
- package/lib/inflator.js +6 -19
- package/lib/input/domkeytable.js +77 -48
- package/lib/input/fixedkeys.js +8 -3
- package/lib/input/gesturehandler.js +86 -153
- package/lib/input/keyboard.js +62 -91
- package/lib/input/keysym.js +14 -270
- package/lib/input/keysymdef.js +5 -7
- package/lib/input/util.js +43 -85
- package/lib/input/vkeys.js +0 -3
- package/lib/input/xtscancodes.js +1 -168
- package/lib/ra2.js +1005 -0
- package/lib/rfb.js +795 -923
- package/lib/util/browser.js +66 -29
- package/lib/util/cursor.js +29 -66
- package/lib/util/element.js +3 -5
- package/lib/util/events.js +23 -30
- package/lib/util/eventtarget.js +5 -14
- package/lib/util/int.js +1 -2
- package/lib/util/logging.js +1 -19
- package/lib/util/md5.js +77 -0
- package/lib/util/strings.js +3 -5
- package/lib/vendor/pako/lib/utils/common.js +8 -17
- package/lib/vendor/pako/lib/zlib/adler32.js +3 -7
- package/lib/vendor/pako/lib/zlib/constants.js +2 -5
- package/lib/vendor/pako/lib/zlib/crc32.js +5 -12
- package/lib/vendor/pako/lib/zlib/deflate.js +213 -618
- package/lib/vendor/pako/lib/zlib/gzheader.js +1 -13
- package/lib/vendor/pako/lib/zlib/inffast.js +60 -176
- package/lib/vendor/pako/lib/zlib/inflate.js +398 -888
- package/lib/vendor/pako/lib/zlib/inftrees.js +63 -169
- package/lib/vendor/pako/lib/zlib/messages.js +1 -11
- package/lib/vendor/pako/lib/zlib/trees.js +246 -588
- package/lib/vendor/pako/lib/zlib/zstream.js +2 -18
- package/lib/websock.js +37 -88
- package/package.json +32 -35
package/lib/ra2.js
ADDED
|
@@ -0,0 +1,1005 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.RSACipher = exports.RA2Cipher = exports.AESEAXCipher = void 0;
|
|
7
|
+
var _base = _interopRequireDefault(require("./base64.js"));
|
|
8
|
+
var _strings = require("./util/strings.js");
|
|
9
|
+
var _eventtarget = _interopRequireDefault(require("./util/eventtarget.js"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
27
|
+
var AESEAXCipher = /*#__PURE__*/function () {
|
|
28
|
+
function AESEAXCipher() {
|
|
29
|
+
_classCallCheck(this, AESEAXCipher);
|
|
30
|
+
this._rawKey = null;
|
|
31
|
+
this._ctrKey = null;
|
|
32
|
+
this._cbcKey = null;
|
|
33
|
+
this._zeroBlock = new Uint8Array(16);
|
|
34
|
+
this._prefixBlock0 = this._zeroBlock;
|
|
35
|
+
this._prefixBlock1 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
|
|
36
|
+
this._prefixBlock2 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]);
|
|
37
|
+
}
|
|
38
|
+
_createClass(AESEAXCipher, [{
|
|
39
|
+
key: "_encryptBlock",
|
|
40
|
+
value: function () {
|
|
41
|
+
var _encryptBlock2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(block) {
|
|
42
|
+
var encrypted;
|
|
43
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
|
+
while (1) switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
_context.next = 2;
|
|
47
|
+
return window.crypto.subtle.encrypt({
|
|
48
|
+
name: "AES-CBC",
|
|
49
|
+
iv: this._zeroBlock
|
|
50
|
+
}, this._cbcKey, block);
|
|
51
|
+
case 2:
|
|
52
|
+
encrypted = _context.sent;
|
|
53
|
+
return _context.abrupt("return", new Uint8Array(encrypted).slice(0, 16));
|
|
54
|
+
case 4:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}, _callee, this);
|
|
59
|
+
}));
|
|
60
|
+
function _encryptBlock(_x) {
|
|
61
|
+
return _encryptBlock2.apply(this, arguments);
|
|
62
|
+
}
|
|
63
|
+
return _encryptBlock;
|
|
64
|
+
}()
|
|
65
|
+
}, {
|
|
66
|
+
key: "_initCMAC",
|
|
67
|
+
value: function () {
|
|
68
|
+
var _initCMAC2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
69
|
+
var k1, k2, v, i, lut;
|
|
70
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
_context2.next = 2;
|
|
74
|
+
return this._encryptBlock(this._zeroBlock);
|
|
75
|
+
case 2:
|
|
76
|
+
k1 = _context2.sent;
|
|
77
|
+
k2 = new Uint8Array(16);
|
|
78
|
+
v = k1[0] >>> 6;
|
|
79
|
+
for (i = 0; i < 15; i++) {
|
|
80
|
+
k2[i] = k1[i + 1] >> 6 | k1[i] << 2;
|
|
81
|
+
k1[i] = k1[i + 1] >> 7 | k1[i] << 1;
|
|
82
|
+
}
|
|
83
|
+
lut = [0x0, 0x87, 0x0e, 0x89];
|
|
84
|
+
k2[14] ^= v >>> 1;
|
|
85
|
+
k2[15] = k1[15] << 2 ^ lut[v];
|
|
86
|
+
k1[15] = k1[15] << 1 ^ lut[v >> 1];
|
|
87
|
+
this._k1 = k1;
|
|
88
|
+
this._k2 = k2;
|
|
89
|
+
case 12:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context2.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee2, this);
|
|
94
|
+
}));
|
|
95
|
+
function _initCMAC() {
|
|
96
|
+
return _initCMAC2.apply(this, arguments);
|
|
97
|
+
}
|
|
98
|
+
return _initCMAC;
|
|
99
|
+
}()
|
|
100
|
+
}, {
|
|
101
|
+
key: "_encryptCTR",
|
|
102
|
+
value: function () {
|
|
103
|
+
var _encryptCTR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data, counter) {
|
|
104
|
+
var encrypted;
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
106
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
_context3.next = 2;
|
|
109
|
+
return window.crypto.subtle.encrypt({
|
|
110
|
+
"name": "AES-CTR",
|
|
111
|
+
counter: counter,
|
|
112
|
+
length: 128
|
|
113
|
+
}, this._ctrKey, data);
|
|
114
|
+
case 2:
|
|
115
|
+
encrypted = _context3.sent;
|
|
116
|
+
return _context3.abrupt("return", new Uint8Array(encrypted));
|
|
117
|
+
case 4:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context3.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee3, this);
|
|
122
|
+
}));
|
|
123
|
+
function _encryptCTR(_x2, _x3) {
|
|
124
|
+
return _encryptCTR2.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return _encryptCTR;
|
|
127
|
+
}()
|
|
128
|
+
}, {
|
|
129
|
+
key: "_decryptCTR",
|
|
130
|
+
value: function () {
|
|
131
|
+
var _decryptCTR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data, counter) {
|
|
132
|
+
var decrypted;
|
|
133
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
134
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
_context4.next = 2;
|
|
137
|
+
return window.crypto.subtle.decrypt({
|
|
138
|
+
"name": "AES-CTR",
|
|
139
|
+
counter: counter,
|
|
140
|
+
length: 128
|
|
141
|
+
}, this._ctrKey, data);
|
|
142
|
+
case 2:
|
|
143
|
+
decrypted = _context4.sent;
|
|
144
|
+
return _context4.abrupt("return", new Uint8Array(decrypted));
|
|
145
|
+
case 4:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context4.stop();
|
|
148
|
+
}
|
|
149
|
+
}, _callee4, this);
|
|
150
|
+
}));
|
|
151
|
+
function _decryptCTR(_x4, _x5) {
|
|
152
|
+
return _decryptCTR2.apply(this, arguments);
|
|
153
|
+
}
|
|
154
|
+
return _decryptCTR;
|
|
155
|
+
}()
|
|
156
|
+
}, {
|
|
157
|
+
key: "_computeCMAC",
|
|
158
|
+
value: function () {
|
|
159
|
+
var _computeCMAC2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data, prefixBlock) {
|
|
160
|
+
var n, m, r, cbcData, i, _i, cbcEncrypted, mac;
|
|
161
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
162
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
if (!(prefixBlock.length !== 16)) {
|
|
165
|
+
_context5.next = 2;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
return _context5.abrupt("return", null);
|
|
169
|
+
case 2:
|
|
170
|
+
n = Math.floor(data.length / 16);
|
|
171
|
+
m = Math.ceil(data.length / 16);
|
|
172
|
+
r = data.length - n * 16;
|
|
173
|
+
cbcData = new Uint8Array((m + 1) * 16);
|
|
174
|
+
cbcData.set(prefixBlock);
|
|
175
|
+
cbcData.set(data, 16);
|
|
176
|
+
if (r === 0) {
|
|
177
|
+
for (i = 0; i < 16; i++) {
|
|
178
|
+
cbcData[n * 16 + i] ^= this._k1[i];
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
cbcData[(n + 1) * 16 + r] = 0x80;
|
|
182
|
+
for (_i = 0; _i < 16; _i++) {
|
|
183
|
+
cbcData[(n + 1) * 16 + _i] ^= this._k2[_i];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
_context5.next = 11;
|
|
187
|
+
return window.crypto.subtle.encrypt({
|
|
188
|
+
name: "AES-CBC",
|
|
189
|
+
iv: this._zeroBlock
|
|
190
|
+
}, this._cbcKey, cbcData);
|
|
191
|
+
case 11:
|
|
192
|
+
cbcEncrypted = _context5.sent;
|
|
193
|
+
cbcEncrypted = new Uint8Array(cbcEncrypted);
|
|
194
|
+
mac = cbcEncrypted.slice(cbcEncrypted.length - 32, cbcEncrypted.length - 16);
|
|
195
|
+
return _context5.abrupt("return", mac);
|
|
196
|
+
case 15:
|
|
197
|
+
case "end":
|
|
198
|
+
return _context5.stop();
|
|
199
|
+
}
|
|
200
|
+
}, _callee5, this);
|
|
201
|
+
}));
|
|
202
|
+
function _computeCMAC(_x6, _x7) {
|
|
203
|
+
return _computeCMAC2.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
return _computeCMAC;
|
|
206
|
+
}()
|
|
207
|
+
}, {
|
|
208
|
+
key: "setKey",
|
|
209
|
+
value: function () {
|
|
210
|
+
var _setKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(key) {
|
|
211
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
212
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
213
|
+
case 0:
|
|
214
|
+
this._rawKey = key;
|
|
215
|
+
_context6.next = 3;
|
|
216
|
+
return window.crypto.subtle.importKey("raw", key, {
|
|
217
|
+
"name": "AES-CTR"
|
|
218
|
+
}, false, ["encrypt", "decrypt"]);
|
|
219
|
+
case 3:
|
|
220
|
+
this._ctrKey = _context6.sent;
|
|
221
|
+
_context6.next = 6;
|
|
222
|
+
return window.crypto.subtle.importKey("raw", key, {
|
|
223
|
+
"name": "AES-CBC"
|
|
224
|
+
}, false, ["encrypt", "decrypt"]);
|
|
225
|
+
case 6:
|
|
226
|
+
this._cbcKey = _context6.sent;
|
|
227
|
+
_context6.next = 9;
|
|
228
|
+
return this._initCMAC();
|
|
229
|
+
case 9:
|
|
230
|
+
case "end":
|
|
231
|
+
return _context6.stop();
|
|
232
|
+
}
|
|
233
|
+
}, _callee6, this);
|
|
234
|
+
}));
|
|
235
|
+
function setKey(_x8) {
|
|
236
|
+
return _setKey.apply(this, arguments);
|
|
237
|
+
}
|
|
238
|
+
return setKey;
|
|
239
|
+
}()
|
|
240
|
+
}, {
|
|
241
|
+
key: "encrypt",
|
|
242
|
+
value: function () {
|
|
243
|
+
var _encrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(message, associatedData, nonce) {
|
|
244
|
+
var nCMAC, encrypted, adCMAC, mac, i, res;
|
|
245
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
246
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
247
|
+
case 0:
|
|
248
|
+
_context7.next = 2;
|
|
249
|
+
return this._computeCMAC(nonce, this._prefixBlock0);
|
|
250
|
+
case 2:
|
|
251
|
+
nCMAC = _context7.sent;
|
|
252
|
+
_context7.next = 5;
|
|
253
|
+
return this._encryptCTR(message, nCMAC);
|
|
254
|
+
case 5:
|
|
255
|
+
encrypted = _context7.sent;
|
|
256
|
+
_context7.next = 8;
|
|
257
|
+
return this._computeCMAC(associatedData, this._prefixBlock1);
|
|
258
|
+
case 8:
|
|
259
|
+
adCMAC = _context7.sent;
|
|
260
|
+
_context7.next = 11;
|
|
261
|
+
return this._computeCMAC(encrypted, this._prefixBlock2);
|
|
262
|
+
case 11:
|
|
263
|
+
mac = _context7.sent;
|
|
264
|
+
for (i = 0; i < 16; i++) {
|
|
265
|
+
mac[i] ^= nCMAC[i] ^ adCMAC[i];
|
|
266
|
+
}
|
|
267
|
+
res = new Uint8Array(16 + encrypted.length);
|
|
268
|
+
res.set(encrypted);
|
|
269
|
+
res.set(mac, encrypted.length);
|
|
270
|
+
return _context7.abrupt("return", res);
|
|
271
|
+
case 17:
|
|
272
|
+
case "end":
|
|
273
|
+
return _context7.stop();
|
|
274
|
+
}
|
|
275
|
+
}, _callee7, this);
|
|
276
|
+
}));
|
|
277
|
+
function encrypt(_x9, _x10, _x11) {
|
|
278
|
+
return _encrypt.apply(this, arguments);
|
|
279
|
+
}
|
|
280
|
+
return encrypt;
|
|
281
|
+
}()
|
|
282
|
+
}, {
|
|
283
|
+
key: "decrypt",
|
|
284
|
+
value: function () {
|
|
285
|
+
var _decrypt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(encrypted, associatedData, nonce, mac) {
|
|
286
|
+
var nCMAC, adCMAC, computedMac, i, _i2, res;
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
288
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
289
|
+
case 0:
|
|
290
|
+
_context8.next = 2;
|
|
291
|
+
return this._computeCMAC(nonce, this._prefixBlock0);
|
|
292
|
+
case 2:
|
|
293
|
+
nCMAC = _context8.sent;
|
|
294
|
+
_context8.next = 5;
|
|
295
|
+
return this._computeCMAC(associatedData, this._prefixBlock1);
|
|
296
|
+
case 5:
|
|
297
|
+
adCMAC = _context8.sent;
|
|
298
|
+
_context8.next = 8;
|
|
299
|
+
return this._computeCMAC(encrypted, this._prefixBlock2);
|
|
300
|
+
case 8:
|
|
301
|
+
computedMac = _context8.sent;
|
|
302
|
+
for (i = 0; i < 16; i++) {
|
|
303
|
+
computedMac[i] ^= nCMAC[i] ^ adCMAC[i];
|
|
304
|
+
}
|
|
305
|
+
if (!(computedMac.length !== mac.length)) {
|
|
306
|
+
_context8.next = 12;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
return _context8.abrupt("return", null);
|
|
310
|
+
case 12:
|
|
311
|
+
_i2 = 0;
|
|
312
|
+
case 13:
|
|
313
|
+
if (!(_i2 < mac.length)) {
|
|
314
|
+
_context8.next = 19;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
if (!(computedMac[_i2] !== mac[_i2])) {
|
|
318
|
+
_context8.next = 16;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
return _context8.abrupt("return", null);
|
|
322
|
+
case 16:
|
|
323
|
+
_i2++;
|
|
324
|
+
_context8.next = 13;
|
|
325
|
+
break;
|
|
326
|
+
case 19:
|
|
327
|
+
_context8.next = 21;
|
|
328
|
+
return this._decryptCTR(encrypted, nCMAC);
|
|
329
|
+
case 21:
|
|
330
|
+
res = _context8.sent;
|
|
331
|
+
return _context8.abrupt("return", res);
|
|
332
|
+
case 23:
|
|
333
|
+
case "end":
|
|
334
|
+
return _context8.stop();
|
|
335
|
+
}
|
|
336
|
+
}, _callee8, this);
|
|
337
|
+
}));
|
|
338
|
+
function decrypt(_x12, _x13, _x14, _x15) {
|
|
339
|
+
return _decrypt.apply(this, arguments);
|
|
340
|
+
}
|
|
341
|
+
return decrypt;
|
|
342
|
+
}()
|
|
343
|
+
}]);
|
|
344
|
+
return AESEAXCipher;
|
|
345
|
+
}();
|
|
346
|
+
exports.AESEAXCipher = AESEAXCipher;
|
|
347
|
+
var RA2Cipher = /*#__PURE__*/function () {
|
|
348
|
+
function RA2Cipher() {
|
|
349
|
+
_classCallCheck(this, RA2Cipher);
|
|
350
|
+
this._cipher = new AESEAXCipher();
|
|
351
|
+
this._counter = new Uint8Array(16);
|
|
352
|
+
}
|
|
353
|
+
_createClass(RA2Cipher, [{
|
|
354
|
+
key: "setKey",
|
|
355
|
+
value: function () {
|
|
356
|
+
var _setKey2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(key) {
|
|
357
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
358
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
359
|
+
case 0:
|
|
360
|
+
_context9.next = 2;
|
|
361
|
+
return this._cipher.setKey(key);
|
|
362
|
+
case 2:
|
|
363
|
+
case "end":
|
|
364
|
+
return _context9.stop();
|
|
365
|
+
}
|
|
366
|
+
}, _callee9, this);
|
|
367
|
+
}));
|
|
368
|
+
function setKey(_x16) {
|
|
369
|
+
return _setKey2.apply(this, arguments);
|
|
370
|
+
}
|
|
371
|
+
return setKey;
|
|
372
|
+
}()
|
|
373
|
+
}, {
|
|
374
|
+
key: "makeMessage",
|
|
375
|
+
value: function () {
|
|
376
|
+
var _makeMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(message) {
|
|
377
|
+
var ad, encrypted, i, res;
|
|
378
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
379
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
380
|
+
case 0:
|
|
381
|
+
ad = new Uint8Array([(message.length & 0xff00) >>> 8, message.length & 0xff]);
|
|
382
|
+
_context10.next = 3;
|
|
383
|
+
return this._cipher.encrypt(message, ad, this._counter);
|
|
384
|
+
case 3:
|
|
385
|
+
encrypted = _context10.sent;
|
|
386
|
+
for (i = 0; i < 16 && this._counter[i]++ === 255; i++);
|
|
387
|
+
res = new Uint8Array(message.length + 2 + 16);
|
|
388
|
+
res.set(ad);
|
|
389
|
+
res.set(encrypted, 2);
|
|
390
|
+
return _context10.abrupt("return", res);
|
|
391
|
+
case 9:
|
|
392
|
+
case "end":
|
|
393
|
+
return _context10.stop();
|
|
394
|
+
}
|
|
395
|
+
}, _callee10, this);
|
|
396
|
+
}));
|
|
397
|
+
function makeMessage(_x17) {
|
|
398
|
+
return _makeMessage.apply(this, arguments);
|
|
399
|
+
}
|
|
400
|
+
return makeMessage;
|
|
401
|
+
}()
|
|
402
|
+
}, {
|
|
403
|
+
key: "receiveMessage",
|
|
404
|
+
value: function () {
|
|
405
|
+
var _receiveMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(length, encrypted, mac) {
|
|
406
|
+
var ad, res, i;
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
408
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
409
|
+
case 0:
|
|
410
|
+
ad = new Uint8Array([(length & 0xff00) >>> 8, length & 0xff]);
|
|
411
|
+
_context11.next = 3;
|
|
412
|
+
return this._cipher.decrypt(encrypted, ad, this._counter, mac);
|
|
413
|
+
case 3:
|
|
414
|
+
res = _context11.sent;
|
|
415
|
+
for (i = 0; i < 16 && this._counter[i]++ === 255; i++);
|
|
416
|
+
return _context11.abrupt("return", res);
|
|
417
|
+
case 6:
|
|
418
|
+
case "end":
|
|
419
|
+
return _context11.stop();
|
|
420
|
+
}
|
|
421
|
+
}, _callee11, this);
|
|
422
|
+
}));
|
|
423
|
+
function receiveMessage(_x18, _x19, _x20) {
|
|
424
|
+
return _receiveMessage.apply(this, arguments);
|
|
425
|
+
}
|
|
426
|
+
return receiveMessage;
|
|
427
|
+
}()
|
|
428
|
+
}]);
|
|
429
|
+
return RA2Cipher;
|
|
430
|
+
}();
|
|
431
|
+
exports.RA2Cipher = RA2Cipher;
|
|
432
|
+
var RSACipher = /*#__PURE__*/function () {
|
|
433
|
+
function RSACipher(keyLength) {
|
|
434
|
+
_classCallCheck(this, RSACipher);
|
|
435
|
+
this._key = null;
|
|
436
|
+
this._keyLength = keyLength;
|
|
437
|
+
this._keyBytes = Math.ceil(keyLength / 8);
|
|
438
|
+
this._n = null;
|
|
439
|
+
this._e = null;
|
|
440
|
+
this._d = null;
|
|
441
|
+
this._nBigInt = null;
|
|
442
|
+
this._eBigInt = null;
|
|
443
|
+
this._dBigInt = null;
|
|
444
|
+
}
|
|
445
|
+
_createClass(RSACipher, [{
|
|
446
|
+
key: "_base64urlDecode",
|
|
447
|
+
value: function _base64urlDecode(data) {
|
|
448
|
+
data = data.replace(/-/g, "+").replace(/_/g, "/");
|
|
449
|
+
data = data.padEnd(Math.ceil(data.length / 4) * 4, "=");
|
|
450
|
+
return _base["default"].decode(data);
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "_u8ArrayToBigInt",
|
|
454
|
+
value: function _u8ArrayToBigInt(arr) {
|
|
455
|
+
var hex = '0x';
|
|
456
|
+
for (var i = 0; i < arr.length; i++) {
|
|
457
|
+
hex += arr[i].toString(16).padStart(2, '0');
|
|
458
|
+
}
|
|
459
|
+
return BigInt(hex);
|
|
460
|
+
}
|
|
461
|
+
}, {
|
|
462
|
+
key: "_padArray",
|
|
463
|
+
value: function _padArray(arr, length) {
|
|
464
|
+
var res = new Uint8Array(length);
|
|
465
|
+
res.set(arr, length - arr.length);
|
|
466
|
+
return res;
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "_bigIntToU8Array",
|
|
470
|
+
value: function _bigIntToU8Array(bigint) {
|
|
471
|
+
var padLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
472
|
+
var hex = bigint.toString(16);
|
|
473
|
+
if (padLength === 0) {
|
|
474
|
+
padLength = Math.ceil(hex.length / 2) * 2;
|
|
475
|
+
}
|
|
476
|
+
hex = hex.padStart(padLength * 2, '0');
|
|
477
|
+
var length = hex.length / 2;
|
|
478
|
+
var arr = new Uint8Array(length);
|
|
479
|
+
for (var i = 0; i < length; i++) {
|
|
480
|
+
arr[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
481
|
+
}
|
|
482
|
+
return arr;
|
|
483
|
+
}
|
|
484
|
+
}, {
|
|
485
|
+
key: "_modPow",
|
|
486
|
+
value: function _modPow(b, e, m) {
|
|
487
|
+
if (m === 1n) {
|
|
488
|
+
return 0;
|
|
489
|
+
}
|
|
490
|
+
var r = 1n;
|
|
491
|
+
b = b % m;
|
|
492
|
+
while (e > 0) {
|
|
493
|
+
if (e % 2n === 1n) {
|
|
494
|
+
r = r * b % m;
|
|
495
|
+
}
|
|
496
|
+
e = e / 2n;
|
|
497
|
+
b = b * b % m;
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
}, {
|
|
502
|
+
key: "generateKey",
|
|
503
|
+
value: function () {
|
|
504
|
+
var _generateKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
505
|
+
var privateKey;
|
|
506
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
507
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
508
|
+
case 0:
|
|
509
|
+
_context12.next = 2;
|
|
510
|
+
return window.crypto.subtle.generateKey({
|
|
511
|
+
name: "RSA-OAEP",
|
|
512
|
+
modulusLength: this._keyLength,
|
|
513
|
+
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
|
|
514
|
+
hash: {
|
|
515
|
+
name: "SHA-256"
|
|
516
|
+
}
|
|
517
|
+
}, true, ["encrypt", "decrypt"]);
|
|
518
|
+
case 2:
|
|
519
|
+
this._key = _context12.sent;
|
|
520
|
+
_context12.next = 5;
|
|
521
|
+
return window.crypto.subtle.exportKey("jwk", this._key.privateKey);
|
|
522
|
+
case 5:
|
|
523
|
+
privateKey = _context12.sent;
|
|
524
|
+
this._n = this._padArray(this._base64urlDecode(privateKey.n), this._keyBytes);
|
|
525
|
+
this._nBigInt = this._u8ArrayToBigInt(this._n);
|
|
526
|
+
this._e = this._padArray(this._base64urlDecode(privateKey.e), this._keyBytes);
|
|
527
|
+
this._eBigInt = this._u8ArrayToBigInt(this._e);
|
|
528
|
+
this._d = this._padArray(this._base64urlDecode(privateKey.d), this._keyBytes);
|
|
529
|
+
this._dBigInt = this._u8ArrayToBigInt(this._d);
|
|
530
|
+
case 12:
|
|
531
|
+
case "end":
|
|
532
|
+
return _context12.stop();
|
|
533
|
+
}
|
|
534
|
+
}, _callee12, this);
|
|
535
|
+
}));
|
|
536
|
+
function generateKey() {
|
|
537
|
+
return _generateKey.apply(this, arguments);
|
|
538
|
+
}
|
|
539
|
+
return generateKey;
|
|
540
|
+
}()
|
|
541
|
+
}, {
|
|
542
|
+
key: "setPublicKey",
|
|
543
|
+
value: function setPublicKey(n, e) {
|
|
544
|
+
if (n.length !== this._keyBytes || e.length !== this._keyBytes) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
this._n = new Uint8Array(this._keyBytes);
|
|
548
|
+
this._e = new Uint8Array(this._keyBytes);
|
|
549
|
+
this._n.set(n);
|
|
550
|
+
this._e.set(e);
|
|
551
|
+
this._nBigInt = this._u8ArrayToBigInt(this._n);
|
|
552
|
+
this._eBigInt = this._u8ArrayToBigInt(this._e);
|
|
553
|
+
}
|
|
554
|
+
}, {
|
|
555
|
+
key: "encrypt",
|
|
556
|
+
value: function encrypt(message) {
|
|
557
|
+
if (message.length > this._keyBytes - 11) {
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
var ps = new Uint8Array(this._keyBytes - message.length - 3);
|
|
561
|
+
window.crypto.getRandomValues(ps);
|
|
562
|
+
for (var i = 0; i < ps.length; i++) {
|
|
563
|
+
ps[i] = Math.floor(ps[i] * 254 / 255 + 1);
|
|
564
|
+
}
|
|
565
|
+
var em = new Uint8Array(this._keyBytes);
|
|
566
|
+
em[1] = 0x02;
|
|
567
|
+
em.set(ps, 2);
|
|
568
|
+
em.set(message, ps.length + 3);
|
|
569
|
+
var emBigInt = this._u8ArrayToBigInt(em);
|
|
570
|
+
var c = this._modPow(emBigInt, this._eBigInt, this._nBigInt);
|
|
571
|
+
return this._bigIntToU8Array(c, this._keyBytes);
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "decrypt",
|
|
575
|
+
value: function decrypt(message) {
|
|
576
|
+
if (message.length !== this._keyBytes) {
|
|
577
|
+
return null;
|
|
578
|
+
}
|
|
579
|
+
var msgBigInt = this._u8ArrayToBigInt(message);
|
|
580
|
+
var emBigInt = this._modPow(msgBigInt, this._dBigInt, this._nBigInt);
|
|
581
|
+
var em = this._bigIntToU8Array(emBigInt, this._keyBytes);
|
|
582
|
+
if (em[0] !== 0x00 || em[1] !== 0x02) {
|
|
583
|
+
return null;
|
|
584
|
+
}
|
|
585
|
+
var i = 2;
|
|
586
|
+
for (; i < em.length; i++) {
|
|
587
|
+
if (em[i] === 0x00) {
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (i === em.length) {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
return em.slice(i + 1, em.length);
|
|
595
|
+
}
|
|
596
|
+
}, {
|
|
597
|
+
key: "keyLength",
|
|
598
|
+
get: function get() {
|
|
599
|
+
return this._keyLength;
|
|
600
|
+
}
|
|
601
|
+
}, {
|
|
602
|
+
key: "n",
|
|
603
|
+
get: function get() {
|
|
604
|
+
return this._n;
|
|
605
|
+
}
|
|
606
|
+
}, {
|
|
607
|
+
key: "e",
|
|
608
|
+
get: function get() {
|
|
609
|
+
return this._e;
|
|
610
|
+
}
|
|
611
|
+
}, {
|
|
612
|
+
key: "d",
|
|
613
|
+
get: function get() {
|
|
614
|
+
return this._d;
|
|
615
|
+
}
|
|
616
|
+
}]);
|
|
617
|
+
return RSACipher;
|
|
618
|
+
}();
|
|
619
|
+
exports.RSACipher = RSACipher;
|
|
620
|
+
var RSAAESAuthenticationState = /*#__PURE__*/function (_EventTargetMixin) {
|
|
621
|
+
_inherits(RSAAESAuthenticationState, _EventTargetMixin);
|
|
622
|
+
var _super = _createSuper(RSAAESAuthenticationState);
|
|
623
|
+
function RSAAESAuthenticationState(sock, getCredentials) {
|
|
624
|
+
var _this;
|
|
625
|
+
_classCallCheck(this, RSAAESAuthenticationState);
|
|
626
|
+
_this = _super.call(this);
|
|
627
|
+
_this._hasStarted = false;
|
|
628
|
+
_this._checkSock = null;
|
|
629
|
+
_this._checkCredentials = null;
|
|
630
|
+
_this._approveServerResolve = null;
|
|
631
|
+
_this._sockReject = null;
|
|
632
|
+
_this._credentialsReject = null;
|
|
633
|
+
_this._approveServerReject = null;
|
|
634
|
+
_this._sock = sock;
|
|
635
|
+
_this._getCredentials = getCredentials;
|
|
636
|
+
return _this;
|
|
637
|
+
}
|
|
638
|
+
_createClass(RSAAESAuthenticationState, [{
|
|
639
|
+
key: "_waitSockAsync",
|
|
640
|
+
value: function _waitSockAsync(len) {
|
|
641
|
+
var _this2 = this;
|
|
642
|
+
return new Promise(function (resolve, reject) {
|
|
643
|
+
var hasData = function hasData() {
|
|
644
|
+
return !_this2._sock.rQwait('RA2', len);
|
|
645
|
+
};
|
|
646
|
+
if (hasData()) {
|
|
647
|
+
resolve();
|
|
648
|
+
} else {
|
|
649
|
+
_this2._checkSock = function () {
|
|
650
|
+
if (hasData()) {
|
|
651
|
+
resolve();
|
|
652
|
+
_this2._checkSock = null;
|
|
653
|
+
_this2._sockReject = null;
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
_this2._sockReject = reject;
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
}, {
|
|
661
|
+
key: "_waitApproveKeyAsync",
|
|
662
|
+
value: function _waitApproveKeyAsync() {
|
|
663
|
+
var _this3 = this;
|
|
664
|
+
return new Promise(function (resolve, reject) {
|
|
665
|
+
_this3._approveServerResolve = resolve;
|
|
666
|
+
_this3._approveServerReject = reject;
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
}, {
|
|
670
|
+
key: "_waitCredentialsAsync",
|
|
671
|
+
value: function _waitCredentialsAsync(subtype) {
|
|
672
|
+
var _this4 = this;
|
|
673
|
+
var hasCredentials = function hasCredentials() {
|
|
674
|
+
if (subtype === 1 && _this4._getCredentials().username !== undefined && _this4._getCredentials().password !== undefined) {
|
|
675
|
+
return true;
|
|
676
|
+
} else if (subtype === 2 && _this4._getCredentials().password !== undefined) {
|
|
677
|
+
return true;
|
|
678
|
+
}
|
|
679
|
+
return false;
|
|
680
|
+
};
|
|
681
|
+
return new Promise(function (resolve, reject) {
|
|
682
|
+
if (hasCredentials()) {
|
|
683
|
+
resolve();
|
|
684
|
+
} else {
|
|
685
|
+
_this4._checkCredentials = function () {
|
|
686
|
+
if (hasCredentials()) {
|
|
687
|
+
resolve();
|
|
688
|
+
_this4._checkCredentials = null;
|
|
689
|
+
_this4._credentialsReject = null;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
_this4._credentialsReject = reject;
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}, {
|
|
697
|
+
key: "checkInternalEvents",
|
|
698
|
+
value: function checkInternalEvents() {
|
|
699
|
+
if (this._checkSock !== null) {
|
|
700
|
+
this._checkSock();
|
|
701
|
+
}
|
|
702
|
+
if (this._checkCredentials !== null) {
|
|
703
|
+
this._checkCredentials();
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}, {
|
|
707
|
+
key: "approveServer",
|
|
708
|
+
value: function approveServer() {
|
|
709
|
+
if (this._approveServerResolve !== null) {
|
|
710
|
+
this._approveServerResolve();
|
|
711
|
+
this._approveServerResolve = null;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}, {
|
|
715
|
+
key: "disconnect",
|
|
716
|
+
value: function disconnect() {
|
|
717
|
+
if (this._sockReject !== null) {
|
|
718
|
+
this._sockReject(new Error("disconnect normally"));
|
|
719
|
+
this._sockReject = null;
|
|
720
|
+
}
|
|
721
|
+
if (this._credentialsReject !== null) {
|
|
722
|
+
this._credentialsReject(new Error("disconnect normally"));
|
|
723
|
+
this._credentialsReject = null;
|
|
724
|
+
}
|
|
725
|
+
if (this._approveServerReject !== null) {
|
|
726
|
+
this._approveServerReject(new Error("disconnect normally"));
|
|
727
|
+
this._approveServerReject = null;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}, {
|
|
731
|
+
key: "negotiateRA2neAuthAsync",
|
|
732
|
+
value: function () {
|
|
733
|
+
var _negotiateRA2neAuthAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
734
|
+
var serverKeyLengthBuffer, serverKeyLength, serverKeyBytes, serverN, serverE, serverRSACipher, serverPublickey, clientKeyLength, clientKeyBytes, clientRSACipher, clientN, clientE, clientPublicKey, clientRandom, clientEncryptedRandom, clientRandomMessage, serverEncryptedRandom, serverRandom, clientSessionKey, serverSessionKey, clientCipher, serverCipher, serverHash, clientHash, serverHashReceived, i, subtype, username, password, credentials, _i3, _i4;
|
|
735
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
736
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
737
|
+
case 0:
|
|
738
|
+
this._hasStarted = true;
|
|
739
|
+
// 1: Receive server public key
|
|
740
|
+
_context13.next = 3;
|
|
741
|
+
return this._waitSockAsync(4);
|
|
742
|
+
case 3:
|
|
743
|
+
serverKeyLengthBuffer = this._sock.rQslice(0, 4);
|
|
744
|
+
serverKeyLength = this._sock.rQshift32();
|
|
745
|
+
if (!(serverKeyLength < 1024)) {
|
|
746
|
+
_context13.next = 9;
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
throw new Error("RA2: server public key is too short: " + serverKeyLength);
|
|
750
|
+
case 9:
|
|
751
|
+
if (!(serverKeyLength > 8192)) {
|
|
752
|
+
_context13.next = 11;
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
throw new Error("RA2: server public key is too long: " + serverKeyLength);
|
|
756
|
+
case 11:
|
|
757
|
+
serverKeyBytes = Math.ceil(serverKeyLength / 8);
|
|
758
|
+
_context13.next = 14;
|
|
759
|
+
return this._waitSockAsync(serverKeyBytes * 2);
|
|
760
|
+
case 14:
|
|
761
|
+
serverN = this._sock.rQshiftBytes(serverKeyBytes);
|
|
762
|
+
serverE = this._sock.rQshiftBytes(serverKeyBytes);
|
|
763
|
+
serverRSACipher = new RSACipher(serverKeyLength);
|
|
764
|
+
serverRSACipher.setPublicKey(serverN, serverE);
|
|
765
|
+
serverPublickey = new Uint8Array(4 + serverKeyBytes * 2);
|
|
766
|
+
serverPublickey.set(serverKeyLengthBuffer);
|
|
767
|
+
serverPublickey.set(serverN, 4);
|
|
768
|
+
serverPublickey.set(serverE, 4 + serverKeyBytes);
|
|
769
|
+
|
|
770
|
+
// verify server public key
|
|
771
|
+
this.dispatchEvent(new CustomEvent("serververification", {
|
|
772
|
+
detail: {
|
|
773
|
+
type: "RSA",
|
|
774
|
+
publickey: serverPublickey
|
|
775
|
+
}
|
|
776
|
+
}));
|
|
777
|
+
_context13.next = 25;
|
|
778
|
+
return this._waitApproveKeyAsync();
|
|
779
|
+
case 25:
|
|
780
|
+
// 2: Send client public key
|
|
781
|
+
clientKeyLength = 2048;
|
|
782
|
+
clientKeyBytes = Math.ceil(clientKeyLength / 8);
|
|
783
|
+
clientRSACipher = new RSACipher(clientKeyLength);
|
|
784
|
+
_context13.next = 30;
|
|
785
|
+
return clientRSACipher.generateKey();
|
|
786
|
+
case 30:
|
|
787
|
+
clientN = clientRSACipher.n;
|
|
788
|
+
clientE = clientRSACipher.e;
|
|
789
|
+
clientPublicKey = new Uint8Array(4 + clientKeyBytes * 2);
|
|
790
|
+
clientPublicKey[0] = (clientKeyLength & 0xff000000) >>> 24;
|
|
791
|
+
clientPublicKey[1] = (clientKeyLength & 0xff0000) >>> 16;
|
|
792
|
+
clientPublicKey[2] = (clientKeyLength & 0xff00) >>> 8;
|
|
793
|
+
clientPublicKey[3] = clientKeyLength & 0xff;
|
|
794
|
+
clientPublicKey.set(clientN, 4);
|
|
795
|
+
clientPublicKey.set(clientE, 4 + clientKeyBytes);
|
|
796
|
+
this._sock.send(clientPublicKey);
|
|
797
|
+
|
|
798
|
+
// 3: Send client random
|
|
799
|
+
clientRandom = new Uint8Array(16);
|
|
800
|
+
window.crypto.getRandomValues(clientRandom);
|
|
801
|
+
clientEncryptedRandom = serverRSACipher.encrypt(clientRandom);
|
|
802
|
+
clientRandomMessage = new Uint8Array(2 + serverKeyBytes);
|
|
803
|
+
clientRandomMessage[0] = (serverKeyBytes & 0xff00) >>> 8;
|
|
804
|
+
clientRandomMessage[1] = serverKeyBytes & 0xff;
|
|
805
|
+
clientRandomMessage.set(clientEncryptedRandom, 2);
|
|
806
|
+
this._sock.send(clientRandomMessage);
|
|
807
|
+
|
|
808
|
+
// 4: Receive server random
|
|
809
|
+
_context13.next = 50;
|
|
810
|
+
return this._waitSockAsync(2);
|
|
811
|
+
case 50:
|
|
812
|
+
if (!(this._sock.rQshift16() !== clientKeyBytes)) {
|
|
813
|
+
_context13.next = 52;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
throw new Error("RA2: wrong encrypted message length");
|
|
817
|
+
case 52:
|
|
818
|
+
serverEncryptedRandom = this._sock.rQshiftBytes(clientKeyBytes);
|
|
819
|
+
serverRandom = clientRSACipher.decrypt(serverEncryptedRandom);
|
|
820
|
+
if (!(serverRandom === null || serverRandom.length !== 16)) {
|
|
821
|
+
_context13.next = 56;
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
throw new Error("RA2: corrupted server encrypted random");
|
|
825
|
+
case 56:
|
|
826
|
+
// 5: Compute session keys and set ciphers
|
|
827
|
+
clientSessionKey = new Uint8Array(32);
|
|
828
|
+
serverSessionKey = new Uint8Array(32);
|
|
829
|
+
clientSessionKey.set(serverRandom);
|
|
830
|
+
clientSessionKey.set(clientRandom, 16);
|
|
831
|
+
serverSessionKey.set(clientRandom);
|
|
832
|
+
serverSessionKey.set(serverRandom, 16);
|
|
833
|
+
_context13.next = 64;
|
|
834
|
+
return window.crypto.subtle.digest("SHA-1", clientSessionKey);
|
|
835
|
+
case 64:
|
|
836
|
+
clientSessionKey = _context13.sent;
|
|
837
|
+
clientSessionKey = new Uint8Array(clientSessionKey).slice(0, 16);
|
|
838
|
+
_context13.next = 68;
|
|
839
|
+
return window.crypto.subtle.digest("SHA-1", serverSessionKey);
|
|
840
|
+
case 68:
|
|
841
|
+
serverSessionKey = _context13.sent;
|
|
842
|
+
serverSessionKey = new Uint8Array(serverSessionKey).slice(0, 16);
|
|
843
|
+
clientCipher = new RA2Cipher();
|
|
844
|
+
_context13.next = 73;
|
|
845
|
+
return clientCipher.setKey(clientSessionKey);
|
|
846
|
+
case 73:
|
|
847
|
+
serverCipher = new RA2Cipher();
|
|
848
|
+
_context13.next = 76;
|
|
849
|
+
return serverCipher.setKey(serverSessionKey);
|
|
850
|
+
case 76:
|
|
851
|
+
// 6: Compute and exchange hashes
|
|
852
|
+
serverHash = new Uint8Array(8 + serverKeyBytes * 2 + clientKeyBytes * 2);
|
|
853
|
+
clientHash = new Uint8Array(8 + serverKeyBytes * 2 + clientKeyBytes * 2);
|
|
854
|
+
serverHash.set(serverPublickey);
|
|
855
|
+
serverHash.set(clientPublicKey, 4 + serverKeyBytes * 2);
|
|
856
|
+
clientHash.set(clientPublicKey);
|
|
857
|
+
clientHash.set(serverPublickey, 4 + clientKeyBytes * 2);
|
|
858
|
+
_context13.next = 84;
|
|
859
|
+
return window.crypto.subtle.digest("SHA-1", serverHash);
|
|
860
|
+
case 84:
|
|
861
|
+
serverHash = _context13.sent;
|
|
862
|
+
_context13.next = 87;
|
|
863
|
+
return window.crypto.subtle.digest("SHA-1", clientHash);
|
|
864
|
+
case 87:
|
|
865
|
+
clientHash = _context13.sent;
|
|
866
|
+
serverHash = new Uint8Array(serverHash);
|
|
867
|
+
clientHash = new Uint8Array(clientHash);
|
|
868
|
+
_context13.t0 = this._sock;
|
|
869
|
+
_context13.next = 93;
|
|
870
|
+
return clientCipher.makeMessage(clientHash);
|
|
871
|
+
case 93:
|
|
872
|
+
_context13.t1 = _context13.sent;
|
|
873
|
+
_context13.t0.send.call(_context13.t0, _context13.t1);
|
|
874
|
+
_context13.next = 97;
|
|
875
|
+
return this._waitSockAsync(2 + 20 + 16);
|
|
876
|
+
case 97:
|
|
877
|
+
if (!(this._sock.rQshift16() !== 20)) {
|
|
878
|
+
_context13.next = 99;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
throw new Error("RA2: wrong server hash");
|
|
882
|
+
case 99:
|
|
883
|
+
_context13.next = 101;
|
|
884
|
+
return serverCipher.receiveMessage(20, this._sock.rQshiftBytes(20), this._sock.rQshiftBytes(16));
|
|
885
|
+
case 101:
|
|
886
|
+
serverHashReceived = _context13.sent;
|
|
887
|
+
if (!(serverHashReceived === null)) {
|
|
888
|
+
_context13.next = 104;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
throw new Error("RA2: failed to authenticate the message");
|
|
892
|
+
case 104:
|
|
893
|
+
i = 0;
|
|
894
|
+
case 105:
|
|
895
|
+
if (!(i < 20)) {
|
|
896
|
+
_context13.next = 111;
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
if (!(serverHashReceived[i] !== serverHash[i])) {
|
|
900
|
+
_context13.next = 108;
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
throw new Error("RA2: wrong server hash");
|
|
904
|
+
case 108:
|
|
905
|
+
i++;
|
|
906
|
+
_context13.next = 105;
|
|
907
|
+
break;
|
|
908
|
+
case 111:
|
|
909
|
+
_context13.next = 113;
|
|
910
|
+
return this._waitSockAsync(2 + 1 + 16);
|
|
911
|
+
case 113:
|
|
912
|
+
if (!(this._sock.rQshift16() !== 1)) {
|
|
913
|
+
_context13.next = 115;
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
throw new Error("RA2: wrong subtype");
|
|
917
|
+
case 115:
|
|
918
|
+
_context13.next = 117;
|
|
919
|
+
return serverCipher.receiveMessage(1, this._sock.rQshiftBytes(1), this._sock.rQshiftBytes(16));
|
|
920
|
+
case 117:
|
|
921
|
+
subtype = _context13.sent;
|
|
922
|
+
if (!(subtype === null)) {
|
|
923
|
+
_context13.next = 120;
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
throw new Error("RA2: failed to authenticate the message");
|
|
927
|
+
case 120:
|
|
928
|
+
subtype = subtype[0];
|
|
929
|
+
if (!(subtype === 1)) {
|
|
930
|
+
_context13.next = 125;
|
|
931
|
+
break;
|
|
932
|
+
}
|
|
933
|
+
if (this._getCredentials().username === undefined || this._getCredentials().password === undefined) {
|
|
934
|
+
this.dispatchEvent(new CustomEvent("credentialsrequired", {
|
|
935
|
+
detail: {
|
|
936
|
+
types: ["username", "password"]
|
|
937
|
+
}
|
|
938
|
+
}));
|
|
939
|
+
}
|
|
940
|
+
_context13.next = 130;
|
|
941
|
+
break;
|
|
942
|
+
case 125:
|
|
943
|
+
if (!(subtype === 2)) {
|
|
944
|
+
_context13.next = 129;
|
|
945
|
+
break;
|
|
946
|
+
}
|
|
947
|
+
if (this._getCredentials().password === undefined) {
|
|
948
|
+
this.dispatchEvent(new CustomEvent("credentialsrequired", {
|
|
949
|
+
detail: {
|
|
950
|
+
types: ["password"]
|
|
951
|
+
}
|
|
952
|
+
}));
|
|
953
|
+
}
|
|
954
|
+
_context13.next = 130;
|
|
955
|
+
break;
|
|
956
|
+
case 129:
|
|
957
|
+
throw new Error("RA2: wrong subtype");
|
|
958
|
+
case 130:
|
|
959
|
+
_context13.next = 132;
|
|
960
|
+
return this._waitCredentialsAsync(subtype);
|
|
961
|
+
case 132:
|
|
962
|
+
if (subtype === 1) {
|
|
963
|
+
username = (0, _strings.encodeUTF8)(this._getCredentials().username).slice(0, 255);
|
|
964
|
+
} else {
|
|
965
|
+
username = "";
|
|
966
|
+
}
|
|
967
|
+
password = (0, _strings.encodeUTF8)(this._getCredentials().password).slice(0, 255);
|
|
968
|
+
credentials = new Uint8Array(username.length + password.length + 2);
|
|
969
|
+
credentials[0] = username.length;
|
|
970
|
+
credentials[username.length + 1] = password.length;
|
|
971
|
+
for (_i3 = 0; _i3 < username.length; _i3++) {
|
|
972
|
+
credentials[_i3 + 1] = username.charCodeAt(_i3);
|
|
973
|
+
}
|
|
974
|
+
for (_i4 = 0; _i4 < password.length; _i4++) {
|
|
975
|
+
credentials[username.length + 2 + _i4] = password.charCodeAt(_i4);
|
|
976
|
+
}
|
|
977
|
+
_context13.t2 = this._sock;
|
|
978
|
+
_context13.next = 142;
|
|
979
|
+
return clientCipher.makeMessage(credentials);
|
|
980
|
+
case 142:
|
|
981
|
+
_context13.t3 = _context13.sent;
|
|
982
|
+
_context13.t2.send.call(_context13.t2, _context13.t3);
|
|
983
|
+
case 144:
|
|
984
|
+
case "end":
|
|
985
|
+
return _context13.stop();
|
|
986
|
+
}
|
|
987
|
+
}, _callee13, this);
|
|
988
|
+
}));
|
|
989
|
+
function negotiateRA2neAuthAsync() {
|
|
990
|
+
return _negotiateRA2neAuthAsync.apply(this, arguments);
|
|
991
|
+
}
|
|
992
|
+
return negotiateRA2neAuthAsync;
|
|
993
|
+
}()
|
|
994
|
+
}, {
|
|
995
|
+
key: "hasStarted",
|
|
996
|
+
get: function get() {
|
|
997
|
+
return this._hasStarted;
|
|
998
|
+
},
|
|
999
|
+
set: function set(s) {
|
|
1000
|
+
this._hasStarted = s;
|
|
1001
|
+
}
|
|
1002
|
+
}]);
|
|
1003
|
+
return RSAAESAuthenticationState;
|
|
1004
|
+
}(_eventtarget["default"]);
|
|
1005
|
+
exports["default"] = RSAAESAuthenticationState;
|