You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RTL/frontend/main.a0be7063e8c24e04.js

1 line
3.0 MiB
JavaScript

(self.webpackChunkRTLApp=self.webpackChunkRTLApp||[]).push([[179],{4361:(We,q)=>{"use strict";function m(xe){return Object.keys(xe).map(fe=>xe[fe])}var xe;Object.defineProperty(q,"__esModule",{value:!0}),(xe=q.HashAlgorithms||(q.HashAlgorithms={})).SHA1="sha1",xe.SHA256="sha256",xe.SHA512="sha512";const t=m(q.HashAlgorithms);!function(xe){xe.ASCII="ascii",xe.BASE64="base64",xe.HEX="hex",xe.LATIN1="latin1",xe.UTF8="utf8"}(q.KeyEncodings||(q.KeyEncodings={}));const e=m(q.KeyEncodings);!function(xe){xe.HOTP="hotp",xe.TOTP="totp"}(q.Strategy||(q.Strategy={}));const _=m(q.Strategy),T=()=>{throw new Error("Please provide an options.createDigest implementation.")};function s(xe){return/^(\d+)$/.test(xe)}function y(xe,fe,Oe){return xe.length>=fe?xe:`${Array(fe+1).join(Oe)}${xe}`.slice(-1*fe)}function h(xe){const fe=`otpauth://${xe.type}/{labelPrefix}:{accountName}?secret={secret}{query}`,Oe=[];if(_.indexOf(xe.type)<0)throw new Error(`Expecting options.type to be one of ${_.join(", ")}. Received ${xe.type}.`);if("hotp"===xe.type){if(null==xe.counter||"number"!=typeof xe.counter)throw new Error('Expecting options.counter to be a number when options.type is "hotp".');Oe.push(`&counter=${xe.counter}`)}return"totp"===xe.type&&xe.step&&Oe.push(`&period=${xe.step}`),xe.digits&&Oe.push(`&digits=${xe.digits}`),xe.algorithm&&Oe.push(`&algorithm=${xe.algorithm.toUpperCase()}`),xe.issuer&&Oe.push(`&issuer=${encodeURIComponent(xe.issuer)}`),fe.replace("{labelPrefix}",encodeURIComponent(xe.issuer||xe.accountName)).replace("{accountName}",encodeURIComponent(xe.accountName)).replace("{secret}",xe.secret).replace("{query}",Oe.join(""))}class P{constructor(fe={}){this._defaultOptions=Object.freeze({...fe}),this._options=Object.freeze({})}create(fe={}){return new P(fe)}clone(fe={}){const Oe=this.create({...this._defaultOptions,...fe});return Oe.options=this._options,Oe}get options(){return Object.freeze({...this._defaultOptions,...this._options})}set options(fe){this._options=Object.freeze({...this._options,...fe})}allOptions(){return this.options}resetOptions(){this._options=Object.freeze({})}}function d(xe){if("function"!=typeof xe.createDigest)throw new Error("Expecting options.createDigest to be a function.");if("function"!=typeof xe.createHmacKey)throw new Error("Expecting options.createHmacKey to be a function.");if("number"!=typeof xe.digits)throw new Error("Expecting options.digits to be a number.");if(!xe.algorithm||t.indexOf(xe.algorithm)<0)throw new Error(`Expecting options.algorithm to be one of ${t.join(", ")}. Received ${xe.algorithm}.`);if(!xe.encoding||e.indexOf(xe.encoding)<0)throw new Error(`Expecting options.encoding to be one of ${e.join(", ")}. Received ${xe.encoding}.`)}const w=(xe,fe,Oe)=>Buffer.from(fe,Oe).toString("hex");function C(){return{algorithm:q.HashAlgorithms.SHA1,createHmacKey:w,createDigest:T,digits:6,encoding:q.KeyEncodings.ASCII}}function L(xe){const fe={...C(),...xe};return d(fe),Object.freeze(fe)}function D(xe){return y(xe.toString(16),16,"0")}function H(xe,fe){const Oe=Buffer.from(xe,"hex"),oe=15&Oe[Oe.length-1],De=((127&Oe[oe])<<24|(255&Oe[oe+1])<<16|(255&Oe[oe+2])<<8|255&Oe[oe+3])%Math.pow(10,fe);return y(String(De),fe,"0")}function U(xe,fe,Oe){const oe=Oe.digest||function Z(xe,fe,Oe){const oe=D(fe),Fe=Oe.createHmacKey(Oe.algorithm,xe,Oe.encoding);return Oe.createDigest(Oe.algorithm,Fe,oe)}(xe,fe,Oe);return H(oe,Oe.digits)}function j(xe,fe,Oe,oe){return!!s(xe)&&xe===U(fe,Oe,oe)}function K(xe,fe,Oe,oe,Fe){return h({algorithm:Fe.algorithm,digits:Fe.digits,type:q.Strategy.HOTP,accountName:xe,counter:oe,issuer:fe,secret:Oe})}class J extends P{create(fe={}){return new J(fe)}allOptions(){return L(this.options)}generate(fe,Oe){return U(fe,Oe,this.allOptions())}check(fe,Oe,oe){return j(fe,Oe,oe,this.allOptions())}verify(fe){if("object"!=typeof fe)throw new Error("Expecting argument 0 of verify to be an object");return this.check(fe.token,fe.secret,fe.counter)}keyuri(fe,Oe,oe,Fe){return K(fe,Oe,oe,Fe,this.allOptions())}}function $(xe){if("number"==typeof xe)return[Math.abs(xe),Math.abs(xe)];if(Array.isArray(xe)){c