@inner-dj/server 0.1.5 → 0.1.7
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/README.md +1 -0
- package/assets/js/otplib.js +1 -1
- package/lib/src/browser/otplib.js +1 -4
- package/lib/src/config.d.ts +2 -0
- package/lib/src/config.js +13 -0
- package/lib/src/config.js.map +1 -1
- package/lib/src/web.js +3 -1
- package/lib/src/web.js.map +1 -1
- package/package.json +23 -8
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ To use a custom config path, set environment variable `CONFIG`.
|
|
|
50
50
|
| adminOtp | ADMINOTP | string | TOTP token for admin access. If blank, one is generated at start up. Check logs. | RANDOM |
|
|
51
51
|
| cookieTTL | COOKIETTL | number | Cookie max age in ms | 2592000000 (30d) |
|
|
52
52
|
| jwtSecret | JWTSECRET | string | Secret for communications between client and server. Only share with client. | REQUIRED |
|
|
53
|
+
| limiter | - | [LimiterOptions](https://github.com/express-rate-limit/express-rate-limit#configuration) | Rate limiter settings for authentication endpoint | see [setDefaultLimits()](https://codeberg.org/sanin/inner-dj/src/branch/master/packages/server/src/config.ts) |
|
|
53
54
|
| cookies | COOKIES | string | Optional path to Netscape-formatted file to read cookies from. See [how do I pass cookies to yt-dlp?](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp) | null |
|
|
54
55
|
| db | | [DBConfig](#dbconfig) | | |
|
|
55
56
|
| discord | | [DiscordReceiverConfig](#discordreceiverconfig) | | |
|
package/assets/js/otplib.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var otplib=(()=>{var U=Object.defineProperty,H=Object.getOwnPropertyDescriptor,L=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty,X={},e=(((e,t)=>{for(var r in t)U(e,r,{get:t[r],enumerable:!0})})(X,{HOTP:()=>De,NobleCryptoPlugin:()=>At,OTP:()=>Ot,ScureBase32Plugin:()=>tt,TOTP:()=>Xe,createGuardrails:()=>E,generate:()=>_t,generateSecret:()=>function(e){var{crypto:e=St,base32:t=rt,length:r=20}=e||{};return n({crypto:e,base32:t,length:r})},generateSync:()=>Mt,generateURI:()=>kt,stringToBytes:()=>Ae,verify:()=>Bt,verifySync:()=>Nt,wrapResult:()=>function(t){return(...e)=>{try{return _e(t(...e))}catch(e){return Me(e)}}},wrapResultAsync:()=>function(t){return async(...e)=>{try{return _e(await t(...e))}catch(e){return Me(e)}}}}),class extends Error{constructor(e,t){super(e,t),this.name="OTPError"}}),t=class extends e{constructor(e){super(e),this.name="SecretError"}},G=class extends t{constructor(e,t){super(`Secret must be at least ${e} bytes (${8*e} bits), got ${t} bytes`),this.name="SecretTooShortError"}},$=class extends t{constructor(e,t){super(`Secret must not exceed ${e} bytes, got ${t} bytes`),this.name="SecretTooLongError"}},t=class extends e{constructor(e){super(e),this.name="CounterError"}},F=class extends t{constructor(){super("Counter must be non-negative"),this.name="CounterNegativeError"}},j=class extends t{constructor(){super("Counter exceeds maximum safe integer value"),this.name="CounterOverflowError"}},Y=class extends t{constructor(){super("Counter must be a finite integer"),this.name="CounterNotIntegerError"}},t=class extends e{constructor(e){super(e),this.name="TimeError"}},W=class extends t{constructor(){super("Time must be non-negative"),this.name="TimeNegativeError"}},q=class extends t{constructor(){super("Time must be a finite number"),this.name="TimeNotFiniteError"}},t=class extends e{constructor(e){super(e),this.name="PeriodError"}},V=class extends t{constructor(e){super(`Period must be at least ${e} second(s)`),this.name="PeriodTooSmallError"}},z=class extends t{constructor(e){super(`Period must not exceed ${e} seconds`),this.name="PeriodTooLargeError"}},t=class extends e{constructor(e){super(e),this.name="TokenError"}},J=class extends t{constructor(e,t){super(`Token must be ${e} digits, got `+t),this.name="TokenLengthError"}},K=class extends t{constructor(){super("Token must contain only digits"),this.name="TokenFormatError"}},t=class extends e{constructor(e,t){super(e,t),this.name="CryptoError"}},s=class extends t{constructor(e,t){super("HMAC computation failed: "+e,t),this.name="HMACError"}},Q=class extends t{constructor(e,t){super("Random byte generation failed: "+e,t),this.name="RandomBytesError"}},Z=class extends e{constructor(e){super(e),this.name="CounterToleranceError"}},ee=class extends Z{constructor(e,t){super(`Counter tolerance validation failed: total checks (${t}) exceeds MAX_WINDOW (${e})`),this.name="CounterToleranceTooLargeError"}},te=class extends Z{constructor(){super("Counter tolerance cannot contain negative values"),this.name="CounterToleranceNegativeError"}},re=class extends e{constructor(e){super(e),this.name="EpochToleranceError"}},oe=class extends re{constructor(){super("Epoch tolerance cannot contain negative values"),this.name="EpochToleranceNegativeError"}},se=class extends re{constructor(e,t){super(`Epoch tolerance must not exceed ${e} seconds, got ${t}. Large tolerances can cause performance issues.`),this.name="EpochToleranceTooLargeError"}},t=class extends e{constructor(e){super(e),this.name="PluginError"}},ne=class extends t{constructor(){super("Crypto plugin is required."),this.name="CryptoPluginMissingError"}},ie=class extends t{constructor(){super("Base32 plugin is required."),this.name="Base32PluginMissingError"}},o=class extends e{constructor(e){super(e),this.name="ConfigurationError"}},ae=class extends o{constructor(){super("Secret is required. Use generateSecret() to create one, or provide via { secret: 'YOUR_BASE32_SECRET' }"),this.name="SecretMissingError"}},ce=class extends o{constructor(){super("Label is required for URI generation. Example: { label: 'user@example.com' }"),this.name="LabelMissingError"}},ue=class extends o{constructor(){super("Issuer is required for URI generation. Example: { issuer: 'MyApp' }"),this.name="IssuerMissingError"}},he=class extends o{constructor(){super("Class API requires secret to be a Base32 string, not Uint8Array. Use generateSecret() or provide a Base32-encoded string."),this.name="SecretTypeError"}},t=class extends e{constructor(e){super(e),this.name="AfterTimeStepError"}},de=class extends t{constructor(){super("afterTimeStep must be >= 0"),this.name="AfterTimeStepNegativeError"}},le=class extends t{constructor(){super("Invalid afterTimeStep: non-integer value"),this.name="AfterTimeStepNotIntegerError"}},fe=class extends t{constructor(){super("Invalid afterTimeStep: cannot be greater than current time step plus window"),this.name="AfterTimeStepRangeExceededError"}},pe=new TextEncoder,ge=(new TextDecoder,20),be=30,e=Number.MAX_SAFE_INTEGER,ye=Symbol("otplib.guardrails.override");function r(e,t,r){if("number"!=typeof t||!Number.isSafeInteger(t))throw new o(`Guardrail '${e}' must be a safe integer`);if(t<r)throw new o(`Guardrail '${e}' must be >= `+r)}var w=Object.freeze({MIN_SECRET_BYTES:16,MAX_SECRET_BYTES:64,MIN_PERIOD:1,MAX_PERIOD:3600,MAX_COUNTER:e,MAX_WINDOW:99,[ye]:!1});function E(e){if(!e)return w;void 0!==e.MIN_SECRET_BYTES&&r("MIN_SECRET_BYTES",e.MIN_SECRET_BYTES,1),void 0!==e.MAX_SECRET_BYTES&&r("MAX_SECRET_BYTES",e.MAX_SECRET_BYTES,1),void 0!==e.MIN_PERIOD&&r("MIN_PERIOD",e.MIN_PERIOD,1),void 0!==e.MAX_PERIOD&&r("MAX_PERIOD",e.MAX_PERIOD,1),void 0!==e.MAX_COUNTER&&r("MAX_COUNTER",e.MAX_COUNTER,0),void 0!==e.MAX_WINDOW&&r("MAX_WINDOW",e.MAX_WINDOW,1);e={...w,...e};if(e.MAX_SECRET_BYTES<e.MIN_SECRET_BYTES)throw new o("Guardrail 'MIN_SECRET_BYTES' must be <= 'MAX_SECRET_BYTES'");if(e.MAX_PERIOD<e.MIN_PERIOD)throw new o("Guardrail 'MIN_PERIOD' must be <= 'MAX_PERIOD'");return Object.freeze({...e,[ye]:!0})}function x(e,t=w){if(e.length<t.MIN_SECRET_BYTES)throw new G(t.MIN_SECRET_BYTES,e.length);if(t.MAX_SECRET_BYTES<e.length)throw new $(t.MAX_SECRET_BYTES,e.length)}function me(e,t=w){if("number"==typeof e){if(!Number.isFinite(e)||!Number.isInteger(e))throw new Y;if(!Number.isSafeInteger(e))throw new j}e="bigint"==typeof e?e:BigInt(e);if(e<0n)throw new F;if(e>BigInt(t.MAX_COUNTER))throw new j}function we(e){if(!Number.isFinite(e))throw new q;if(e<0)throw new W}function Ee(e,t=w){if(!Number.isInteger(e)||e<t.MIN_PERIOD)throw new V(t.MIN_PERIOD);if(e>t.MAX_PERIOD)throw new z(t.MAX_PERIOD)}function xe(e,t){if(e.length!==t)throw new J(t,e.length);if(!/^\d+$/.test(e))throw new K}function ve(e){var t=15&e[e.length-1];return(127&e[t])<<24|e[1+t]<<16|e[2+t]<<8|e[3+t]}function Te(e,t){return(e%10**t).toString().padStart(t,"0")}function Ae(e){return"string"==typeof e?pe.encode(e):e}function v(e,t){return"string"==typeof e?(i(t),t.decode(e)):e}function n(e){var{crypto:e,base32:t,length:r=ge}=e,e=(T(e),i(t),e.randomBytes(r));return t.encode(e,{padding:!1})}function Se(e=0){return Array.isArray(e)?e:[0,e]}function T(e){if(!e)throw new ne}function i(e){if(!e)throw new ie}function A(e){if(!e)throw new ae}function Ie(e){if(!e)throw new ce}function Ce(e){if(!e)throw new ue}function ke(e){if("string"!=typeof e)throw new he}function _e(e){return{ok:!0,value:e}}function Me(e){return{ok:!1,error:e}}var Be=class{constructor(e){this.crypto=e}get plugin(){return this.crypto}async hmac(t,e,r){try{var o=this.crypto.hmac(t,e,r);return o instanceof Promise?await o:o}catch(e){t=e instanceof Error?e.message:String(e);throw new s(t,{cause:e})}}hmacSync(t,e,r){try{var o=this.crypto.hmac(t,e,r);if(o instanceof Promise)throw new s("Crypto plugin does not support synchronous HMAC operations");return o}catch(e){if(e instanceof s)throw e;t=e instanceof Error?e.message:String(e);throw new s(t,{cause:e})}}randomBytes(t){try{return this.crypto.randomBytes(t)}catch(e){t=e instanceof Error?e.message:String(e);throw new Q(t,{cause:e})}}};function Ne(e){var{type:e,label:t,params:r}=e,t=`otpauth://${e}/${t.split(":").map(e=>encodeURIComponent(e)).join(":")}?`,o=[];return r.secret&&o.push("secret="+encodeURIComponent(r.secret)),r.issuer&&o.push("issuer="+encodeURIComponent(r.issuer)),r.algorithm&&"sha1"!==r.algorithm&&o.push("algorithm="+r.algorithm.toUpperCase()),r.digits&&6!==r.digits&&o.push("digits="+r.digits),"hotp"===e&&void 0!==r.counter&&o.push("counter="+r.counter),"totp"===e&&void 0!==r.period&&30!==r.period&&o.push("period="+r.period),t+=o.join("&")}function Oe(e){var{issuer:e,label:t,secret:r,algorithm:o="sha1",digits:s=6,period:n=30}=e;return Ne({type:"totp",label:e?e+":"+t:t,params:{secret:r,issuer:e,algorithm:o,digits:s,period:n}})}function Re(e){var{issuer:e,label:t,secret:r,counter:o=0,algorithm:s="sha1",digits:n=6}=e;return Ne({type:"hotp",label:e?e+":"+t:t,params:{secret:r,issuer:e,algorithm:s,digits:n,counter:o}})}var De=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=E(e.guardrails)}generateSecret(){var{crypto:e,base32:t}=this.options;return T(e),i(t),n({crypto:e,base32:t})}async generate(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return u({secret:o,counter:e,algorithm:i,digits:a,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}async verify(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6,counterTolerance:c=0}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return Pe({secret:o,token:e.token,counter:e.counter,algorithm:i,digits:a,counterTolerance:c,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}toURI(e=0){var{issuer:t,label:r,secret:o,algorithm:s="sha1",digits:n=6}=this.options;return A(o),Ie(r),Ce(t),ke(o),Re({issuer:t,label:r,secret:o,algorithm:s,digits:n,counter:e})}};function Ue(e){var{secret:e,counter:t,algorithm:r="sha1",digits:o=6,crypto:s,base32:n,guardrails:i,hooks:a}=e,e=(A(e),T(s),v(e,n)),n=(x(e,i),me(t,i),new Be(s));return i="bigint"==typeof(i=t)?i:BigInt(i),s=new ArrayBuffer(8),new DataView(s).setBigUint64(0,i,!1),{ctx:n,algorithm:r,digits:o,secretBytes:e,counterBytes:new Uint8Array(s),hooks:a}}async function u(e){var{ctx:e,algorithm:t,digits:r,secretBytes:o,counterBytes:s,hooks:n}=Ue(e),e=await e.hmac(t,o,s),t=n?.truncateDigest?n.truncateDigest(e):ve(e);return n?.encodeToken?n.encodeToken(t,r):Te(t,r)}function He(e){var{ctx:e,algorithm:t,digits:r,secretBytes:o,counterBytes:s,hooks:n}=Ue(e),e=e.hmacSync(t,o,s),t=n?.truncateDigest?n.truncateDigest(e):ve(e);return n?.encodeToken?n.encodeToken(t,r):Te(t,r)}function Le(e){let{secret:t,counter:r,token:o,algorithm:s="sha1",digits:n=6,crypto:i,base32:a,counterTolerance:c=0,guardrails:u=E(),hooks:h}=e,d=(A(t),T(i),v(t,a));x(d,u),me(r,u),h?.validateToken?h.validateToken(o,n):xe(o,n);var[e,l=w]=[c,u],[e,f]=Se(e);if(!Number.isSafeInteger(e)||!Number.isSafeInteger(f))throw new Z("Counter tolerance values must be safe integers");if(e<0||f<0)throw new te;if((e=e+f+1)>l.MAX_WINDOW)throw new ee(l.MAX_WINDOW,e);var f="bigint"==typeof r?Number(r):r,[l,e]=Se(c);return{token:o,counterNum:f,past:l,future:e,totalChecks:l+e+1,crypto:i,getGenerateOptions:e=>({secret:d,counter:e,algorithm:s,digits:n,crypto:i,guardrails:u,hooks:h})}}async function Pe(e){var{token:t,counterNum:r,past:o,totalChecks:s,crypto:n,getGenerateOptions:i}=Le(e);for(let e=Math.max(0,o-r);e<s;e++){var a=e-o,c=await u(i(r+a));if(n.constantTimeEqual(c,t))return{valid:!0,delta:0|a}}return{valid:!1}}var Xe=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=E(e.guardrails)}generateSecret(){var{crypto:e,base32:t}=this.options;return T(e),i(t),n({crypto:e,base32:t})}async generate(e){var t={...this.options,...e},{secret:r,crypto:o,base32:s,algorithm:n="sha1",digits:i=6,period:a=30,epoch:c,t0:u=0}=t,e=(A(r),T(o),e?.guardrails??this.guardrails);return $e({secret:r,algorithm:n,digits:i,period:a,epoch:c??Math.floor(Date.now()/1e3),t0:u,crypto:o,base32:s,guardrails:e,hooks:t.hooks})}async verify(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6,period:c=30,epoch:u,t0:h=0,epochTolerance:d=0,afterTimeStep:l}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return We({secret:o,token:e,algorithm:i,digits:a,period:c,epoch:u??Math.floor(Date.now()/1e3),t0:h,epochTolerance:d,afterTimeStep:l,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}toURI(e){var{issuer:t,label:r,secret:o,algorithm:s="sha1",digits:n=6,period:i=30}=this.options,r=e?.label??r,t=e?.issuer??t,e=e?.secret??o;return A(e),Ie(r),Ce(t),ke(e),Oe({issuer:t,label:r,secret:e,algorithm:s,digits:n,period:i})}};function Ge(e){var{secret:e,epoch:t=Math.floor(Date.now()/1e3),t0:r=0,period:o=30,algorithm:s="sha1",digits:n=6,crypto:i,base32:a,guardrails:c=E(),hooks:u}=e,e=(A(e),T(i),v(e,a)),a=(x(e,c),we(t),Ee(o,c),Math.floor((t-r)/o));return{secret:e,counter:a,algorithm:s,digits:n,crypto:i,guardrails:c,hooks:u}}async function $e(e){return u(Ge(e))}function Fe(e){return He(Ge(e))}function je(e,t){return void 0!==t&&e<=t}function Ye(e){let{secret:t,token:r,epoch:o=Math.floor(Date.now()/1e3),t0:s=0,period:n=30,algorithm:i="sha1",digits:a=6,crypto:c,base32:u,epochTolerance:h=0,afterTimeStep:d,guardrails:l=E(),hooks:f}=e,p=(A(t),T(c),v(t,u));x(p,l),we(o),Ee(n,l),f?.validateToken?f.validateToken(r,a):xe(r,a);var[e,g=be,b=w]=[h,n,l],[e,y]=Array.isArray(e)?e:[e,e];if(!Number.isSafeInteger(e)||!Number.isSafeInteger(y))throw new re("Epoch tolerance values must be safe integers");if(e<0||y<0)throw new oe;if((b=(b.MAX_WINDOW-1)*g)<(g=e+y))throw new se(b,g);var e=Math.floor((o-s)/n),[b,g]=([y=0]=[h],Array.isArray(y)?y:[y,y]),y=Math.max(0,Math.floor((o-b-s)/n)),b=Math.floor((o+g-s)/n),g=d,m=b;if(void 0!==g){if(g<0)throw new de;if(!Number.isSafeInteger(g))throw new le;if(m<g)throw new fe}return{token:r,crypto:c,minCounter:y,maxCounter:b,currentCounter:e,t0:s,period:n,afterTimeStep:d,getGenerateOptions:e=>({secret:p,epoch:e*n+s,t0:s,period:n,algorithm:i,digits:a,crypto:c,guardrails:l,hooks:f})}}async function We(t){var{token:r,crypto:o,minCounter:t,maxCounter:s,currentCounter:n,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=Ye(t);for(let e=t;e<=s;e++)if(!je(e,c)){var h=await $e(u(e));if(o.constantTimeEqual(h,r))return{valid:!0,delta:e-n,epoch:e*a+i,timeStep:e}}return{valid:!1}}function qe(e,t){return Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function a(e,t){if("string"!=typeof t)throw new Error(e+": string expected")}function Ve(e){if(!Number.isSafeInteger(e))throw new Error("invalid integer: "+e)}function ze(e){if(!Array.isArray(e))throw new Error("array expected")}function c(e,t){if(!qe(!0,t))throw new Error(e+": array of strings expected")}var Je=(e,t)=>0===t?e:Je(t,e%t),h=(e,t)=>e+(t-Je(e,t)),Ke=(()=>{var t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function Qe(e,t,r,o){if(ze(e),t<=0||32<t)throw new Error("convertRadix2: wrong from="+t);if(r<=0||32<r)throw new Error("convertRadix2: wrong to="+r);if(32<h(t,r))throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=`+h(t,r));let s=0,n=0,i=Ke[t],a=Ke[r]-1,c=[];for(var u of e){if(Ve(u),u>=i)throw new Error(`convertRadix2: invalid data word=${u} from=`+t);if(s=s<<t|u,32<n+t)throw new Error(`convertRadix2: carry overflow pos=${n} from=`+t);for(n+=t;n>=r;n-=r)c.push((s>>n-r&a)>>>0);u=Ke[n];if(void 0===u)throw new Error("invalid carry");s&=u-1}if(s=s<<r-n&a,!o&&n>=t)throw new Error("Excess padding");if(!o&&0<s)throw new Error("Non-zero padding: "+s);return o&&0<n&&c.push(s>>>0),c}t=[((r,o=!1)=>{if(Ve(r),r<=0||32<r)throw new Error("radix2: bits should be in (0..32]");if(32<h(8,r)||32<h(r,8))throw new Error("radix2: carry overflow");return{encode:e=>{var t;if((t=e)instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name)return Qe(Array.from(e),8,r,!o);throw new Error("radix2.encode input should be Uint8Array")},decode:e=>{var t="radix2.decode";if(qe(!1,e))return Uint8Array.from(Qe(e,r,8,o));throw new Error(t+": array of numbers expected")}}})(5),(r=>{let t="string"==typeof r?r.split(""):r,o=t.length,s=(c("alphabet",t),new Map(t.map((e,t)=>[e,t])));return{encode:e=>(ze(e),e.map(e=>{if(!Number.isSafeInteger(e)||e<0||e>=o)throw new Error(`alphabet.encode: digit index outside alphabet "${e}". Allowed: `+r);return t[e]})),decode:e=>(ze(e),e.map(e=>{a("alphabet.decode",e);var t=s.get(e);if(void 0===t)throw new Error(`Unknown letter: "${e}". Allowed: `+r);return t}))}})("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),(l="=",Ve(d=5),a("padding",l),{encode(e){for(c("padding.encode",e);e.length*d%8;)e.push(l);return e},decode(e){c("padding.decode",e);let t=e.length;if(t*d%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;0<t&&e[t-1]===l;t--)if((t-1)*d%8==0)throw new Error("padding: invalid, string has too much padding");return e.slice(0,t)}}),(a("join",Ze=""),{encode:e=>(c("join.decode",e),e.join(Ze)),decode:e=>(a("join.decode",e),e.split(Ze))})],e=e=>e,y=(t,r)=>e=>t(r(e));var Ze,d,l,et={encode:t.map(e=>e.encode).reduceRight(y,e),decode:t.map(e=>e.decode).reduce(y,e)},tt=class{name="scure";encode(e,t={}){var{padding:t=!1}=t,e=et.encode(e);return t?e:e.replace(/=+$/,"")}decode(e){try{var t=e.toUpperCase(),r=t.padEnd(8*Math.ceil(t.length/8),"=");return et.decode(r)}catch(e){throw e instanceof Error?new Error("Invalid Base32 string: "+e.message):new Error("Invalid Base32 string")}}},rt=Object.freeze(new tt);function ot(e,t=""){if(!Number.isSafeInteger(e)||e<0)throw new Error((t&&`"${t}" `)+"expected integer >= 0, got "+e)}function f(e,t,r=""){var o=(o=e)instanceof Uint8Array||ArrayBuffer.isView(o)&&"Uint8Array"===o.constructor.name,s=e?.length,n=void 0!==t;if(!o||n&&s!==t)throw new Error((r&&`"${r}" `)+"expected Uint8Array"+(n?" of length "+t:"")+", got "+(o?"length="+s:"type="+typeof e))}function p(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function g(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function st(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function b(e,t){return e<<32-t|e>>>t}function nt(e,t){return e<<t|e>>>32-t>>>0}function it(r,e={}){var t=(e,t)=>r(t).update(e).digest(),o=r(void 0);return t.outputLen=o.outputLen,t.blockLen=o.blockLen,t.create=e=>r(e),Object.assign(t,e),Object.freeze(t)}var t=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])}),at=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){var r=e;if("function"!=typeof r||"function"!=typeof r.create)throw new Error("Hash must wrapped by utils.createHasher");if(ot(r.outputLen),ot(r.blockLen),f(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;var r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),g(o)}update(e){return p(this),this.iHash.update(e),this}digestInto(e){p(this),f(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){var e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){var{oHash:t,iHash:r,finished:o,destroyed:s,blockLen:n,outputLen:i}=this;return(e||=Object.create(Object.getPrototypeOf(this),{})).finished=o,e.destroyed=s,e.blockLen=n,e.outputLen=i,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ct=(e,t,r)=>new at(e,t).update(r).digest();function ut(e,t,r){return e&t^~e&r}function ht(e,t,r){return e&t^e&r^t&r}ct.create=(e,t)=>new at(e,t);var y=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=st(this.buffer)}update(t){p(this),f(t);var{view:r,buffer:o,blockLen:s}=this,n=t.length;for(let e=0;e<n;){var i=Math.min(s-this.pos,n-e);if(i===s)for(var a=st(t);s<=n-e;e+=s)this.process(a,e);else o.set(t.subarray(e,e+i),this.pos),this.pos+=i,e+=i,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(e){p(this);var t=e,r=this;if(f(t,void 0,"digestInto() output"),r=r.outputLen,t.length<r)throw new Error('"digestInto() output" expected to be of length >='+r);this.finished=!0;let{buffer:o,view:s,blockLen:n,isLE:i}=this,a=this.pos;o[a++]=128,g(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(s,0),a=0);for(let e=a;e<n;e++)o[e]=0;s.setBigUint64(n-8,BigInt(8*this.length),i),this.process(s,0);var c=st(e),t=this.outputLen;if(t%4)throw new Error("_sha2: outputLen must be aligned to 32bit");var u=t/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,h[e],i)}digest(){var{buffer:e,outputLen:t}=this,e=(this.digestInto(e),e.slice(0,t));return this.destroy(),e}_cloneInto(e){(e||=new this.constructor).set(...this.get());var{blockLen:t,buffer:r,length:o,finished:s,destroyed:n,pos:i}=this;return e.destroyed=n,e.finished=s,e.length=o,e.pos=i,o%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},m=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),S=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),I=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),C=new Uint32Array(80),dt=class extends y{A=0|I[0];B=0|I[1];C=0|I[2];D=0|I[3];E=0|I[4];constructor(){super(64,20,8,!1)}get(){var{A:e,B:t,C:r,D:o,E:s}=this;return[e,t,r,o,s]}set(e,t,r,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|s}process(t,r){for(let e=0;e<16;e++,r+=4)C[e]=t.getUint32(r,!1);for(let e=16;e<80;e++)C[e]=nt(C[e-3]^C[e-8]^C[e-14]^C[e-16],1);let{A:o,B:s,C:n,D:i,E:a}=this;for(let r=0;r<80;r++){let e,t;t=r<20?(e=ut(s,n,i),1518500249):r<40?(e=s^n^i,1859775393):r<60?(e=ht(s,n,i),2400959708):(e=s^n^i,3395469782);var c=nt(o,5)+e+a+t+C[r]|0;a=i,i=n,n=nt(s,30),s=o,o=c}o=o+this.A|0,s=s+this.B|0,n=n+this.C|0,i=i+this.D|0,a=a+this.E|0,this.set(o,s,n,i,a)}roundClean(){g(C)}destroy(){this.set(0,0,0,0,0),g(this.buffer)}},lt=it(()=>new dt),k=BigInt(4294967295),ft=BigInt(32);var pt=(e,t,r)=>e<<32-r|t>>>r,M=(e,t,r)=>e>>>r|t<<32-r,B=(e,t,r)=>e<<32-r|t>>>r,gt=(e,t,r)=>e<<64-r|t>>>r-32,bt=(e,t,r)=>e>>>r-32|t<<64-r;function N(e,t,r,o){t=(t>>>0)+(o>>>0);return{h:e+r+(t/2**32|0)|0,l:0|t}}var yt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_=new Uint32Array(64),e=class extends y{constructor(e){super(64,e,8,!1)}get(){var{A:e,B:t,C:r,D:o,E:s,F:n,G:i,H:a}=this;return[e,t,r,o,s,n,i,a]}set(e,t,r,o,s,n,i,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|s,this.F=0|n,this.G=0|i,this.H=0|a}process(t,r){for(let e=0;e<16;e++,r+=4)_[e]=t.getUint32(r,!1);for(let e=16;e<64;e++){var o=_[e-15],s=_[e-2],o=b(o,7)^b(o,18)^o>>>3,s=b(s,17)^b(s,19)^s>>>10;_[e]=s+_[e-7]+o+_[e-16]|0}let{A:n,B:i,C:a,D:c,E:u,F:h,G:d,H:l}=this;for(let e=0;e<64;e++){var f=b(u,6)^b(u,11)^b(u,25),f=l+f+ut(u,h,d)+yt[e]+_[e]|0,p=(b(n,2)^b(n,13)^b(n,22))+ht(n,i,a)|0;l=d,d=h,h=u,u=c+f|0,c=a,a=i,i=n,n=f+p|0}n=n+this.A|0,i=i+this.B|0,a=a+this.C|0,c=c+this.D|0,u=u+this.E|0,h=h+this.F|0,d=d+this.G|0,l=l+this.H|0,this.set(n,i,a,c,u,h,d,l)}roundClean(){g(_)}destroy(){this.set(0,0,0,0,0,0,0,0),g(this.buffer)}},mt=class extends e{A=0|m[0];B=0|m[1];C=0|m[2];D=0|m[3];E=0|m[4];F=0|m[5];G=0|m[6];H=0|m[7];constructor(){super(32)}},e=((t,r=!1)=>{var o=t.length,s=new Uint32Array(o),n=new Uint32Array(o);for(let e=0;e<o;e++){[a,i=!1]=[t[e],r];var{h:i,l:a}=i?{h:Number(a&k),l:Number(a>>ft&k)}:{h:0|Number(a>>ft&k),l:0|Number(a&k)};[s[e],n[e]]=[i,a]}return[s,n]})(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),wt=e[0],Et=e[1],O=new Uint32Array(80),R=new Uint32Array(80),e=class extends y{constructor(e){super(128,e,16,!1)}get(){var{Ah:e,Al:t,Bh:r,Bl:o,Ch:s,Cl:n,Dh:i,Dl:a,Eh:c,El:u,Fh:h,Fl:d,Gh:l,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,o,s,n,i,a,c,u,h,d,l,f,p,g]}set(e,t,r,o,s,n,i,a,c,u,h,d,l,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|o,this.Ch=0|s,this.Cl=0|n,this.Dh=0|i,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|h,this.Fl=0|d,this.Gh=0|l,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(t,r){for(let e=0;e<16;e++,r+=4)O[e]=t.getUint32(r),R[e]=t.getUint32(r+=4);for(let e=16;e<80;e++){var o=0|O[e-15],s=0|R[e-15],n=M(o,s,1)^M(o,s,8)^o>>>7,o=B(o,s,1)^B(o,s,8)^pt(o,s,7),s=0|O[e-2],i=0|R[e-2],a=M(s,i,19)^gt(s,i,61)^s>>>6,o=(o>>>0)+((B(s,i,19)^bt(s,i,61)^pt(s,i,6))>>>0)+(R[e-7]>>>0)+(R[e-16]>>>0);s=O[e-7],i=O[e-16],O[e]=0|(n+a+s+i+(o/2**32|0)|0),R[e]=0|o}let{Ah:c,Al:u,Bh:h,Bl:d,Ch:l,Cl:f,Dh:p,Dl:g,Eh:b,El:y,Fh:m,Fl:w,Gh:E,Gl:x,Hh:v,Hl:T}=this;for(let e=0;e<80;e++){var A=M(b,y,14)^M(b,y,18)^gt(b,y,41),S=B(b,y,14)^B(b,y,18)^bt(b,y,41),I=b&m^~b&E,C=y&w^~y&x,S=(T>>>0)+(S>>>0)+(C>>>0)+(Et[e]>>>0)+(R[e]>>>0),C=(C=v,k=wt[e],_=O[e],C+A+I+k+_+(S/2**32|0)|0),A=0|S,I=M(c,u,28)^gt(c,u,34)^gt(c,u,39),k=B(c,u,28)^bt(c,u,34)^bt(c,u,39),_=c&h^c&l^h&l,S=u&d^u&f^d&f,A=(v=0|E,T=0|x,E=0|m,x=0|w,m=0|b,w=0|y,{h:b,l:y}=N(0|p,0|g,0|C,0|A),p=0|l,g=0|f,l=0|h,f=0|d,h=0|c,d=0|u,(A>>>0)+(k>>>0)+(S>>>0));c=C+I+_+(A/2**32|0)|0,u=0|A}({h:c,l:u}=N(0|this.Ah,0|this.Al,0|c,0|u)),{h,l:d}=N(0|this.Bh,0|this.Bl,0|h,0|d),{h:l,l:f}=N(0|this.Ch,0|this.Cl,0|l,0|f),{h:p,l:g}=N(0|this.Dh,0|this.Dl,0|p,0|g),{h:b,l:y}=N(0|this.Eh,0|this.El,0|b,0|y),{h:m,l:w}=N(0|this.Fh,0|this.Fl,0|m,0|w),{h:E,l:x}=N(0|this.Gh,0|this.Gl,0|E,0|x),{h:v,l:T}=N(0|this.Hh,0|this.Hl,0|v,0|T),this.set(c,u,h,d,l,f,p,g,b,y,m,w,E,x,v,T)}roundClean(){g(O,R)}destroy(){g(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},xt=class extends e{Ah=0|S[0];Al=0|S[1];Bh=0|S[2];Bl=0|S[3];Ch=0|S[4];Cl=0|S[5];Dh=0|S[6];Dl=0|S[7];Eh=0|S[8];El=0|S[9];Fh=0|S[10];Fl=0|S[11];Gh=0|S[12];Gl=0|S[13];Hh=0|S[14];Hl=0|S[15];constructor(){super(64)}},vt=it(()=>new mt,t(1)),Tt=it(()=>new xt,t(3)),At=class{name="noble";hmac(e,t,r){return ct("sha1"===e?lt:"sha256"===e?vt:Tt,t,r)}randomBytes(e){var[e=32]=[e],t="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof t?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}constantTimeEqual(e,r){{var o=Ae(e),s=Ae(r);if(o.length!==s.length)return!1;let t=0;for(let e=0;e<o.length;e++)t|=o[e]^s[e];return 0===t}}},St=Object.freeze(new At);function It(e){return{secret:e.secret,strategy:e.strategy??"totp",crypto:e.crypto??St,base32:e.base32??rt,algorithm:e.algorithm??"sha1",digits:e.digits??6,period:e.period??30,epoch:e.epoch??Math.floor(Date.now()/1e3),t0:e.t0??0,counter:e.counter,guardrails:e.guardrails??E(),hooks:e.hooks}}function Ct(e){return{...It(e),token:e.token,epochTolerance:e.epochTolerance??0,counterTolerance:e.counterTolerance??0,afterTimeStep:e.afterTimeStep}}function D(e,t,r){if("totp"===e)return r.totp();if("hotp"!==e)throw new o(`Unknown OTP strategy: ${e}. Valid strategies are 'totp' or 'hotp'.`);if(void 0===t)throw new o("Counter is required for HOTP strategy. Example: { strategy: 'hotp', counter: 0 }");return r.hotp(t)}function kt(e){let{strategy:t="totp",issuer:r,label:o,secret:s,algorithm:n="sha1",digits:i=6,period:a=30,counter:c}=e;return D(t,c,{totp:()=>Oe({issuer:r,label:o,secret:s,algorithm:n,digits:i,period:a}),hotp:e=>Re({issuer:r,label:o,secret:s,algorithm:n,digits:i,counter:e})})}async function _t(e){let t=It(e),{secret:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a}=t,c={secret:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a};return D(t.strategy,t.counter,{totp:()=>$e({...c,period:t.period,epoch:t.epoch,t0:t.t0,guardrails:t.guardrails}),hotp:e=>u({...c,counter:e,guardrails:t.guardrails})})}function Mt(e){let t=It(e),{secret:r,crypto:o,base32:s,algorithm:n,digits:i}=t,a={secret:r,crypto:o,base32:s,algorithm:n,digits:i};return D(t.strategy,t.counter,{totp:()=>Fe({...a,period:t.period,epoch:t.epoch,t0:t.t0,guardrails:t.guardrails}),hotp:e=>He({...a,counter:e,guardrails:t.guardrails})})}async function Bt(e){let t=Ct(e),{secret:r,token:o,crypto:s,base32:n,algorithm:i,digits:a,hooks:c}=t,u={secret:r,token:o,crypto:s,base32:n,algorithm:i,digits:a,hooks:c};return D(t.strategy,t.counter,{totp:()=>We({...u,period:t.period,epoch:t.epoch,t0:t.t0,epochTolerance:t.epochTolerance,afterTimeStep:t.afterTimeStep,guardrails:t.guardrails}),hotp:e=>Pe({...u,counter:e,counterTolerance:t.counterTolerance,guardrails:t.guardrails})})}function Nt(e){let d=Ct(e),{secret:t,token:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a}=d,l={secret:t,token:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a};return D(d.strategy,d.counter,{totp:()=>{var{token:t,crypto:r,minCounter:o,maxCounter:s,currentCounter:n,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=Ye(o={...l,period:d.period,epoch:d.epoch,t0:d.t0,epochTolerance:d.epochTolerance,afterTimeStep:d.afterTimeStep,guardrails:d.guardrails});for(let e=o;e<=s;e++)if(!je(e,c)){var h=Fe(u(e));if(r.constantTimeEqual(h,t))return{valid:!0,delta:e-n,epoch:e*a+i,timeStep:e}}return{valid:!1}},hotp:e=>{var{token:t,counterNum:r,past:o,totalChecks:s,crypto:n,getGenerateOptions:i}=Le({...l,counter:e,counterTolerance:d.counterTolerance,guardrails:d.guardrails});for(let e=Math.max(0,o-r);e<s;e++){var a=e-o,c=He(i(r+a));if(n.constantTimeEqual(c,t))return{valid:!0,delta:0|a}}return{valid:!1}}})}var Ot=class{strategy;crypto;base32;guardrails;constructor(e={}){var{strategy:e="totp",crypto:t=St,base32:r=rt,guardrails:o}=e;this.strategy=e,this.crypto=t,this.base32=r,this.guardrails=E(o)}getStrategy(){return this.strategy}generateSecret(e=20){return n({crypto:this.crypto,base32:this.base32,length:e})}async generate(e){return _t({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateSync(e){return Mt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}async verify(e){return Bt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}verifySync(e){return Nt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateURI(e){return kt({...e,strategy:this.strategy})}};return y=X,((t,r,o,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let e of L(r))P.call(t,e)||e===o||U(t,e,{get:()=>r[e],enumerable:!(s=H(r,e))||s.enumerable});return t})(U({},"__esModule",{value:!0}),y)})();
|
|
1
|
+
var otplib=(()=>{var L=Object.defineProperty,U=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty,X={},e=(((e,t)=>{for(var r in t)L(e,r,{get:t[r],enumerable:!0})})(X,{HOTP:()=>De,NobleCryptoPlugin:()=>St,OTP:()=>Ot,ScureBase32Plugin:()=>tt,TOTP:()=>Xe,createGuardrails:()=>w,generate:()=>Rt,generateSecret:()=>function(e){var{crypto:e=It,base32:t=rt,length:r=20}=e||{};return n({crypto:e,base32:t,length:r})},generateSync:()=>Mt,generateURI:()=>kt,stringToBytes:()=>Ae,verify:()=>Bt,verifySync:()=>Nt,wrapResult:()=>function(t){return(...e)=>{try{return ke(t(...e))}catch(e){return Re(e)}}},wrapResultAsync:()=>function(t){return async(...e)=>{try{return ke(await t(...e))}catch(e){return Re(e)}}}}),class extends Error{constructor(e,t){super(e,t),this.name="OTPError"}}),t=class extends e{constructor(e){super(e),this.name="SecretError"}},G=class extends t{constructor(e,t){super(`Secret must be at least ${e} bytes (${8*e} bits), got ${t} bytes`),this.name="SecretTooShortError"}},$=class extends t{constructor(e,t){super(`Secret must not exceed ${e} bytes, got ${t} bytes`),this.name="SecretTooLongError"}},t=class extends e{constructor(e){super(e),this.name="CounterError"}},F=class extends t{constructor(){super("Counter must be non-negative"),this.name="CounterNegativeError"}},Y=class extends t{constructor(){super("Counter exceeds maximum safe integer value"),this.name="CounterOverflowError"}},j=class extends t{constructor(){super("Counter must be a finite integer"),this.name="CounterNotIntegerError"}},t=class extends e{constructor(e){super(e),this.name="TimeError"}},W=class extends t{constructor(){super("Time must be non-negative"),this.name="TimeNegativeError"}},q=class extends t{constructor(){super("Time must be a finite number"),this.name="TimeNotFiniteError"}},t=class extends e{constructor(e){super(e),this.name="PeriodError"}},V=class extends t{constructor(e){super(`Period must be at least ${e} second(s)`),this.name="PeriodTooSmallError"}},z=class extends t{constructor(e){super(`Period must not exceed ${e} seconds`),this.name="PeriodTooLargeError"}},t=class extends e{constructor(e){super(e),this.name="TokenError"}},J=class extends t{constructor(e,t){super(`Token must be ${e} digits, got `+t),this.name="TokenLengthError"}},K=class extends t{constructor(){super("Token must contain only digits"),this.name="TokenFormatError"}},t=class extends e{constructor(e,t){super(e,t),this.name="CryptoError"}},s=class extends t{constructor(e,t){super("HMAC computation failed: "+e,t),this.name="HMACError"}},Q=class extends t{constructor(e,t){super("Random byte generation failed: "+e,t),this.name="RandomBytesError"}},Z=class extends e{constructor(e){super(e),this.name="CounterToleranceError"}},ee=class extends Z{constructor(e,t){super(`Counter tolerance validation failed: total checks (${t}) exceeds MAX_WINDOW (${e})`),this.name="CounterToleranceTooLargeError"}},te=class extends Z{constructor(){super("Counter tolerance cannot contain negative values"),this.name="CounterToleranceNegativeError"}},re=class extends e{constructor(e){super(e),this.name="EpochToleranceError"}},oe=class extends re{constructor(){super("Epoch tolerance cannot contain negative values"),this.name="EpochToleranceNegativeError"}},se=class extends re{constructor(e,t){super(`Epoch tolerance must not exceed ${e} seconds, got ${t}. Large tolerances can cause performance issues.`),this.name="EpochToleranceTooLargeError"}},t=class extends e{constructor(e){super(e),this.name="PluginError"}},ne=class extends t{constructor(){super("Crypto plugin is required."),this.name="CryptoPluginMissingError"}},ie=class extends t{constructor(){super("Base32 plugin is required."),this.name="Base32PluginMissingError"}},o=class extends e{constructor(e){super(e),this.name="ConfigurationError"}},ae=class extends o{constructor(){super("Secret is required. Use generateSecret() to create one, or provide via { secret: 'YOUR_BASE32_SECRET' }"),this.name="SecretMissingError"}},ce=class extends o{constructor(){super("Label is required for URI generation. Example: { label: 'user@example.com' }"),this.name="LabelMissingError"}},he=class extends o{constructor(){super("Issuer is required for URI generation. Example: { issuer: 'MyApp' }"),this.name="IssuerMissingError"}},ue=class extends o{constructor(){super("Class API requires secret to be a Base32 string, not Uint8Array. Use generateSecret() or provide a Base32-encoded string."),this.name="SecretTypeError"}},t=class extends e{constructor(e){super(e),this.name="AfterTimeStepError"}},de=class extends t{constructor(){super("afterTimeStep must be >= 0"),this.name="AfterTimeStepNegativeError"}},le=class extends t{constructor(){super("Invalid afterTimeStep: non-integer value"),this.name="AfterTimeStepNotIntegerError"}},fe=class extends t{constructor(){super("Invalid afterTimeStep: cannot be greater than current time step plus window"),this.name="AfterTimeStepRangeExceededError"}},pe=new TextEncoder,ge=(new TextDecoder,20),be=30,e=Number.MAX_SAFE_INTEGER,ye=Symbol("otplib.guardrails.override");function r(e,t,r){if("number"!=typeof t||!Number.isSafeInteger(t))throw new o(`Guardrail '${e}' must be a safe integer`);if(t<r)throw new o(`Guardrail '${e}' must be >= `+r)}var E=Object.freeze({MIN_SECRET_BYTES:16,MAX_SECRET_BYTES:64,MIN_PERIOD:1,MAX_PERIOD:3600,MAX_COUNTER:e,MAX_WINDOW:99,[ye]:!1});function w(e){if(!e)return E;void 0!==e.MIN_SECRET_BYTES&&r("MIN_SECRET_BYTES",e.MIN_SECRET_BYTES,1),void 0!==e.MAX_SECRET_BYTES&&r("MAX_SECRET_BYTES",e.MAX_SECRET_BYTES,1),void 0!==e.MIN_PERIOD&&r("MIN_PERIOD",e.MIN_PERIOD,1),void 0!==e.MAX_PERIOD&&r("MAX_PERIOD",e.MAX_PERIOD,1),void 0!==e.MAX_COUNTER&&r("MAX_COUNTER",e.MAX_COUNTER,0),void 0!==e.MAX_WINDOW&&r("MAX_WINDOW",e.MAX_WINDOW,1);e={...E,...e};if(e.MAX_SECRET_BYTES<e.MIN_SECRET_BYTES)throw new o("Guardrail 'MIN_SECRET_BYTES' must be <= 'MAX_SECRET_BYTES'");if(e.MAX_PERIOD<e.MIN_PERIOD)throw new o("Guardrail 'MIN_PERIOD' must be <= 'MAX_PERIOD'");return Object.freeze({...e,[ye]:!0})}function x(e,t=E){if(e.length<t.MIN_SECRET_BYTES)throw new G(t.MIN_SECRET_BYTES,e.length);if(t.MAX_SECRET_BYTES<e.length)throw new $(t.MAX_SECRET_BYTES,e.length)}function me(e,t=E){if("number"==typeof e){if(!Number.isFinite(e)||!Number.isInteger(e))throw new j;if(!Number.isSafeInteger(e))throw new Y}e="bigint"==typeof e?e:BigInt(e);if(e<0n)throw new F;if(e>BigInt(t.MAX_COUNTER))throw new Y}function Ee(e){if(!Number.isFinite(e))throw new q;if(e<0)throw new W}function we(e,t=E){if(!Number.isInteger(e)||e<t.MIN_PERIOD)throw new V(t.MIN_PERIOD);if(e>t.MAX_PERIOD)throw new z(t.MAX_PERIOD)}function xe(e,t){if(e.length!==t)throw new J(t,e.length);if(!/^\d+$/.test(e))throw new K}function ve(e){var t=15&e[e.length-1];return(127&e[t])<<24|e[1+t]<<16|e[2+t]<<8|e[3+t]}function Te(e,t){return(e%10**t).toString().padStart(t,"0")}function Ae(e){return"string"==typeof e?pe.encode(e):e}function v(e,t){return"string"==typeof e?(i(t),t.decode(e)):e}function n(e){var{crypto:e,base32:t,length:r=ge}=e,e=(T(e),i(t),e.randomBytes(r));return t.encode(e,{padding:!1})}function Se(e=0){return Array.isArray(e)?e:[0,e]}function T(e){if(!e)throw new ne}function i(e){if(!e)throw new ie}function A(e){if(!e)throw new ae}function Ie(e){if(!e)throw new ce}function Ce(e){if(!e)throw new he}function _e(e){if("string"!=typeof e)throw new ue}function ke(e){return{ok:!0,value:e}}function Re(e){return{ok:!1,error:e}}var Me=class{constructor(e){this.crypto=e}get plugin(){return this.crypto}async hmac(t,e,r){try{var o=this.crypto.hmac(t,e,r);return o instanceof Promise?await o:o}catch(e){t=e instanceof Error?e.message:String(e);throw new s(t,{cause:e})}}hmacSync(t,e,r){try{var o=this.crypto.hmac(t,e,r);if(o instanceof Promise)throw new s("Crypto plugin does not support synchronous HMAC operations");return o}catch(e){if(e instanceof s)throw e;t=e instanceof Error?e.message:String(e);throw new s(t,{cause:e})}}randomBytes(t){try{return this.crypto.randomBytes(t)}catch(e){t=e instanceof Error?e.message:String(e);throw new Q(t,{cause:e})}}};function Be(e){var{type:e,label:t,params:r}=e,t=`otpauth://${e}/${t.split(":").map(e=>encodeURIComponent(e)).join(":")}?`,o=[];return r.secret&&o.push("secret="+encodeURIComponent(r.secret)),r.issuer&&o.push("issuer="+encodeURIComponent(r.issuer)),r.algorithm&&"sha1"!==r.algorithm&&o.push("algorithm="+r.algorithm.toUpperCase()),r.digits&&6!==r.digits&&o.push("digits="+r.digits),"hotp"===e&&void 0!==r.counter&&o.push("counter="+r.counter),"totp"===e&&void 0!==r.period&&30!==r.period&&o.push("period="+r.period),t+=o.join("&")}function Ne(e){var{issuer:e,label:t,secret:r,algorithm:o="sha1",digits:s=6,period:n=30}=e;return Be({type:"totp",label:e?e+":"+t:t,params:{secret:r,issuer:e,algorithm:o,digits:s,period:n}})}function Oe(e){var{issuer:e,label:t,secret:r,counter:o=0,algorithm:s="sha1",digits:n=6}=e;return Be({type:"hotp",label:e?e+":"+t:t,params:{secret:r,issuer:e,algorithm:s,digits:n,counter:o}})}var De=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=w(e.guardrails)}generateSecret(){var{crypto:e,base32:t}=this.options;return T(e),i(t),n({crypto:e,base32:t})}async generate(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return h({secret:o,counter:e,algorithm:i,digits:a,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}async verify(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6,counterTolerance:c=0}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return Pe({secret:o,token:e.token,counter:e.counter,algorithm:i,digits:a,counterTolerance:c,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}toURI(e=0){var{issuer:t,label:r,secret:o,algorithm:s="sha1",digits:n=6}=this.options;return A(o),Ie(r),Ce(t),_e(o),Oe({issuer:t,label:r,secret:o,algorithm:s,digits:n,counter:e})}};function Le(e){var{secret:e,counter:t,algorithm:r="sha1",digits:o=6,crypto:s,base32:n,guardrails:i,hooks:a}=e,e=(A(e),T(s),v(e,n)),n=(x(e,i),me(t,i),new Me(s));return i="bigint"==typeof(i=t)?i:BigInt(i),s=new ArrayBuffer(8),new DataView(s).setBigUint64(0,i,!1),{ctx:n,algorithm:r,digits:o,secretBytes:e,counterBytes:new Uint8Array(s),hooks:a}}async function h(e){var{ctx:e,algorithm:t,digits:r,secretBytes:o,counterBytes:s,hooks:n}=Le(e),e=await e.hmac(t,o,s),t=n?.truncateDigest?n.truncateDigest(e):ve(e);return n?.encodeToken?n.encodeToken(t,r):Te(t,r)}function Ue(e){var{ctx:e,algorithm:t,digits:r,secretBytes:o,counterBytes:s,hooks:n}=Le(e),e=e.hmacSync(t,o,s),t=n?.truncateDigest?n.truncateDigest(e):ve(e);return n?.encodeToken?n.encodeToken(t,r):Te(t,r)}function He(e){let{secret:t,counter:r,token:o,algorithm:s="sha1",digits:n=6,crypto:i,base32:a,counterTolerance:c=0,guardrails:h=w(),hooks:u}=e,d=(A(t),T(i),v(t,a));x(d,h),me(r,h),u?.validateToken?u.validateToken(o,n):xe(o,n);var[e,l=E]=[c,h],[e,f]=Se(e);if(!Number.isSafeInteger(e)||!Number.isSafeInteger(f))throw new Z("Counter tolerance values must be safe integers");if(e<0||f<0)throw new te;if((e=e+f+1)>l.MAX_WINDOW)throw new ee(l.MAX_WINDOW,e);var f="bigint"==typeof r?Number(r):r,[l,e]=Se(c);return{token:o,counterNum:f,past:l,future:e,totalChecks:l+e+1,crypto:i,getGenerateOptions:e=>({secret:d,counter:e,algorithm:s,digits:n,crypto:i,guardrails:h,hooks:u})}}async function Pe(e){var{token:t,counterNum:r,past:o,totalChecks:s,crypto:n,getGenerateOptions:i}=He(e);for(let e=Math.max(0,o-r);e<s;e++){var a=e-o,c=await h(i(r+a));if(n.constantTimeEqual(c,t))return{valid:!0,delta:0|a}}return{valid:!1}}var Xe=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=w(e.guardrails)}generateSecret(){var{crypto:e,base32:t}=this.options;return T(e),i(t),n({crypto:e,base32:t})}async generate(e){var t={...this.options,...e},{secret:r,crypto:o,base32:s,algorithm:n="sha1",digits:i=6,period:a=30,epoch:c,t0:h=0}=t,e=(A(r),T(o),e?.guardrails??this.guardrails);return $e({secret:r,algorithm:n,digits:i,period:a,epoch:c??Math.floor(Date.now()/1e3),t0:h,crypto:o,base32:s,guardrails:e,hooks:t.hooks})}async verify(e,t){var r={...this.options,...t},{secret:o,crypto:s,base32:n,algorithm:i="sha1",digits:a=6,period:c=30,epoch:h,t0:u=0,epochTolerance:d=0,afterTimeStep:l}=r,t=(A(o),T(s),t?.guardrails??this.guardrails);return We({secret:o,token:e,algorithm:i,digits:a,period:c,epoch:h??Math.floor(Date.now()/1e3),t0:u,epochTolerance:d,afterTimeStep:l,crypto:s,base32:n,guardrails:t,hooks:r.hooks})}toURI(e){var{issuer:t,label:r,secret:o,algorithm:s="sha1",digits:n=6,period:i=30}=this.options,r=e?.label??r,t=e?.issuer??t,e=e?.secret??o;return A(e),Ie(r),Ce(t),_e(e),Ne({issuer:t,label:r,secret:e,algorithm:s,digits:n,period:i})}};function Ge(e){var{secret:e,epoch:t=Math.floor(Date.now()/1e3),t0:r=0,period:o=30,algorithm:s="sha1",digits:n=6,crypto:i,base32:a,guardrails:c=w(),hooks:h}=e,e=(A(e),T(i),v(e,a)),a=(x(e,c),Ee(t),we(o,c),Math.floor((t-r)/o));return{secret:e,counter:a,algorithm:s,digits:n,crypto:i,guardrails:c,hooks:h}}async function $e(e){return h(Ge(e))}function Fe(e){return Ue(Ge(e))}function Ye(e,t){return void 0!==t&&e<=t}function je(e){let{secret:t,token:r,epoch:o=Math.floor(Date.now()/1e3),t0:s=0,period:n=30,algorithm:i="sha1",digits:a=6,crypto:c,base32:h,epochTolerance:u=0,afterTimeStep:d,guardrails:l=w(),hooks:f}=e,p=(A(t),T(c),v(t,h));x(p,l),Ee(o),we(n,l),f?.validateToken?f.validateToken(r,a):xe(r,a);var[e,g=be,b=E]=[u,n,l],[e,y]=Array.isArray(e)?e:[e,e];if(!Number.isSafeInteger(e)||!Number.isSafeInteger(y))throw new re("Epoch tolerance values must be safe integers");if(e<0||y<0)throw new oe;if((b=(b.MAX_WINDOW-1)*g)<(g=e+y))throw new se(b,g);var e=Math.floor((o-s)/n),[b,g]=([y=0]=[u],Array.isArray(y)?y:[y,y]),y=Math.max(0,Math.floor((o-b-s)/n)),b=Math.floor((o+g-s)/n),g=d,m=b;if(void 0!==g){if(g<0)throw new de;if(!Number.isSafeInteger(g))throw new le;if(m<g)throw new fe}return{token:r,crypto:c,minCounter:y,maxCounter:b,currentCounter:e,t0:s,period:n,afterTimeStep:d,getGenerateOptions:e=>({secret:p,epoch:e*n+s,t0:s,period:n,algorithm:i,digits:a,crypto:c,guardrails:l,hooks:f})}}async function We(t){var{token:r,crypto:o,minCounter:t,maxCounter:s,currentCounter:n,t0:i,period:a,afterTimeStep:c,getGenerateOptions:h}=je(t);for(let e=t;e<=s;e++)if(!Ye(e,c)){var u=await $e(h(e));if(o.constantTimeEqual(u,r))return{valid:!0,delta:e-n,epoch:e*a+i,timeStep:e}}return{valid:!1}}function qe(e,t){return Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function a(e,t){if("string"!=typeof t)throw new TypeError(e+": string expected")}function Ve(e){if("number"!=typeof e)throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e))throw new RangeError("invalid integer: "+e)}function ze(e){if(!Array.isArray(e))throw new TypeError("array expected")}function c(e,t){if(!qe(!0,t))throw new TypeError(e+": array of strings expected")}var Je=(e,t)=>0===t?e:Je(t,e%t),u=(e,t)=>e+(t-Je(e,t)),Ke=(()=>{var t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function Qe(e,t,r,o){if(ze(e),t<=0||32<t)throw new RangeError("convertRadix2: wrong from="+t);if(r<=0||32<r)throw new RangeError("convertRadix2: wrong to="+r);if(32<u(t,r))throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=`+u(t,r));let s=0,n=0,i=Ke[t],a=Ke[r]-1,c=[];for(var h of e){if(Ve(h),h>=i)throw new Error(`convertRadix2: invalid data word=${h} from=`+t);if(s=s<<t|h,32<n+t)throw new Error(`convertRadix2: carry overflow pos=${n} from=`+t);for(n+=t;n>=r;n-=r)c.push((s>>n-r&a)>>>0);h=Ke[n];if(void 0===h)throw new Error("invalid carry");s&=h-1}if(s=s<<r-n&a,!o&&n>=t)throw new Error("Excess padding");if(!o&&0<s)throw new Error("Non-zero padding: "+s);return o&&0<n&&c.push(s>>>0),c}var Ze,d,l,et=Object.freeze((t=[((r,o=!1)=>{if(Ve(r),r<=0||32<r)throw new RangeError("radix2: bits should be in (0..32]");if(32<u(8,r)||32<u(r,8))throw new RangeError("radix2: carry overflow");return{encode:e=>{var t;if((t=e)instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name&&"BYTES_PER_ELEMENT"in t&&1===t.BYTES_PER_ELEMENT)return Qe(Array.from(e),8,r,!o);throw new TypeError("radix2.encode input should be Uint8Array")},decode:e=>{var t="radix2.decode";if(qe(!1,e))return Uint8Array.from(Qe(e,r,8,o));throw new TypeError(t+": array of numbers expected")}}})(5),(r=>{let t="string"==typeof r?r.split(""):r,o=t.length,s=(c("alphabet",t),new Map(t.map((e,t)=>[e,t])));return{encode:e=>(ze(e),e.map(e=>{if(!Number.isSafeInteger(e)||e<0||e>=o)throw new Error(`alphabet.encode: digit index outside alphabet "${e}". Allowed: `+r);return t[e]})),decode:e=>(ze(e),e.map(e=>{a("alphabet.decode",e);var t=s.get(e);if(void 0===t)throw new Error(`Unknown letter: "${e}". Allowed: `+r);return t}))}})("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),(l="=",Ve(d=5),a("padding",l),{encode(e){for(c("padding.encode",e);e.length*d%8;)e.push(l);return e},decode(e){c("padding.decode",e);let t=e.length;if(t*d%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;0<t&&e[t-1]===l;t--)if((t-1)*d%8==0)throw new Error("padding: invalid, string has too much padding");return e.slice(0,t)}}),(a("join",Ze=""),{encode:e=>(c("join.decode",e),e.join(Ze)),decode:e=>(a("join.decode",e),e.split(Ze))})],e=e=>e,_=(t,r)=>e=>t(r(e)),{encode:t.map(e=>e.encode).reduceRight(_,e),decode:t.map(e=>e.decode).reduce(_,e)})),tt=class{name="scure";encode(e,t={}){var{padding:t=!1}=t,e=et.encode(e);return t?e:e.replace(/=+$/,"")}decode(e){try{var t=e.toUpperCase(),r=t.padEnd(8*Math.ceil(t.length/8),"=");return et.decode(r)}catch(e){throw new Error("Invalid Base32 string: "+e.message)}}},rt=Object.freeze(new tt);function ot(e,t=""){if("number"!=typeof e)throw new TypeError((t&&`"${t}" `)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError((t&&`"${t}" `)+"expected integer >= 0, got "+e)}function st(e,t,r=""){var o=(o=e)instanceof Uint8Array||ArrayBuffer.isView(o)&&"Uint8Array"===o.constructor.name&&"BYTES_PER_ELEMENT"in o&&1===o.BYTES_PER_ELEMENT,s=e?.length,n=void 0!==t;if(!o||n&&s!==t)throw r=(r&&`"${r}" `)+"expected Uint8Array"+(n?" of length "+t:"")+", got "+(o?"length="+s:"type="+typeof e),new(o?RangeError:TypeError)(r)}function f(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function nt(e,t){st(e,void 0,"digestInto() output");t=t.outputLen;if(e.length<t)throw new RangeError('"digestInto() output" expected to be of length >='+t)}function p(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function it(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function g(e,t){return e<<32-t|e>>>t}function at(e,t){return e<<t|e>>>32-t>>>0}function ct(r,e={}){var t=(e,t)=>r(t).update(e).digest(),o=r(void 0);return t.outputLen=o.outputLen,t.blockLen=o.blockLen,t.canXOF=o.canXOF,t.create=e=>r(e),Object.assign(t,e),Object.freeze(t)}var t=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])}),ht=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){var r=e;if("function"!=typeof r||"function"!=typeof r.create)throw new TypeError("Hash must wrapped by utils.createHasher");if(ot(r.outputLen),ot(r.blockLen),r.outputLen<1)throw new Error('"outputLen" must be >= 1');if(r.blockLen<1)throw new Error('"blockLen" must be >= 1');if(st(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;var r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),p(o)}update(e){return f(this),this.iHash.update(e),this}digestInto(e){f(this),nt(e,this),this.finished=!0;e=e.subarray(0,this.outputLen);this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){var e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){var{oHash:t,iHash:r,finished:o,destroyed:s,blockLen:n,outputLen:i}=this;return(e||=Object.create(Object.getPrototypeOf(this),{})).finished=o,e.destroyed=s,e.blockLen=n,e.outputLen=i,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ut=((_=(e,t,r)=>new ht(e,t).update(r).digest()).create=(e,t)=>new ht(e,t),_);function dt(e,t,r){return e&t^~e&r}function lt(e,t,r){return e&t^e&r^t&r}var e=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=it(this.buffer)}update(t){f(this),st(t);var{view:r,buffer:o,blockLen:s}=this,n=t.length;for(let e=0;e<n;){var i=Math.min(s-this.pos,n-e);if(i===s)for(var a=it(t);s<=n-e;e+=s)this.process(a,e);else o.set(t.subarray(e,e+i),this.pos),this.pos+=i,e+=i,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(e){f(this),nt(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:s}=this,n=this.pos;t[n++]=128,p(this.buffer.subarray(n)),this.padOffset>o-n&&(this.process(r,0),n=0);for(let e=n;e<o;e++)t[e]=0;r.setBigUint64(o-8,BigInt(8*this.length),s),this.process(r,0);var i=it(e),e=this.outputLen;if(e%4)throw new Error("_sha2: outputLen must be aligned to 32bit");var a=e/4,c=this.get();if(a>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<a;e++)i.setUint32(4*e,c[e],s)}digest(){var{buffer:e,outputLen:t}=this,e=(this.digestInto(e),e.slice(0,t));return this.destroy(),e}_cloneInto(e){(e||=new this.constructor).set(...this.get());var{blockLen:t,buffer:r,length:o,finished:s,destroyed:n,pos:i}=this;return e.destroyed=n,e.finished=s,e.length=o,e.pos=i,o%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},b=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),y=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),m=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),S=new Uint32Array(80),ft=class extends e{A=0|m[0];B=0|m[1];C=0|m[2];D=0|m[3];E=0|m[4];constructor(){super(64,20,8,!1)}get(){var{A:e,B:t,C:r,D:o,E:s}=this;return[e,t,r,o,s]}set(e,t,r,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|s}process(t,r){for(let e=0;e<16;e++,r+=4)S[e]=t.getUint32(r,!1);for(let e=16;e<80;e++)S[e]=at(S[e-3]^S[e-8]^S[e-14]^S[e-16],1);let{A:o,B:s,C:n,D:i,E:a}=this;for(let r=0;r<80;r++){let e,t;t=r<20?(e=dt(s,n,i),1518500249):r<40?(e=s^n^i,1859775393):r<60?(e=lt(s,n,i),2400959708):(e=s^n^i,3395469782);var c=at(o,5)+e+a+t+S[r]|0;a=i,i=n,n=at(s,30),s=o,o=c}o=o+this.A|0,s=s+this.B|0,n=n+this.C|0,i=i+this.D|0,a=a+this.E|0,this.set(o,s,n,i,a)}roundClean(){p(S)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0),p(this.buffer)}},pt=ct(()=>new ft),I=BigInt(4294967295),gt=BigInt(32);var bt=(e,t,r)=>e<<32-r|t>>>r,R=(e,t,r)=>e>>>r|t<<32-r,M=(e,t,r)=>e<<32-r|t>>>r,B=(e,t,r)=>e<<64-r|t>>>r-32,yt=(e,t,r)=>e>>>r-32|t<<64-r;function N(e,t,r,o){t=(t>>>0)+(o>>>0);return{h:e+r+(t/2**32|0)|0,l:0|t}}var mt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),C=new Uint32Array(64),_=class extends e{constructor(e){super(64,e,8,!1)}get(){var{A:e,B:t,C:r,D:o,E:s,F:n,G:i,H:a}=this;return[e,t,r,o,s,n,i,a]}set(e,t,r,o,s,n,i,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|s,this.F=0|n,this.G=0|i,this.H=0|a}process(t,r){for(let e=0;e<16;e++,r+=4)C[e]=t.getUint32(r,!1);for(let e=16;e<64;e++){var o=C[e-15],s=C[e-2],o=g(o,7)^g(o,18)^o>>>3,s=g(s,17)^g(s,19)^s>>>10;C[e]=s+C[e-7]+o+C[e-16]|0}let{A:n,B:i,C:a,D:c,E:h,F:u,G:d,H:l}=this;for(let e=0;e<64;e++){var f=g(h,6)^g(h,11)^g(h,25),f=l+f+dt(h,u,d)+mt[e]+C[e]|0,p=(g(n,2)^g(n,13)^g(n,22))+lt(n,i,a)|0;l=d,d=u,u=h,h=c+f|0,c=a,a=i,i=n,n=f+p|0}n=n+this.A|0,i=i+this.B|0,a=a+this.C|0,c=c+this.D|0,h=h+this.E|0,u=u+this.F|0,d=d+this.G|0,l=l+this.H|0,this.set(n,i,a,c,h,u,d,l)}roundClean(){p(C)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),p(this.buffer)}},Et=class extends _{A=0|b[0];B=0|b[1];C=0|b[2];D=0|b[3];E=0|b[4];F=0|b[5];G=0|b[6];H=0|b[7];constructor(){super(32)}},_=((t,r=!1)=>{var o=t.length,s=new Uint32Array(o),n=new Uint32Array(o);for(let e=0;e<o;e++){[a,i=!1]=[t[e],r];var{h:i,l:a}=i?{h:Number(a&I),l:Number(a>>gt&I)}:{h:0|Number(a>>gt&I),l:0|Number(a&I)};[s[e],n[e]]=[i,a]}return[s,n]})(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),wt=_[0],xt=_[1],O=new Uint32Array(80),D=new Uint32Array(80),_=class extends e{constructor(e){super(128,e,16,!1)}get(){var{Ah:e,Al:t,Bh:r,Bl:o,Ch:s,Cl:n,Dh:i,Dl:a,Eh:c,El:h,Fh:u,Fl:d,Gh:l,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,o,s,n,i,a,c,h,u,d,l,f,p,g]}set(e,t,r,o,s,n,i,a,c,h,u,d,l,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|o,this.Ch=0|s,this.Cl=0|n,this.Dh=0|i,this.Dl=0|a,this.Eh=0|c,this.El=0|h,this.Fh=0|u,this.Fl=0|d,this.Gh=0|l,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(t,r){for(let e=0;e<16;e++,r+=4)O[e]=t.getUint32(r),D[e]=t.getUint32(r+=4);for(let e=16;e<80;e++){var o=0|O[e-15],s=0|D[e-15],n=R(o,s,1)^R(o,s,8)^o>>>7,o=M(o,s,1)^M(o,s,8)^bt(o,s,7),s=0|O[e-2],i=0|D[e-2],a=R(s,i,19)^B(s,i,61)^s>>>6,o=(o>>>0)+((M(s,i,19)^yt(s,i,61)^bt(s,i,6))>>>0)+(D[e-7]>>>0)+(D[e-16]>>>0);s=O[e-7],i=O[e-16],O[e]=0|(n+a+s+i+(o/2**32|0)|0),D[e]=0|o}let{Ah:c,Al:h,Bh:u,Bl:d,Ch:l,Cl:f,Dh:p,Dl:g,Eh:b,El:y,Fh:m,Fl:E,Gh:w,Gl:x,Hh:v,Hl:T}=this;for(let e=0;e<80;e++){var A=R(b,y,14)^R(b,y,18)^B(b,y,41),S=M(b,y,14)^M(b,y,18)^yt(b,y,41),I=b&m^~b&w,C=y&E^~y&x,S=(T>>>0)+(S>>>0)+(C>>>0)+(xt[e]>>>0)+(D[e]>>>0),C=(C=v,_=wt[e],k=O[e],C+A+I+_+k+(S/2**32|0)|0),A=0|S,I=R(c,h,28)^B(c,h,34)^B(c,h,39),_=M(c,h,28)^yt(c,h,34)^yt(c,h,39),k=c&u^c&l^u&l,S=h&d^h&f^d&f,A=(v=0|w,T=0|x,w=0|m,x=0|E,m=0|b,E=0|y,{h:b,l:y}=N(0|p,0|g,0|C,0|A),p=0|l,g=0|f,l=0|u,f=0|d,u=0|c,d=0|h,(A>>>0)+(_>>>0)+(S>>>0));c=C+I+k+(A/2**32|0)|0,h=0|A}({h:c,l:h}=N(0|this.Ah,0|this.Al,0|c,0|h)),{h:u,l:d}=N(0|this.Bh,0|this.Bl,0|u,0|d),{h:l,l:f}=N(0|this.Ch,0|this.Cl,0|l,0|f),{h:p,l:g}=N(0|this.Dh,0|this.Dl,0|p,0|g),{h:b,l:y}=N(0|this.Eh,0|this.El,0|b,0|y),{h:m,l:E}=N(0|this.Fh,0|this.Fl,0|m,0|E),{h:w,l:x}=N(0|this.Gh,0|this.Gl,0|w,0|x),{h:v,l:T}=N(0|this.Hh,0|this.Hl,0|v,0|T),this.set(c,h,u,d,l,f,p,g,b,y,m,E,w,x,v,T)}roundClean(){p(O,D)}destroy(){this.destroyed=!0,p(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},vt=class extends _{Ah=0|y[0];Al=0|y[1];Bh=0|y[2];Bl=0|y[3];Ch=0|y[4];Cl=0|y[5];Dh=0|y[6];Dl=0|y[7];Eh=0|y[8];El=0|y[9];Fh=0|y[10];Fl=0|y[11];Gh=0|y[12];Gl=0|y[13];Hh=0|y[14];Hl=0|y[15];constructor(){super(64)}},Tt=ct(()=>new Et,t(1)),At=ct(()=>new vt,t(3)),St=class{name="noble";hmac(e,t,r){return ut("sha1"===e?pt:"sha256"===e?Tt:At,t,r)}randomBytes(e){var[e=32]=[e],t=(ot(e,"bytesLength"),"object"==typeof globalThis?globalThis.crypto:null);if("function"!=typeof t?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");if(65536<e)throw new RangeError('"bytesLength" expected <= 65536, got '+e);return t.getRandomValues(new Uint8Array(e))}constantTimeEqual(e,r){{var o=Ae(e),s=Ae(r);if(o.length!==s.length)return!1;let t=0;for(let e=0;e<o.length;e++)t|=o[e]^s[e];return 0===t}}},It=Object.freeze(new St);function Ct(e){return{secret:e.secret,strategy:e.strategy??"totp",crypto:e.crypto??It,base32:e.base32??rt,algorithm:e.algorithm??"sha1",digits:e.digits??6,period:e.period??30,epoch:e.epoch??Math.floor(Date.now()/1e3),t0:e.t0??0,counter:e.counter,guardrails:e.guardrails??w(),hooks:e.hooks}}function _t(e){return{...Ct(e),token:e.token,epochTolerance:e.epochTolerance??0,counterTolerance:e.counterTolerance??0,afterTimeStep:e.afterTimeStep}}function k(e,t,r){if("totp"===e)return r.totp();if("hotp"!==e)throw new o(`Unknown OTP strategy: ${e}. Valid strategies are 'totp' or 'hotp'.`);if(void 0===t)throw new o("Counter is required for HOTP strategy. Example: { strategy: 'hotp', counter: 0 }");return r.hotp(t)}function kt(e){let{strategy:t="totp",issuer:r,label:o,secret:s,algorithm:n="sha1",digits:i=6,period:a=30,counter:c}=e;return k(t,c,{totp:()=>Ne({issuer:r,label:o,secret:s,algorithm:n,digits:i,period:a}),hotp:e=>Oe({issuer:r,label:o,secret:s,algorithm:n,digits:i,counter:e})})}async function Rt(e){let t=Ct(e),{secret:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a}=t,c={secret:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a};return k(t.strategy,t.counter,{totp:()=>$e({...c,period:t.period,epoch:t.epoch,t0:t.t0,guardrails:t.guardrails}),hotp:e=>h({...c,counter:e,guardrails:t.guardrails})})}function Mt(e){let t=Ct(e),{secret:r,crypto:o,base32:s,algorithm:n,digits:i}=t,a={secret:r,crypto:o,base32:s,algorithm:n,digits:i};return k(t.strategy,t.counter,{totp:()=>Fe({...a,period:t.period,epoch:t.epoch,t0:t.t0,guardrails:t.guardrails}),hotp:e=>Ue({...a,counter:e,guardrails:t.guardrails})})}async function Bt(e){let t=_t(e),{secret:r,token:o,crypto:s,base32:n,algorithm:i,digits:a,hooks:c}=t,h={secret:r,token:o,crypto:s,base32:n,algorithm:i,digits:a,hooks:c};return k(t.strategy,t.counter,{totp:()=>We({...h,period:t.period,epoch:t.epoch,t0:t.t0,epochTolerance:t.epochTolerance,afterTimeStep:t.afterTimeStep,guardrails:t.guardrails}),hotp:e=>Pe({...h,counter:e,counterTolerance:t.counterTolerance,guardrails:t.guardrails})})}function Nt(e){let d=_t(e),{secret:t,token:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a}=d,l={secret:t,token:r,crypto:o,base32:s,algorithm:n,digits:i,hooks:a};return k(d.strategy,d.counter,{totp:()=>{var{token:t,crypto:r,minCounter:o,maxCounter:s,currentCounter:n,t0:i,period:a,afterTimeStep:c,getGenerateOptions:h}=je(o={...l,period:d.period,epoch:d.epoch,t0:d.t0,epochTolerance:d.epochTolerance,afterTimeStep:d.afterTimeStep,guardrails:d.guardrails});for(let e=o;e<=s;e++)if(!Ye(e,c)){var u=Fe(h(e));if(r.constantTimeEqual(u,t))return{valid:!0,delta:e-n,epoch:e*a+i,timeStep:e}}return{valid:!1}},hotp:e=>{var{token:t,counterNum:r,past:o,totalChecks:s,crypto:n,getGenerateOptions:i}=He({...l,counter:e,counterTolerance:d.counterTolerance,guardrails:d.guardrails});for(let e=Math.max(0,o-r);e<s;e++){var a=e-o,c=Ue(i(r+a));if(n.constantTimeEqual(c,t))return{valid:!0,delta:0|a}}return{valid:!1}}})}var Ot=class{strategy;crypto;base32;guardrails;constructor(e={}){var{strategy:e="totp",crypto:t=It,base32:r=rt,guardrails:o}=e;this.strategy=e,this.crypto=t,this.base32=r,this.guardrails=w(o)}getStrategy(){return this.strategy}generateSecret(e=20){return n({crypto:this.crypto,base32:this.base32,length:e})}async generate(e){return Rt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateSync(e){return Mt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}async verify(e){return Bt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}verifySync(e){return Nt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateURI(e){return kt({...e,strategy:this.strategy})}};return e=X,((t,r,o,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let e of H(r))P.call(t,e)||e===o||L(t,e,{get:()=>r[e],enumerable:!(s=U(r,e))||s.enumerable});return t})(L({},"__esModule",{value:!0}),e)})();
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";var otplib=(()=>{var Rt=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var qr=Object.prototype.hasOwnProperty;var Fr=(t,e)=>{for(var r in e)Rt(t,r,{get:e[r],enumerable:!0})},jr=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $r(e))!qr.call(t,n)&&n!==r&&Rt(t,n,{get:()=>e[n],enumerable:!(o=Nr(e,n))||o.enumerable});return t};var Wr=t=>jr(Rt({},"__esModule",{value:!0}),t);var un={};Fr(un,{HOTP:()=>Ne,NobleCryptoPlugin:()=>Ke,OTP:()=>wt,ScureBase32Plugin:()=>je,TOTP:()=>qe,createGuardrails:()=>m,generate:()=>Tt,generateSecret:()=>Lr,generateSync:()=>Ot,generateURI:()=>bt,stringToBytes:()=>De,verify:()=>Et,verifySync:()=>Pt,wrapResult:()=>_t,wrapResultAsync:()=>Gt});var P=class extends Error{constructor(e,r){super(e,r),this.name="OTPError"}},oe=class extends P{constructor(e){super(e),this.name="SecretError"}},se=class extends oe{constructor(e,r){super(`Secret must be at least ${e} bytes (${e*8} bits), got ${r} bytes`),this.name="SecretTooShortError"}},ie=class extends oe{constructor(e,r){super(`Secret must not exceed ${e} bytes, got ${r} bytes`),this.name="SecretTooLongError"}},K=class extends P{constructor(e){super(e),this.name="CounterError"}},ae=class extends K{constructor(){super("Counter must be non-negative"),this.name="CounterNegativeError"}},J=class extends K{constructor(){super("Counter exceeds maximum safe integer value"),this.name="CounterOverflowError"}},ce=class extends K{constructor(){super("Counter must be a finite integer"),this.name="CounterNotIntegerError"}},ue=class extends P{constructor(e){super(e),this.name="TimeError"}},le=class extends ue{constructor(){super("Time must be non-negative"),this.name="TimeNegativeError"}},pe=class extends ue{constructor(){super("Time must be a finite number"),this.name="TimeNotFiniteError"}},fe=class extends P{constructor(e){super(e),this.name="PeriodError"}},de=class extends fe{constructor(e){super(`Period must be at least ${e} second(s)`),this.name="PeriodTooSmallError"}},he=class extends fe{constructor(e){super(`Period must not exceed ${e} seconds`),this.name="PeriodTooLargeError"}};var ge=class extends P{constructor(e){super(e),this.name="TokenError"}},xe=class extends ge{constructor(e,r){super(`Token must be ${e} digits, got ${r}`),this.name="TokenLengthError"}},ye=class extends ge{constructor(){super("Token must contain only digits"),this.name="TokenFormatError"}},me=class extends P{constructor(e,r){super(e,r),this.name="CryptoError"}},v=class extends me{constructor(e,r){super(`HMAC computation failed: ${e}`,r),this.name="HMACError"}},be=class extends me{constructor(e,r){super(`Random byte generation failed: ${e}`,r),this.name="RandomBytesError"}};var V=class extends P{constructor(e){super(e),this.name="CounterToleranceError"}},Te=class extends V{constructor(e,r){super(`Counter tolerance validation failed: total checks (${r}) exceeds MAX_WINDOW (${e})`),this.name="CounterToleranceTooLargeError"}},Oe=class extends V{constructor(){super("Counter tolerance cannot contain negative values"),this.name="CounterToleranceNegativeError"}},N=class extends P{constructor(e){super(e),this.name="EpochToleranceError"}},Ee=class extends N{constructor(){super("Epoch tolerance cannot contain negative values"),this.name="EpochToleranceNegativeError"}},Pe=class extends N{constructor(e,r){super(`Epoch tolerance must not exceed ${e} seconds, got ${r}. Large tolerances can cause performance issues.`),this.name="EpochToleranceTooLargeError"}},we=class extends P{constructor(e){super(e),this.name="PluginError"}},Ae=class extends we{constructor(){super("Crypto plugin is required."),this.name="CryptoPluginMissingError"}},Se=class extends we{constructor(){super("Base32 plugin is required."),this.name="Base32PluginMissingError"}},T=class extends P{constructor(e){super(e),this.name="ConfigurationError"}},Ce=class extends T{constructor(){super("Secret is required. Use generateSecret() to create one, or provide via { secret: 'YOUR_BASE32_SECRET' }"),this.name="SecretMissingError"}},Be=class extends T{constructor(){super("Label is required for URI generation. Example: { label: 'user@example.com' }"),this.name="LabelMissingError"}},Re=class extends T{constructor(){super("Issuer is required for URI generation. Example: { issuer: 'MyApp' }"),this.name="IssuerMissingError"}},Ie=class extends T{constructor(){super("Class API requires secret to be a Base32 string, not Uint8Array. Use generateSecret() or provide a Base32-encoded string."),this.name="SecretTypeError"}},Q=class extends P{constructor(e){super(e),this.name="AfterTimeStepError"}},He=class extends Q{constructor(){super("afterTimeStep must be >= 0"),this.name="AfterTimeStepNegativeError"}},Ue=class extends Q{constructor(){super("Invalid afterTimeStep: non-integer value"),this.name="AfterTimeStepNotIntegerError"}},ve=class extends Q{constructor(){super("Invalid afterTimeStep: cannot be greater than current time step plus window"),this.name="AfterTimeStepRangeExceededError"}};var Xr=new TextEncoder,hn=new TextDecoder,tr=16,rr=64,nr=20,or=1,sr=3600,ir=30,ar=Number.MAX_SAFE_INTEGER,cr=99,ur=Symbol("otplib.guardrails.override");function Z(t,e,r){if(typeof e!="number"||!Number.isSafeInteger(e))throw new T(`Guardrail '${t}' must be a safe integer`);if(e<r)throw new T(`Guardrail '${t}' must be >= ${r}`)}var $=Object.freeze({MIN_SECRET_BYTES:tr,MAX_SECRET_BYTES:rr,MIN_PERIOD:or,MAX_PERIOD:sr,MAX_COUNTER:ar,MAX_WINDOW:cr,[ur]:!1});function m(t){if(!t)return $;t.MIN_SECRET_BYTES!==void 0&&Z("MIN_SECRET_BYTES",t.MIN_SECRET_BYTES,1),t.MAX_SECRET_BYTES!==void 0&&Z("MAX_SECRET_BYTES",t.MAX_SECRET_BYTES,1),t.MIN_PERIOD!==void 0&&Z("MIN_PERIOD",t.MIN_PERIOD,1),t.MAX_PERIOD!==void 0&&Z("MAX_PERIOD",t.MAX_PERIOD,1),t.MAX_COUNTER!==void 0&&Z("MAX_COUNTER",t.MAX_COUNTER,0),t.MAX_WINDOW!==void 0&&Z("MAX_WINDOW",t.MAX_WINDOW,1);let e={...$,...t};if(e.MIN_SECRET_BYTES>e.MAX_SECRET_BYTES)throw new T("Guardrail 'MIN_SECRET_BYTES' must be <= 'MAX_SECRET_BYTES'");if(e.MIN_PERIOD>e.MAX_PERIOD)throw new T("Guardrail 'MIN_PERIOD' must be <= 'MAX_PERIOD'");return Object.freeze({...e,[ur]:!0})}function q(t,e=$){if(t.length<e.MIN_SECRET_BYTES)throw new se(e.MIN_SECRET_BYTES,t.length);if(t.length>e.MAX_SECRET_BYTES)throw new ie(e.MAX_SECRET_BYTES,t.length)}function et(t,e=$){if(typeof t=="number"){if(!Number.isFinite(t)||!Number.isInteger(t))throw new ce;if(!Number.isSafeInteger(t))throw new J}let r=typeof t=="bigint"?t:BigInt(t);if(r<0n)throw new ae;if(r>BigInt(e.MAX_COUNTER))throw new J}function tt(t){if(!Number.isFinite(t))throw new pe;if(t<0)throw new le}function rt(t,e=$){if(!Number.isInteger(t)||t<e.MIN_PERIOD)throw new de(e.MIN_PERIOD);if(t>e.MAX_PERIOD)throw new he(e.MAX_PERIOD)}function _e(t,e){if(t.length!==e)throw new xe(e,t.length);if(!/^\d+$/.test(t))throw new ye}function It(t,e=$){let[r,o]=st(t);if(!Number.isSafeInteger(r)||!Number.isSafeInteger(o))throw new V("Counter tolerance values must be safe integers");if(r<0||o<0)throw new Oe;let n=r+o+1;if(n>e.MAX_WINDOW)throw new Te(e.MAX_WINDOW,n)}function Ht(t,e=ir,r=$){let[o,n]=Array.isArray(t)?t:[t,t];if(!Number.isSafeInteger(o)||!Number.isSafeInteger(n))throw new N("Epoch tolerance values must be safe integers");if(o<0||n<0)throw new Ee;let s=(r.MAX_WINDOW-1)*e,i=o+n;if(i>s)throw new Pe(s,i)}function Ut(t){let e=typeof t=="bigint"?t:BigInt(t),r=new ArrayBuffer(8);return new DataView(r).setBigUint64(0,e,!1),new Uint8Array(r)}function nt(t){let e=t[t.length-1]&15;return(t[e]&127)<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function ot(t,e){let r=10**e;return(t%r).toString().padStart(e,"0")}function lr(t,e){return t.length===e.length}function vt(t,e){let r=De(t),o=De(e);if(!lr(r,o))return!1;let n=0;for(let s=0;s<r.length;s++)n|=r[s]^o[s];return n===0}function De(t){return typeof t=="string"?Xr.encode(t):t}function F(t,e){return typeof t=="string"?(j(e),e.decode(t)):t}function I(t){let{crypto:e,base32:r,length:o=nr}=t;b(e),j(r);let n=e.randomBytes(o);return r.encode(n,{padding:!1})}function st(t=0){return Array.isArray(t)?t:[0,t]}function Dt(t=0){return Array.isArray(t)?t:[t,t]}function b(t){if(!t)throw new Ae}function j(t){if(!t)throw new Se}function O(t){if(!t)throw new Ce}function Ge(t){if(!t)throw new Be}function ke(t){if(!t)throw new Re}function Me(t){if(typeof t!="string")throw new Ie}function pr(t){return{ok:!0,value:t}}function fr(t){return{ok:!1,error:t}}function _t(t){return(...e)=>{try{return pr(t(...e))}catch(r){return fr(r)}}}function Gt(t){return async(...e)=>{try{return pr(await t(...e))}catch(r){return fr(r)}}}var it=class{constructor(e){this.crypto=e}get plugin(){return this.crypto}async hmac(e,r,o){try{let n=this.crypto.hmac(e,r,o);return n instanceof Promise?await n:n}catch(n){let s=n instanceof Error?n.message:String(n);throw new v(s,{cause:n})}}hmacSync(e,r,o){try{let n=this.crypto.hmac(e,r,o);if(n instanceof Promise)throw new v("Crypto plugin does not support synchronous HMAC operations");return n}catch(n){if(n instanceof v)throw n;let s=n instanceof Error?n.message:String(n);throw new v(s,{cause:n})}}randomBytes(e){try{return this.crypto.randomBytes(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new be(o,{cause:r})}}};function kt(t){return new it(t)}function Mt(t){let{type:e,label:r,params:o}=t,n=r.split(":").map(a=>encodeURIComponent(a)).join(":"),s=`otpauth://${e}/${n}?`,i=[];return o.secret&&i.push(`secret=${encodeURIComponent(o.secret)}`),o.issuer&&i.push(`issuer=${encodeURIComponent(o.issuer)}`),o.algorithm&&o.algorithm!=="sha1"&&i.push(`algorithm=${o.algorithm.toUpperCase()}`),o.digits&&o.digits!==6&&i.push(`digits=${o.digits}`),e==="hotp"&&o.counter!==void 0&&i.push(`counter=${o.counter}`),e==="totp"&&o.period!==void 0&&o.period!==30&&i.push(`period=${o.period}`),s+=i.join("&"),s}function Le(t){let{issuer:e,label:r,secret:o,algorithm:n="sha1",digits:s=6,period:i=30}=t,a=e?`${e}:${r}`:r;return Mt({type:"totp",label:a,params:{secret:o,issuer:e,algorithm:n,digits:s,period:i}})}function Ve(t){let{issuer:e,label:r,secret:o,counter:n=0,algorithm:s="sha1",digits:i=6}=t,a=e?`${e}:${r}`:r;return Mt({type:"hotp",label:a,params:{secret:o,issuer:e,algorithm:s,digits:i,counter:n}})}var Ne=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=m(e.guardrails)}generateSecret(){let{crypto:e,base32:r}=this.options;return b(e),j(r),I({crypto:e,base32:r})}async generate(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6}=o;O(n),b(s);let u=r?.guardrails??this.guardrails;return W({secret:n,counter:e,algorithm:a,digits:c,crypto:s,base32:i,guardrails:u,hooks:o.hooks})}async verify(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6,counterTolerance:u=0}=o;O(n),b(s);let l=r?.guardrails??this.guardrails;return at({secret:n,token:e.token,counter:e.counter,algorithm:a,digits:c,counterTolerance:u,crypto:s,base32:i,guardrails:l,hooks:o.hooks})}toURI(e=0){let{issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6}=this.options;return O(n),Ge(o),ke(r),Me(n),Ve({issuer:r,label:o,secret:n,algorithm:s,digits:i,counter:e})}};function dr(t){let{secret:e,counter:r,algorithm:o="sha1",digits:n=6,crypto:s,base32:i,guardrails:a,hooks:c}=t;O(e),b(s);let u=F(e,i);q(u,a),et(r,a);let l=kt(s),p=Ut(r);return{ctx:l,algorithm:o,digits:n,secretBytes:u,counterBytes:p,hooks:c}}async function W(t){let{ctx:e,algorithm:r,digits:o,secretBytes:n,counterBytes:s,hooks:i}=dr(t),a=await e.hmac(r,n,s),c=i?.truncateDigest?i.truncateDigest(a):nt(a);return i?.encodeToken?i.encodeToken(c,o):ot(c,o)}function $e(t){let{ctx:e,algorithm:r,digits:o,secretBytes:n,counterBytes:s,hooks:i}=dr(t),a=e.hmacSync(r,n,s),c=i?.truncateDigest?i.truncateDigest(a):nt(a);return i?.encodeToken?i.encodeToken(c,o):ot(c,o)}function hr(t){let{secret:e,counter:r,token:o,algorithm:n="sha1",digits:s=6,crypto:i,base32:a,counterTolerance:c=0,guardrails:u=m(),hooks:l}=t;O(e),b(i);let p=F(e,a);q(p,u),et(r,u),l?.validateToken?l.validateToken(o,s):_e(o,s),It(c,u);let f=typeof r=="bigint"?Number(r):r,[h,g]=st(c),x=h+g+1;return{token:o,counterNum:f,past:h,future:g,totalChecks:x,crypto:i,getGenerateOptions:E=>({secret:p,counter:E,algorithm:n,digits:s,crypto:i,guardrails:u,hooks:l})}}async function at(t){let{token:e,counterNum:r,past:o,totalChecks:n,crypto:s,getGenerateOptions:i}=hr(t),a=Math.max(0,o-r);for(let c=a;c<n;c++){let u=c-o,l=r+u,p=await W(i(l));if(s.constantTimeEqual(p,e))return{valid:!0,delta:u|0}}return{valid:!1}}function gr(t){let{token:e,counterNum:r,past:o,totalChecks:n,crypto:s,getGenerateOptions:i}=hr(t),a=Math.max(0,o-r);for(let c=a;c<n;c++){let u=c-o,l=r+u,p=$e(i(l));if(s.constantTimeEqual(p,e))return{valid:!0,delta:u|0}}return{valid:!1}}var qe=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=m(e.guardrails)}generateSecret(){let{crypto:e,base32:r}=this.options;return b(e),j(r),I({crypto:e,base32:r})}async generate(e){let r={...this.options,...e},{secret:o,crypto:n,base32:s,algorithm:i="sha1",digits:a=6,period:c=30,epoch:u,t0:l=0}=r;O(o),b(n);let p=e?.guardrails??this.guardrails;return Fe({secret:o,algorithm:i,digits:a,period:c,epoch:u??Math.floor(Date.now()/1e3),t0:l,crypto:n,base32:s,guardrails:p,hooks:r.hooks})}async verify(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6,period:u=30,epoch:l,t0:p=0,epochTolerance:f=0,afterTimeStep:h}=o;O(n),b(s);let g=r?.guardrails??this.guardrails;return ct({secret:n,token:e,algorithm:a,digits:c,period:u,epoch:l??Math.floor(Date.now()/1e3),t0:p,epochTolerance:f,afterTimeStep:h,crypto:s,base32:i,guardrails:g,hooks:o.hooks})}toURI(e){let{issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6,period:a=30}=this.options,c=e?.label??o,u=e?.issuer??r,l=e?.secret??n;return O(l),Ge(c),ke(u),Me(l),Le({issuer:u,label:c,secret:l,algorithm:s,digits:i,period:a})}};function xr(t){let{secret:e,epoch:r=Math.floor(Date.now()/1e3),t0:o=0,period:n=30,algorithm:s="sha1",digits:i=6,crypto:a,base32:c,guardrails:u=m(),hooks:l}=t;O(e),b(a);let p=F(e,c);q(p,u),tt(r),rt(n,u);let f=Math.floor((r-o)/n);return{secret:p,counter:f,algorithm:s,digits:i,crypto:a,guardrails:u,hooks:l}}async function Fe(t){let e=xr(t);return W(e)}function Lt(t){let e=xr(t);return $e(e)}function Yr(t,e){if(t!==void 0){if(t<0)throw new He;if(!Number.isSafeInteger(t))throw new Ue;if(t>e)throw new ve}}function yr(t,e){return e!==void 0&&t<=e}function mr(t){let{secret:e,token:r,epoch:o=Math.floor(Date.now()/1e3),t0:n=0,period:s=30,algorithm:i="sha1",digits:a=6,crypto:c,base32:u,epochTolerance:l=0,afterTimeStep:p,guardrails:f=m(),hooks:h}=t;O(e),b(c);let g=F(e,u);q(g,f),tt(o),rt(s,f),h?.validateToken?h.validateToken(r,a):_e(r,a),Ht(l,s,f);let x=Math.floor((o-n)/s),[E,M]=Dt(l),L=Math.max(0,Math.floor((o-E-n)/s)),d=Math.floor((o+M-n)/s);return Yr(p,d),{token:r,crypto:c,minCounter:L,maxCounter:d,currentCounter:x,t0:n,period:s,afterTimeStep:p,getGenerateOptions:S=>({secret:g,epoch:S*s+n,t0:n,period:s,algorithm:i,digits:a,crypto:c,guardrails:f,hooks:h})}}async function ct(t){let{token:e,crypto:r,minCounter:o,maxCounter:n,currentCounter:s,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=mr(t);for(let l=o;l<=n;l++){if(yr(l,c))continue;let p=await Fe(u(l));if(r.constantTimeEqual(p,e))return{valid:!0,delta:l-s,epoch:l*a+i,timeStep:l}}return{valid:!1}}function br(t){let{token:e,crypto:r,minCounter:o,maxCounter:n,currentCounter:s,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=mr(t);for(let l=o;l<=n;l++){if(yr(l,c))continue;let p=Lt(u(l));if(r.constantTimeEqual(p,e))return{valid:!0,delta:l-s,epoch:l*a+i,timeStep:l}}return{valid:!1}}function zr(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Or(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(r=>typeof r=="string"):e.every(r=>Number.isSafeInteger(r)):!1}function ut(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}function $t(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}function Nt(t){if(!Array.isArray(t))throw new Error("array expected")}function lt(t,e){if(!Or(!0,e))throw new Error(`${t}: array of strings expected`)}function Kr(t,e){if(!Or(!1,e))throw new Error(`${t}: array of numbers expected`)}function Jr(...t){let e=s=>s,r=(s,i)=>a=>s(i(a)),o=t.map(s=>s.encode).reduceRight(r,e),n=t.map(s=>s.decode).reduce(r,e);return{encode:o,decode:n}}function Qr(t){let e=typeof t=="string"?t.split(""):t,r=e.length;lt("alphabet",e);let o=new Map(e.map((n,s)=>[n,s]));return{encode:n=>(Nt(n),n.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${t}`);return e[s]})),decode:n=>(Nt(n),n.map(s=>{ut("alphabet.decode",s);let i=o.get(s);if(i===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${t}`);return i}))}}function Zr(t=""){return ut("join",t),{encode:e=>(lt("join.decode",e),e.join(t)),decode:e=>(ut("join.decode",e),e.split(t))}}function en(t,e="="){return $t(t),ut("padding",e),{encode(r){for(lt("padding.encode",r);r.length*t%8;)r.push(e);return r},decode(r){lt("padding.decode",r);let o=r.length;if(o*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;o>0&&r[o-1]===e;o--)if((o-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,o)}}}var Er=(t,e)=>e===0?t:Er(e,t%e),pt=(t,e)=>t+(e-Er(t,e)),Vt=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function Tr(t,e,r,o){if(Nt(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(pt(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${pt(e,r)}`);let n=0,s=0,i=Vt[e],a=Vt[r]-1,c=[];for(let u of t){if($t(u),u>=i)throw new Error(`convertRadix2: invalid data word=${u} from=${e}`);if(n=n<<e|u,s+e>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);for(s+=e;s>=r;s-=r)c.push((n>>s-r&a)>>>0);let l=Vt[s];if(l===void 0)throw new Error("invalid carry");n&=l-1}if(n=n<<r-s&a,!o&&s>=e)throw new Error("Excess padding");if(!o&&n>0)throw new Error(`Non-zero padding: ${n}`);return o&&s>0&&c.push(n>>>0),c}function tn(t,e=!1){if($t(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(pt(8,t)>32||pt(t,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!zr(r))throw new Error("radix2.encode input should be Uint8Array");return Tr(Array.from(r),8,t,!e)},decode:r=>(Kr("radix2.decode",r),Uint8Array.from(Tr(r,t,8,e)))}}var qt=Jr(tn(5),Qr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),en(5),Zr(""));var je=class{name="scure";encode(e,r={}){let{padding:o=!1}=r,n=qt.encode(e);return o?n:n.replace(/=+$/,"")}decode(e){try{let r=e.toUpperCase(),o=r.padEnd(Math.ceil(r.length/8)*8,"=");return qt.decode(o)}catch(r){throw r instanceof Error?new Error(`Invalid Base32 string: ${r.message}`):new Error("Invalid Base32 string")}}},ee=Object.freeze(new je);function rn(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Pr(t,e=""){if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new Error(`${r}expected integer >= 0, got ${t}`)}}function te(t,e,r=""){let o=rn(t),n=t?.length,s=e!==void 0;if(!o||s&&n!==e){let i=r&&`"${r}" `,a=s?` of length ${e}`:"",c=o?`length=${n}`:`type=${typeof t}`;throw new Error(i+"expected Uint8Array"+a+", got "+c)}return t}function wr(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Pr(t.outputLen),Pr(t.blockLen)}function re(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ar(t,e){te(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function w(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function ft(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function A(t,e){return t<<32-e|t>>>e}function dt(t,e){return t<<e|t>>>32-e>>>0}function We(t,e={}){let r=(n,s)=>t(s).update(n).digest(),o=t(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.create=n=>t(n),Object.assign(r,e),Object.freeze(r)}function Sr(t=32){let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(t))}var Ft=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});var ht=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,r){if(wr(e),te(r,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,n=new Uint8Array(o);n.set(r.length>o?e.create().update(r).digest():r);for(let s=0;s<n.length;s++)n[s]^=54;this.iHash.update(n),this.oHash=e.create();for(let s=0;s<n.length;s++)n[s]^=106;this.oHash.update(n),w(n)}update(e){return re(this),this.iHash.update(e),this}digestInto(e){re(this),te(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:o,finished:n,destroyed:s,blockLen:i,outputLen:a}=this;return e=e,e.finished=n,e.destroyed=s,e.blockLen=i,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=o._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},jt=(t,e,r)=>new ht(t,e).update(r).digest();jt.create=(t,e)=>new ht(t,e);function gt(t,e,r){return t&e^~t&r}function xt(t,e,r){return t&e^t&r^e&r}var X=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,o,n){this.blockLen=e,this.outputLen=r,this.padOffset=o,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ft(this.buffer)}update(e){re(this),te(e);let{view:r,buffer:o,blockLen:n}=this,s=e.length;for(let i=0;i<s;){let a=Math.min(n-this.pos,s-i);if(a===n){let c=ft(e);for(;n<=s-i;i+=n)this.process(c,i);continue}o.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){re(this),Ar(e,this),this.finished=!0;let{buffer:r,view:o,blockLen:n,isLE:s}=this,{pos:i}=this;r[i++]=128,w(this.buffer.subarray(i)),this.padOffset>n-i&&(this.process(o,0),i=0);for(let p=i;p<n;p++)r[p]=0;o.setBigUint64(n-8,BigInt(this.length*8),s),this.process(o,0);let a=ft(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<u;p++)a.setUint32(4*p,l[p],s)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let o=e.slice(0,r);return this.destroy(),o}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:r,buffer:o,length:n,finished:s,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=s,e.length=n,e.pos=a,n%r&&e.buffer.set(o),e}clone(){return this._cloneInto()}},H=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var y=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var Xe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),D=new Uint32Array(80),Wt=class extends X{A=Xe[0]|0;B=Xe[1]|0;C=Xe[2]|0;D=Xe[3]|0;E=Xe[4]|0;constructor(){super(64,20,8,!1)}get(){let{A:e,B:r,C:o,D:n,E:s}=this;return[e,r,o,n,s]}set(e,r,o,n,s){this.A=e|0,this.B=r|0,this.C=o|0,this.D=n|0,this.E=s|0}process(e,r){for(let c=0;c<16;c++,r+=4)D[c]=e.getUint32(r,!1);for(let c=16;c<80;c++)D[c]=dt(D[c-3]^D[c-8]^D[c-14]^D[c-16],1);let{A:o,B:n,C:s,D:i,E:a}=this;for(let c=0;c<80;c++){let u,l;c<20?(u=gt(n,s,i),l=1518500249):c<40?(u=n^s^i,l=1859775393):c<60?(u=xt(n,s,i),l=2400959708):(u=n^s^i,l=3395469782);let p=dt(o,5)+u+a+l+D[c]|0;a=i,i=s,s=dt(n,30),n=o,o=p}o=o+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,this.set(o,n,s,i,a)}roundClean(){w(D)}destroy(){this.set(0,0,0,0,0),w(this.buffer)}},Cr=We(()=>new Wt);var yt=BigInt(4294967295),Br=BigInt(32);function nn(t,e=!1){return e?{h:Number(t&yt),l:Number(t>>Br&yt)}:{h:Number(t>>Br&yt)|0,l:Number(t&yt)|0}}function Rr(t,e=!1){let r=t.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let s=0;s<r;s++){let{h:i,l:a}=nn(t[s],e);[o[s],n[s]]=[i,a]}return[o,n]}var Xt=(t,e,r)=>t>>>r,Yt=(t,e,r)=>t<<32-r|e>>>r,Y=(t,e,r)=>t>>>r|e<<32-r,z=(t,e,r)=>t<<32-r|e>>>r,Ye=(t,e,r)=>t<<64-r|e>>>r-32,ze=(t,e,r)=>t>>>r-32|e<<64-r;function C(t,e,r,o){let n=(e>>>0)+(o>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}var Ir=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Hr=(t,e,r,o)=>e+r+o+(t/2**32|0)|0,Ur=(t,e,r,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),vr=(t,e,r,o,n)=>e+r+o+n+(t/2**32|0)|0,Dr=(t,e,r,o,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0)+(n>>>0),_r=(t,e,r,o,n,s)=>e+r+o+n+s+(t/2**32|0)|0;var sn=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_=new Uint32Array(64),zt=class extends X{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:r,C:o,D:n,E:s,F:i,G:a,H:c}=this;return[e,r,o,n,s,i,a,c]}set(e,r,o,n,s,i,a,c){this.A=e|0,this.B=r|0,this.C=o|0,this.D=n|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(e,r){for(let p=0;p<16;p++,r+=4)_[p]=e.getUint32(r,!1);for(let p=16;p<64;p++){let f=_[p-15],h=_[p-2],g=A(f,7)^A(f,18)^f>>>3,x=A(h,17)^A(h,19)^h>>>10;_[p]=x+_[p-7]+g+_[p-16]|0}let{A:o,B:n,C:s,D:i,E:a,F:c,G:u,H:l}=this;for(let p=0;p<64;p++){let f=A(a,6)^A(a,11)^A(a,25),h=l+f+gt(a,c,u)+sn[p]+_[p]|0,x=(A(o,2)^A(o,13)^A(o,22))+xt(o,n,s)|0;l=u,u=c,c=a,a=i+h|0,i=s,s=n,n=o,o=h+x|0}o=o+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(o,n,s,i,a,c,u,l)}roundClean(){w(_)}destroy(){this.set(0,0,0,0,0,0,0,0),w(this.buffer)}},Kt=class extends zt{A=H[0]|0;B=H[1]|0;C=H[2]|0;D=H[3]|0;E=H[4]|0;F=H[5]|0;G=H[6]|0;H=H[7]|0;constructor(){super(32)}};var Gr=Rr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),an=Gr[0],cn=Gr[1],G=new Uint32Array(80),k=new Uint32Array(80),Jt=class extends X{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:r,Bh:o,Bl:n,Ch:s,Cl:i,Dh:a,Dl:c,Eh:u,El:l,Fh:p,Fl:f,Gh:h,Gl:g,Hh:x,Hl:E}=this;return[e,r,o,n,s,i,a,c,u,l,p,f,h,g,x,E]}set(e,r,o,n,s,i,a,c,u,l,p,f,h,g,x,E){this.Ah=e|0,this.Al=r|0,this.Bh=o|0,this.Bl=n|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=p|0,this.Fl=f|0,this.Gh=h|0,this.Gl=g|0,this.Hh=x|0,this.Hl=E|0}process(e,r){for(let d=0;d<16;d++,r+=4)G[d]=e.getUint32(r),k[d]=e.getUint32(r+=4);for(let d=16;d<80;d++){let S=G[d-15]|0,U=k[d-15]|0,At=Y(S,U,1)^Y(S,U,8)^Xt(S,U,7),St=z(S,U,1)^z(S,U,8)^Yt(S,U,7),B=G[d-2]|0,R=k[d-2]|0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qt=class extends Jt{Ah=y[0]|0;Al=y[1]|0;Bh=y[2]|0;Bl=y[3]|0;Ch=y[4]|0;Cl=y[5]|0;Dh=y[6]|0;Dl=y[7]|0;Eh=y[8]|0;El=y[9]|0;Fh=y[10]|0;Fl=y[11]|0;Gh=y[12]|0;Gl=y[13]|0;Hh=y[14]|0;Hl=y[15]|0;constructor(){super(64)}};var kr=We(()=>new Kt,Ft(1));var Mr=We(()=>new Qt,Ft(3));var Ke=class{name="noble";hmac(e,r,o){return jt(e==="sha1"?Cr:e==="sha256"?kr:Mr,r,o)}randomBytes(e){return Sr(e)}constantTimeEqual(e,r){return vt(e,r)}},ne=Object.freeze(new Ke);function mt(t){return{secret:t.secret,strategy:t.strategy??"totp",crypto:t.crypto??ne,base32:t.base32??ee,algorithm:t.algorithm??"sha1",digits:t.digits??6,period:t.period??30,epoch:t.epoch??Math.floor(Date.now()/1e3),t0:t.t0??0,counter:t.counter,guardrails:t.guardrails??m(),hooks:t.hooks}}function Zt(t){return{...mt(t),token:t.token,epochTolerance:t.epochTolerance??0,counterTolerance:t.counterTolerance??0,afterTimeStep:t.afterTimeStep}}function Je(t,e,r){if(t==="totp")return r.totp();if(t==="hotp"){if(e===void 0)throw new T("Counter is required for HOTP strategy. Example: { strategy: 'hotp', counter: 0 }");return r.hotp(e)}throw new T(`Unknown OTP strategy: ${t}. Valid strategies are 'totp' or 'hotp'.`)}function Lr(t){let{crypto:e=ne,base32:r=ee,length:o=20}=t||{};return I({crypto:e,base32:r,length:o})}function bt(t){let{strategy:e="totp",issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6,period:a=30,counter:c}=t;return Je(e,c,{totp:()=>Le({issuer:r,label:o,secret:n,algorithm:s,digits:i,period:a}),hotp:u=>Ve({issuer:r,label:o,secret:n,algorithm:s,digits:i,counter:u})})}async function Tt(t){let e=mt(t),{secret:r,crypto:o,base32:n,algorithm:s,digits:i,hooks:a}=e,c={secret:r,crypto:o,base32:n,algorithm:s,digits:i,hooks:a};return Je(e.strategy,e.counter,{totp:()=>Fe({...c,period:e.period,epoch:e.epoch,t0:e.t0,guardrails:e.guardrails}),hotp:u=>W({...c,counter:u,guardrails:e.guardrails})})}function Ot(t){let e=mt(t),{secret:r,crypto:o,base32:n,algorithm:s,digits:i}=e,a={secret:r,crypto:o,base32:n,algorithm:s,digits:i};return Je(e.strategy,e.counter,{totp:()=>Lt({...a,period:e.period,epoch:e.epoch,t0:e.t0,guardrails:e.guardrails}),hotp:c=>$e({...a,counter:c,guardrails:e.guardrails})})}async function Et(t){let e=Zt(t),{secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c}=e,u={secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c};return Je(e.strategy,e.counter,{totp:()=>ct({...u,period:e.period,epoch:e.epoch,t0:e.t0,epochTolerance:e.epochTolerance,afterTimeStep:e.afterTimeStep,guardrails:e.guardrails}),hotp:l=>at({...u,counter:l,counterTolerance:e.counterTolerance,guardrails:e.guardrails})})}function Pt(t){let e=Zt(t),{secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c}=e,u={secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c};return Je(e.strategy,e.counter,{totp:()=>br({...u,period:e.period,epoch:e.epoch,t0:e.t0,epochTolerance:e.epochTolerance,afterTimeStep:e.afterTimeStep,guardrails:e.guardrails}),hotp:l=>gr({...u,counter:l,counterTolerance:e.counterTolerance,guardrails:e.guardrails})})}var wt=class{strategy;crypto;base32;guardrails;constructor(e={}){let{strategy:r="totp",crypto:o=ne,base32:n=ee,guardrails:s}=e;this.strategy=r,this.crypto=o,this.base32=n,this.guardrails=m(s)}getStrategy(){return this.strategy}generateSecret(e=20){return I({crypto:this.crypto,base32:this.base32,length:e})}async generate(e){return Tt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateSync(e){return Ot({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}async verify(e){return Et({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}verifySync(e){return Pt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateURI(e){return bt({...e,strategy:this.strategy})}};return Wr(un);})();
|
|
1
|
+
"use strict";var otplib=(()=>{var It=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var $r=Object.getOwnPropertyNames;var jr=Object.prototype.hasOwnProperty;var Fr=(t,e)=>{for(var r in e)It(t,r,{get:e[r],enumerable:!0})},qr=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $r(e))!jr.call(t,n)&&n!==r&&It(t,n,{get:()=>e[n],enumerable:!(o=Nr(e,n))||o.enumerable});return t};var Wr=t=>qr(It({},"__esModule",{value:!0}),t);var un={};Fr(un,{HOTP:()=>Ve,NobleCryptoPlugin:()=>Ke,OTP:()=>At,ScureBase32Plugin:()=>Fe,TOTP:()=>$e,createGuardrails:()=>b,generate:()=>Ot,generateSecret:()=>Gr,generateSync:()=>Et,generateURI:()=>Tt,stringToBytes:()=>Ue,verify:()=>wt,verifySync:()=>Pt,wrapResult:()=>kt,wrapResultAsync:()=>Lt});var w=class extends Error{constructor(e,r){super(e,r),this.name="OTPError"}},ne=class extends w{constructor(e){super(e),this.name="SecretError"}},oe=class extends ne{constructor(e,r){super(`Secret must be at least ${e} bytes (${e*8} bits), got ${r} bytes`),this.name="SecretTooShortError"}},se=class extends ne{constructor(e,r){super(`Secret must not exceed ${e} bytes, got ${r} bytes`),this.name="SecretTooLongError"}},K=class extends w{constructor(e){super(e),this.name="CounterError"}},ie=class extends K{constructor(){super("Counter must be non-negative"),this.name="CounterNegativeError"}},J=class extends K{constructor(){super("Counter exceeds maximum safe integer value"),this.name="CounterOverflowError"}},ae=class extends K{constructor(){super("Counter must be a finite integer"),this.name="CounterNotIntegerError"}},ce=class extends w{constructor(e){super(e),this.name="TimeError"}},ue=class extends ce{constructor(){super("Time must be non-negative"),this.name="TimeNegativeError"}},fe=class extends ce{constructor(){super("Time must be a finite number"),this.name="TimeNotFiniteError"}},le=class extends w{constructor(e){super(e),this.name="PeriodError"}},pe=class extends le{constructor(e){super(`Period must be at least ${e} second(s)`),this.name="PeriodTooSmallError"}},de=class extends le{constructor(e){super(`Period must not exceed ${e} seconds`),this.name="PeriodTooLargeError"}};var he=class extends w{constructor(e){super(e),this.name="TokenError"}},ge=class extends he{constructor(e,r){super(`Token must be ${e} digits, got ${r}`),this.name="TokenLengthError"}},xe=class extends he{constructor(){super("Token must contain only digits"),this.name="TokenFormatError"}},ye=class extends w{constructor(e,r){super(e,r),this.name="CryptoError"}},U=class extends ye{constructor(e,r){super(`HMAC computation failed: ${e}`,r),this.name="HMACError"}},be=class extends ye{constructor(e,r){super(`Random byte generation failed: ${e}`,r),this.name="RandomBytesError"}};var V=class extends w{constructor(e){super(e),this.name="CounterToleranceError"}},me=class extends V{constructor(e,r){super(`Counter tolerance validation failed: total checks (${r}) exceeds MAX_WINDOW (${e})`),this.name="CounterToleranceTooLargeError"}},Te=class extends V{constructor(){super("Counter tolerance cannot contain negative values"),this.name="CounterToleranceNegativeError"}},N=class extends w{constructor(e){super(e),this.name="EpochToleranceError"}},Oe=class extends N{constructor(){super("Epoch tolerance cannot contain negative values"),this.name="EpochToleranceNegativeError"}},Ee=class extends N{constructor(e,r){super(`Epoch tolerance must not exceed ${e} seconds, got ${r}. Large tolerances can cause performance issues.`),this.name="EpochToleranceTooLargeError"}},we=class extends w{constructor(e){super(e),this.name="PluginError"}},Pe=class extends we{constructor(){super("Crypto plugin is required."),this.name="CryptoPluginMissingError"}},Ae=class extends we{constructor(){super("Base32 plugin is required."),this.name="Base32PluginMissingError"}},T=class extends w{constructor(e){super(e),this.name="ConfigurationError"}},Se=class extends T{constructor(){super("Secret is required. Use generateSecret() to create one, or provide via { secret: 'YOUR_BASE32_SECRET' }"),this.name="SecretMissingError"}},Ce=class extends T{constructor(){super("Label is required for URI generation. Example: { label: 'user@example.com' }"),this.name="LabelMissingError"}},Re=class extends T{constructor(){super("Issuer is required for URI generation. Example: { issuer: 'MyApp' }"),this.name="IssuerMissingError"}},Be=class extends T{constructor(){super("Class API requires secret to be a Base32 string, not Uint8Array. Use generateSecret() or provide a Base32-encoded string."),this.name="SecretTypeError"}},Q=class extends w{constructor(e){super(e),this.name="AfterTimeStepError"}},Ie=class extends Q{constructor(){super("afterTimeStep must be >= 0"),this.name="AfterTimeStepNegativeError"}},He=class extends Q{constructor(){super("Invalid afterTimeStep: non-integer value"),this.name="AfterTimeStepNotIntegerError"}},_e=class extends Q{constructor(){super("Invalid afterTimeStep: cannot be greater than current time step plus window"),this.name="AfterTimeStepRangeExceededError"}};var Xr=new TextEncoder,hn=new TextDecoder,rr=16,nr=64,or=20,sr=1,ir=3600,ar=30,cr=Number.MAX_SAFE_INTEGER,ur=99,fr=Symbol("otplib.guardrails.override");function Z(t,e,r){if(typeof e!="number"||!Number.isSafeInteger(e))throw new T(`Guardrail '${t}' must be a safe integer`);if(e<r)throw new T(`Guardrail '${t}' must be >= ${r}`)}var $=Object.freeze({MIN_SECRET_BYTES:rr,MAX_SECRET_BYTES:nr,MIN_PERIOD:sr,MAX_PERIOD:ir,MAX_COUNTER:cr,MAX_WINDOW:ur,[fr]:!1});function b(t){if(!t)return $;t.MIN_SECRET_BYTES!==void 0&&Z("MIN_SECRET_BYTES",t.MIN_SECRET_BYTES,1),t.MAX_SECRET_BYTES!==void 0&&Z("MAX_SECRET_BYTES",t.MAX_SECRET_BYTES,1),t.MIN_PERIOD!==void 0&&Z("MIN_PERIOD",t.MIN_PERIOD,1),t.MAX_PERIOD!==void 0&&Z("MAX_PERIOD",t.MAX_PERIOD,1),t.MAX_COUNTER!==void 0&&Z("MAX_COUNTER",t.MAX_COUNTER,0),t.MAX_WINDOW!==void 0&&Z("MAX_WINDOW",t.MAX_WINDOW,1);let e={...$,...t};if(e.MIN_SECRET_BYTES>e.MAX_SECRET_BYTES)throw new T("Guardrail 'MIN_SECRET_BYTES' must be <= 'MAX_SECRET_BYTES'");if(e.MIN_PERIOD>e.MAX_PERIOD)throw new T("Guardrail 'MIN_PERIOD' must be <= 'MAX_PERIOD'");return Object.freeze({...e,[fr]:!0})}function j(t,e=$){if(t.length<e.MIN_SECRET_BYTES)throw new oe(e.MIN_SECRET_BYTES,t.length);if(t.length>e.MAX_SECRET_BYTES)throw new se(e.MAX_SECRET_BYTES,t.length)}function et(t,e=$){if(typeof t=="number"){if(!Number.isFinite(t)||!Number.isInteger(t))throw new ae;if(!Number.isSafeInteger(t))throw new J}let r=typeof t=="bigint"?t:BigInt(t);if(r<0n)throw new ie;if(r>BigInt(e.MAX_COUNTER))throw new J}function tt(t){if(!Number.isFinite(t))throw new fe;if(t<0)throw new ue}function rt(t,e=$){if(!Number.isInteger(t)||t<e.MIN_PERIOD)throw new pe(e.MIN_PERIOD);if(t>e.MAX_PERIOD)throw new de(e.MAX_PERIOD)}function ve(t,e){if(t.length!==e)throw new ge(e,t.length);if(!/^\d+$/.test(t))throw new xe}function Ht(t,e=$){let[r,o]=st(t);if(!Number.isSafeInteger(r)||!Number.isSafeInteger(o))throw new V("Counter tolerance values must be safe integers");if(r<0||o<0)throw new Te;let n=r+o+1;if(n>e.MAX_WINDOW)throw new me(e.MAX_WINDOW,n)}function _t(t,e=ar,r=$){let[o,n]=Array.isArray(t)?t:[t,t];if(!Number.isSafeInteger(o)||!Number.isSafeInteger(n))throw new N("Epoch tolerance values must be safe integers");if(o<0||n<0)throw new Oe;let s=(r.MAX_WINDOW-1)*e,i=o+n;if(i>s)throw new Ee(s,i)}function Ut(t){let e=typeof t=="bigint"?t:BigInt(t),r=new ArrayBuffer(8);return new DataView(r).setBigUint64(0,e,!1),new Uint8Array(r)}function nt(t){let e=t[t.length-1]&15;return(t[e]&127)<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function ot(t,e){let r=10**e;return(t%r).toString().padStart(e,"0")}function lr(t,e){return t.length===e.length}function vt(t,e){let r=Ue(t),o=Ue(e);if(!lr(r,o))return!1;let n=0;for(let s=0;s<r.length;s++)n|=r[s]^o[s];return n===0}function Ue(t){return typeof t=="string"?Xr.encode(t):t}function F(t,e){return typeof t=="string"?(q(e),e.decode(t)):t}function I(t){let{crypto:e,base32:r,length:o=or}=t;m(e),q(r);let n=e.randomBytes(o);return r.encode(n,{padding:!1})}function st(t=0){return Array.isArray(t)?t:[0,t]}function Dt(t=0){return Array.isArray(t)?t:[t,t]}function m(t){if(!t)throw new Pe}function q(t){if(!t)throw new Ae}function O(t){if(!t)throw new Se}function De(t){if(!t)throw new Ce}function ke(t){if(!t)throw new Re}function Le(t){if(typeof t!="string")throw new Be}function pr(t){return{ok:!0,value:t}}function dr(t){return{ok:!1,error:t}}function kt(t){return(...e)=>{try{return pr(t(...e))}catch(r){return dr(r)}}}function Lt(t){return async(...e)=>{try{return pr(await t(...e))}catch(r){return dr(r)}}}var it=class{constructor(e){this.crypto=e}get plugin(){return this.crypto}async hmac(e,r,o){try{let n=this.crypto.hmac(e,r,o);return n instanceof Promise?await n:n}catch(n){let s=n instanceof Error?n.message:String(n);throw new U(s,{cause:n})}}hmacSync(e,r,o){try{let n=this.crypto.hmac(e,r,o);if(n instanceof Promise)throw new U("Crypto plugin does not support synchronous HMAC operations");return n}catch(n){if(n instanceof U)throw n;let s=n instanceof Error?n.message:String(n);throw new U(s,{cause:n})}}randomBytes(e){try{return this.crypto.randomBytes(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new be(o,{cause:r})}}};function Mt(t){return new it(t)}function Gt(t){let{type:e,label:r,params:o}=t,n=r.split(":").map(a=>encodeURIComponent(a)).join(":"),s=`otpauth://${e}/${n}?`,i=[];return o.secret&&i.push(`secret=${encodeURIComponent(o.secret)}`),o.issuer&&i.push(`issuer=${encodeURIComponent(o.issuer)}`),o.algorithm&&o.algorithm!=="sha1"&&i.push(`algorithm=${o.algorithm.toUpperCase()}`),o.digits&&o.digits!==6&&i.push(`digits=${o.digits}`),e==="hotp"&&o.counter!==void 0&&i.push(`counter=${o.counter}`),e==="totp"&&o.period!==void 0&&o.period!==30&&i.push(`period=${o.period}`),s+=i.join("&"),s}function Me(t){let{issuer:e,label:r,secret:o,algorithm:n="sha1",digits:s=6,period:i=30}=t,a=e?`${e}:${r}`:r;return Gt({type:"totp",label:a,params:{secret:o,issuer:e,algorithm:n,digits:s,period:i}})}function Ge(t){let{issuer:e,label:r,secret:o,counter:n=0,algorithm:s="sha1",digits:i=6}=t,a=e?`${e}:${r}`:r;return Gt({type:"hotp",label:a,params:{secret:o,issuer:e,algorithm:s,digits:i,counter:n}})}var Ve=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=b(e.guardrails)}generateSecret(){let{crypto:e,base32:r}=this.options;return m(e),q(r),I({crypto:e,base32:r})}async generate(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6}=o;O(n),m(s);let u=r?.guardrails??this.guardrails;return W({secret:n,counter:e,algorithm:a,digits:c,crypto:s,base32:i,guardrails:u,hooks:o.hooks})}async verify(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6,counterTolerance:u=0}=o;O(n),m(s);let f=r?.guardrails??this.guardrails;return at({secret:n,token:e.token,counter:e.counter,algorithm:a,digits:c,counterTolerance:u,crypto:s,base32:i,guardrails:f,hooks:o.hooks})}toURI(e=0){let{issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6}=this.options;return O(n),De(o),ke(r),Le(n),Ge({issuer:r,label:o,secret:n,algorithm:s,digits:i,counter:e})}};function hr(t){let{secret:e,counter:r,algorithm:o="sha1",digits:n=6,crypto:s,base32:i,guardrails:a,hooks:c}=t;O(e),m(s);let u=F(e,i);j(u,a),et(r,a);let f=Mt(s),l=Ut(r);return{ctx:f,algorithm:o,digits:n,secretBytes:u,counterBytes:l,hooks:c}}async function W(t){let{ctx:e,algorithm:r,digits:o,secretBytes:n,counterBytes:s,hooks:i}=hr(t),a=await e.hmac(r,n,s),c=i?.truncateDigest?i.truncateDigest(a):nt(a);return i?.encodeToken?i.encodeToken(c,o):ot(c,o)}function Ne(t){let{ctx:e,algorithm:r,digits:o,secretBytes:n,counterBytes:s,hooks:i}=hr(t),a=e.hmacSync(r,n,s),c=i?.truncateDigest?i.truncateDigest(a):nt(a);return i?.encodeToken?i.encodeToken(c,o):ot(c,o)}function gr(t){let{secret:e,counter:r,token:o,algorithm:n="sha1",digits:s=6,crypto:i,base32:a,counterTolerance:c=0,guardrails:u=b(),hooks:f}=t;O(e),m(i);let l=F(e,a);j(l,u),et(r,u),f?.validateToken?f.validateToken(o,s):ve(o,s),Ht(c,u);let p=typeof r=="bigint"?Number(r):r,[h,g]=st(c),x=h+g+1;return{token:o,counterNum:p,past:h,future:g,totalChecks:x,crypto:i,getGenerateOptions:E=>({secret:l,counter:E,algorithm:n,digits:s,crypto:i,guardrails:u,hooks:f})}}async function at(t){let{token:e,counterNum:r,past:o,totalChecks:n,crypto:s,getGenerateOptions:i}=gr(t),a=Math.max(0,o-r);for(let c=a;c<n;c++){let u=c-o,f=r+u,l=await W(i(f));if(s.constantTimeEqual(l,e))return{valid:!0,delta:u|0}}return{valid:!1}}function xr(t){let{token:e,counterNum:r,past:o,totalChecks:n,crypto:s,getGenerateOptions:i}=gr(t),a=Math.max(0,o-r);for(let c=a;c<n;c++){let u=c-o,f=r+u,l=Ne(i(f));if(s.constantTimeEqual(l,e))return{valid:!0,delta:u|0}}return{valid:!1}}var $e=class{options;guardrails;constructor(e={}){this.options=e,this.guardrails=b(e.guardrails)}generateSecret(){let{crypto:e,base32:r}=this.options;return m(e),q(r),I({crypto:e,base32:r})}async generate(e){let r={...this.options,...e},{secret:o,crypto:n,base32:s,algorithm:i="sha1",digits:a=6,period:c=30,epoch:u,t0:f=0}=r;O(o),m(n);let l=e?.guardrails??this.guardrails;return je({secret:o,algorithm:i,digits:a,period:c,epoch:u??Math.floor(Date.now()/1e3),t0:f,crypto:n,base32:s,guardrails:l,hooks:r.hooks})}async verify(e,r){let o={...this.options,...r},{secret:n,crypto:s,base32:i,algorithm:a="sha1",digits:c=6,period:u=30,epoch:f,t0:l=0,epochTolerance:p=0,afterTimeStep:h}=o;O(n),m(s);let g=r?.guardrails??this.guardrails;return ct({secret:n,token:e,algorithm:a,digits:c,period:u,epoch:f??Math.floor(Date.now()/1e3),t0:l,epochTolerance:p,afterTimeStep:h,crypto:s,base32:i,guardrails:g,hooks:o.hooks})}toURI(e){let{issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6,period:a=30}=this.options,c=e?.label??o,u=e?.issuer??r,f=e?.secret??n;return O(f),De(c),ke(u),Le(f),Me({issuer:u,label:c,secret:f,algorithm:s,digits:i,period:a})}};function yr(t){let{secret:e,epoch:r=Math.floor(Date.now()/1e3),t0:o=0,period:n=30,algorithm:s="sha1",digits:i=6,crypto:a,base32:c,guardrails:u=b(),hooks:f}=t;O(e),m(a);let l=F(e,c);j(l,u),tt(r),rt(n,u);let p=Math.floor((r-o)/n);return{secret:l,counter:p,algorithm:s,digits:i,crypto:a,guardrails:u,hooks:f}}async function je(t){let e=yr(t);return W(e)}function Vt(t){let e=yr(t);return Ne(e)}function zr(t,e){if(t!==void 0){if(t<0)throw new Ie;if(!Number.isSafeInteger(t))throw new He;if(t>e)throw new _e}}function br(t,e){return e!==void 0&&t<=e}function mr(t){let{secret:e,token:r,epoch:o=Math.floor(Date.now()/1e3),t0:n=0,period:s=30,algorithm:i="sha1",digits:a=6,crypto:c,base32:u,epochTolerance:f=0,afterTimeStep:l,guardrails:p=b(),hooks:h}=t;O(e),m(c);let g=F(e,u);j(g,p),tt(o),rt(s,p),h?.validateToken?h.validateToken(r,a):ve(r,a),_t(f,s,p);let x=Math.floor((o-n)/s),[E,M]=Dt(f),G=Math.max(0,Math.floor((o-E-n)/s)),d=Math.floor((o+M-n)/s);return zr(l,d),{token:r,crypto:c,minCounter:G,maxCounter:d,currentCounter:x,t0:n,period:s,afterTimeStep:l,getGenerateOptions:S=>({secret:g,epoch:S*s+n,t0:n,period:s,algorithm:i,digits:a,crypto:c,guardrails:p,hooks:h})}}async function ct(t){let{token:e,crypto:r,minCounter:o,maxCounter:n,currentCounter:s,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=mr(t);for(let f=o;f<=n;f++){if(br(f,c))continue;let l=await je(u(f));if(r.constantTimeEqual(l,e))return{valid:!0,delta:f-s,epoch:f*a+i,timeStep:f}}return{valid:!1}}function Tr(t){let{token:e,crypto:r,minCounter:o,maxCounter:n,currentCounter:s,t0:i,period:a,afterTimeStep:c,getGenerateOptions:u}=mr(t);for(let f=o;f<=n;f++){if(br(f,c))continue;let l=Vt(u(f));if(r.constantTimeEqual(l,e))return{valid:!0,delta:f-s,epoch:f*a+i,timeStep:f}}return{valid:!1}}function Yr(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Er(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(r=>typeof r=="string"):e.every(r=>Number.isSafeInteger(r)):!1}function ut(t,e){if(typeof e!="string")throw new TypeError(`${t}: string expected`);return!0}function jt(t){if(typeof t!="number")throw new TypeError(`number expected, got ${typeof t}`);if(!Number.isSafeInteger(t))throw new RangeError(`invalid integer: ${t}`)}function $t(t){if(!Array.isArray(t))throw new TypeError("array expected")}function ft(t,e){if(!Er(!0,e))throw new TypeError(`${t}: array of strings expected`)}function Kr(t,e){if(!Er(!1,e))throw new TypeError(`${t}: array of numbers expected`)}function Jr(...t){let e=s=>s,r=(s,i)=>a=>s(i(a)),o=t.map(s=>s.encode).reduceRight(r,e),n=t.map(s=>s.decode).reduce(r,e);return{encode:o,decode:n}}function Qr(t){let e=typeof t=="string"?t.split(""):t,r=e.length;ft("alphabet",e);let o=new Map(e.map((n,s)=>[n,s]));return{encode:n=>($t(n),n.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${t}`);return e[s]})),decode:n=>($t(n),n.map(s=>{ut("alphabet.decode",s);let i=o.get(s);if(i===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${t}`);return i}))}}function Zr(t=""){return ut("join",t),{encode:e=>(ft("join.decode",e),e.join(t)),decode:e=>(ut("join.decode",e),e.split(t))}}function en(t,e="="){return jt(t),ut("padding",e),{encode(r){for(ft("padding.encode",r);r.length*t%8;)r.push(e);return r},decode(r){ft("padding.decode",r);let o=r.length;if(o*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;o>0&&r[o-1]===e;o--)if((o-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,o)}}}var wr=(t,e)=>e===0?t:wr(e,t%e),lt=(t,e)=>t+(e-wr(t,e)),Nt=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function Or(t,e,r,o){if($t(t),e<=0||e>32)throw new RangeError(`convertRadix2: wrong from=${e}`);if(r<=0||r>32)throw new RangeError(`convertRadix2: wrong to=${r}`);if(lt(e,r)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${r} carryBits=${lt(e,r)}`);let n=0,s=0,i=Nt[e],a=Nt[r]-1,c=[];for(let u of t){if(jt(u),u>=i)throw new Error(`convertRadix2: invalid data word=${u} from=${e}`);if(n=n<<e|u,s+e>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);for(s+=e;s>=r;s-=r)c.push((n>>s-r&a)>>>0);let f=Nt[s];if(f===void 0)throw new Error("invalid carry");n&=f-1}if(n=n<<r-s&a,!o&&s>=e)throw new Error("Excess padding");if(!o&&n>0)throw new Error(`Non-zero padding: ${n}`);return o&&s>0&&c.push(n>>>0),c}function tn(t,e=!1){if(jt(t),t<=0||t>32)throw new RangeError("radix2: bits should be in (0..32]");if(lt(8,t)>32||lt(t,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!Yr(r))throw new TypeError("radix2.encode input should be Uint8Array");return Or(Array.from(r),8,t,!e)},decode:r=>(Kr("radix2.decode",r),Uint8Array.from(Or(r,t,8,e)))}}var Ft=Object.freeze(Jr(tn(5),Qr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),en(5),Zr("")));var Fe=class{name="scure";encode(e,r={}){let{padding:o=!1}=r,n=Ft.encode(e);return o?n:n.replace(/=+$/,"")}decode(e){try{let r=e.toUpperCase(),o=r.padEnd(Math.ceil(r.length/8)*8,"=");return Ft.decode(o)}catch(r){throw new Error(`Invalid Base32 string: ${r.message}`)}}},ee=Object.freeze(new Fe);function rn(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function qt(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(`${r}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new RangeError(`${r}expected integer >= 0, got ${t}`)}}function qe(t,e,r=""){let o=rn(t),n=t?.length,s=e!==void 0;if(!o||s&&n!==e){let i=r&&`"${r}" `,a=s?` of length ${e}`:"",c=o?`length=${n}`:`type=${typeof t}`,u=i+"expected Uint8Array"+a+", got "+c;throw o?new RangeError(u):new TypeError(u)}return t}function Pr(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(qt(t.outputLen),qt(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function te(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function pt(t,e){qe(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function P(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function dt(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function A(t,e){return t<<32-e|t>>>e}function ht(t,e){return t<<e|t>>>32-e>>>0}function We(t,e={}){let r=(n,s)=>t(s).update(n).digest(),o=t(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.canXOF=o.canXOF,r.create=n=>t(n),Object.assign(r,e),Object.freeze(r)}function Ar(t=32){qt(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var Wt=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});var gt=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,r){if(Pr(e),qe(r,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,n=new Uint8Array(o);n.set(r.length>o?e.create().update(r).digest():r);for(let s=0;s<n.length;s++)n[s]^=54;this.iHash.update(n),this.oHash=e.create();for(let s=0;s<n.length;s++)n[s]^=106;this.oHash.update(n),P(n)}update(e){return te(this),this.iHash.update(e),this}digestInto(e){te(this),pt(e,this),this.finished=!0;let r=e.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:o,finished:n,destroyed:s,blockLen:i,outputLen:a}=this;return e=e,e.finished=n,e.destroyed=s,e.blockLen=i,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=o._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sr=(()=>{let t=((e,r,o)=>new gt(e,r).update(o).digest());return t.create=(e,r)=>new gt(e,r),t})();function xt(t,e,r){return t&e^~t&r}function yt(t,e,r){return t&e^t&r^e&r}var X=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,o,n){this.blockLen=e,this.outputLen=r,this.padOffset=o,this.isLE=n,this.buffer=new Uint8Array(e),this.view=dt(this.buffer)}update(e){te(this),qe(e);let{view:r,buffer:o,blockLen:n}=this,s=e.length;for(let i=0;i<s;){let a=Math.min(n-this.pos,s-i);if(a===n){let c=dt(e);for(;n<=s-i;i+=n)this.process(c,i);continue}o.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){te(this),pt(e,this),this.finished=!0;let{buffer:r,view:o,blockLen:n,isLE:s}=this,{pos:i}=this;r[i++]=128,P(this.buffer.subarray(i)),this.padOffset>n-i&&(this.process(o,0),i=0);for(let l=i;l<n;l++)r[l]=0;o.setBigUint64(n-8,BigInt(this.length*8),s),this.process(o,0);let a=dt(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)a.setUint32(4*l,f[l],s)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let o=e.slice(0,r);return this.destroy(),o}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:r,buffer:o,length:n,finished:s,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=s,e.length=n,e.pos=a,n%r&&e.buffer.set(o),e}clone(){return this._cloneInto()}},H=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var y=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var Xe=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),v=new Uint32Array(80),Xt=class extends X{A=Xe[0]|0;B=Xe[1]|0;C=Xe[2]|0;D=Xe[3]|0;E=Xe[4]|0;constructor(){super(64,20,8,!1)}get(){let{A:e,B:r,C:o,D:n,E:s}=this;return[e,r,o,n,s]}set(e,r,o,n,s){this.A=e|0,this.B=r|0,this.C=o|0,this.D=n|0,this.E=s|0}process(e,r){for(let c=0;c<16;c++,r+=4)v[c]=e.getUint32(r,!1);for(let c=16;c<80;c++)v[c]=ht(v[c-3]^v[c-8]^v[c-14]^v[c-16],1);let{A:o,B:n,C:s,D:i,E:a}=this;for(let c=0;c<80;c++){let u,f;c<20?(u=xt(n,s,i),f=1518500249):c<40?(u=n^s^i,f=1859775393):c<60?(u=yt(n,s,i),f=2400959708):(u=n^s^i,f=3395469782);let l=ht(o,5)+u+a+f+v[c]|0;a=i,i=s,s=ht(n,30),n=o,o=l}o=o+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,this.set(o,n,s,i,a)}roundClean(){P(v)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0),P(this.buffer)}},Cr=We(()=>new Xt);var bt=BigInt(4294967295),Rr=BigInt(32);function nn(t,e=!1){return e?{h:Number(t&bt),l:Number(t>>Rr&bt)}:{h:Number(t>>Rr&bt)|0,l:Number(t&bt)|0}}function Br(t,e=!1){let r=t.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let s=0;s<r;s++){let{h:i,l:a}=nn(t[s],e);[o[s],n[s]]=[i,a]}return[o,n]}var zt=(t,e,r)=>t>>>r,Yt=(t,e,r)=>t<<32-r|e>>>r,z=(t,e,r)=>t>>>r|e<<32-r,Y=(t,e,r)=>t<<32-r|e>>>r,ze=(t,e,r)=>t<<64-r|e>>>r-32,Ye=(t,e,r)=>t>>>r-32|e<<64-r;function C(t,e,r,o){let n=(e>>>0)+(o>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}var Ir=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Hr=(t,e,r,o)=>e+r+o+(t/2**32|0)|0,_r=(t,e,r,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),Ur=(t,e,r,o,n)=>e+r+o+n+(t/2**32|0)|0,vr=(t,e,r,o,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0)+(n>>>0),Dr=(t,e,r,o,n,s)=>e+r+o+n+s+(t/2**32|0)|0;var sn=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=new Uint32Array(64),Kt=class extends X{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:r,C:o,D:n,E:s,F:i,G:a,H:c}=this;return[e,r,o,n,s,i,a,c]}set(e,r,o,n,s,i,a,c){this.A=e|0,this.B=r|0,this.C=o|0,this.D=n|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)D[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=D[l-15],h=D[l-2],g=A(p,7)^A(p,18)^p>>>3,x=A(h,17)^A(h,19)^h>>>10;D[l]=x+D[l-7]+g+D[l-16]|0}let{A:o,B:n,C:s,D:i,E:a,F:c,G:u,H:f}=this;for(let l=0;l<64;l++){let p=A(a,6)^A(a,11)^A(a,25),h=f+p+xt(a,c,u)+sn[l]+D[l]|0,x=(A(o,2)^A(o,13)^A(o,22))+yt(o,n,s)|0;f=u,u=c,c=a,a=i+h|0,i=s,s=n,n=o,o=h+x|0}o=o+this.A|0,n=n+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(o,n,s,i,a,c,u,f)}roundClean(){P(D)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),P(this.buffer)}},Jt=class extends Kt{A=H[0]|0;B=H[1]|0;C=H[2]|0;D=H[3]|0;E=H[4]|0;F=H[5]|0;G=H[6]|0;H=H[7]|0;constructor(){super(32)}};var kr=Br(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),an=kr[0],cn=kr[1],k=new Uint32Array(80),L=new Uint32Array(80),Qt=class extends X{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:r,Bh:o,Bl:n,Ch:s,Cl:i,Dh:a,Dl:c,Eh:u,El:f,Fh:l,Fl:p,Gh:h,Gl:g,Hh:x,Hl:E}=this;return[e,r,o,n,s,i,a,c,u,f,l,p,h,g,x,E]}set(e,r,o,n,s,i,a,c,u,f,l,p,h,g,x,E){this.Ah=e|0,this.Al=r|0,this.Bh=o|0,this.Bl=n|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=p|0,this.Gh=h|0,this.Gl=g|0,this.Hh=x|0,this.Hl=E|0}process(e,r){for(let d=0;d<16;d++,r+=4)k[d]=e.getUint32(r),L[d]=e.getUint32(r+=4);for(let d=16;d<80;d++){let S=k[d-15]|0,_=L[d-15]|0,St=z(S,_,1)^z(S,_,8)^zt(S,_,7),Ct=Y(S,_,1)^Y(S,_,8)^Yt(S,_,7),R=k[d-2]|0,B=L[d-2]|0,Qe=z(R,B,19)^ze(R,B,61)^zt(R,B,6),Rt=Y(R,B,19)^Ye(R,B,61)^Yt(R,B,6),Ze=_r(Ct,Rt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0;Cl=y[5]|0;Dh=y[6]|0;Dl=y[7]|0;Eh=y[8]|0;El=y[9]|0;Fh=y[10]|0;Fl=y[11]|0;Gh=y[12]|0;Gl=y[13]|0;Hh=y[14]|0;Hl=y[15]|0;constructor(){super(64)}};var Lr=We(()=>new Jt,Wt(1));var Mr=We(()=>new Zt,Wt(3));var Ke=class{name="noble";hmac(e,r,o){return Sr(e==="sha1"?Cr:e==="sha256"?Lr:Mr,r,o)}randomBytes(e){return Ar(e)}constantTimeEqual(e,r){return vt(e,r)}},re=Object.freeze(new Ke);function mt(t){return{secret:t.secret,strategy:t.strategy??"totp",crypto:t.crypto??re,base32:t.base32??ee,algorithm:t.algorithm??"sha1",digits:t.digits??6,period:t.period??30,epoch:t.epoch??Math.floor(Date.now()/1e3),t0:t.t0??0,counter:t.counter,guardrails:t.guardrails??b(),hooks:t.hooks}}function er(t){return{...mt(t),token:t.token,epochTolerance:t.epochTolerance??0,counterTolerance:t.counterTolerance??0,afterTimeStep:t.afterTimeStep}}function Je(t,e,r){if(t==="totp")return r.totp();if(t==="hotp"){if(e===void 0)throw new T("Counter is required for HOTP strategy. Example: { strategy: 'hotp', counter: 0 }");return r.hotp(e)}throw new T(`Unknown OTP strategy: ${t}. Valid strategies are 'totp' or 'hotp'.`)}function Gr(t){let{crypto:e=re,base32:r=ee,length:o=20}=t||{};return I({crypto:e,base32:r,length:o})}function Tt(t){let{strategy:e="totp",issuer:r,label:o,secret:n,algorithm:s="sha1",digits:i=6,period:a=30,counter:c}=t;return Je(e,c,{totp:()=>Me({issuer:r,label:o,secret:n,algorithm:s,digits:i,period:a}),hotp:u=>Ge({issuer:r,label:o,secret:n,algorithm:s,digits:i,counter:u})})}async function Ot(t){let e=mt(t),{secret:r,crypto:o,base32:n,algorithm:s,digits:i,hooks:a}=e,c={secret:r,crypto:o,base32:n,algorithm:s,digits:i,hooks:a};return Je(e.strategy,e.counter,{totp:()=>je({...c,period:e.period,epoch:e.epoch,t0:e.t0,guardrails:e.guardrails}),hotp:u=>W({...c,counter:u,guardrails:e.guardrails})})}function Et(t){let e=mt(t),{secret:r,crypto:o,base32:n,algorithm:s,digits:i}=e,a={secret:r,crypto:o,base32:n,algorithm:s,digits:i};return Je(e.strategy,e.counter,{totp:()=>Vt({...a,period:e.period,epoch:e.epoch,t0:e.t0,guardrails:e.guardrails}),hotp:c=>Ne({...a,counter:c,guardrails:e.guardrails})})}async function wt(t){let e=er(t),{secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c}=e,u={secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c};return Je(e.strategy,e.counter,{totp:()=>ct({...u,period:e.period,epoch:e.epoch,t0:e.t0,epochTolerance:e.epochTolerance,afterTimeStep:e.afterTimeStep,guardrails:e.guardrails}),hotp:f=>at({...u,counter:f,counterTolerance:e.counterTolerance,guardrails:e.guardrails})})}function Pt(t){let e=er(t),{secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c}=e,u={secret:r,token:o,crypto:n,base32:s,algorithm:i,digits:a,hooks:c};return Je(e.strategy,e.counter,{totp:()=>Tr({...u,period:e.period,epoch:e.epoch,t0:e.t0,epochTolerance:e.epochTolerance,afterTimeStep:e.afterTimeStep,guardrails:e.guardrails}),hotp:f=>xr({...u,counter:f,counterTolerance:e.counterTolerance,guardrails:e.guardrails})})}var At=class{strategy;crypto;base32;guardrails;constructor(e={}){let{strategy:r="totp",crypto:o=re,base32:n=ee,guardrails:s}=e;this.strategy=r,this.crypto=o,this.base32=n,this.guardrails=b(s)}getStrategy(){return this.strategy}generateSecret(e=20){return I({crypto:this.crypto,base32:this.base32,length:e})}async generate(e){return Ot({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateSync(e){return Et({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}async verify(e){return wt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}verifySync(e){return Pt({...e,strategy:this.strategy,crypto:this.crypto,base32:this.base32,guardrails:e.guardrails??this.guardrails})}generateURI(e){return Tt({...e,strategy:this.strategy})}};return Wr(un);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@scure/base/index.js:
|
|
5
5
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
6
|
-
|
|
7
|
-
@noble/hashes/utils.js:
|
|
8
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
9
6
|
*/
|
|
10
7
|
//# sourceMappingURL=index.global.js.map
|
package/lib/src/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Options as LimiterOptions } from 'express-rate-limit';
|
|
1
2
|
import { type DBConfig } from './session-store.js';
|
|
2
3
|
import { type DiscordReceiverConfig } from '@inner-dj/discord-receiver';
|
|
3
4
|
import { type TwilioReceiverConfig } from '@inner-dj/twilio-receiver';
|
|
@@ -14,6 +15,7 @@ export interface ServerConfig {
|
|
|
14
15
|
db: DBConfig;
|
|
15
16
|
discord: DiscordReceiverConfig;
|
|
16
17
|
twilio: TwilioReceiverConfig;
|
|
18
|
+
limiter: Partial<LimiterOptions>;
|
|
17
19
|
cookies: string | undefined;
|
|
18
20
|
}
|
|
19
21
|
export declare function getConfig(cfgPath?: string): Promise<ServerConfig>;
|
package/lib/src/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import fsp from 'fs/promises';
|
|
3
3
|
import { parse } from 'yaml';
|
|
4
4
|
import { generateSecret } from "otplib";
|
|
5
|
+
import { MemoryStore } from 'express-rate-limit';
|
|
5
6
|
import { notStupidParseInt, getBoolean, throwNewError } from '@inner-dj/common';
|
|
6
7
|
import { SessionStore } from './session-store.js';
|
|
7
8
|
import { InnerDJDiscordBot } from '@inner-dj/discord-receiver';
|
|
@@ -29,6 +30,17 @@ function generateTotpSecret(field) {
|
|
|
29
30
|
console.log(`TOTP secret for ${field} is ${secret}\nSave the secret in your configuration if you want to keep it.`);
|
|
30
31
|
return secret;
|
|
31
32
|
}
|
|
33
|
+
function setDefaultLimits(options) {
|
|
34
|
+
options.windowMs ||= 50000;
|
|
35
|
+
options.limit ||= 3;
|
|
36
|
+
options.legacyHeaders ||= false;
|
|
37
|
+
options.store = new MemoryStore();
|
|
38
|
+
options.message ||= {
|
|
39
|
+
status: 'bad',
|
|
40
|
+
reason: 'too many submissions'
|
|
41
|
+
};
|
|
42
|
+
return options;
|
|
43
|
+
}
|
|
32
44
|
export async function getConfig(cfgPath) {
|
|
33
45
|
const p = process.env['CONFIG'] || cfgPath || path.join('config', 'config.yaml');
|
|
34
46
|
const cfg = await parseConfig(p);
|
|
@@ -47,6 +59,7 @@ export async function getConfig(cfgPath) {
|
|
|
47
59
|
discord: InnerDJDiscordBot.getConfig(cfg.discord),
|
|
48
60
|
twilio: TwilioReceiver.getConfig(cfg.twilio),
|
|
49
61
|
cookies: process.env['COOKIES'] ?? cfg.cookies,
|
|
62
|
+
limiter: setDefaultLimits(cfg.limiter || {}),
|
|
50
63
|
};
|
|
51
64
|
}
|
|
52
65
|
//# sourceMappingURL=config.js.map
|
package/lib/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAiB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAA8B,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC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AAa,CAAC,2BAA2B,CAAC;QAC9G,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,SAAS,CAAC;QAC5F,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,kBAAkB,CAAC,UAAU,CAAC;QACnF,SAAS,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACnG,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,SAAS,IAAI,aAAa,CAAC,uBAAuB,CAAC;QAC9F,EAAE,EAAE,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;QACjD,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;QAC5C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,OAAO;QAC9C,OAAO,EAAE,gBAAgB,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KAC/C,CAAA;AACL,CAAC"}
|
package/lib/src/web.js
CHANGED
|
@@ -9,6 +9,7 @@ import expressWs from 'express-ws';
|
|
|
9
9
|
import session from 'express-session';
|
|
10
10
|
import getYouTubeID from 'get-youtube-id-ng';
|
|
11
11
|
import contentDisposition from 'content-disposition';
|
|
12
|
+
import { rateLimit } from 'express-rate-limit';
|
|
12
13
|
import { verify } from "otplib";
|
|
13
14
|
import { getExpectedCWD } from './cwd-checker.js';
|
|
14
15
|
import { getFilesNoError, encodePayload, ytdlp, ytdlpDefaults } from '@inner-dj/common';
|
|
@@ -33,6 +34,7 @@ export class Web extends EventEmitter {
|
|
|
33
34
|
initialize = async () => {
|
|
34
35
|
const config = this.config;
|
|
35
36
|
const app = this._app = expressWs(express()).app;
|
|
37
|
+
const limiter = rateLimit(config.limiter);
|
|
36
38
|
app.set('trust proxy', config.trustProxy);
|
|
37
39
|
app.set('view engine', 'ejs');
|
|
38
40
|
app.set('view options', { outputFunctionName: 'echo' });
|
|
@@ -149,7 +151,7 @@ export class Web extends EventEmitter {
|
|
|
149
151
|
res.redirect('/');
|
|
150
152
|
});
|
|
151
153
|
});
|
|
152
|
-
app.post('/', sessionMiddleware, express.json(), async (req, res) => {
|
|
154
|
+
app.post('/', limiter, sessionMiddleware, express.json(), async (req, res) => {
|
|
153
155
|
const token = req.body?.['code'];
|
|
154
156
|
if (typeof token !== 'string') {
|
|
155
157
|
res.status(400).send({
|
package/lib/src/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,cAAc,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C,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;oBACnC,IAAI,GAAG,EAAE,CAAC;wBACN,MAAM,CAAC,GAAG,CAAC,CAAC;wBACZ,OAAO;oBACX,CAAC;oBACD,OAAO,EAAE,CAAC;gBACd,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC,CAAA;IAED,KAAK,GAAG,GAAG,EAAE;QACT,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC,CAAA;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inner-dj/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "server component of inner-dj",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jukebox",
|
|
7
|
+
"jam",
|
|
8
|
+
"youtube",
|
|
9
|
+
"server"
|
|
10
|
+
],
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://codeberg.org/sanin/inner-dj/issues",
|
|
13
|
+
"email": "corysanin@outlook.com"
|
|
14
|
+
},
|
|
5
15
|
"repository": {
|
|
6
16
|
"type": "git",
|
|
7
17
|
"url": "https://codeberg.org/sanin/inner-dj.git"
|
|
8
18
|
},
|
|
9
19
|
"license": "MIT",
|
|
10
|
-
"author":
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "Cory Sanin",
|
|
22
|
+
"email": "corysanin@outlook.com",
|
|
23
|
+
"url": "https://sanin.dev/"
|
|
24
|
+
},
|
|
11
25
|
"type": "module",
|
|
12
26
|
"exports": {
|
|
13
27
|
".": {
|
|
@@ -30,19 +44,20 @@
|
|
|
30
44
|
"dependencies": {
|
|
31
45
|
"better-sqlite3": "^12.10.0",
|
|
32
46
|
"bulma": "^1.0.4",
|
|
33
|
-
"content-disposition": "2.0.
|
|
34
|
-
"ejs": "^
|
|
47
|
+
"content-disposition": "2.0.1",
|
|
48
|
+
"ejs": "^6.0.1",
|
|
35
49
|
"express": "^5.2.1",
|
|
50
|
+
"express-rate-limit": "^8.5.2",
|
|
36
51
|
"express-session": "^1.19.0",
|
|
37
52
|
"express-ws": "^5.0.2",
|
|
38
53
|
"get-youtube-id-ng": "1.0.1",
|
|
39
54
|
"jsonwebtoken": "9.0.3",
|
|
40
|
-
"otplib": "^13.4.
|
|
55
|
+
"otplib": "^13.4.1",
|
|
41
56
|
"qr-creator": "^1.0.0",
|
|
42
57
|
"yaml": "^2.9.0",
|
|
43
|
-
"@inner-dj/common": "0.1.
|
|
44
|
-
"@inner-dj/
|
|
45
|
-
"@inner-dj/
|
|
58
|
+
"@inner-dj/common": "0.1.6",
|
|
59
|
+
"@inner-dj/discord-receiver": "0.1.6",
|
|
60
|
+
"@inner-dj/twilio-receiver": "0.1.6"
|
|
46
61
|
},
|
|
47
62
|
"devDependencies": {
|
|
48
63
|
"@sindresorhus/tsconfig": "8.1.0",
|