Debian Codegraph @

qml/js/otpauth.js

raw
1 (function(){/*
2 otpauth v4.0.0 | (c) Héctor Molinero Fernández <[email protected]> | https://github.com/hectorm/otpauth | MIT */
3 'use strict';
4 var $jscomp = $jscomp || {};
5 $jscomp.scope = {};
6 $jscomp.arrayIteratorImpl = function(array) {
7 var index = 0;
8 return function() {
9 return index < array.length ? {done:!1, value:array[index++]} : {done:!0};
10 };
11 };
12 $jscomp.arrayIterator = function(array) {
13 return {next:$jscomp.arrayIteratorImpl(array)};
14 };
15 $jscomp.ASSUME_ES5 = !1;
16 $jscomp.ASSUME_NO_NATIVE_MAP = !1;
17 $jscomp.ASSUME_NO_NATIVE_SET = !1;
18 $jscomp.SIMPLE_FROUND_POLYFILL = !1;
19 $jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(target, property, descriptor) {
20 target != Array.prototype && target != Object.prototype && (target[property] = descriptor.value);
21 };
22 $jscomp.getGlobal = function(maybeGlobal) {
23 return "undefined" != typeof window && window === maybeGlobal ? maybeGlobal : "undefined" != typeof global && null != global ? global : maybeGlobal;
24 };
25 $jscomp.global = $jscomp.getGlobal(this);
26 $jscomp.SYMBOL_PREFIX = "jscomp_symbol_";
27 $jscomp.initSymbol = function() {
28 $jscomp.initSymbol = function() {
29 };
30 $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol);
31 };
32 $jscomp.SymbolClass = function(id, opt_description) {
33 this.$jscomp$symbol$id_ = id;
34 $jscomp.defineProperty(this, "description", {configurable:!0, writable:!0, value:opt_description});
35 };
36 $jscomp.SymbolClass.prototype.toString = function() {
37 return this.$jscomp$symbol$id_;
38 };
39 $jscomp.Symbol = function() {
40 function Symbol(opt_description) {
41 if (this instanceof Symbol) {
42 throw new TypeError("Symbol is not a constructor");
43 }
44 return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX + (opt_description || "") + "_" + counter++, opt_description);
45 }
46 var counter = 0;
47 return Symbol;
48 }();
49 $jscomp.initSymbolIterator = function() {
50 $jscomp.initSymbol();
51 var symbolIterator = $jscomp.global.Symbol.iterator;
52 symbolIterator || (symbolIterator = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("Symbol.iterator"));
53 "function" != typeof Array.prototype[symbolIterator] && $jscomp.defineProperty(Array.prototype, symbolIterator, {configurable:!0, writable:!0, value:function() {
54 return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this));
55 }});
56 $jscomp.initSymbolIterator = function() {
57 };
58 };
59 $jscomp.initSymbolAsyncIterator = function() {
60 $jscomp.initSymbol();
61 var symbolAsyncIterator = $jscomp.global.Symbol.asyncIterator;
62 symbolAsyncIterator || (symbolAsyncIterator = $jscomp.global.Symbol.asyncIterator = $jscomp.global.Symbol("Symbol.asyncIterator"));
63 $jscomp.initSymbolAsyncIterator = function() {
64 };
65 };
66 $jscomp.iteratorPrototype = function(next) {
67 $jscomp.initSymbolIterator();
68 next = {next:next};
69 next[$jscomp.global.Symbol.iterator] = function() {
70 return this;
71 };
72 return next;
73 };
74 $jscomp.polyfill = function(target, polyfill, fromLang, toLang) {
75 if (polyfill) {
76 fromLang = $jscomp.global;
77 target = target.split(".");
78 for (toLang = 0; toLang < target.length - 1; toLang++) {
79 var key = target[toLang];
80 key in fromLang || (fromLang[key] = {});
81 fromLang = fromLang[key];
82 }
83 target = target[target.length - 1];
84 toLang = fromLang[target];
85 polyfill = polyfill(toLang);
86 polyfill != toLang && null != polyfill && $jscomp.defineProperty(fromLang, target, {configurable:!0, writable:!0, value:polyfill});
87 }
88 };
89 $jscomp.polyfill("Number.parseInt", function(orig) {
90 return orig || parseInt;
91 }, "es6", "es3");
92 (function(root, factory) {
93 "object" === typeof exports && "object" === typeof module ? module.exports = factory() : "function" === typeof define && define.amd ? define([], factory) : "object" === typeof exports ? exports.OTPAuth = factory() : root.OTPAuth = factory();
94 })(this, function() {
95 return function(modules) {
96 function __webpack_require__(moduleId) {
97 if (installedModules[moduleId]) {
98 return installedModules[moduleId].exports;
99 }
100 var module = installedModules[moduleId] = {i:moduleId, l:!1, exports:{}};
101 modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
102 module.l = !0;
103 return module.exports;
104 }
105 var installedModules = {};
106 __webpack_require__.m = modules;
107 __webpack_require__.c = installedModules;
108 __webpack_require__.d = function(exports, name, getter) {
109 __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {enumerable:!0, get:getter});
110 };
111 __webpack_require__.r = function(exports) {
112 $jscomp.initSymbol();
113 $jscomp.initSymbol();
114 "undefined" !== typeof Symbol && Symbol.toStringTag && ($jscomp.initSymbol(), Object.defineProperty(exports, Symbol.toStringTag, {value:"Module"}));
115 Object.defineProperty(exports, "__esModule", {value:!0});
116 };
117 __webpack_require__.t = function(value, mode) {
118 mode & 1 && (value = __webpack_require__(value));
119 if (mode & 8 || mode & 4 && "object" === typeof value && value && value.__esModule) {
120 return value;
121 }
122 var ns = Object.create(null);
123 __webpack_require__.r(ns);
124 Object.defineProperty(ns, "default", {enumerable:!0, value:value});
125 if (mode & 2 && "string" != typeof value) {
126 for (var key$jscomp$0 in value) {
127 __webpack_require__.d(ns, key$jscomp$0, function(key) {
128 return value[key];
129 }.bind(null, key$jscomp$0));
130 }
131 }
132 return ns;
133 };
134 __webpack_require__.n = function(module) {
135 var getter = module && module.__esModule ? function() {
136 return module["default"];
137 } : function() {
138 return module;
139 };
140 __webpack_require__.d(getter, "a", getter);
141 return getter;
142 };
143 __webpack_require__.o = function(object, property) {
144 return Object.prototype.hasOwnProperty.call(object, property);
145 };
146 __webpack_require__.p = "";
147 return __webpack_require__(__webpack_require__.s = 4);
148 }([function(module, __webpack_exports__, __webpack_require__) {
149 (function(global) {
150 __webpack_require__.d(__webpack_exports__, "b", function() {
151 return Utils;
152 });
153 __webpack_require__.d(__webpack_exports__, "a", function() {
154 return InternalUtils;
155 });
156 var Utils = {uint:{}};
157 Utils.uint.decode = function(buf) {
158 buf = new Uint8Array(buf);
159 for (var num = 0, i = 0; i < buf.length; i++) {
160 0 !== buf[i] && (num *= 256, num += buf[i]);
161 }
162 return num;
163 };
164 Utils.uint.encode = function(num) {
165 for (var buf = new ArrayBuffer(8), arr = new Uint8Array(buf), i = 7; 0 <= i && 0 !== num; i--) {
166 arr[i] = num & 255, num -= arr[i], num /= 256;
167 }
168 return buf;
169 };
170 Utils.raw = {};
171 Utils.raw.decode = function(buf) {
172 buf = new Uint8Array(buf);
173 for (var str = "", i = 0; i < buf.length; i++) {
174 str += String.fromCharCode(buf[i]);
175 }
176 return str;
177 };
178 Utils.raw.encode = function(str) {
179 for (var buf = new ArrayBuffer(str.length), arr = new Uint8Array(buf), i = 0; i < str.length; i++) {
180 arr[i] = str.charCodeAt(i);
181 }
182 return buf;
183 };
184 Utils.b32 = {};
185 Utils.b32.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
186 Utils.b32.decode = function(buf) {
187 buf = new Uint8Array(buf);
188 for (var bits = 0, value = 0, str = "", i = 0; i < buf.length; i++) {
189 for (value = value << 8 | buf[i], bits += 8; 5 <= bits;) {
190 str += Utils.b32.alphabet[value >>> bits - 5 & 31], bits -= 5;
191 }
192 }
193 0 < bits && (str += Utils.b32.alphabet[value << 5 - bits & 31]);
194 return str;
195 };
196 Utils.b32.encode = function(str) {
197 var strUpp = str.toUpperCase();
198 str = new ArrayBuffer(5 * str.length / 8 | 0);
199 for (var arr = new Uint8Array(str), bits = 0, value = 0, index = 0, i = 0; i < strUpp.length; i++) {
200 var idx = Utils.b32.alphabet.indexOf(strUpp[i]);
201 if (-1 === idx) {
202 throw new TypeError("Invalid character found: " + strUpp[i]);
203 }
204 value = value << 5 | idx;
205 bits += 5;
206 8 <= bits && (arr[index++] = value >>> bits - 8 & 255, bits -= 8);
207 }
208 return str;
209 };
210 Utils.hex = {};
211 Utils.hex.decode = function(buf) {
212 buf = new Uint8Array(buf);
213 for (var str = "", i = 0; i < buf.length; i++) {
214 var hexByte = buf[i].toString(16);
215 str += 1 === hexByte.length ? "0" + hexByte : hexByte;
216 }
217 return str.toUpperCase();
218 };
219 Utils.hex.encode = function(str) {
220 for (var buf = new ArrayBuffer(str.length / 2), arr = new Uint8Array(buf), i = 0; i < arr.length; i++) {
221 arr[i] = Number.parseInt(str.substr(2 * i, 2), 16);
222 }
223 return buf;
224 };
225 Utils.pad = function(num, digits) {
226 var prefix = "";
227 for (digits -= String(num).length; 0 < digits--;) {
228 prefix += "0";
229 }
230 return "" + prefix + num;
231 };
232 var InternalUtils = {};
233 InternalUtils.isNode = "[object process]" === Object.prototype.toString.call(global.process);
234 InternalUtils.require = function(name) {
235 return InternalUtils.isNode ? eval("require")(name) : null;
236 };
237 }).call(this, __webpack_require__(3));
238 }, function(module, __webpack_exports__, __webpack_require__) {
239 var sjcl = {cipher:{}, hash:{}, keyexchange:{}, mode:{}, misc:{}, codec:{}, exception:{corrupt:function(message) {
240 this.toString = function() {
241 return "CORRUPT: " + this.message;
242 };
243 this.message = message;
244 }, invalid:function(message) {
245 this.toString = function() {
246 return "INVALID: " + this.message;
247 };
248 this.message = message;
249 }, bug:function(message) {
250 this.toString = function() {
251 return "BUG: " + this.message;
252 };
253 this.message = message;
254 }, notReady:function(message) {
255 this.toString = function() {
256 return "NOT READY: " + this.message;
257 };
258 this.message = message;
259 }}, bitArray:{bitSlice:function(a, bstart, bend) {
260 a = sjcl.bitArray._shiftRight(a.slice(bstart / 32), 32 - (bstart & 31)).slice(1);
261 return void 0 === bend ? a : sjcl.bitArray.clamp(a, bend - bstart);
262 }, extract:function(a, bstart, blength) {
263 var sh = Math.floor(-bstart - blength & 31);
264 return ((bstart + blength - 1 ^ bstart) & -32 ? a[bstart / 32 | 0] << 32 - sh ^ a[bstart / 32 + 1 | 0] >>> sh : a[bstart / 32 | 0] >>> sh) & (1 << blength) - 1;
265 }, concat:function(a1, a2) {
266 if (0 === a1.length || 0 === a2.length) {
267 return a1.concat(a2);
268 }
269 var last = a1[a1.length - 1], shift = sjcl.bitArray.getPartial(last);
270 return 32 === shift ? a1.concat(a2) : sjcl.bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));
271 }, bitLength:function(a) {
272 var l = a.length;
273 return 0 === l ? 0 : 32 * (l - 1) + sjcl.bitArray.getPartial(a[l - 1]);
274 }, clamp:function(a, len) {
275 if (32 * a.length < len) {
276 return a;
277 }
278 a = a.slice(0, Math.ceil(len / 32));
279 var l = a.length;
280 len &= 31;
281 0 < l && len && (a[l - 1] = sjcl.bitArray.partial(len, a[l - 1] & 2147483648 >> len - 1, 1));
282 return a;
283 }, partial:function(len, x, _end) {
284 return 32 === len ? x : (_end ? x | 0 : x << 32 - len) + 1099511627776 * len;
285 }, getPartial:function(x) {
286 return Math.round(x / 1099511627776) || 32;
287 }, equal:function(a, b) {
288 if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
289 return !1;
290 }
291 var x = 0, i;
292 for (i = 0; i < a.length; i++) {
293 x |= a[i] ^ b[i];
294 }
295 return 0 === x;
296 }, _shiftRight:function(a, shift, carry, out) {
297 var i;
298 for (void 0 === out && (out = []); 32 <= shift; shift -= 32) {
299 out.push(carry), carry = 0;
300 }
301 if (0 === shift) {
302 return out.concat(a);
303 }
304 for (i = 0; i < a.length; i++) {
305 out.push(carry | a[i] >>> shift), carry = a[i] << 32 - shift;
306 }
307 a = sjcl.bitArray.getPartial(a.length ? a[a.length - 1] : 0);
308 out.push(sjcl.bitArray.partial(shift + a & 31, 32 < shift + a ? carry : out.pop(), 1));
309 return out;
310 }, _xor4:function(x, y) {
311 return [x[0] ^ y[0], x[1] ^ y[1], x[2] ^ y[2], x[3] ^ y[3]];
312 }, byteswapM:function(a) {
313 var i;
314 for (i = 0; i < a.length; ++i) {
315 var v = a[i];
316 a[i] = v >>> 24 | v >>> 8 & 65280 | (v & 65280) << 8 | v << 24;
317 }
318 return a;
319 }}};
320 "undefined" === typeof ArrayBuffer && function(globals) {
321 globals.ArrayBuffer = function() {
322 };
323 globals.DataView = function() {
324 };
325 }(void 0);
326 sjcl.codec.arrayBuffer = {fromBits:function(arr, padding, padding_count) {
327 padding = void 0 == padding ? !0 : padding;
328 padding_count = padding_count || 8;
329 if (0 === arr.length) {
330 return new ArrayBuffer(0);
331 }
332 var ol = sjcl.bitArray.bitLength(arr) / 8;
333 if (0 !== sjcl.bitArray.bitLength(arr) % 8) {
334 throw new sjcl.exception.invalid("Invalid bit size, must be divisble by 8 to fit in an arraybuffer correctly");
335 }
336 padding && 0 !== ol % padding_count && (ol += padding_count - ol % padding_count);
337 padding_count = new DataView(new ArrayBuffer(4 * arr.length));
338 for (padding = 0; padding < arr.length; padding++) {
339 padding_count.setUint32(4 * padding, arr[padding] << 32);
340 }
341 arr = new DataView(new ArrayBuffer(ol));
342 if (arr.byteLength === padding_count.byteLength) {
343 return padding_count.buffer;
344 }
345 ol = padding_count.byteLength < arr.byteLength ? padding_count.byteLength : arr.byteLength;
346 for (padding = 0; padding < ol; padding++) {
347 arr.setUint8(padding, padding_count.getUint8(padding));
348 }
349 return arr.buffer;
350 }, toBits:function(buffer) {
351 var out = [];
352 if (0 === buffer.byteLength) {
353 return [];
354 }
355 var inView = new DataView(buffer);
356 var len = inView.byteLength - inView.byteLength % 4;
357 for (buffer = 0; buffer < len; buffer += 4) {
358 out.push(inView.getUint32(buffer));
359 }
360 if (0 != inView.byteLength % 4) {
361 var tmp = new DataView(new ArrayBuffer(4));
362 buffer = 0;
363 for (var l = inView.byteLength % 4; buffer < l; buffer++) {
364 tmp.setUint8(buffer + 4 - l, inView.getUint8(len + buffer));
365 }
366 out.push(sjcl.bitArray.partial(inView.byteLength % 4 * 8, tmp.getUint32(0)));
367 }
368 return out;
369 }, hexDumpBuffer:function(buffer) {
370 buffer = new DataView(buffer);
371 for (var string = "", i = 0; i < buffer.byteLength; i += 2) {
372 0 == i % 16 && (string += "\n" + i.toString(16) + "\t");
373 var JSCompiler_inline_result = buffer.getUint16(i).toString(16);
374 JSCompiler_inline_result += "";
375 JSCompiler_inline_result = 4 <= JSCompiler_inline_result.length ? JSCompiler_inline_result : Array(4 - JSCompiler_inline_result.length + 1).join("0") + JSCompiler_inline_result;
376 string += JSCompiler_inline_result + " ";
377 }
378 console.log(string.toUpperCase());
379 }};
380 sjcl.hash.sha1 = function(hash) {
381 hash ? (this._h = hash._h.slice(0), this._buffer = hash._buffer.slice(0), this._length = hash._length) : this.reset();
382 };
383 sjcl.hash.sha1.hash = function(data) {
384 return (new sjcl.hash.sha1).update(data).finalize();
385 };
386 sjcl.hash.sha1.prototype = {blockSize:512, reset:function() {
387 this._h = this._init.slice(0);
388 this._buffer = [];
389 this._length = 0;
390 return this;
391 }, update:function(data) {
392 "string" === typeof data && (data = sjcl.codec.utf8String.toBits(data));
393 var b = this._buffer = sjcl.bitArray.concat(this._buffer, data);
394 var i = this._length;
395 data = this._length = i + sjcl.bitArray.bitLength(data);
396 if (9007199254740991 < data) {
397 throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
398 }
399 if ("undefined" !== typeof Uint32Array) {
400 var c = new Uint32Array(b), j = 0;
401 for (i = this.blockSize + i - (this.blockSize + i & this.blockSize - 1); i <= data; i += this.blockSize) {
402 this._block(c.subarray(16 * j, 16 * (j + 1))), j += 1;
403 }
404 b.splice(0, 16 * j);
405 } else {
406 for (i = this.blockSize + i - (this.blockSize + i & this.blockSize - 1); i <= data; i += this.blockSize) {
407 this._block(b.splice(0, 16));
408 }
409 }
410 return this;
411 }, finalize:function() {
412 var i, b = this._buffer, h = this._h;
413 b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);
414 for (i = b.length + 2; i & 15; i++) {
415 b.push(0);
416 }
417 b.push(Math.floor(this._length / 4294967296));
418 for (b.push(this._length | 0); b.length;) {
419 this._block(b.splice(0, 16));
420 }
421 this.reset();
422 return h;
423 }, _init:[1732584193, 4023233417, 2562383102, 271733878, 3285377520], _key:[1518500249, 1859775393, 2400959708, 3395469782], _f:function(t, b, c, d) {
424 if (19 >= t) {
425 return b & c | ~b & d;
426 }
427 if (39 >= t) {
428 return b ^ c ^ d;
429 }
430 if (59 >= t) {
431 return b & c | b & d | c & d;
432 }
433 if (79 >= t) {
434 return b ^ c ^ d;
435 }
436 }, _S:function(n, x) {
437 return x << n | x >>> 32 - n;
438 }, _block:function(words) {
439 var tmp, h = this._h;
440 if ("undefined" !== typeof Uint32Array) {
441 var w = Array(80);
442 for (tmp = 0; 16 > tmp; tmp++) {
443 w[tmp] = words[tmp];
444 }
445 } else {
446 w = words;
447 }
448 var a = h[0];
449 var b = h[1];
450 var c = h[2];
451 var d = h[3];
452 var e = h[4];
453 for (words = 0; 79 >= words; words++) {
454 16 <= words && (w[words] = this._S(1, w[words - 3] ^ w[words - 8] ^ w[words - 14] ^ w[words - 16])), tmp = this._S(5, a) + this._f(words, b, c, d) + e + w[words] + this._key[Math.floor(words / 20)] | 0, e = d, d = c, c = this._S(30, b), b = a, a = tmp;
455 }
456 h[0] = h[0] + a | 0;
457 h[1] = h[1] + b | 0;
458 h[2] = h[2] + c | 0;
459 h[3] = h[3] + d | 0;
460 h[4] = h[4] + e | 0;
461 }};
462 sjcl.hash.sha256 = function(hash) {
463 this._key[0] || this._precompute();
464 hash ? (this._h = hash._h.slice(0), this._buffer = hash._buffer.slice(0), this._length = hash._length) : this.reset();
465 };
466 sjcl.hash.sha256.hash = function(data) {
467 return (new sjcl.hash.sha256).update(data).finalize();
468 };
469 sjcl.hash.sha256.prototype = {blockSize:512, reset:function() {
470 this._h = this._init.slice(0);
471 this._buffer = [];
472 this._length = 0;
473 return this;
474 }, update:function(data) {
475 "string" === typeof data && (data = sjcl.codec.utf8String.toBits(data));
476 var b = this._buffer = sjcl.bitArray.concat(this._buffer, data);
477 var i = this._length;
478 data = this._length = i + sjcl.bitArray.bitLength(data);
479 if (9007199254740991 < data) {
480 throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
481 }
482 if ("undefined" !== typeof Uint32Array) {
483 var c = new Uint32Array(b), j = 0;
484 for (i = 512 + i - (512 + i & 511); i <= data; i += 512) {
485 this._block(c.subarray(16 * j, 16 * (j + 1))), j += 1;
486 }
487 b.splice(0, 16 * j);
488 } else {
489 for (i = 512 + i - (512 + i & 511); i <= data; i += 512) {
490 this._block(b.splice(0, 16));
491 }
492 }
493 return this;
494 }, finalize:function() {
495 var i, b = this._buffer, h = this._h;
496 b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);
497 for (i = b.length + 2; i & 15; i++) {
498 b.push(0);
499 }
500 b.push(Math.floor(this._length / 4294967296));
501 for (b.push(this._length | 0); b.length;) {
502 this._block(b.splice(0, 16));
503 }
504 this.reset();
505 return h;
506 }, _init:[], _key:[], _precompute:function() {
507 function frac(x) {
508 return 4294967296 * (x - Math.floor(x)) | 0;
509 }
510 for (var i = 0, prime = 2, factor, isPrime; 64 > i; prime++) {
511 isPrime = !0;
512 for (factor = 2; factor * factor <= prime; factor++) {
513 if (0 === prime % factor) {
514 isPrime = !1;
515 break;
516 }
517 }
518 isPrime && (8 > i && (this._init[i] = frac(Math.pow(prime, .5))), this._key[i] = frac(Math.pow(prime, 1 / 3)), i++);
519 }
520 }, _block:function(w) {
521 var i, h = this._h, k = this._key, h0 = h[0], h1 = h[1], h2 = h[2], h3 = h[3], h4 = h[4], h5 = h[5], h6 = h[6], h7 = h[7];
522 for (i = 0; 64 > i; i++) {
523 if (16 > i) {
524 var tmp = w[i];
525 } else {
526 tmp = w[i + 1 & 15];
527 var b = w[i + 14 & 15];
528 tmp = w[i & 15] = (tmp >>> 7 ^ tmp >>> 18 ^ tmp >>> 3 ^ tmp << 25 ^ tmp << 14) + (b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) + w[i & 15] + w[i + 9 & 15] | 0;
529 }
530 tmp = tmp + h7 + (h4 >>> 6 ^ h4 >>> 11 ^ h4 >>> 25 ^ h4 << 26 ^ h4 << 21 ^ h4 << 7) + (h6 ^ h4 & (h5 ^ h6)) + k[i];
531 h7 = h6;
532 h6 = h5;
533 h5 = h4;
534 h4 = h3 + tmp | 0;
535 h3 = h2;
536 h2 = h1;
537 h1 = h0;
538 h0 = tmp + (h1 & h2 ^ h3 & (h1 ^ h2)) + (h1 >>> 2 ^ h1 >>> 13 ^ h1 >>> 22 ^ h1 << 30 ^ h1 << 19 ^ h1 << 10) | 0;
539 }
540 h[0] = h[0] + h0 | 0;
541 h[1] = h[1] + h1 | 0;
542 h[2] = h[2] + h2 | 0;
543 h[3] = h[3] + h3 | 0;
544 h[4] = h[4] + h4 | 0;
545 h[5] = h[5] + h5 | 0;
546 h[6] = h[6] + h6 | 0;
547 h[7] = h[7] + h7 | 0;
548 }};
549 sjcl.hash.sha512 = function(hash) {
550 this._key[0] || this._precompute();
551 hash ? (this._h = hash._h.slice(0), this._buffer = hash._buffer.slice(0), this._length = hash._length) : this.reset();
552 };
553 sjcl.hash.sha512.hash = function(data) {
554 return (new sjcl.hash.sha512).update(data).finalize();
555 };
556 sjcl.hash.sha512.prototype = {blockSize:1024, reset:function() {
557 this._h = this._init.slice(0);
558 this._buffer = [];
559 this._length = 0;
560 return this;
561 }, update:function(data) {
562 "string" === typeof data && (data = sjcl.codec.utf8String.toBits(data));
563 var b = this._buffer = sjcl.bitArray.concat(this._buffer, data);
564 var i = this._length;
565 data = this._length = i + sjcl.bitArray.bitLength(data);
566 if (9007199254740991 < data) {
567 throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
568 }
569 if ("undefined" !== typeof Uint32Array) {
570 var c = new Uint32Array(b), j = 0;
571 for (i = 1024 + i - (1024 + i & 1023); i <= data; i += 1024) {
572 this._block(c.subarray(32 * j, 32 * (j + 1))), j += 1;
573 }
574 b.splice(0, 32 * j);
575 } else {
576 for (i = 1024 + i - (1024 + i & 1023); i <= data; i += 1024) {
577 this._block(b.splice(0, 32));
578 }
579 }
580 return this;
581 }, finalize:function() {
582 var i, b = this._buffer, h = this._h;
583 b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1, 1)]);
584 for (i = b.length + 4; i & 31; i++) {
585 b.push(0);
586 }
587 b.push(0);
588 b.push(0);
589 b.push(Math.floor(this._length / 4294967296));
590 for (b.push(this._length | 0); b.length;) {
591 this._block(b.splice(0, 32));
592 }
593 this.reset();
594 return h;
595 }, _init:[], _initr:[12372232, 13281083, 9762859, 1914609, 15106769, 4090911, 4308331, 8266105], _key:[], _keyr:[2666018, 15689165, 5061423, 9034684, 4764984, 380953, 1658779, 7176472, 197186, 7368638, 14987916, 16757986, 8096111, 1480369, 13046325, 6891156, 15813330, 5187043, 9229749, 11312229, 2818677, 10937475, 4324308, 1135541, 6741931, 11809296, 16458047, 15666916, 11046850, 698149, 229999, 945776, 13774844, 2541862, 12856045, 9810911, 11494366, 7844520, 15576806, 8533307, 15795044, 4337665,
596 16291729, 5553712, 15684120, 6662416, 7413802, 12308920, 13816008, 4303699, 9366425, 10176680, 13195875, 4295371, 6546291, 11712675, 15708924, 1519456, 15772530, 6568428, 6495784, 8568297, 13007125, 7492395, 2515356, 12632583, 14740254, 7262584, 1535930, 13146278, 16321966, 1853211, 294276, 13051027, 13221564, 1051980, 4080310, 6651434, 14088940, 4675607], _precompute:function() {
597 function frac(x) {
598 return 4294967296 * (x - Math.floor(x)) | 0;
599 }
600 function frac2(x) {
601 return 1099511627776 * (x - Math.floor(x)) & 255;
602 }
603 for (var i = 0, prime = 2, factor, isPrime; 80 > i; prime++) {
604 isPrime = !0;
605 for (factor = 2; factor * factor <= prime; factor++) {
606 if (0 === prime % factor) {
607 isPrime = !1;
608 break;
609 }
610 }
611 isPrime && (8 > i && (this._init[2 * i] = frac(Math.pow(prime, .5)), this._init[2 * i + 1] = frac2(Math.pow(prime, .5)) << 24 | this._initr[i]), this._key[2 * i] = frac(Math.pow(prime, 1 / 3)), this._key[2 * i + 1] = frac2(Math.pow(prime, 1 / 3)) << 24 | this._keyr[i], i++);
612 }
613 }, _block:function(words) {
614 var h = this._h, k = this._key, h0h = h[0], h0l = h[1], h1h = h[2], h1l = h[3], h2h = h[4], h2l = h[5], h3h = h[6], h3l = h[7], h4h = h[8], h4l = h[9], h5h = h[10], h5l = h[11], h6h = h[12], h6l = h[13], h7h = h[14], h7l = h[15];
615 if ("undefined" !== typeof Uint32Array) {
616 var w = Array(160);
617 for (var j = 0; 32 > j; j++) {
618 w[j] = words[j];
619 }
620 } else {
621 w = words;
622 }
623 j = h0h;
624 var al = h0l, bh = h1h, bl = h1l, ch = h2h, cl = h2l, dh = h3h, dl = h3l, eh = h4h, el = h4l, fh = h5h, fl = h5l, gh = h6h, gl = h6l, hh = h7h, hl = h7l;
625 for (words = 0; 80 > words; words++) {
626 if (16 > words) {
627 var wrh = w[2 * words];
628 var wrl = w[2 * words + 1];
629 } else {
630 wrl = w[2 * (words - 15)];
631 var gamma0xl = w[2 * (words - 15) + 1];
632 wrh = (gamma0xl << 31 | wrl >>> 1) ^ (gamma0xl << 24 | wrl >>> 8) ^ wrl >>> 7;
633 var gamma0l = (wrl << 31 | gamma0xl >>> 1) ^ (wrl << 24 | gamma0xl >>> 8) ^ (wrl << 25 | gamma0xl >>> 7);
634 wrl = w[2 * (words - 2)];
635 var gamma1xl = w[2 * (words - 2) + 1];
636 gamma0xl = (gamma1xl << 13 | wrl >>> 19) ^ (wrl << 3 | gamma1xl >>> 29) ^ wrl >>> 6;
637 gamma1xl = (wrl << 13 | gamma1xl >>> 19) ^ (gamma1xl << 3 | wrl >>> 29) ^ (wrl << 26 | gamma1xl >>> 6);
638 var wr7h = w[2 * (words - 7)], wr16h = w[2 * (words - 16)], wr16l = w[2 * (words - 16) + 1];
639 wrl = gamma0l + w[2 * (words - 7) + 1];
640 wrh = wrh + wr7h + (wrl >>> 0 < gamma0l >>> 0 ? 1 : 0);
641 wrl += gamma1xl;
642 wrh += gamma0xl + (wrl >>> 0 < gamma1xl >>> 0 ? 1 : 0);
643 wrl += wr16l;
644 wrh += wr16h + (wrl >>> 0 < wr16l >>> 0 ? 1 : 0);
645 }
646 w[2 * words] = wrh |= 0;
647 w[2 * words + 1] = wrl |= 0;
648 wr7h = eh & fh ^ ~eh & gh;
649 var chl = el & fl ^ ~el & gl;
650 gamma1xl = j & bh ^ j & ch ^ bh & ch;
651 var majl = al & bl ^ al & cl ^ bl & cl;
652 wr16h = (al << 4 | j >>> 28) ^ (j << 30 | al >>> 2) ^ (j << 25 | al >>> 7);
653 wr16l = (j << 4 | al >>> 28) ^ (al << 30 | j >>> 2) ^ (al << 25 | j >>> 7);
654 var krh = k[2 * words], krl = k[2 * words + 1];
655 gamma0xl = hl + ((eh << 18 | el >>> 14) ^ (eh << 14 | el >>> 18) ^ (el << 23 | eh >>> 9));
656 gamma0l = hh + ((el << 18 | eh >>> 14) ^ (el << 14 | eh >>> 18) ^ (eh << 23 | el >>> 9)) + (gamma0xl >>> 0 < hl >>> 0 ? 1 : 0);
657 gamma0xl += chl;
658 gamma0l += wr7h + (gamma0xl >>> 0 < chl >>> 0 ? 1 : 0);
659 gamma0xl += krl;
660 gamma0l += krh + (gamma0xl >>> 0 < krl >>> 0 ? 1 : 0);
661 gamma0xl = gamma0xl + wrl | 0;
662 gamma0l += wrh + (gamma0xl >>> 0 < wrl >>> 0 ? 1 : 0);
663 wrl = wr16l + majl;
664 wrh = wr16h + gamma1xl + (wrl >>> 0 < wr16l >>> 0 ? 1 : 0);
665 hh = gh;
666 hl = gl;
667 gh = fh;
668 gl = fl;
669 fh = eh;
670 fl = el;
671 el = dl + gamma0xl | 0;
672 eh = dh + gamma0l + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0;
673 dh = ch;
674 dl = cl;
675 ch = bh;
676 cl = bl;
677 bh = j;
678 bl = al;
679 al = gamma0xl + wrl | 0;
680 j = gamma0l + wrh + (al >>> 0 < gamma0xl >>> 0 ? 1 : 0) | 0;
681 }
682 h0l = h[1] = h0l + al | 0;
683 h[0] = h0h + j + (h0l >>> 0 < al >>> 0 ? 1 : 0) | 0;
684 h1l = h[3] = h1l + bl | 0;
685 h[2] = h1h + bh + (h1l >>> 0 < bl >>> 0 ? 1 : 0) | 0;
686 h2l = h[5] = h2l + cl | 0;
687 h[4] = h2h + ch + (h2l >>> 0 < cl >>> 0 ? 1 : 0) | 0;
688 h3l = h[7] = h3l + dl | 0;
689 h[6] = h3h + dh + (h3l >>> 0 < dl >>> 0 ? 1 : 0) | 0;
690 h4l = h[9] = h4l + el | 0;
691 h[8] = h4h + eh + (h4l >>> 0 < el >>> 0 ? 1 : 0) | 0;
692 h5l = h[11] = h5l + fl | 0;
693 h[10] = h5h + fh + (h5l >>> 0 < fl >>> 0 ? 1 : 0) | 0;
694 h6l = h[13] = h6l + gl | 0;
695 h[12] = h6h + gh + (h6l >>> 0 < gl >>> 0 ? 1 : 0) | 0;
696 h7l = h[15] = h7l + hl | 0;
697 h[14] = h7h + hh + (h7l >>> 0 < hl >>> 0 ? 1 : 0) | 0;
698 }};
699 sjcl.misc.hmac = function(key, Hash) {
700 this._hash = Hash = Hash || sjcl.hash.sha256;
701 var exKey = [[], []], i, bs = Hash.prototype.blockSize / 32;
702 this._baseHash = [new Hash, new Hash];
703 key.length > bs && (key = Hash.hash(key));
704 for (i = 0; i < bs; i++) {
705 exKey[0][i] = key[i] ^ 909522486, exKey[1][i] = key[i] ^ 1549556828;
706 }
707 this._baseHash[0].update(exKey[0]);
708 this._baseHash[1].update(exKey[1]);
709 this._resultHash = new Hash(this._baseHash[0]);
710 };
711 sjcl.misc.hmac.prototype.encrypt = sjcl.misc.hmac.prototype.mac = function(data) {
712 if (this._updated) {
713 throw new sjcl.exception.invalid("encrypt on already updated hmac called!");
714 }
715 this.update(data);
716 return this.digest(data);
717 };
718 sjcl.misc.hmac.prototype.reset = function() {
719 this._resultHash = new this._hash(this._baseHash[0]);
720 this._updated = !1;
721 };
722 sjcl.misc.hmac.prototype.update = function(data) {
723 this._updated = !0;
724 this._resultHash.update(data);
725 };
726 sjcl.misc.hmac.prototype.digest = function() {
727 var w = this._resultHash.finalize();
728 w = (new this._hash(this._baseHash[1])).update(w).finalize();
729 this.reset();
730 return w;
731 };
732 __webpack_exports__.a = sjcl;
733 }, function(module, __webpack_exports__, __webpack_require__) {
734 (function(global) {
735 __webpack_require__.d(__webpack_exports__, "a", function() {
736 return Crypto;
737 });
738 var sjcl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1), NodeCrypto = __webpack_require__(0).a.require("crypto"), Crypto = {};
739 if (NodeCrypto) {
740 var bufferFrom = "function" === typeof Buffer.from ? Buffer.from : function(arrbuf) {
741 var nodeBuf = new Buffer(arrbuf.byteLength);
742 arrbuf = new Uint8Array(arrbuf);
743 for (var i = 0; i < arrbuf.length; i++) {
744 nodeBuf[i] = arrbuf[i];
745 }
746 return nodeBuf;
747 };
748 var bufferTo = Buffer.prototype instanceof Uint8Array ? function(nodeBuf) {
749 return nodeBuf;
750 } : function(nodeBuf) {
751 for (var arr = new Uint8Array(nodeBuf.length), i = 0; i < arr.length; i++) {
752 arr[i] = nodeBuf[i];
753 }
754 return arr;
755 };
756 Crypto.randomBytes = function(size) {
757 size = NodeCrypto.randomBytes(size);
758 return bufferTo(size);
759 };
760 Crypto.hmacDigest = function(algorithm, key, message) {
761 algorithm = NodeCrypto.createHmac(algorithm, bufferFrom(key));
762 return bufferTo(algorithm).update(bufferFrom(message)).digest();
763 };
764 } else {
765 if ("undefined" !== typeof global.crypto && "function" === typeof global.crypto.getRandomValues) {
766 var getRandomValues = function(arr) {
767 global.crypto.getRandomValues(arr);
768 };
769 } else {
770 "undefined" !== typeof global.msCrypto && "function" === typeof global.msCrypto.getRandomValues ? getRandomValues = function(arr) {
771 global.msCrypto.getRandomValues(arr);
772 } : (console.warn("Cryptography API not available, falling back to 'Math.random'..."), getRandomValues = function(arr) {
773 for (var i = 0; i < arr.length; i++) {
774 arr[i] = Math.floor(256 * Math.random());
775 }
776 });
777 }
778 Crypto.randomBytes = function(size) {
779 size = new Uint8Array(size);
780 getRandomValues(size);
781 return size;
782 };
783 Crypto.hmacDigest = function(algorithm, key, message) {
784 algorithm = sjcl__WEBPACK_IMPORTED_MODULE_0__.a.hash[algorithm.toLowerCase()];
785 if ("undefined" === typeof algorithm) {
786 throw new TypeError("Unknown hash function");
787 }
788 key = new sjcl__WEBPACK_IMPORTED_MODULE_0__.a.misc.hmac(sjcl__WEBPACK_IMPORTED_MODULE_0__.a.codec.arrayBuffer.toBits(key), algorithm);
789 key.update(sjcl__WEBPACK_IMPORTED_MODULE_0__.a.codec.arrayBuffer.toBits(message));
790 return sjcl__WEBPACK_IMPORTED_MODULE_0__.a.codec.arrayBuffer.fromBits(key.digest(), !1);
791 };
792 }
793 }).call(this, __webpack_require__(3));
794 }, function(module, exports) {
795 exports = function() {
796 return this;
797 }();
798 try {
799 exports = exports || (new Function("return this"))();
800 } catch (e) {
801 "object" === typeof window && (exports = window);
802 }
803 module.exports = exports;
804 }, function(module, __webpack_exports__, __webpack_require__) {
805 __webpack_require__.r(__webpack_exports__);
806 var utils = __webpack_require__(0), src_crypto = __webpack_require__(2), secret_Secret = function($jscomp$destructuring$var0) {
807 var $jscomp$destructuring$var1 = void 0 === $jscomp$destructuring$var0 ? {} : $jscomp$destructuring$var0;
808 $jscomp$destructuring$var0 = $jscomp$destructuring$var1.buffer;
809 $jscomp$destructuring$var1 = void 0 === $jscomp$destructuring$var1.size ? 20 : $jscomp$destructuring$var1.size;
810 this.buffer = "undefined" === typeof $jscomp$destructuring$var0 ? src_crypto.a.randomBytes($jscomp$destructuring$var1).buffer : $jscomp$destructuring$var0;
811 };
812 secret_Secret.fromRaw = function(str) {
813 return new this({buffer:utils.b.raw.encode(str)});
814 };
815 secret_Secret.fromB32 = function(str) {
816 return new this({buffer:utils.b.b32.encode(str)});
817 };
818 secret_Secret.fromHex = function(str) {
819 return new this({buffer:utils.b.hex.encode(str)});
820 };
821 $jscomp.global.Object.defineProperties(secret_Secret.prototype, {raw:{configurable:!0, enumerable:!0, get:function() {
822 Object.defineProperty(this, "raw", {enumerable:!0, configurable:!0, writable:!0, value:utils.b.raw.decode(this.buffer)});
823 return this.raw;
824 }}, b32:{configurable:!0, enumerable:!0, get:function() {
825 Object.defineProperty(this, "b32", {enumerable:!0, configurable:!0, writable:!0, value:utils.b.b32.decode(this.buffer)});
826 return this.b32;
827 }}, hex:{configurable:!0, enumerable:!0, get:function() {
828 Object.defineProperty(this, "hex", {enumerable:!0, configurable:!0, writable:!0, value:utils.b.hex.decode(this.buffer)});
829 return this.hex;
830 }}});
831 var OTPURI_REGEX = /^otpauth:\/\/([ht]otp)\/(.+)\?((?:&?(?:issuer|secret|algorithm|digits|counter|period)=[^&]+)+)$/i, SECRET_REGEX = /^[2-7A-Z]+$/i, ALGORITHM_REGEX = /^SHA(?:1|256|512)$/i, INTEGER_REGEX = /^[+-]?\d+$/, POSITIVE_INTEGER_REGEX = /^\+?[1-9]\d*$/, uri_URI = function() {
832 };
833 uri_URI.parse = function(uri) {
834 try {
835 var uriGroups = uri.match(OTPURI_REGEX);
836 } catch (error) {
837 }
838 if (!Array.isArray(uriGroups)) {
839 throw new URIError("Invalid URI format");
840 }
841 var uriType = uriGroups[1].toLowerCase();
842 uri = uriGroups[2].split(/:(.+)/, 2).map(decodeURIComponent);
843 uriGroups = uriGroups[3].split("&").reduce(function(acc, cur) {
844 cur = cur.split(/=(.+)/, 2).map(decodeURIComponent);
845 var pairKey = cur[0].toLowerCase();
846 acc[pairKey] = cur[1];
847 return acc;
848 }, {});
849 var config = {};
850 if ("hotp" === uriType) {
851 if (uriType = otp_HOTP, "undefined" !== typeof uriGroups.counter && INTEGER_REGEX.test(uriGroups.counter)) {
852 config.counter = Number.parseInt(uriGroups.counter, 10);
853 } else {
854 throw new TypeError("Missing or invalid 'counter' parameter");
855 }
856 } else {
857 if ("totp" === uriType) {
858 if (uriType = otp_TOTP, "undefined" !== typeof uriGroups.period) {
859 if (POSITIVE_INTEGER_REGEX.test(uriGroups.period)) {
860 config.period = Number.parseInt(uriGroups.period, 10);
861 } else {
862 throw new TypeError("Invalid 'period' parameter");
863 }
864 }
865 } else {
866 throw new TypeError("Unknown OTP type");
867 }
868 }
869 if (2 === uri.length) {
870 if (config.label = uri[1], "undefined" === typeof uriGroups.issuer) {
871 config.issuer = uri[0];
872 } else {
873 if (uriGroups.issuer === uri[0]) {
874 config.issuer = uriGroups.issuer;
875 } else {
876 throw new TypeError("Invalid 'issuer' parameter");
877 }
878 }
879 } else {
880 config.label = uri[0], "undefined" !== typeof uriGroups.issuer && (config.issuer = uriGroups.issuer);
881 }
882 if ("undefined" !== typeof uriGroups.secret && SECRET_REGEX.test(uriGroups.secret)) {
883 config.secret = new secret_Secret({buffer:utils.b.b32.encode(uriGroups.secret)});
884 } else {
885 throw new TypeError("Missing or invalid 'secret' parameter");
886 }
887 if ("undefined" !== typeof uriGroups.algorithm) {
888 if (ALGORITHM_REGEX.test(uriGroups.algorithm)) {
889 config.algorithm = uriGroups.algorithm;
890 } else {
891 throw new TypeError("Invalid 'algorithm' parameter");
892 }
893 }
894 if ("undefined" !== typeof uriGroups.digits) {
895 if (POSITIVE_INTEGER_REGEX.test(uriGroups.digits)) {
896 config.digits = Number.parseInt(uriGroups.digits, 10);
897 } else {
898 throw new TypeError("Invalid 'digits' parameter");
899 }
900 }
901 return new uriType(config);
902 };
903 uri_URI.stringify = function(otp, $jscomp$destructuring$var2) {
904 $jscomp$destructuring$var2 = void 0 === $jscomp$destructuring$var2 ? {} : $jscomp$destructuring$var2;
905 $jscomp$destructuring$var2 = void 0 === $jscomp$destructuring$var2.legacyIssuer ? !0 : $jscomp$destructuring$var2.legacyIssuer;
906 var isTOTP = otp instanceof otp_TOTP;
907 if (!(otp instanceof otp_HOTP || isTOTP)) {
908 throw new TypeError("Invalid 'HOTP/TOTP' object");
909 }
910 var uri = "otpauth://" + ((isTOTP ? "totp" : "hotp") + "/");
911 0 < otp.issuer.length ? ($jscomp$destructuring$var2 && (uri += encodeURIComponent(otp.issuer) + ":"), uri += encodeURIComponent(otp.label) + "?", uri += "issuer=" + encodeURIComponent(otp.issuer) + "&") : uri += encodeURIComponent(otp.label) + "?";
912 uri += "secret=" + encodeURIComponent(otp.secret.b32) + ("&algorithm=" + encodeURIComponent(otp.algorithm)) + ("&digits=" + encodeURIComponent(otp.digits));
913 return uri = isTOTP ? uri + ("&period=" + encodeURIComponent(otp.period)) : uri + ("&counter=" + encodeURIComponent(otp.counter));
914 };
915 var otp_HOTP = function($jscomp$destructuring$var4) {
916 var $jscomp$destructuring$var5 = void 0 === $jscomp$destructuring$var4 ? {} : $jscomp$destructuring$var4;
917 $jscomp$destructuring$var4 = void 0 === $jscomp$destructuring$var5.issuer ? "" : $jscomp$destructuring$var5.issuer;
918 var label = void 0 === $jscomp$destructuring$var5.label ? "OTPAuth" : $jscomp$destructuring$var5.label, secret = void 0 === $jscomp$destructuring$var5.secret ? new secret_Secret : $jscomp$destructuring$var5.secret, algorithm = void 0 === $jscomp$destructuring$var5.algorithm ? "SHA1" : $jscomp$destructuring$var5.algorithm, digits = void 0 === $jscomp$destructuring$var5.digits ? 6 : $jscomp$destructuring$var5.digits;
919 $jscomp$destructuring$var5 = void 0 === $jscomp$destructuring$var5.counter ? 0 : $jscomp$destructuring$var5.counter;
920 this.issuer = $jscomp$destructuring$var4;
921 this.label = label;
922 this.secret = secret;
923 this.algorithm = algorithm;
924 this.digits = digits;
925 this.counter = $jscomp$destructuring$var5;
926 };
927 otp_HOTP.generate = function($jscomp$destructuring$var6) {
928 var digits = void 0 === $jscomp$destructuring$var6.digits ? 6 : $jscomp$destructuring$var6.digits;
929 $jscomp$destructuring$var6 = new Uint8Array(src_crypto.a.hmacDigest(void 0 === $jscomp$destructuring$var6.algorithm ? "SHA1" : $jscomp$destructuring$var6.algorithm, $jscomp$destructuring$var6.secret.buffer, utils.b.uint.encode(void 0 === $jscomp$destructuring$var6.counter ? 0 : $jscomp$destructuring$var6.counter)));
930 var offset = $jscomp$destructuring$var6[$jscomp$destructuring$var6.byteLength - 1] & 15;
931 return utils.b.pad((($jscomp$destructuring$var6[offset] & 127) << 24 | ($jscomp$destructuring$var6[offset + 1] & 255) << 16 | ($jscomp$destructuring$var6[offset + 2] & 255) << 8 | $jscomp$destructuring$var6[offset + 3] & 255) % Math.pow(10, digits), digits);
932 };
933 otp_HOTP.prototype.generate = function($jscomp$destructuring$var8) {
934 $jscomp$destructuring$var8 = void 0 === $jscomp$destructuring$var8 ? {} : $jscomp$destructuring$var8;
935 $jscomp$destructuring$var8 = void 0 === $jscomp$destructuring$var8.counter ? this.counter++ : $jscomp$destructuring$var8.counter;
936 return otp_HOTP.generate({secret:this.secret, algorithm:this.algorithm, digits:this.digits, counter:$jscomp$destructuring$var8});
937 };
938 otp_HOTP.validate = function($jscomp$destructuring$var10) {
939 var token = $jscomp$destructuring$var10.token, secret = $jscomp$destructuring$var10.secret, algorithm = $jscomp$destructuring$var10.algorithm, counter = void 0 === $jscomp$destructuring$var10.counter ? 0 : $jscomp$destructuring$var10.counter;
940 $jscomp$destructuring$var10 = void 0 === $jscomp$destructuring$var10.window ? 50 : $jscomp$destructuring$var10.window;
941 for (var i = counter - $jscomp$destructuring$var10; i <= counter + $jscomp$destructuring$var10; ++i) {
942 var generatedToken = otp_HOTP.generate({secret:secret, algorithm:algorithm, digits:token.length, counter:i});
943 if (token === generatedToken) {
944 return i - counter;
945 }
946 }
947 return null;
948 };
949 otp_HOTP.prototype.validate = function($jscomp$destructuring$var12) {
950 var counter = void 0 === $jscomp$destructuring$var12.counter ? this.counter : $jscomp$destructuring$var12.counter, window = $jscomp$destructuring$var12.window;
951 return otp_HOTP.validate({token:utils.b.pad($jscomp$destructuring$var12.token, this.digits), secret:this.secret, algorithm:this.algorithm, counter:counter, window:window});
952 };
953 otp_HOTP.prototype.toString = function() {
954 return uri_URI.stringify(this);
955 };
956 var otp_TOTP = function($jscomp$destructuring$var14) {
957 var $jscomp$destructuring$var15 = void 0 === $jscomp$destructuring$var14 ? {} : $jscomp$destructuring$var14;
958 $jscomp$destructuring$var14 = void 0 === $jscomp$destructuring$var15.issuer ? "" : $jscomp$destructuring$var15.issuer;
959 var label = void 0 === $jscomp$destructuring$var15.label ? "OTPAuth" : $jscomp$destructuring$var15.label, secret = void 0 === $jscomp$destructuring$var15.secret ? new secret_Secret : $jscomp$destructuring$var15.secret, algorithm = void 0 === $jscomp$destructuring$var15.algorithm ? "SHA1" : $jscomp$destructuring$var15.algorithm, digits = void 0 === $jscomp$destructuring$var15.digits ? 6 : $jscomp$destructuring$var15.digits;
960 $jscomp$destructuring$var15 = void 0 === $jscomp$destructuring$var15.period ? 30 : $jscomp$destructuring$var15.period;
961 this.issuer = $jscomp$destructuring$var14;
962 this.label = label;
963 this.secret = secret;
964 this.algorithm = algorithm;
965 this.digits = digits;
966 this.period = $jscomp$destructuring$var15;
967 };
968 otp_TOTP.generate = function($jscomp$destructuring$var16) {
969 var secret = $jscomp$destructuring$var16.secret, algorithm = $jscomp$destructuring$var16.algorithm, digits = $jscomp$destructuring$var16.digits, period = void 0 === $jscomp$destructuring$var16.period ? 30 : $jscomp$destructuring$var16.period;
970 $jscomp$destructuring$var16 = void 0 === $jscomp$destructuring$var16.timestamp ? Date.now() : $jscomp$destructuring$var16.timestamp;
971 return otp_HOTP.generate({secret:secret, algorithm:algorithm, digits:digits, counter:Math.floor($jscomp$destructuring$var16 / 1000 / period)});
972 };
973 otp_TOTP.prototype.generate = function($jscomp$destructuring$var18) {
974 $jscomp$destructuring$var18 = void 0 === $jscomp$destructuring$var18 ? {} : $jscomp$destructuring$var18;
975 $jscomp$destructuring$var18 = void 0 === $jscomp$destructuring$var18.timestamp ? Date.now() : $jscomp$destructuring$var18.timestamp;
976 return otp_TOTP.generate({secret:this.secret, algorithm:this.algorithm, digits:this.digits, period:this.period, timestamp:$jscomp$destructuring$var18});
977 };
978 otp_TOTP.validate = function($jscomp$destructuring$var20) {
979 var token = $jscomp$destructuring$var20.token, secret = $jscomp$destructuring$var20.secret, algorithm = $jscomp$destructuring$var20.algorithm, period = void 0 === $jscomp$destructuring$var20.period ? 30 : $jscomp$destructuring$var20.period, timestamp = void 0 === $jscomp$destructuring$var20.timestamp ? Date.now() : $jscomp$destructuring$var20.timestamp;
980 return otp_HOTP.validate({token:token, secret:secret, algorithm:algorithm, counter:Math.floor(timestamp / 1000 / period), window:$jscomp$destructuring$var20.window});
981 };
982 otp_TOTP.prototype.validate = function($jscomp$destructuring$var22) {
983 var timestamp = $jscomp$destructuring$var22.timestamp, window = $jscomp$destructuring$var22.window;
984 return otp_TOTP.validate({token:utils.b.pad($jscomp$destructuring$var22.token, this.digits), secret:this.secret, algorithm:this.algorithm, period:this.period, timestamp:timestamp, window:window});
985 };
986 otp_TOTP.prototype.toString = function() {
987 return uri_URI.stringify(this);
988 };
989 __webpack_require__.d(__webpack_exports__, "version", function() {
990 return "4.0.0";
991 });
992 __webpack_require__.d(__webpack_exports__, "HOTP", function() {
993 return otp_HOTP;
994 });
995 __webpack_require__.d(__webpack_exports__, "TOTP", function() {
996 return otp_TOTP;
997 });
998 __webpack_require__.d(__webpack_exports__, "URI", function() {
999 return uri_URI;
1000 });
1001 __webpack_require__.d(__webpack_exports__, "Secret", function() {
1002 return secret_Secret;
1003 });
1004 __webpack_require__.d(__webpack_exports__, "Utils", function() {
1005 return utils.b;
1006 });
1007 }]);
1008 });
1009 }).call(this || window)
1010
1011 //# sourceMappingURL=otpauth.js.map