@passflow/core 0.34.0 → 0.35.0
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 +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.mjs +457 -439
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var i = "__passflowAntiBot", a = (e, t) => {
|
|
|
11
11
|
if (typeof e != "object" || !e) return;
|
|
12
12
|
let t = e[i];
|
|
13
13
|
return typeof t == "object" && t ? t : void 0;
|
|
14
|
-
}, s = "0.
|
|
14
|
+
}, s = "0.35.0", c = "X-Passflow-Clientid", l = "Authorization", u = "X-Passflow-DeviceId", d = "X-Passflow-DeviceType", f = "X-Passflow-Anti-Bot", p = "X-Passflow-Agent-Tool", m = "passflow_auth", h = s, g = [
|
|
15
15
|
"id",
|
|
16
16
|
"offline",
|
|
17
17
|
"openid"
|
|
@@ -192,7 +192,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
192
192
|
this.storageManager.storage.removeItem(this.SESSION_STATE_KEY);
|
|
193
193
|
} catch {}
|
|
194
194
|
}
|
|
195
|
-
}, P = "tokens_scopes", F = "passflowDeviceId", I = "passflowInvitationToken", le = "passflowPreviousRedirectUrl",
|
|
195
|
+
}, P = "tokens_scopes", F = "passflowDeviceId", I = "passflowInvitationToken", le = "passflowPreviousRedirectUrl", ue = class {
|
|
196
196
|
constructor({ storage: e, prefix: t, appId: n } = {}) {
|
|
197
197
|
this.keyStoragePrefix = "", this.STORAGE_PREFIX = "passflow_", this.ID_TOKEN_KEY = `${this.STORAGE_PREFIX}id_token`, this.CSRF_TOKEN_KEY = `${this.STORAGE_PREFIX}csrf_token`, this.DELIVERY_MODE_KEY = `${this.STORAGE_PREFIX}delivery_mode`, this.storage = e ?? localStorage, this.keyStoragePrefix = t ? `${t}_` : "", this.scopes = `${this.keyStoragePrefix}${P}`, this.deviceId = `${this.keyStoragePrefix}${F}`, this.invitationToken = `${this.keyStoragePrefix}${I}`, this.previousRedirectUrl = `${this.keyStoragePrefix}${le}`, this.appId = n || void 0;
|
|
198
198
|
}
|
|
@@ -243,9 +243,16 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
243
243
|
removeOwnToken(e) {
|
|
244
244
|
this.holdsOtherAppToken(e) || this.storage.removeItem(e);
|
|
245
245
|
}
|
|
246
|
-
saveTokens(e, t) {
|
|
247
|
-
let { id_token:
|
|
248
|
-
t === N.Cookie || t === N.BFF
|
|
246
|
+
saveTokens(e, t, n) {
|
|
247
|
+
let { id_token: r, access_token: i, refresh_token: a, scopes: o } = e;
|
|
248
|
+
if (t === N.Cookie || t === N.BFF) r && this.storage.setItem(this.ID_TOKEN_KEY, r);
|
|
249
|
+
else {
|
|
250
|
+
if (n?.replace && i) {
|
|
251
|
+
let e = this.holdsOnlyOtherAppSession();
|
|
252
|
+
r || this.removeOwnToken(this.getKeyForTokenType(M.id_token)), a || this.removeOwnToken(this.getKeyForTokenType(M.refresh_token)), !o && !e && this.removePrefixed(this.scopes, P);
|
|
253
|
+
}
|
|
254
|
+
r && this.storage.setItem(this.getKeyForTokenType(M.id_token), r), i && this.storage.setItem(this.getKeyForTokenType(M.access_token), i), a && this.storage.setItem(this.getKeyForTokenType(M.refresh_token), a), o && this.storage.setItem(this.scopes, o.join(","));
|
|
255
|
+
}
|
|
249
256
|
}
|
|
250
257
|
getToken(e) {
|
|
251
258
|
return this.readToken(this.getKeyForTokenType(e));
|
|
@@ -393,9 +400,9 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
393
400
|
getKeyForTokenType(e) {
|
|
394
401
|
return `${this.keyStoragePrefix}${e}`;
|
|
395
402
|
}
|
|
396
|
-
},
|
|
403
|
+
}, de = class {
|
|
397
404
|
constructor(e) {
|
|
398
|
-
this.storageManager = e ?? new
|
|
405
|
+
this.storageManager = e ?? new ue();
|
|
399
406
|
}
|
|
400
407
|
getDeviceId() {
|
|
401
408
|
return this.storageManager.getDeviceId() || (this.mintedDeviceId ?? (this.mintedDeviceId = this.generateUniqueDeviceId()), this.storageManager.setDeviceId(this.mintedDeviceId), this.mintedDeviceId);
|
|
@@ -403,11 +410,11 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
403
410
|
generateUniqueDeviceId() {
|
|
404
411
|
return re();
|
|
405
412
|
}
|
|
406
|
-
},
|
|
413
|
+
}, fe = class extends Error {
|
|
407
414
|
constructor(e = "Authentication popup was closed") {
|
|
408
415
|
super(e), this.name = "PopupClosedError";
|
|
409
416
|
}
|
|
410
|
-
},
|
|
417
|
+
}, L = class {
|
|
411
418
|
constructor() {
|
|
412
419
|
this.passkeys = {
|
|
413
420
|
startRegistration: (e) => r({ optionsJSON: e }),
|
|
@@ -484,7 +491,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
484
491
|
watchPopup(e, t) {
|
|
485
492
|
return new Promise((n, r) => {
|
|
486
493
|
let i = Date.now(), a = setInterval(() => {
|
|
487
|
-
if (e.closed) clearInterval(a), r(new
|
|
494
|
+
if (e.closed) clearInterval(a), r(new fe());
|
|
488
495
|
else if (Date.now() - i > 6e4) clearInterval(a), e.close(), r(/* @__PURE__ */ Error("Authentication popup timed out"));
|
|
489
496
|
else try {
|
|
490
497
|
if (e.location.href.startsWith(t)) {
|
|
@@ -519,16 +526,16 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
519
526
|
getDeviceType() {
|
|
520
527
|
return "web";
|
|
521
528
|
}
|
|
522
|
-
},
|
|
529
|
+
}, R = new L(), pe = /^[0-9]+$/, me = Object.freeze({
|
|
523
530
|
unorderable: !1,
|
|
524
531
|
zero: !1
|
|
525
|
-
}),
|
|
526
|
-
if (!e) return
|
|
532
|
+
}), he = (e) => pe.test(e) ? Number.parseInt(e, 10) : void 0, ge = (e) => {
|
|
533
|
+
if (!e) return me;
|
|
527
534
|
let t = e.split(/\s+/).filter((e) => e !== "");
|
|
528
|
-
if (t.length === 0) return
|
|
535
|
+
if (t.length === 0) return me;
|
|
529
536
|
let n = [];
|
|
530
537
|
for (let e of t) {
|
|
531
|
-
let t =
|
|
538
|
+
let t = he(e);
|
|
532
539
|
t !== void 0 && n.push(t);
|
|
533
540
|
}
|
|
534
541
|
if (n.length === 0) return {
|
|
@@ -547,17 +554,17 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
547
554
|
unorderable: !1,
|
|
548
555
|
zero: !1
|
|
549
556
|
};
|
|
550
|
-
},
|
|
557
|
+
}, _e = (e) => ge(e).level, ve = "insufficient_user_authentication", ye = "upgrade_required", be = /([A-Za-z0-9!#$%&'*+\-.^_`|~]+)\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^\s,]*))/g, xe = (e) => e.replace(/\\(.)/g, "$1"), Se = (e) => {
|
|
551
558
|
let t = {};
|
|
552
|
-
|
|
553
|
-
for (let n of e.matchAll(
|
|
559
|
+
be.lastIndex = 0;
|
|
560
|
+
for (let n of e.matchAll(be)) {
|
|
554
561
|
let e = n[1];
|
|
555
562
|
if (!e) continue;
|
|
556
563
|
let r = n[2], i = n[3];
|
|
557
|
-
t[e.toLowerCase()] = r === void 0 ? i ?? "" :
|
|
564
|
+
t[e.toLowerCase()] = r === void 0 ? i ?? "" : xe(r);
|
|
558
565
|
}
|
|
559
566
|
return t;
|
|
560
|
-
},
|
|
567
|
+
}, Ce = (e) => {
|
|
561
568
|
if (e == null || e === "") return { kind: "absent" };
|
|
562
569
|
let t = typeof e == "number" ? e : Number.parseInt(String(e), 10);
|
|
563
570
|
return Number.isFinite(t) && t > 0 ? {
|
|
@@ -567,38 +574,38 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
567
574
|
kind: "invalid",
|
|
568
575
|
raw: e
|
|
569
576
|
};
|
|
570
|
-
},
|
|
571
|
-
let t =
|
|
577
|
+
}, we = (e) => {
|
|
578
|
+
let t = Ce(e);
|
|
572
579
|
return t.kind === "valid" ? t.value : void 0;
|
|
573
|
-
},
|
|
580
|
+
}, Te = (e, t) => {
|
|
574
581
|
if (!e || !/(^|[\s,])Bearer\b/i.test(e)) return;
|
|
575
|
-
let n =
|
|
582
|
+
let n = Se(e);
|
|
576
583
|
if (n.error === "insufficient_user_authentication") return {
|
|
577
584
|
acrValues: n.acr_values || void 0,
|
|
578
|
-
maxAge:
|
|
585
|
+
maxAge: we(n.max_age),
|
|
579
586
|
status: t
|
|
580
587
|
};
|
|
581
|
-
},
|
|
588
|
+
}, Ee = (e, t) => {
|
|
582
589
|
if (!e || typeof e != "object") return;
|
|
583
590
|
let n = e;
|
|
584
591
|
if (n.error !== "upgrade_required") return;
|
|
585
592
|
let r = Array.isArray(n.available_factors) ? n.available_factors.filter((e) => typeof e == "string") : void 0;
|
|
586
593
|
return {
|
|
587
594
|
acrValues: typeof n.acr_values == "string" && n.acr_values ? n.acr_values : void 0,
|
|
588
|
-
maxAge:
|
|
595
|
+
maxAge: we(n.max_age),
|
|
589
596
|
status: t,
|
|
590
597
|
...r ? { availableFactors: r } : {},
|
|
591
598
|
...typeof n.sign_in_required == "boolean" ? { signInRequired: n.sign_in_required } : {}
|
|
592
599
|
};
|
|
593
|
-
},
|
|
600
|
+
}, De = (e, t, n) => ({
|
|
594
601
|
channel: e,
|
|
595
|
-
acr:
|
|
596
|
-
maxAge:
|
|
602
|
+
acr: ge(t.acrValues),
|
|
603
|
+
maxAge: Ce(n),
|
|
597
604
|
raw: t.acrValues
|
|
598
|
-
}),
|
|
605
|
+
}), Oe = (e) => e ? Se(e) : {}, ke = (e, t) => {
|
|
599
606
|
let { status: n } = e;
|
|
600
607
|
if (n !== 401 && n !== 403) return { diagnostics: [] };
|
|
601
|
-
let r = t?.requireChallengeChannel === "header", i = e.getHeader("www-authenticate"), a =
|
|
608
|
+
let r = t?.requireChallengeChannel === "header", i = e.getHeader("www-authenticate"), a = Te(i, n), o = r ? void 0 : Ee(e.body, n), s = [], c = (e, t) => {
|
|
602
609
|
s.push({
|
|
603
610
|
status: n,
|
|
604
611
|
url: "",
|
|
@@ -608,9 +615,9 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
608
615
|
};
|
|
609
616
|
if (!a && !o) return r && c("header-required-but-absent", i ? { header: i } : void 0), { diagnostics: s };
|
|
610
617
|
let l = [];
|
|
611
|
-
if (a && l.push(
|
|
618
|
+
if (a && l.push(De("header", a, Oe(i).max_age)), o) {
|
|
612
619
|
let t = e.body;
|
|
613
|
-
l.push(
|
|
620
|
+
l.push(De("body", o, t?.max_age));
|
|
614
621
|
}
|
|
615
622
|
let u = (e) => e;
|
|
616
623
|
for (let e of l) e.acr.unorderable && c("channels-unorderable", { [u(e.channel)]: e.raw }), e.acr.zero && c("zero-constraint-ignored", {
|
|
@@ -646,23 +653,23 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
646
653
|
},
|
|
647
654
|
diagnostics: s
|
|
648
655
|
};
|
|
649
|
-
},
|
|
656
|
+
}, Ae = (e, t, n) => ke({
|
|
650
657
|
status: e,
|
|
651
658
|
getHeader: t,
|
|
652
659
|
body: n
|
|
653
|
-
}).challenge,
|
|
660
|
+
}).challenge, je = "__passflowUpgradeTransaction", Me = "__passflowUpgradeReplayed", Ne = (e, t) => typeof e == "object" && !!e && e[t] === !0, Pe = (e) => ({
|
|
654
661
|
...e ?? {},
|
|
655
|
-
[Ae]: !0
|
|
656
|
-
}), Pe = (e) => Me(e, Ae), Fe = (e) => ({
|
|
657
|
-
...e,
|
|
658
662
|
[je]: !0
|
|
659
|
-
}),
|
|
663
|
+
}), Fe = (e) => Ne(e, je), Ie = (e) => ({
|
|
664
|
+
...e,
|
|
665
|
+
[Me]: !0
|
|
666
|
+
}), Le = (e) => Ne(e, Me), Re = /* @__PURE__ */ function(e) {
|
|
660
667
|
return e.GET = "get", e.POST = "post", e.PUT = "put", e.PATCH = "patch", e.DELETE = "delete", e;
|
|
661
|
-
}({}),
|
|
668
|
+
}({}), z = /* @__PURE__ */ function(e) {
|
|
662
669
|
return e.signin = "/auth/login", e.signup = "/auth/register", e.pkceExchange = "/auth/pkce_exchange", e.redirectCheck = "/auth/redirect/check", e.signInWithProvider = "/auth/federated/start/", e.passwordless = "/auth/passwordless/start", e.passwordlessComplete = "/auth/passwordless/complete", e.passwordlessStatus = "/auth/passwordless/status", e.passwordlessApprovalInfo = "/auth/passwordless/approval/info", e.passwordlessApprovalDecide = "/auth/passwordless/approval/decide", e.logout = "/user/logout", e.refresh = "/auth/refresh", e.validateSession = "/user/me", e.sendPasswordResetEmail = "/auth/password/reset", e.resetPassword = "/auth/password/change", e.appSettings = "/app/settings", e.passkeyRegisterStart = "/auth/passkey/register/start", e.passkeyRegisterComplete = "/auth/passkey/register/complete", e.passkeyAuthenticateStart = "/auth/passkey/authenticate/start", e.passkeyAuthenticateComplete = "/auth/passkey/authenticate/complete", e.passkeyValidate = "/auth/validate", e.settingsAll = "/settings", e.settingsPasswordPolicy = "/settings/password", e.settingsPasskey = "/settings/passkey", e.userPasskey = "/user/passkey", e.addUserPasskey = "/user/passkey/add/start", e.completeAddUserPasskey = "/user/passkey/add/complete", e.userSessions = "/user/sessions", e.userSessionsRevokeOthers = "/user/sessions/revoke-others", e.joinInvitation = "/user/tenant/join", e.tenantPath = "/user/tenant", e.invitationsPath = "/user/tenant/:tenantID/invitations", e.requestInvitation = "/user/invite", e.invitationDelete = "/user/invite/:invitationID", e.invitationResend = "/user/invite/:invitationID/resend", e.invitationGetLink = "/user/invite/:invitationID/link", e.twoFactor = "/user/2fa", e.twoFactorStatus = "/user/2fa/status", e.twoFactorSetupBegin = "/user/2fa/setup/begin", e.twoFactorSetupConfirm = "/user/2fa/setup/confirm", e.twoFactorVerify = "/auth/2fa/verify", e.twoFactorRecovery = "/auth/2fa/recovery", e.twoFactorRegenerateCodes = "/user/2fa/recovery-codes/regenerate", e.twoFactorSetupMagicLink = "/auth/2fa-setup", e.twoFactorEnrollment = "/auth/2fa/enrollment", e.twoFactorEnrollmentEmailLink = "/auth/2fa/enrollment/email-link", e.twoFactorEnrollmentBegin = "/auth/2fa/setup/begin", e.twoFactorEnrollmentConfirm = "/auth/2fa/setup/confirm", e.TwoFactorMethodsAvailable = "/v2/user/2fa/methods/available", e.TwoFactorMethodsRegistered = "/v2/user/2fa/methods", e.TwoFactorSetupStart = "/v2/user/2fa/setup/start", e.TwoFactorSetupComplete = "/v2/user/2fa/setup/complete", e.TwoFactorMethodRemove = "/v2/user/2fa/methods/:id", e.TwoFactorChallenge = "/v2/auth/2fa/challenge", e.TwoFactorVerifyV2 = "/v2/auth/2fa/verify", e.TwoFactorAlternative = "/v2/auth/2fa/alternative", e.TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices", e.TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id", e.cliAuthStatus = "/cli/auth/status/:sessionId", e.cliAuthComplete = "/cli/auth/complete", e.upgradeStart = "/auth/upgrade/start", e.hostedUpgradeStart = "/auth/session/upgrade/start", e.hostedUpgrade = "/auth/session/upgrade", e.antiBotChallenge = "/auth/anti-bot/challenge", e.deviceAntiBotChallenge = "/oidc/device/anti-bot/challenge", e;
|
|
663
|
-
}({}),
|
|
670
|
+
}({}), ze = /* @__PURE__ */ function(e) {
|
|
664
671
|
return e.passkeyRegisterStart = "/admin/auth/passkey/register/start", e.passkeyRegisterComplete = "/admin/auth/passkey/register/complete", e.passkeyAuthenticateStart = "/admin/auth/passkey/authenticate/start", e.passkeyAuthenticateComplete = "/admin/auth/passkey/authenticate/complete", e.passkeyValidate = "/admin/auth/validate", e.logout = "/admin/auth/logout", e;
|
|
665
|
-
}({}),
|
|
672
|
+
}({}), Be = (e) => {
|
|
666
673
|
if (!e) return null;
|
|
667
674
|
try {
|
|
668
675
|
let t = new URL(e), n = t.pathname.replace(/\/+$/, "");
|
|
@@ -673,57 +680,57 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
673
680
|
} catch {
|
|
674
681
|
return null;
|
|
675
682
|
}
|
|
676
|
-
},
|
|
683
|
+
}, Ve = (e) => typeof e == "object" && !!e && e.email_verification_required === !0, He = "error.service.unavailable", Ue = "Passflow is temporarily unavailable. Please try again in a moment.", B = class extends Error {
|
|
677
684
|
constructor(e, t) {
|
|
678
685
|
super(), this.name = "PassflowError", this.id = e?.id ?? "unknown", this.message = e?.message ?? e ?? "Something went wrong", this.status = e?.status ?? 500, this.location = e?.location ?? "unknown", this.time = e?.time ?? (/* @__PURE__ */ new Date()).toISOString(), t?.cause !== void 0 && (this.cause = t.cause);
|
|
679
686
|
}
|
|
680
|
-
},
|
|
687
|
+
}, We = "error.api.password.change.required", Ge = "error.api.anti_bot.required", Ke = "error.api.anti_bot.failed", qe = "error.api.anti_bot.unavailable", Je = "error.anti_bot.provider_missing", Ye = "error.anti_bot.provider_failed", Xe = "error.anti_bot.solve_failed", Ze = class extends B {
|
|
681
688
|
constructor(e, t) {
|
|
682
689
|
super(e, t), this.name = "PassflowPasswordChangeRequiredError";
|
|
683
690
|
}
|
|
684
|
-
},
|
|
691
|
+
}, Qe = /* @__PURE__ */ function(e) {
|
|
685
692
|
return e.google = "google", e.facebook = "facebook", e;
|
|
686
|
-
}({}),
|
|
693
|
+
}({}), $e = Object.freeze([
|
|
687
694
|
"debug_otp_code_for_registration",
|
|
688
695
|
"fcm_server_key",
|
|
689
696
|
"webpush_vapid_private_key"
|
|
690
|
-
]),
|
|
697
|
+
]), et = "mask://", tt = "error.server.update.settings.masked.value.unknown", nt = (e) => typeof e == "string" && e.startsWith("mask://"), rt = /* @__PURE__ */ function(e) {
|
|
691
698
|
return e.web = "web", e.ios = "ios", e.android = "android", e;
|
|
692
699
|
}({});
|
|
693
|
-
function
|
|
700
|
+
function it(e) {
|
|
694
701
|
return e;
|
|
695
702
|
}
|
|
696
|
-
function
|
|
703
|
+
function at(e, t) {
|
|
697
704
|
let n = e;
|
|
698
705
|
return Object.entries(t).forEach(([e, t]) => {
|
|
699
706
|
n = n.replace(`:${e}`, t);
|
|
700
707
|
}), n;
|
|
701
708
|
}
|
|
702
|
-
var
|
|
709
|
+
var ot = /* @__PURE__ */ function(e) {
|
|
703
710
|
return e.Disabled = "disabled", e.Optional = "optional", e.Required = "required", e;
|
|
704
|
-
}({}),
|
|
711
|
+
}({}), st = 3, ct = 1e3, lt = (e) => (t) => {
|
|
705
712
|
let n = e.headers?.[t] ?? e.headers?.[t.toLowerCase()];
|
|
706
713
|
return Array.isArray(n) ? n.join(", ") : n;
|
|
707
|
-
},
|
|
714
|
+
}, ut = (e) => Ae(e.status, lt(e), e.data), dt = (e) => ut(e) !== void 0, ft = (e) => {
|
|
708
715
|
let t = e.response?.data?.error;
|
|
709
716
|
return typeof t?.id == "string" ? t.id : void 0;
|
|
710
|
-
},
|
|
717
|
+
}, pt = (n) => e.isAxiosError(n) && !n.response && (n.code === t.ERR_NETWORK || !n.code && n.cause instanceof TypeError), mt = [
|
|
711
718
|
502,
|
|
712
719
|
503,
|
|
713
720
|
504
|
|
714
|
-
],
|
|
721
|
+
], ht = (e) => typeof e == "object" && !!e && typeof e.error == "object" && e.error !== null, gt = (e, n) => {
|
|
715
722
|
let r = new t(e.message, e.code);
|
|
716
|
-
return e.cause instanceof TypeError && (r.cause = e.cause), new
|
|
717
|
-
id:
|
|
718
|
-
message:
|
|
723
|
+
return e.cause instanceof TypeError && (r.cause = e.cause), new B({
|
|
724
|
+
id: He,
|
|
725
|
+
message: Ue,
|
|
719
726
|
status: n,
|
|
720
727
|
location: e.config?.url ?? "unknown",
|
|
721
728
|
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
722
729
|
}, { cause: r });
|
|
723
|
-
},
|
|
730
|
+
}, _t = (e) => e?.includes(z.refresh) ?? !1, vt = (e) => e?.includes("/auth/session/") ?? !1, yt = (e) => e?.includes("logout") ?? !1, bt = "__passflowOwnBearer", xt = (e) => typeof e == "object" && !!e && e[bt] === !0, St = (e) => e ? {
|
|
724
731
|
headers: { [l]: `Bearer ${e}` },
|
|
725
|
-
[
|
|
726
|
-
} : {},
|
|
732
|
+
[bt]: !0
|
|
733
|
+
} : {}, Ct = class {
|
|
727
734
|
get origin() {
|
|
728
735
|
return this._platform.getCurrentUrl()?.origin ?? "";
|
|
729
736
|
}
|
|
@@ -742,10 +749,10 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
742
749
|
"upgrade"
|
|
743
750
|
];
|
|
744
751
|
let { url: i, appId: a, keyStoragePrefix: s } = t;
|
|
745
|
-
this._platform = t.platform ??
|
|
752
|
+
this._platform = t.platform ?? R, this.url = i || "https://auth.passflow.cloud", this.upgradeDomain = Be(i), this.storageManager = n ?? new ue({
|
|
746
753
|
prefix: s ?? "",
|
|
747
754
|
appId: a
|
|
748
|
-
}), this.deviceService = r ?? new
|
|
755
|
+
}), this.deviceService = r ?? new de(this.storageManager), this.tokenService = new k(this.storageManager), this.tokenDeliveryManager = new ce(this.storageManager), a && (this.appId = a, this.defaultHeaders = {
|
|
749
756
|
...this.defaultHeaders,
|
|
750
757
|
[c]: a
|
|
751
758
|
}), this.defaultHeaders = {
|
|
@@ -761,17 +768,17 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
761
768
|
let n = await this.antiBotHandler(t);
|
|
762
769
|
n && (e.headers[f] = n.value, t.builtin = n.builtin);
|
|
763
770
|
}
|
|
764
|
-
if (this.isNonAuthEndpoint(e.url) ||
|
|
771
|
+
if (this.isNonAuthEndpoint(e.url) || xt(e) || vt(e.url)) return e;
|
|
765
772
|
if (this.tokenDeliveryManager.isCookieMode()) {
|
|
766
773
|
e.withCredentials = !0;
|
|
767
774
|
let t = this.storageManager.getCsrfToken();
|
|
768
775
|
return t && (e.headers["X-CSRF-Token"] = t), e;
|
|
769
776
|
}
|
|
770
|
-
if (
|
|
777
|
+
if (_t(e.url)) return e;
|
|
771
778
|
let n = this.storageManager.getTokens();
|
|
772
779
|
if (!n?.access_token) return e;
|
|
773
780
|
let r = n.access_token;
|
|
774
|
-
if (this.refreshHandler && n.refresh_token && !
|
|
781
|
+
if (this.refreshHandler && n.refresh_token && !yt(e.url)) {
|
|
775
782
|
let e = j(n.access_token);
|
|
776
783
|
if (A(e, 30)) {
|
|
777
784
|
let t = !A(e, 0);
|
|
@@ -787,11 +794,11 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
787
794
|
}
|
|
788
795
|
return e.headers[l] = `Bearer ${r}`, e;
|
|
789
796
|
}), this.instance.interceptors.response.use((e) => e, async (e) => {
|
|
790
|
-
e.response?.status !== 401 ||
|
|
797
|
+
e.response?.status !== 401 || _t(e.config?.url) || vt(e.config?.url) || xt(e.config) || this.isUpgradeTransactionError(e) || this.tokenDeliveryManager.setSessionInvalid();
|
|
791
798
|
let t = o(e.config);
|
|
792
|
-
if (e.config && e.response?.status === 403 &&
|
|
793
|
-
if (e.response && this.upgradeHandler && !
|
|
794
|
-
let t =
|
|
799
|
+
if (e.config && e.response?.status === 403 && ft(e) === "error.api.anti_bot.failed" && t?.builtin && !t.retried) return t.retried = !0, this.instance.request(e.config);
|
|
800
|
+
if (e.response && this.upgradeHandler && !vt(e.config?.url)) {
|
|
801
|
+
let t = ut(e.response);
|
|
795
802
|
if (t) try {
|
|
796
803
|
return await this.upgradeHandler(e, t);
|
|
797
804
|
} catch (t) {
|
|
@@ -802,7 +809,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
802
809
|
});
|
|
803
810
|
}
|
|
804
811
|
isUpgradeTransactionError(e) {
|
|
805
|
-
return
|
|
812
|
+
return Fe(e.config) || e.response !== void 0 && dt(e.response);
|
|
806
813
|
}
|
|
807
814
|
setUpgradeInterceptor(e) {
|
|
808
815
|
this.upgradeHandler = e;
|
|
@@ -827,7 +834,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
827
834
|
}
|
|
828
835
|
async handleRateLimitError(e) {
|
|
829
836
|
let t = e.config;
|
|
830
|
-
if (!t ||
|
|
837
|
+
if (!t || _t(t.url)) return Promise.reject(e);
|
|
831
838
|
let n = t.method?.toUpperCase();
|
|
832
839
|
if (![
|
|
833
840
|
"GET",
|
|
@@ -835,8 +842,8 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
835
842
|
"OPTIONS"
|
|
836
843
|
].includes(n || "")) return Promise.reject(e);
|
|
837
844
|
let r = t._retryCount || 0;
|
|
838
|
-
if (r >=
|
|
839
|
-
let i =
|
|
845
|
+
if (r >= st) return Promise.reject(e);
|
|
846
|
+
let i = ct * 2 ** r, a = e.response?.headers?.["retry-after"];
|
|
840
847
|
if (a) {
|
|
841
848
|
let e = Number.parseInt(a, 10);
|
|
842
849
|
if (!Number.isNaN(e)) i = e * 1e3;
|
|
@@ -848,16 +855,16 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
848
855
|
return await new Promise((e) => setTimeout(e, i)), t._retryCount = r + 1, this.instance.request(t);
|
|
849
856
|
}
|
|
850
857
|
async handleAxiosError(e) {
|
|
851
|
-
if (
|
|
858
|
+
if (pt(e)) return Promise.reject(gt(e, 0));
|
|
852
859
|
if (!e.response) return Promise.reject(e);
|
|
853
860
|
let t = e.response.status;
|
|
854
|
-
if (
|
|
861
|
+
if (mt.includes(t) && !ht(e.response.data)) return Promise.reject(gt(e, t));
|
|
855
862
|
let n = e.response.data;
|
|
856
863
|
if ("error" in n && typeof n.error == "object" && n.error !== null) {
|
|
857
864
|
let { error: e } = n;
|
|
858
|
-
return e.id === "error.api.password.change.required" ? Promise.reject(new
|
|
865
|
+
return e.id === "error.api.password.change.required" ? Promise.reject(new Ze(e)) : Promise.reject(new B(e));
|
|
859
866
|
}
|
|
860
|
-
return Promise.reject(new
|
|
867
|
+
return Promise.reject(new B({
|
|
861
868
|
id: `error.http.${t}`,
|
|
862
869
|
message: e.message || "An error occurred",
|
|
863
870
|
status: t,
|
|
@@ -873,28 +880,28 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
873
880
|
})).data;
|
|
874
881
|
}
|
|
875
882
|
get(e, t) {
|
|
876
|
-
return this.send(
|
|
883
|
+
return this.send(Re.GET, e, t);
|
|
877
884
|
}
|
|
878
885
|
post(e, t, n) {
|
|
879
|
-
return this.send(
|
|
886
|
+
return this.send(Re.POST, e, {
|
|
880
887
|
data: t,
|
|
881
888
|
...n
|
|
882
889
|
});
|
|
883
890
|
}
|
|
884
891
|
put(e, t, n) {
|
|
885
|
-
return this.send(
|
|
892
|
+
return this.send(Re.PUT, e, {
|
|
886
893
|
data: t,
|
|
887
894
|
...n
|
|
888
895
|
});
|
|
889
896
|
}
|
|
890
897
|
patch(e, t, n) {
|
|
891
|
-
return this.send(
|
|
898
|
+
return this.send(Re.PATCH, e, {
|
|
892
899
|
data: t,
|
|
893
900
|
...n
|
|
894
901
|
});
|
|
895
902
|
}
|
|
896
903
|
delete(e, t) {
|
|
897
|
-
return this.send(
|
|
904
|
+
return this.send(Re.DELETE, e, t);
|
|
898
905
|
}
|
|
899
906
|
setAppId(e) {
|
|
900
907
|
this.appId = e, this.defaultHeaders = {
|
|
@@ -902,27 +909,27 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
902
909
|
[c]: e
|
|
903
910
|
}, this.instance.defaults.headers[c] = e;
|
|
904
911
|
}
|
|
905
|
-
},
|
|
912
|
+
}, wt = class {
|
|
906
913
|
constructor(e, t, n) {
|
|
907
|
-
this.axiosClient = new
|
|
914
|
+
this.axiosClient = new Ct(e, t, n);
|
|
908
915
|
}
|
|
909
916
|
setAppId(e) {
|
|
910
917
|
this.axiosClient.setAppId(e);
|
|
911
918
|
}
|
|
912
919
|
getAppSettings() {
|
|
913
|
-
return this.axiosClient.get(
|
|
920
|
+
return this.axiosClient.get(z.appSettings);
|
|
914
921
|
}
|
|
915
|
-
},
|
|
916
|
-
if (e instanceof
|
|
922
|
+
}, Tt = { withCredentials: !0 }, Et = 15e3, Dt = "X-Passflow-CSRF", Ot = "Sign-in failed. Start again.", kt = "Something went wrong. Try again later.", At = (e, t, n, r) => {
|
|
923
|
+
if (e instanceof B) return e;
|
|
917
924
|
let i = e?.response?.data?.error;
|
|
918
|
-
return new
|
|
925
|
+
return new B({
|
|
919
926
|
id: typeof i?.id == "string" ? i.id : n,
|
|
920
927
|
message: typeof i?.message == "string" ? i.message : r,
|
|
921
928
|
status: typeof i?.status == "number" ? i.status : 0,
|
|
922
929
|
location: t,
|
|
923
930
|
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
924
931
|
});
|
|
925
|
-
},
|
|
932
|
+
}, V = (e, t, n, r) => !t && !r?.agentTool ? e : {
|
|
926
933
|
...e,
|
|
927
934
|
...t ? a(t, n) : {},
|
|
928
935
|
...r?.agentTool ? { headers: {
|
|
@@ -931,7 +938,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
931
938
|
} } : {}
|
|
932
939
|
}, jt = class {
|
|
933
940
|
constructor(e, t, n) {
|
|
934
|
-
this.axiosClient = new
|
|
941
|
+
this.axiosClient = new Ct(e, t, n);
|
|
935
942
|
}
|
|
936
943
|
setAppId(e) {
|
|
937
944
|
this.axiosClient.setAppId(e);
|
|
@@ -941,20 +948,20 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
941
948
|
}
|
|
942
949
|
async antiBotChallenge(e) {
|
|
943
950
|
try {
|
|
944
|
-
return await this.axiosClient.post(
|
|
951
|
+
return await this.axiosClient.post(z.antiBotChallenge, e);
|
|
945
952
|
} catch (e) {
|
|
946
|
-
throw
|
|
953
|
+
throw At(e, z.antiBotChallenge, "error.anti_bot.challenge", kt);
|
|
947
954
|
}
|
|
948
955
|
}
|
|
949
956
|
async deviceAntiBotChallenge(e, t) {
|
|
950
957
|
try {
|
|
951
|
-
return await this.axiosClient.post(
|
|
958
|
+
return await this.axiosClient.post(z.deviceAntiBotChallenge, e, { headers: { [Dt]: t } });
|
|
952
959
|
} catch (e) {
|
|
953
|
-
throw
|
|
960
|
+
throw At(e, z.deviceAntiBotChallenge, "error.anti_bot.challenge", kt);
|
|
954
961
|
}
|
|
955
962
|
}
|
|
956
963
|
federatedStart(e, t, n) {
|
|
957
|
-
return this.axiosClient.post(`${
|
|
964
|
+
return this.axiosClient.post(`${z.signInWithProvider}${e}`, t, V(Tt, "federated.start", void 0, n));
|
|
958
965
|
}
|
|
959
966
|
refreshToken(e, t, n, r) {
|
|
960
967
|
let i = {
|
|
@@ -962,7 +969,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
962
969
|
scopes: t,
|
|
963
970
|
...r ? { upgrade: r } : {}
|
|
964
971
|
}, a = { headers: { [l]: `Bearer ${e}` } };
|
|
965
|
-
return this.axiosClient.post(
|
|
972
|
+
return this.axiosClient.post(z.refresh, i, r ? Pe(a) : a);
|
|
966
973
|
}
|
|
967
974
|
signIn(e, t, n, r) {
|
|
968
975
|
let i = {
|
|
@@ -970,7 +977,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
970
977
|
device: t,
|
|
971
978
|
os: n
|
|
972
979
|
};
|
|
973
|
-
return this.axiosClient.post(
|
|
980
|
+
return this.axiosClient.post(z.signin, i, V(Tt, "sign-in", e.email ?? e.phone ?? e.username, r));
|
|
974
981
|
}
|
|
975
982
|
signUp(e, t) {
|
|
976
983
|
let { create_tenant: n, anonymous: r } = e, i = {
|
|
@@ -978,16 +985,16 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
978
985
|
create_tenant: n ?? !1,
|
|
979
986
|
anonymous: r ?? !1
|
|
980
987
|
};
|
|
981
|
-
return this.axiosClient.post(
|
|
988
|
+
return this.axiosClient.post(z.signup, i, V(Tt, "sign-up", e.user.email ?? e.user.phone_number ?? e.user.username, t));
|
|
982
989
|
}
|
|
983
990
|
async pkceExchange(e, t) {
|
|
984
991
|
try {
|
|
985
|
-
return await this.axiosClient.post(
|
|
992
|
+
return await this.axiosClient.post(z.pkceExchange, {
|
|
986
993
|
authz_code: e,
|
|
987
994
|
verifier: t
|
|
988
|
-
},
|
|
995
|
+
}, Tt);
|
|
989
996
|
} catch (e) {
|
|
990
|
-
throw
|
|
997
|
+
throw At(e, z.pkceExchange, "error.pkce.exchange", Ot);
|
|
991
998
|
}
|
|
992
999
|
}
|
|
993
1000
|
async passwordlessSignIn(e, t, n, r) {
|
|
@@ -998,68 +1005,68 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
998
1005
|
os: n
|
|
999
1006
|
};
|
|
1000
1007
|
try {
|
|
1001
|
-
return await this.axiosClient.post(
|
|
1008
|
+
return await this.axiosClient.post(z.passwordless, a, V(void 0, "passwordless.start", e.email ?? e.phone, r));
|
|
1002
1009
|
} catch (e) {
|
|
1003
|
-
throw
|
|
1010
|
+
throw At(e, z.passwordless, "error.passwordless.start", kt);
|
|
1004
1011
|
}
|
|
1005
1012
|
}
|
|
1006
1013
|
async passwordlessSignInComplete(e, t) {
|
|
1007
1014
|
try {
|
|
1008
|
-
return await this.axiosClient.post(
|
|
1015
|
+
return await this.axiosClient.post(z.passwordlessComplete, e, V(Tt, void 0, void 0, t));
|
|
1009
1016
|
} catch (e) {
|
|
1010
|
-
throw
|
|
1017
|
+
throw At(e, z.passwordlessComplete, "error.passwordless.complete", kt);
|
|
1011
1018
|
}
|
|
1012
1019
|
}
|
|
1013
1020
|
async passwordlessStatus(e, t) {
|
|
1014
1021
|
try {
|
|
1015
|
-
return await this.axiosClient.post(
|
|
1016
|
-
...
|
|
1017
|
-
timeout:
|
|
1022
|
+
return await this.axiosClient.post(z.passwordlessStatus, e, {
|
|
1023
|
+
...Tt,
|
|
1024
|
+
timeout: Et,
|
|
1018
1025
|
signal: t?.signal
|
|
1019
1026
|
});
|
|
1020
1027
|
} catch (e) {
|
|
1021
|
-
throw
|
|
1028
|
+
throw At(e, z.passwordlessStatus, "error.passwordless.status", Ot);
|
|
1022
1029
|
}
|
|
1023
1030
|
}
|
|
1024
1031
|
async checkRedirectUrl(e) {
|
|
1025
1032
|
try {
|
|
1026
|
-
return (await this.axiosClient.post(
|
|
1033
|
+
return (await this.axiosClient.post(z.redirectCheck, { redirect_url: e })).redirect_url;
|
|
1027
1034
|
} catch (e) {
|
|
1028
|
-
throw
|
|
1035
|
+
throw At(e, z.redirectCheck, "error.redirect.check", kt);
|
|
1029
1036
|
}
|
|
1030
1037
|
}
|
|
1031
1038
|
async passwordlessApprovalInfo(e) {
|
|
1032
1039
|
try {
|
|
1033
|
-
return await this.axiosClient.post(
|
|
1040
|
+
return await this.axiosClient.post(z.passwordlessApprovalInfo, e);
|
|
1034
1041
|
} catch (e) {
|
|
1035
|
-
throw
|
|
1042
|
+
throw At(e, z.passwordlessApprovalInfo, "error.passwordless.approval", kt);
|
|
1036
1043
|
}
|
|
1037
1044
|
}
|
|
1038
1045
|
async passwordlessApprovalDecide(e) {
|
|
1039
1046
|
try {
|
|
1040
|
-
return await this.axiosClient.post(
|
|
1047
|
+
return await this.axiosClient.post(z.passwordlessApprovalDecide, e);
|
|
1041
1048
|
} catch (e) {
|
|
1042
|
-
throw
|
|
1049
|
+
throw At(e, z.passwordlessApprovalDecide, "error.passwordless.approval", kt);
|
|
1043
1050
|
}
|
|
1044
1051
|
}
|
|
1045
1052
|
validateEmailCode(e) {
|
|
1046
|
-
return this.axiosClient.post(
|
|
1053
|
+
return this.axiosClient.post(z.passkeyValidate, {
|
|
1047
1054
|
challenge_id: e.challenge_id,
|
|
1048
1055
|
otp: e.otp
|
|
1049
|
-
},
|
|
1056
|
+
}, Tt);
|
|
1050
1057
|
}
|
|
1051
1058
|
logOut(e, t, n = !1) {
|
|
1052
1059
|
let r = n ? void 0 : {
|
|
1053
1060
|
refresh_token: t,
|
|
1054
1061
|
device: e
|
|
1055
|
-
}, i = n ?
|
|
1062
|
+
}, i = n ? ze.logout : z.logout;
|
|
1056
1063
|
return this.axiosClient.post(i, r);
|
|
1057
1064
|
}
|
|
1058
1065
|
validateSession() {
|
|
1059
|
-
return this.axiosClient.get(
|
|
1066
|
+
return this.axiosClient.get(z.validateSession);
|
|
1060
1067
|
}
|
|
1061
1068
|
sendPasswordResetEmail(e, t) {
|
|
1062
|
-
return this.axiosClient.post(
|
|
1069
|
+
return this.axiosClient.post(z.sendPasswordResetEmail, e, V(void 0, "password-reset.send", e.email ?? e.phone ?? e.username, t));
|
|
1063
1070
|
}
|
|
1064
1071
|
resetPassword(e, t, n, r) {
|
|
1065
1072
|
let i = {
|
|
@@ -1067,7 +1074,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1067
1074
|
scopes: t,
|
|
1068
1075
|
...r ? { code_challenge: r } : {}
|
|
1069
1076
|
};
|
|
1070
|
-
return this.axiosClient.post(
|
|
1077
|
+
return this.axiosClient.post(z.resetPassword, i, { headers: {
|
|
1071
1078
|
[l]: `Bearer ${n}`,
|
|
1072
1079
|
[c]: void 0
|
|
1073
1080
|
} });
|
|
@@ -1078,16 +1085,16 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1078
1085
|
create_tenant: a ?? !1,
|
|
1079
1086
|
device: t,
|
|
1080
1087
|
os: n
|
|
1081
|
-
}, s = r ?
|
|
1082
|
-
return this.axiosClient.post(s, o,
|
|
1088
|
+
}, s = r ? ze.passkeyRegisterStart : z.passkeyRegisterStart;
|
|
1089
|
+
return this.axiosClient.post(s, o, V(void 0, r ? void 0 : "passkey.register", e.passkey_username, i));
|
|
1083
1090
|
}
|
|
1084
1091
|
passkeyRegisterComplete(e, t, n, r = !1, i) {
|
|
1085
1092
|
let a = {
|
|
1086
1093
|
challenge_id: n,
|
|
1087
1094
|
device: t,
|
|
1088
1095
|
passkey_data: e
|
|
1089
|
-
}, o = r ?
|
|
1090
|
-
return this.axiosClient.post(o, a,
|
|
1096
|
+
}, o = r ? ze.passkeyRegisterComplete : z.passkeyRegisterComplete;
|
|
1097
|
+
return this.axiosClient.post(o, a, V(Tt, void 0, void 0, i));
|
|
1091
1098
|
}
|
|
1092
1099
|
passkeyAuthenticateStart(e, t, n, r = !1, i) {
|
|
1093
1100
|
let a = {
|
|
@@ -1095,91 +1102,91 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1095
1102
|
user_id: e.user_id ?? "",
|
|
1096
1103
|
device: t,
|
|
1097
1104
|
os: n
|
|
1098
|
-
}, o = r ?
|
|
1099
|
-
return this.axiosClient.post(o, a,
|
|
1105
|
+
}, o = r ? ze.passkeyAuthenticateStart : z.passkeyAuthenticateStart;
|
|
1106
|
+
return this.axiosClient.post(o, a, V(void 0, r ? void 0 : "passkey.authenticate", void 0, i));
|
|
1100
1107
|
}
|
|
1101
1108
|
passkeyAuthenticateComplete(e, t, n, r = !1, i) {
|
|
1102
1109
|
let a = {
|
|
1103
1110
|
challenge_id: n,
|
|
1104
1111
|
device: t,
|
|
1105
1112
|
passkey_data: e
|
|
1106
|
-
}, o = r ?
|
|
1107
|
-
return this.axiosClient.post(o, a,
|
|
1113
|
+
}, o = r ? ze.passkeyAuthenticateComplete : z.passkeyAuthenticateComplete;
|
|
1114
|
+
return this.axiosClient.post(o, a, V(Tt, void 0, void 0, i));
|
|
1108
1115
|
}
|
|
1109
1116
|
passkeyValidate(e, t, n, r = !1, i) {
|
|
1110
1117
|
let a = {
|
|
1111
1118
|
otp: e,
|
|
1112
1119
|
device: t,
|
|
1113
1120
|
challenge_id: n
|
|
1114
|
-
}, o =
|
|
1115
|
-
!i && r && (o =
|
|
1121
|
+
}, o = z.passkeyValidate;
|
|
1122
|
+
!i && r && (o = ze.passkeyValidate);
|
|
1116
1123
|
let s = i ? { [c]: i } : {};
|
|
1117
1124
|
return this.axiosClient.post(o, a, { headers: s });
|
|
1118
1125
|
}
|
|
1119
1126
|
}, Mt = class {
|
|
1120
1127
|
constructor(e, t, n) {
|
|
1121
|
-
this.axiosClient = new
|
|
1128
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1122
1129
|
}
|
|
1123
1130
|
setAppId(e) {
|
|
1124
1131
|
this.axiosClient.setAppId(e);
|
|
1125
1132
|
}
|
|
1126
1133
|
getCLIAuthStatus(e) {
|
|
1127
|
-
let t =
|
|
1134
|
+
let t = at(z.cliAuthStatus, { sessionId: e });
|
|
1128
1135
|
return this.axiosClient.get(t);
|
|
1129
1136
|
}
|
|
1130
1137
|
completeCLIAuth(e) {
|
|
1131
|
-
return this.axiosClient.post(
|
|
1138
|
+
return this.axiosClient.post(z.cliAuthComplete, e);
|
|
1132
1139
|
}
|
|
1133
1140
|
}, Nt = class {
|
|
1134
1141
|
constructor(e, t, n) {
|
|
1135
|
-
this.axiosClient = new
|
|
1142
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1136
1143
|
}
|
|
1137
1144
|
setAppId(e) {
|
|
1138
1145
|
this.axiosClient.setAppId(e);
|
|
1139
1146
|
}
|
|
1140
1147
|
requestInviteLink(e) {
|
|
1141
|
-
return this.axiosClient.post(
|
|
1148
|
+
return this.axiosClient.post(z.requestInvitation, e);
|
|
1142
1149
|
}
|
|
1143
1150
|
getInvitations(e) {
|
|
1144
1151
|
let t = {};
|
|
1145
1152
|
e.groupID && (t.group_id = e.groupID.toString()), e.skip !== void 0 && (t.skip = e.skip.toString()), e.limit !== void 0 && (t.limit = e.limit.toString());
|
|
1146
|
-
let n =
|
|
1153
|
+
let n = at(z.invitationsPath, { tenantID: e.tenantID });
|
|
1147
1154
|
return this.axiosClient.get(n, { params: t }).then((e) => ({
|
|
1148
1155
|
invites: e.invites,
|
|
1149
1156
|
nextPageSkip: e.next_page_skip
|
|
1150
1157
|
}));
|
|
1151
1158
|
}
|
|
1152
1159
|
deleteInvitation(e) {
|
|
1153
|
-
let t =
|
|
1160
|
+
let t = at(z.invitationDelete, { invitationID: e });
|
|
1154
1161
|
return this.axiosClient.delete(t);
|
|
1155
1162
|
}
|
|
1156
1163
|
resendInvitation(e) {
|
|
1157
|
-
let t =
|
|
1164
|
+
let t = at(z.invitationResend, { invitationID: e });
|
|
1158
1165
|
return this.axiosClient.post(t, {});
|
|
1159
1166
|
}
|
|
1160
1167
|
getInvitationLink(e) {
|
|
1161
|
-
let t =
|
|
1168
|
+
let t = at(z.invitationGetLink, { invitationID: e });
|
|
1162
1169
|
return this.axiosClient.get(t);
|
|
1163
1170
|
}
|
|
1164
1171
|
}, Pt = class {
|
|
1165
1172
|
constructor(e, t, n) {
|
|
1166
|
-
this.axiosClient = new
|
|
1173
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1167
1174
|
}
|
|
1168
1175
|
setAppId(e) {
|
|
1169
1176
|
this.axiosClient.setAppId(e);
|
|
1170
1177
|
}
|
|
1171
1178
|
getSettingsAll() {
|
|
1172
|
-
return this.axiosClient.get(
|
|
1179
|
+
return this.axiosClient.get(z.settingsAll);
|
|
1173
1180
|
}
|
|
1174
1181
|
getPasswordPolicySettings() {
|
|
1175
|
-
return this.axiosClient.get(
|
|
1182
|
+
return this.axiosClient.get(z.settingsPasswordPolicy);
|
|
1176
1183
|
}
|
|
1177
1184
|
getPasskeySettings() {
|
|
1178
|
-
return this.axiosClient.get(
|
|
1185
|
+
return this.axiosClient.get(z.settingsPasskey);
|
|
1179
1186
|
}
|
|
1180
1187
|
}, Ft = class {
|
|
1181
1188
|
constructor(e, t, n) {
|
|
1182
|
-
this.axiosClient = new
|
|
1189
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1183
1190
|
}
|
|
1184
1191
|
setAppId(e) {
|
|
1185
1192
|
this.axiosClient.setAppId(e);
|
|
@@ -1189,108 +1196,108 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1189
1196
|
invite_token: e,
|
|
1190
1197
|
scopes: t
|
|
1191
1198
|
};
|
|
1192
|
-
return this.axiosClient.post(
|
|
1199
|
+
return this.axiosClient.post(z.joinInvitation, n);
|
|
1193
1200
|
}
|
|
1194
1201
|
createTenant(e) {
|
|
1195
1202
|
let t = { name: e };
|
|
1196
|
-
return this.axiosClient.post(
|
|
1203
|
+
return this.axiosClient.post(z.tenantPath, t);
|
|
1197
1204
|
}
|
|
1198
1205
|
getTenantDetails(e) {
|
|
1199
|
-
let t = `${
|
|
1206
|
+
let t = `${z.tenantPath}/${e}`;
|
|
1200
1207
|
return this.axiosClient.get(t);
|
|
1201
1208
|
}
|
|
1202
1209
|
updateTenant(e, t) {
|
|
1203
|
-
let n = `${
|
|
1210
|
+
let n = `${z.tenantPath}/${e}`, r = { name: t };
|
|
1204
1211
|
return this.axiosClient.put(n, r);
|
|
1205
1212
|
}
|
|
1206
1213
|
deleteTenant(e) {
|
|
1207
|
-
let t = `${
|
|
1214
|
+
let t = `${z.tenantPath}/${e}`;
|
|
1208
1215
|
return this.axiosClient.delete(t);
|
|
1209
1216
|
}
|
|
1210
1217
|
getUserTenantMembership() {
|
|
1211
|
-
return this.axiosClient.get(
|
|
1218
|
+
return this.axiosClient.get(z.tenantPath);
|
|
1212
1219
|
}
|
|
1213
1220
|
createGroup(e, t) {
|
|
1214
|
-
let n = `${
|
|
1221
|
+
let n = `${z.tenantPath}/${e}/group`, r = { name: t };
|
|
1215
1222
|
return this.axiosClient.post(n, r);
|
|
1216
1223
|
}
|
|
1217
1224
|
getGroupInfo(e, t) {
|
|
1218
|
-
let n = `${
|
|
1225
|
+
let n = `${z.tenantPath}/${e}/group/${t}`;
|
|
1219
1226
|
return this.axiosClient.get(n);
|
|
1220
1227
|
}
|
|
1221
1228
|
updateGroup(e, t, n) {
|
|
1222
|
-
let r = `${
|
|
1229
|
+
let r = `${z.tenantPath}/${e}/group/${t}`, i = { name: n };
|
|
1223
1230
|
return this.axiosClient.put(r, i);
|
|
1224
1231
|
}
|
|
1225
1232
|
deleteGroup(e, t) {
|
|
1226
|
-
let n = `${
|
|
1233
|
+
let n = `${z.tenantPath}/${e}/group/${t}`;
|
|
1227
1234
|
return this.axiosClient.delete(n);
|
|
1228
1235
|
}
|
|
1229
1236
|
addUserToGroup(e, t, n, r) {
|
|
1230
|
-
let i = `${
|
|
1237
|
+
let i = `${z.tenantPath}/${e}/group/${t}/add`, a = {
|
|
1231
1238
|
user_id: n,
|
|
1232
1239
|
role: r
|
|
1233
1240
|
};
|
|
1234
1241
|
return this.axiosClient.post(i, a);
|
|
1235
1242
|
}
|
|
1236
1243
|
removeUserRolesFromGroup(e, t, n, r) {
|
|
1237
|
-
let i = `${
|
|
1244
|
+
let i = `${z.tenantPath}/${e}/group/${t}/remove_roles`, a = {
|
|
1238
1245
|
user_id: n,
|
|
1239
1246
|
roles: r
|
|
1240
1247
|
};
|
|
1241
1248
|
return this.axiosClient.post(i, a);
|
|
1242
1249
|
}
|
|
1243
1250
|
changeUserRoles(e, t, n, r) {
|
|
1244
|
-
let i = `${
|
|
1251
|
+
let i = `${z.tenantPath}/${e}/group/${t}/change`, a = {
|
|
1245
1252
|
user_id: n,
|
|
1246
1253
|
roles: r
|
|
1247
1254
|
};
|
|
1248
1255
|
return this.axiosClient.post(i, a);
|
|
1249
1256
|
}
|
|
1250
1257
|
deleteUserFromGroup(e, t, n) {
|
|
1251
|
-
let r = `${
|
|
1258
|
+
let r = `${z.tenantPath}/${e}/group/${t}/${n}`;
|
|
1252
1259
|
return this.axiosClient.delete(r);
|
|
1253
1260
|
}
|
|
1254
1261
|
getRolesForTenant(e) {
|
|
1255
|
-
let t = `${
|
|
1262
|
+
let t = `${z.tenantPath}/${e}/role`;
|
|
1256
1263
|
return this.axiosClient.get(t);
|
|
1257
1264
|
}
|
|
1258
1265
|
createRoleForTenant(e, t) {
|
|
1259
|
-
let n = `${
|
|
1266
|
+
let n = `${z.tenantPath}/${e}/role`, r = { name: t };
|
|
1260
1267
|
return this.axiosClient.post(n, r);
|
|
1261
1268
|
}
|
|
1262
1269
|
updateRole(e, t, n) {
|
|
1263
|
-
let r = `${
|
|
1270
|
+
let r = `${z.tenantPath}/${e}/role/${t}`, i = { name: n };
|
|
1264
1271
|
return this.axiosClient.put(r, i);
|
|
1265
1272
|
}
|
|
1266
1273
|
deleteRole(e, t) {
|
|
1267
|
-
let n = `${
|
|
1274
|
+
let n = `${z.tenantPath}/${e}/role/${t}`;
|
|
1268
1275
|
return this.axiosClient.delete(n);
|
|
1269
1276
|
}
|
|
1270
1277
|
deleteUserFromTenant(e, t) {
|
|
1271
|
-
let n = `${
|
|
1278
|
+
let n = `${z.tenantPath}/${e}/user/${t}`;
|
|
1272
1279
|
return this.axiosClient.delete(n);
|
|
1273
1280
|
}
|
|
1274
1281
|
getGroupInvitations(e, t, n, r) {
|
|
1275
|
-
let i = `${
|
|
1282
|
+
let i = `${z.tenantPath}/${e}/group/${t}/invitations`;
|
|
1276
1283
|
return this.axiosClient.get(i, { params: {
|
|
1277
1284
|
limit: n,
|
|
1278
1285
|
skip: r
|
|
1279
1286
|
} });
|
|
1280
1287
|
}
|
|
1281
1288
|
getTenantInvitations(e, t, n) {
|
|
1282
|
-
let r = `${
|
|
1289
|
+
let r = `${z.tenantPath}/${e}/invitations`;
|
|
1283
1290
|
return this.axiosClient.get(r, { params: {
|
|
1284
1291
|
limit: t,
|
|
1285
1292
|
skip: n
|
|
1286
1293
|
} });
|
|
1287
1294
|
}
|
|
1288
1295
|
invalidateInviteById(e, t, n) {
|
|
1289
|
-
let r = `${
|
|
1296
|
+
let r = `${z.tenantPath}/${e}/group/${t}/invite/${n}`;
|
|
1290
1297
|
return this.axiosClient.delete(r);
|
|
1291
1298
|
}
|
|
1292
1299
|
invalidateInviteByEmail(e, t, n) {
|
|
1293
|
-
let r = `${
|
|
1300
|
+
let r = `${z.tenantPath}/${e}/group/${t}/invite/email/${n}`;
|
|
1294
1301
|
return this.axiosClient.delete(r);
|
|
1295
1302
|
}
|
|
1296
1303
|
}, It = (e) => e ? { headers: { Authorization: `Bearer ${e}` } } : {}, Lt = (e) => ({
|
|
@@ -1306,54 +1313,54 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1306
1313
|
"error.2fa.setup.token.rate.limit.exceeded": "RATE_LIMITED"
|
|
1307
1314
|
}, Bt = class {
|
|
1308
1315
|
constructor(e, t, n) {
|
|
1309
|
-
this.axiosClient = new
|
|
1316
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1310
1317
|
}
|
|
1311
1318
|
setAppId(e) {
|
|
1312
1319
|
this.axiosClient.setAppId(e);
|
|
1313
1320
|
}
|
|
1314
1321
|
getStatus(e) {
|
|
1315
|
-
return this.axiosClient.get(
|
|
1322
|
+
return this.axiosClient.get(z.twoFactorStatus, St(e));
|
|
1316
1323
|
}
|
|
1317
1324
|
async beginSetup(e) {
|
|
1318
|
-
return Rt(await this.axiosClient.post(
|
|
1325
|
+
return Rt(await this.axiosClient.post(z.twoFactorSetupBegin, {}, St(e)));
|
|
1319
1326
|
}
|
|
1320
1327
|
confirmSetup(e, t) {
|
|
1321
|
-
return this.axiosClient.post(
|
|
1328
|
+
return this.axiosClient.post(z.twoFactorSetupConfirm, e, St(t));
|
|
1322
1329
|
}
|
|
1323
1330
|
getEnrollment(e) {
|
|
1324
|
-
return this.axiosClient.get(
|
|
1331
|
+
return this.axiosClient.get(z.twoFactorEnrollment, St(e));
|
|
1325
1332
|
}
|
|
1326
1333
|
sendSetupLink(e) {
|
|
1327
|
-
return this.axiosClient.post(
|
|
1334
|
+
return this.axiosClient.post(z.twoFactorEnrollmentEmailLink, void 0, St(e));
|
|
1328
1335
|
}
|
|
1329
1336
|
async beginEnrollment(e) {
|
|
1330
|
-
return Rt(await this.axiosClient.post(
|
|
1337
|
+
return Rt(await this.axiosClient.post(z.twoFactorEnrollmentBegin, void 0, St(e)));
|
|
1331
1338
|
}
|
|
1332
1339
|
confirmEnrollment(e, t) {
|
|
1333
|
-
return this.axiosClient.post(
|
|
1340
|
+
return this.axiosClient.post(z.twoFactorEnrollmentConfirm, t, St(e));
|
|
1334
1341
|
}
|
|
1335
1342
|
verify(e) {
|
|
1336
1343
|
let { tfa_token: t, code: n, trust_device: r } = e;
|
|
1337
|
-
return this.axiosClient.post(
|
|
1344
|
+
return this.axiosClient.post(z.twoFactorVerify, {
|
|
1338
1345
|
code: n,
|
|
1339
1346
|
...r ? { trust_device: !0 } : {}
|
|
1340
1347
|
}, Lt(t));
|
|
1341
1348
|
}
|
|
1342
1349
|
useRecoveryCode(e) {
|
|
1343
1350
|
let { tfa_token: t, recovery_code: n, trust_device: r } = e;
|
|
1344
|
-
return this.axiosClient.post(
|
|
1351
|
+
return this.axiosClient.post(z.twoFactorRecovery, {
|
|
1345
1352
|
recovery_code: n,
|
|
1346
1353
|
...r ? { trust_device: !0 } : {}
|
|
1347
1354
|
}, Lt(t));
|
|
1348
1355
|
}
|
|
1349
1356
|
disable(e) {
|
|
1350
|
-
return this.axiosClient.delete(
|
|
1357
|
+
return this.axiosClient.delete(z.twoFactor, { data: e });
|
|
1351
1358
|
}
|
|
1352
1359
|
regenerateRecoveryCodes(e) {
|
|
1353
|
-
return this.axiosClient.post(
|
|
1360
|
+
return this.axiosClient.post(z.twoFactorRegenerateCodes, e);
|
|
1354
1361
|
}
|
|
1355
1362
|
validateTwoFactorSetupMagicLink(e) {
|
|
1356
|
-
let t = `${
|
|
1363
|
+
let t = `${z.twoFactorSetupMagicLink}/${e}`;
|
|
1357
1364
|
return this.axiosClient.get(t, { transformRequest: [(e, t) => (t && delete t.Authorization, e)] }).then((e) => {
|
|
1358
1365
|
let t = e;
|
|
1359
1366
|
return t.valid === !1 ? {
|
|
@@ -1370,7 +1377,7 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1370
1377
|
appId: t.app_id
|
|
1371
1378
|
};
|
|
1372
1379
|
}).catch((e) => {
|
|
1373
|
-
if (e instanceof
|
|
1380
|
+
if (e instanceof B) return {
|
|
1374
1381
|
success: !1,
|
|
1375
1382
|
error: {
|
|
1376
1383
|
code: zt[e.id] ?? this.mapStatusToErrorCode(e.status),
|
|
@@ -1416,78 +1423,78 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1416
1423
|
}
|
|
1417
1424
|
}
|
|
1418
1425
|
async getAvailableMethods() {
|
|
1419
|
-
return (await this.axiosClient.get(
|
|
1426
|
+
return (await this.axiosClient.get(z.TwoFactorMethodsAvailable))?.available_methods ?? [];
|
|
1420
1427
|
}
|
|
1421
1428
|
async getRegisteredMethods() {
|
|
1422
|
-
return (await this.axiosClient.get(
|
|
1429
|
+
return (await this.axiosClient.get(z.TwoFactorMethodsRegistered))?.registered_methods ?? [];
|
|
1423
1430
|
}
|
|
1424
1431
|
startMethodSetup(e, t) {
|
|
1425
|
-
return this.axiosClient.post(
|
|
1432
|
+
return this.axiosClient.post(z.TwoFactorSetupStart, {
|
|
1426
1433
|
...t,
|
|
1427
1434
|
method: e
|
|
1428
1435
|
});
|
|
1429
1436
|
}
|
|
1430
1437
|
completeMethodSetup(e, t) {
|
|
1431
|
-
return this.axiosClient.post(
|
|
1438
|
+
return this.axiosClient.post(z.TwoFactorSetupComplete, {
|
|
1432
1439
|
...t,
|
|
1433
1440
|
method: e
|
|
1434
1441
|
});
|
|
1435
1442
|
}
|
|
1436
1443
|
removeMethod(e) {
|
|
1437
|
-
let t =
|
|
1444
|
+
let t = at(z.TwoFactorMethodRemove, { id: e });
|
|
1438
1445
|
return this.axiosClient.delete(t);
|
|
1439
1446
|
}
|
|
1440
1447
|
requestChallenge(e, t) {
|
|
1441
|
-
return this.axiosClient.post(
|
|
1448
|
+
return this.axiosClient.post(z.TwoFactorChallenge, e, It(t));
|
|
1442
1449
|
}
|
|
1443
1450
|
verifyV2(e, t) {
|
|
1444
1451
|
let { trust_device: n, ...r } = e;
|
|
1445
|
-
return this.axiosClient.post(
|
|
1452
|
+
return this.axiosClient.post(z.TwoFactorVerifyV2, {
|
|
1446
1453
|
...r,
|
|
1447
1454
|
...n ? { trust_device: !0 } : {}
|
|
1448
1455
|
}, Lt(t));
|
|
1449
1456
|
}
|
|
1450
1457
|
switchToAlternative(e, t) {
|
|
1451
|
-
return this.axiosClient.post(
|
|
1458
|
+
return this.axiosClient.post(z.TwoFactorAlternative, e, It(t));
|
|
1452
1459
|
}
|
|
1453
1460
|
async getTrustedDevices() {
|
|
1454
|
-
return (await this.axiosClient.get(
|
|
1461
|
+
return (await this.axiosClient.get(z.TwoFactorTrustedDevices, { withCredentials: !0 }))?.devices ?? [];
|
|
1455
1462
|
}
|
|
1456
1463
|
revokeTrustedDevice(e) {
|
|
1457
|
-
let t =
|
|
1464
|
+
let t = at(z.TwoFactorTrustedDeviceRevoke, { id: e });
|
|
1458
1465
|
return this.axiosClient.delete(t);
|
|
1459
1466
|
}
|
|
1460
1467
|
}, Vt = class {
|
|
1461
1468
|
constructor(e, t, n) {
|
|
1462
|
-
this.axiosClient = new
|
|
1469
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1463
1470
|
}
|
|
1464
1471
|
setAppId(e) {
|
|
1465
1472
|
this.axiosClient.setAppId(e);
|
|
1466
1473
|
}
|
|
1467
1474
|
startUpgrade(e) {
|
|
1468
|
-
return this.axiosClient.post(
|
|
1475
|
+
return this.axiosClient.post(z.upgradeStart, e, Pe({}));
|
|
1469
1476
|
}
|
|
1470
1477
|
startHostedUpgrade(e) {
|
|
1471
|
-
return this.axiosClient.post(
|
|
1478
|
+
return this.axiosClient.post(z.hostedUpgradeStart, e, { withCredentials: !0 });
|
|
1472
1479
|
}
|
|
1473
1480
|
async commitHostedUpgrade(e) {
|
|
1474
|
-
await this.axiosClient.post(
|
|
1481
|
+
await this.axiosClient.post(z.hostedUpgrade, e, { withCredentials: !0 });
|
|
1475
1482
|
}
|
|
1476
1483
|
}, Ht = class {
|
|
1477
1484
|
constructor(e, t, n) {
|
|
1478
|
-
this.axiosClient = new
|
|
1485
|
+
this.axiosClient = new Ct(e, t, n);
|
|
1479
1486
|
}
|
|
1480
1487
|
setAppId(e) {
|
|
1481
1488
|
this.axiosClient.setAppId(e);
|
|
1482
1489
|
}
|
|
1483
1490
|
getUserPasskeys() {
|
|
1484
|
-
return this.axiosClient.get(
|
|
1491
|
+
return this.axiosClient.get(z.userPasskey);
|
|
1485
1492
|
}
|
|
1486
1493
|
renameUserPasskey(e, t) {
|
|
1487
|
-
return this.axiosClient.patch(`${
|
|
1494
|
+
return this.axiosClient.patch(`${z.userPasskey}/${t}`, { name: e });
|
|
1488
1495
|
}
|
|
1489
1496
|
deleteUserPasskey(e) {
|
|
1490
|
-
return this.axiosClient.delete(`${
|
|
1497
|
+
return this.axiosClient.delete(`${z.userPasskey}/${e}`);
|
|
1491
1498
|
}
|
|
1492
1499
|
addUserPasskeyStart({ relyingPartyId: e, deviceId: t, os: n, passkeyDisplayName: r, passkeyUsername: i }) {
|
|
1493
1500
|
let a = {
|
|
@@ -1497,23 +1504,23 @@ var at = /* @__PURE__ */ function(e) {
|
|
|
1497
1504
|
deviceId: t,
|
|
1498
1505
|
os: n
|
|
1499
1506
|
};
|
|
1500
|
-
return this.axiosClient.post(
|
|
1507
|
+
return this.axiosClient.post(z.addUserPasskey, a);
|
|
1501
1508
|
}
|
|
1502
1509
|
addUserPasskeyComplete(e, t, n) {
|
|
1503
|
-
return this.axiosClient.post(
|
|
1510
|
+
return this.axiosClient.post(z.completeAddUserPasskey, {
|
|
1504
1511
|
challenge_id: n,
|
|
1505
1512
|
device: t,
|
|
1506
1513
|
passkey_data: e
|
|
1507
1514
|
});
|
|
1508
1515
|
}
|
|
1509
1516
|
getUserSessions() {
|
|
1510
|
-
return this.axiosClient.get(
|
|
1517
|
+
return this.axiosClient.get(z.userSessions);
|
|
1511
1518
|
}
|
|
1512
1519
|
revokeUserSession(e) {
|
|
1513
|
-
return this.axiosClient.delete(`${
|
|
1520
|
+
return this.axiosClient.delete(`${z.userSessions}/${encodeURIComponent(e)}`);
|
|
1514
1521
|
}
|
|
1515
1522
|
revokeOtherUserSessions() {
|
|
1516
|
-
return this.axiosClient.post(
|
|
1523
|
+
return this.axiosClient.post(z.userSessionsRevokeOthers);
|
|
1517
1524
|
}
|
|
1518
1525
|
}, Ut = 10, Wt = 20, Gt = class extends Error {
|
|
1519
1526
|
constructor(e) {
|
|
@@ -2052,7 +2059,7 @@ async function Un(e, t, n, r = Infinity) {
|
|
|
2052
2059
|
return null;
|
|
2053
2060
|
}
|
|
2054
2061
|
// lib/anti-bot/solve.ts
|
|
2055
|
-
var Wn = "The browser check could not be completed. Try again later.", Gn = "Verification failed. Try again.", Kn = 6e4, qn = class extends Error {}, Jn = (e, t, n, r) => new
|
|
2062
|
+
var Wn = "The browser check could not be completed. Try again later.", Gn = "Verification failed. Try again.", Kn = 6e4, qn = class extends Error {}, Jn = (e, t, n, r) => new B({
|
|
2056
2063
|
id: e,
|
|
2057
2064
|
message: t,
|
|
2058
2065
|
status: 0,
|
|
@@ -2068,8 +2075,8 @@ var Wn = "The browser check could not be completed. Try again later.", Gn = "Ver
|
|
|
2068
2075
|
}), i.addEventListener("error", () => o(() => r(/* @__PURE__ */ Error("Anti-bot worker failed")))), i.addEventListener("messageerror", () => o(() => r(/* @__PURE__ */ Error("Anti-bot worker message failed")))), i.postMessage(t);
|
|
2069
2076
|
});
|
|
2070
2077
|
async function Xn(e, t, n = "anti-bot") {
|
|
2071
|
-
if (e.algorithm !== "SHA-256") throw Jn(
|
|
2072
|
-
if (!Number.isSafeInteger(e.max) || e.max < 0 || e.max > 5e6) throw Jn(
|
|
2078
|
+
if (e.algorithm !== "SHA-256") throw Jn(Xe, Wn, n);
|
|
2079
|
+
if (!Number.isSafeInteger(e.max) || e.max < 0 || e.max > 5e6) throw Jn(Xe, Gn, n);
|
|
2073
2080
|
let r = {
|
|
2074
2081
|
salt: e.salt,
|
|
2075
2082
|
challenge: e.challenge,
|
|
@@ -2078,9 +2085,9 @@ async function Xn(e, t, n = "anti-bot") {
|
|
|
2078
2085
|
try {
|
|
2079
2086
|
i = t && typeof Worker < "u" ? await Yn(t, r) : await Un(r.salt, r.challenge, r.max, Date.now() + Kn);
|
|
2080
2087
|
} catch (e) {
|
|
2081
|
-
throw Jn(
|
|
2088
|
+
throw Jn(Xe, e instanceof qn || e instanceof Hn ? Gn : Wn, n, e);
|
|
2082
2089
|
}
|
|
2083
|
-
if (i === null) throw Jn(
|
|
2090
|
+
if (i === null) throw Jn(Xe, Wn, n);
|
|
2084
2091
|
return i;
|
|
2085
2092
|
}
|
|
2086
2093
|
function Zn(e, t) {
|
|
@@ -2106,9 +2113,9 @@ function er(e) {
|
|
|
2106
2113
|
operation: t.operation
|
|
2107
2114
|
});
|
|
2108
2115
|
} catch (e) {
|
|
2109
|
-
throw Jn(
|
|
2116
|
+
throw Jn(Ye, $n, t.operation, e);
|
|
2110
2117
|
}
|
|
2111
|
-
if (typeof n != "string" || n === "") throw Jn(
|
|
2118
|
+
if (typeof n != "string" || n === "") throw Jn(Ye, $n, t.operation);
|
|
2112
2119
|
return n;
|
|
2113
2120
|
}, r = async (t) => {
|
|
2114
2121
|
let n = await e.fetchChallenge({
|
|
@@ -2133,7 +2140,7 @@ function er(e) {
|
|
|
2133
2140
|
if (s) c = await r(i);
|
|
2134
2141
|
else {
|
|
2135
2142
|
let e = t;
|
|
2136
|
-
if (!e) throw Jn(
|
|
2143
|
+
if (!e) throw Jn(Je, Qn, i.operation);
|
|
2137
2144
|
c = await n(e, i);
|
|
2138
2145
|
}
|
|
2139
2146
|
return e.store.notify(G.AntiBotSolved, {
|
|
@@ -2668,7 +2675,7 @@ var J = {
|
|
|
2668
2675
|
"error.refresh.successor_timeout": "The refresh token was already used and no successor arrived",
|
|
2669
2676
|
"error.refresh.identity_changed": "Storage holds another user's tokens",
|
|
2670
2677
|
"error.refresh.disposed": "The Passflow instance was disposed"
|
|
2671
|
-
}, Y = class extends
|
|
2678
|
+
}, Y = class extends B {
|
|
2672
2679
|
constructor(e, t = {}) {
|
|
2673
2680
|
super({
|
|
2674
2681
|
id: e,
|
|
@@ -2795,44 +2802,46 @@ function ri(e) {
|
|
|
2795
2802
|
if (!t || t.fp === e.fp || !ee()) return !1;
|
|
2796
2803
|
let n = x();
|
|
2797
2804
|
return !e.sub || n !== e.sub || t.iat === void 0 || e.iat === void 0 ? !1 : t.sid !== e.sid || o.isAfter(t, e);
|
|
2798
|
-
}, C = (e) => {
|
|
2805
|
+
}, C = (e) => !!e?.access_token && !e.refresh_token && !n.getTokens()?.refresh_token, w = (e) => {
|
|
2799
2806
|
let t = x();
|
|
2800
2807
|
return d.some((n) => n.seq > e && (!n.sub || !t || n.sub === t));
|
|
2801
|
-
},
|
|
2808
|
+
}, T = () => {
|
|
2802
2809
|
let e = x();
|
|
2803
2810
|
for (let t = u.length - 1; t >= 0; t--) {
|
|
2804
2811
|
let n = u[t];
|
|
2805
2812
|
if (!n || n.seq <= f) break;
|
|
2806
2813
|
if (!n.sub || !e || n.sub === e) return n;
|
|
2807
2814
|
}
|
|
2808
|
-
}, T = () => {
|
|
2809
|
-
if (!ee()) return "end";
|
|
2810
|
-
let e = c?.seq ?? 0, t = w();
|
|
2811
|
-
return C(t ? Math.min(e, t.seq) : e) ? "end" : t ? S(t) ? "keep" : "end" : s ? "wait" : "end";
|
|
2812
2815
|
}, E = () => {
|
|
2816
|
+
if (!ee()) return "end";
|
|
2817
|
+
let e = c?.seq ?? 0, t = T();
|
|
2818
|
+
return w(t ? Math.min(e, t.seq) : e) ? "end" : t ? S(t) ? "keep" : "end" : s ? "wait" : "end";
|
|
2819
|
+
}, D = () => {
|
|
2813
2820
|
h?.(), h = void 0;
|
|
2814
|
-
},
|
|
2815
|
-
let t =
|
|
2816
|
-
t === "wait" && e && (t = "end"), t !== "wait" &&
|
|
2817
|
-
h = void 0
|
|
2821
|
+
}, te = (e = !1) => {
|
|
2822
|
+
let t = E();
|
|
2823
|
+
t === "wait" && e && (t = "end"), t !== "wait" && D(), t === "wait" && !h && (h = r(() => {
|
|
2824
|
+
h = void 0;
|
|
2825
|
+
let e = y();
|
|
2826
|
+
e?.refresh_token || C(e) ? A() : te(!0) === "end" && s?.("emptied");
|
|
2818
2827
|
}, ur));
|
|
2819
|
-
let n = t === "keep" ?
|
|
2828
|
+
let n = t === "keep" ? T() : void 0;
|
|
2820
2829
|
return n && (m = Math.max(m, n.seq)), n && g !== n.fp && (g = n.fp, a(`[passflow] The shared token storage was emptied by the end of the session of ${n.fp}, a refresh token the ${b()?.fp ?? "(none)"} this tab holds is ahead of: keeping it. Nothing is refreshed until the storage holds a token again.`)), t;
|
|
2821
|
-
},
|
|
2830
|
+
}, O = (e) => e.held !== void 0 && b()?.fp === e.held.cachedFp, ne = (e) => {
|
|
2822
2831
|
let t = b();
|
|
2823
2832
|
return !!t && !o.isRetired(t) && !o.isEnded(t) && o.isAfter(t, e);
|
|
2824
|
-
},
|
|
2825
|
-
if (!
|
|
2833
|
+
}, re = (e) => {
|
|
2834
|
+
if (!ne(e)) return !1;
|
|
2826
2835
|
if (o.isRetired(e)) return !0;
|
|
2827
2836
|
let t = b();
|
|
2828
2837
|
return e.iat !== void 0 && t?.iat !== void 0 && t.sid === e.sid;
|
|
2829
|
-
},
|
|
2838
|
+
}, ie = (e, t) => o.isForward(e, t) ? !0 : !!e && !!t && e.iat !== void 0 && e.sid !== t.sid && o.isRetired(t) && !o.isRetired(e) && !o.isEnded(e), ae = (e) => {
|
|
2830
2839
|
let t = b();
|
|
2831
2840
|
t && t.fp !== Jr(e.refresh_token) && o.retire(t), n.setTokensCache(e);
|
|
2832
|
-
},
|
|
2841
|
+
}, oe = (e) => {
|
|
2833
2842
|
let t = y(), n = t?.refresh_token;
|
|
2834
2843
|
if (n === e.refreshToken) return null;
|
|
2835
|
-
if (!t || !n) return
|
|
2844
|
+
if (!t || !n) return te() === "end" ? {
|
|
2836
2845
|
kind: "ended",
|
|
2837
2846
|
cause: "emptied"
|
|
2838
2847
|
} : {
|
|
@@ -2854,32 +2863,33 @@ function ri(e) {
|
|
|
2854
2863
|
};
|
|
2855
2864
|
o.retire(e.order);
|
|
2856
2865
|
let a = b();
|
|
2857
|
-
return
|
|
2866
|
+
return ie(i, a) || i?.fp === a?.fp && !o.isRetired(i) ? (ae(t), {
|
|
2858
2867
|
kind: "superseded",
|
|
2859
2868
|
adopted: !0
|
|
2860
2869
|
}) : {
|
|
2861
2870
|
kind: "superseded",
|
|
2862
2871
|
adopted: !1
|
|
2863
2872
|
};
|
|
2864
|
-
},
|
|
2873
|
+
}, k = (e) => S(e) ? {
|
|
2865
2874
|
kind: "superseded",
|
|
2866
2875
|
adopted: !1
|
|
2867
2876
|
} : {
|
|
2868
2877
|
kind: "ended",
|
|
2869
2878
|
cause: "ended"
|
|
2870
|
-
},
|
|
2879
|
+
}, A = () => {
|
|
2871
2880
|
let t = y();
|
|
2872
|
-
if (!t?.refresh_token) {
|
|
2873
|
-
|
|
2881
|
+
if (!t?.refresh_token && !C(t)) {
|
|
2882
|
+
te() === "end" && s?.("emptied");
|
|
2874
2883
|
return;
|
|
2875
2884
|
}
|
|
2876
|
-
|
|
2885
|
+
D();
|
|
2877
2886
|
let n = i(), r = Z(t);
|
|
2878
2887
|
n && r && n !== r ? s?.("identity-changed") : e.onStoredSessionSeen?.();
|
|
2879
|
-
},
|
|
2888
|
+
}, j = !!s || !!e.onStoredSessionSeen, M = j && e.onStorageChange ? e.onStorageChange(A) : void 0, N = j && e.onWake ? e.onWake(A) : void 0, se = () => {
|
|
2880
2889
|
let e = y();
|
|
2890
|
+
if (C(e)) return "held";
|
|
2881
2891
|
if (!e?.refresh_token) {
|
|
2882
|
-
if (
|
|
2892
|
+
if (te() === "end") throw new Qr("emptied");
|
|
2883
2893
|
return "held";
|
|
2884
2894
|
}
|
|
2885
2895
|
let t = n.getTokens();
|
|
@@ -2892,13 +2902,13 @@ function ri(e) {
|
|
|
2892
2902
|
throw new Qr("ended");
|
|
2893
2903
|
}
|
|
2894
2904
|
let c = X(t?.refresh_token);
|
|
2895
|
-
return
|
|
2896
|
-
},
|
|
2905
|
+
return ie(s, c) ? (ae(e), "adopted") : s && c && s.sid !== c.sid ? "send" : s && ne(s) ? "held" : "send";
|
|
2906
|
+
}, ce = (e) => {
|
|
2897
2907
|
let t = i(), r = ei(e);
|
|
2898
2908
|
if (t && r && t !== r) return { kind: "identity-changed" };
|
|
2899
2909
|
let a = X(e) ?? { fp: e };
|
|
2900
2910
|
if (o.isEnded(a)) return S(a) ? { kind: "superseded" } : { kind: "ended" };
|
|
2901
|
-
if (o.isRetired(a) &&
|
|
2911
|
+
if (o.isRetired(a) && ne(a)) return { kind: "superseded" };
|
|
2902
2912
|
let s = {
|
|
2903
2913
|
refreshToken: e,
|
|
2904
2914
|
order: a
|
|
@@ -2907,11 +2917,11 @@ function ri(e) {
|
|
|
2907
2917
|
kind: "send",
|
|
2908
2918
|
sent: s
|
|
2909
2919
|
};
|
|
2910
|
-
},
|
|
2911
|
-
if (o.isEnded(e.order)) return
|
|
2912
|
-
let i =
|
|
2920
|
+
}, P = (e, r) => {
|
|
2921
|
+
if (o.isEnded(e.order)) return k(e.order);
|
|
2922
|
+
let i = oe(e);
|
|
2913
2923
|
if (i) return i;
|
|
2914
|
-
if (!
|
|
2924
|
+
if (!O(e) && re(e.order)) return o.retire(e.order), a(`[passflow] Refused to save a late refresh result: it rotated ${e.order.fp} into ${Jr(r.refresh_token) ?? "(no refresh token)"}, but this tab already holds ${b()?.fp ?? "(none)"}, a later successor of ${e.order.fp}. Neither saved nor adopted.`), {
|
|
2915
2925
|
kind: "superseded",
|
|
2916
2926
|
adopted: !1
|
|
2917
2927
|
};
|
|
@@ -2925,16 +2935,16 @@ function ri(e) {
|
|
|
2925
2935
|
kind: "superseded",
|
|
2926
2936
|
adopted: !1
|
|
2927
2937
|
}) : (o.retire(e.order), t.saveTokens(r), n.setTokensCache(r), { kind: "saved" });
|
|
2928
|
-
},
|
|
2929
|
-
if (o.isEnded(e.order)) return
|
|
2930
|
-
let n =
|
|
2938
|
+
}, F = (e, t) => {
|
|
2939
|
+
if (o.isEnded(e.order)) return k(e.order);
|
|
2940
|
+
let n = oe(e);
|
|
2931
2941
|
if (n) return n.kind === "identity-changed" ? { kind: "identity-changed" } : n;
|
|
2932
|
-
if (o.isRetired(e.order) &&
|
|
2942
|
+
if (o.isRetired(e.order) && ne(e.order)) return {
|
|
2933
2943
|
kind: "superseded",
|
|
2934
2944
|
adopted: !1
|
|
2935
2945
|
};
|
|
2936
2946
|
let r = Br(t), i = r.kind === "blocked" || r.kind === "auth";
|
|
2937
|
-
return
|
|
2947
|
+
return O(e) && i ? (o.retire(e.order), _ = e.order, {
|
|
2938
2948
|
kind: "own",
|
|
2939
2949
|
failure: r,
|
|
2940
2950
|
heldRefused: !0
|
|
@@ -2943,7 +2953,7 @@ function ri(e) {
|
|
|
2943
2953
|
failure: r,
|
|
2944
2954
|
heldRefused: !1
|
|
2945
2955
|
});
|
|
2946
|
-
},
|
|
2956
|
+
}, I = (e) => {
|
|
2947
2957
|
if (!ni(e)) return !1;
|
|
2948
2958
|
let { from: t, fromIat: r, fromSid: a, to: c, tokens: l } = e;
|
|
2949
2959
|
if (typeof t != "string" || typeof c != "string" || !ni(l)) return !1;
|
|
@@ -2965,31 +2975,31 @@ function ri(e) {
|
|
|
2965
2975
|
}
|
|
2966
2976
|
return !0;
|
|
2967
2977
|
};
|
|
2968
|
-
return g?.fp === c ? _() : !o.isForward(h, g) || g?.fp !== t && Jr(d.refresh_token) !== c ? !1 : (
|
|
2969
|
-
},
|
|
2978
|
+
return g?.fp === c ? _() : !o.isForward(h, g) || g?.fp !== t && Jr(d.refresh_token) !== c ? !1 : (ae({ ...u }), _());
|
|
2979
|
+
}, le = (e) => {
|
|
2970
2980
|
if (!e || !_) return !1;
|
|
2971
2981
|
let t = _;
|
|
2972
2982
|
return e.fp === t.fp || o.isEnded(e) || o.isRetired(e) ? !1 : e.iat !== void 0 && t.iat !== void 0 && e.sid !== t.sid || o.isAfter(e, t);
|
|
2973
|
-
},
|
|
2983
|
+
}, ue = () => {
|
|
2974
2984
|
let e = b();
|
|
2975
2985
|
if (!e) return !1;
|
|
2976
|
-
if (
|
|
2986
|
+
if (le(e)) return !0;
|
|
2977
2987
|
let t = y(), r = X(t?.refresh_token);
|
|
2978
|
-
if (!t || !r || r.fp === e.fp || !
|
|
2988
|
+
if (!t || !r || r.fp === e.fp || !le(r) || !ie(r, e)) return !1;
|
|
2979
2989
|
let a = i() ?? Z(n.getTokens()), o = Z(t);
|
|
2980
|
-
return a && o && a !== o ? (s?.("identity-changed"), !1) : (
|
|
2981
|
-
},
|
|
2990
|
+
return a && o && a !== o ? (s?.("identity-changed"), !1) : (ae(t), !0);
|
|
2991
|
+
}, de = (e) => {
|
|
2982
2992
|
let t = X(e?.refresh_token), n = {}, r = i() ?? Z(e);
|
|
2983
2993
|
return t?.fp !== void 0 && (n.fp = t.fp), r !== void 0 && (n.sub = r), t?.sid !== void 0 && (n.sid = t.sid), t?.iat !== void 0 && (n.iat = t.iat), n;
|
|
2984
2994
|
};
|
|
2985
2995
|
return {
|
|
2986
2996
|
lineage: o,
|
|
2987
|
-
checkStoredBeforeSend:
|
|
2988
|
-
beginSend:
|
|
2989
|
-
commitSave:
|
|
2990
|
-
judgeFailure:
|
|
2991
|
-
adoptTokens:
|
|
2992
|
-
adoptSuccessor:
|
|
2997
|
+
checkStoredBeforeSend: se,
|
|
2998
|
+
beginSend: ce,
|
|
2999
|
+
commitSave: P,
|
|
3000
|
+
judgeFailure: F,
|
|
3001
|
+
adoptTokens: I,
|
|
3002
|
+
adoptSuccessor: ue,
|
|
2993
3003
|
beginHeldSend: () => {
|
|
2994
3004
|
let e = X(y()?.refresh_token);
|
|
2995
3005
|
if (!e || o.isRetired(e) || o.isEnded(e)) return v = void 0, !1;
|
|
@@ -3012,10 +3022,10 @@ function ri(e) {
|
|
|
3012
3022
|
...t,
|
|
3013
3023
|
fp: t.fp,
|
|
3014
3024
|
seq: l
|
|
3015
|
-
}), u.length > 4 && u.shift()), b() && n &&
|
|
3025
|
+
}), u.length > 4 && u.shift()), b() && n && te() === "end" && s?.("emptied");
|
|
3016
3026
|
},
|
|
3017
|
-
session: () =>
|
|
3018
|
-
storedSession: () =>
|
|
3027
|
+
session: () => de(n.getTokens()),
|
|
3028
|
+
storedSession: () => de(y()),
|
|
3019
3029
|
dropSession: () => {
|
|
3020
3030
|
n.setTokensCache(void 0), n.stopTokenCheck?.();
|
|
3021
3031
|
},
|
|
@@ -3026,7 +3036,7 @@ function ri(e) {
|
|
|
3026
3036
|
return n.fp === e.fp || r && n.iat !== void 0 && e.iat !== void 0 && n.iat < e.iat ? (t.deleteTokens(), !0) : !1;
|
|
3027
3037
|
},
|
|
3028
3038
|
stop: () => {
|
|
3029
|
-
|
|
3039
|
+
M?.(), N?.(), D();
|
|
3030
3040
|
}
|
|
3031
3041
|
};
|
|
3032
3042
|
}
|
|
@@ -3094,9 +3104,9 @@ function fi(e) {
|
|
|
3094
3104
|
schedule: (e, t) => o.setTimeout(e, t),
|
|
3095
3105
|
onStorageChange: (e) => (ne.add(e), () => ne.delete(e)),
|
|
3096
3106
|
onWake: (e) => (re.add(e), () => re.delete(e)),
|
|
3097
|
-
onSessionLost: (e) =>
|
|
3107
|
+
onSessionLost: (e) => pe(e),
|
|
3098
3108
|
onStoredSessionSeen: () => {
|
|
3099
|
-
u.kind === "blocked-wait" &&
|
|
3109
|
+
u.kind === "blocked-wait" && Ae();
|
|
3100
3110
|
},
|
|
3101
3111
|
warn: (e) => s.warn(e)
|
|
3102
3112
|
}), A = (e) => ({
|
|
@@ -3113,11 +3123,11 @@ function fi(e) {
|
|
|
3113
3123
|
return e.fresh.push(n), n.deferred.promise;
|
|
3114
3124
|
}, N = (e, t, n = !1) => {
|
|
3115
3125
|
e.plain.resolve(D());
|
|
3116
|
-
for (let r of e.fresh) n || t !== void 0 && t >= r.callTime ? r.deferred.resolve(D()) :
|
|
3126
|
+
for (let r of e.fresh) n || t !== void 0 && t >= r.callTime ? r.deferred.resolve(D()) : z("refresh-token", r.callTime).then(r.deferred.resolve, r.deferred.reject);
|
|
3117
3127
|
e.fresh = [];
|
|
3118
3128
|
}, se = (e, t, n) => {
|
|
3119
3129
|
e.plain.reject(t);
|
|
3120
|
-
for (let r of e.fresh) n !== void 0 && n < r.callTime ?
|
|
3130
|
+
for (let r of e.fresh) n !== void 0 && n < r.callTime ? z("refresh-token", r.callTime).then(r.deferred.resolve, r.deferred.reject) : r.deferred.reject(t);
|
|
3121
3131
|
e.fresh = [];
|
|
3122
3132
|
}, ce = (e, t) => {
|
|
3123
3133
|
if (e) {
|
|
@@ -3160,7 +3170,7 @@ function fi(e) {
|
|
|
3160
3170
|
origin: r
|
|
3161
3171
|
};
|
|
3162
3172
|
n !== void 0 && (i.nextRetryAt = n), t("refresh:failing", i);
|
|
3163
|
-
},
|
|
3173
|
+
}, ue = (e, t) => {
|
|
3164
3174
|
let n = r.getTokens(), i = Jr(n?.refresh_token);
|
|
3165
3175
|
e.fp && i && l.post({
|
|
3166
3176
|
type: "tokens-refreshed",
|
|
@@ -3171,14 +3181,14 @@ function fi(e) {
|
|
|
3171
3181
|
to: i,
|
|
3172
3182
|
...t === void 0 ? {} : { sentAt: t }
|
|
3173
3183
|
});
|
|
3174
|
-
},
|
|
3184
|
+
}, de = () => {
|
|
3175
3185
|
p || (p = !0, s.warn(Cr));
|
|
3176
|
-
},
|
|
3186
|
+
}, fe = (e) => {
|
|
3177
3187
|
(e.kind === "backoff" || e.kind === "blocked-wait") && e.cancel();
|
|
3178
|
-
},
|
|
3188
|
+
}, L = (e, n) => {
|
|
3179
3189
|
if (u.kind === "ended") return;
|
|
3180
3190
|
let r = j(u);
|
|
3181
|
-
|
|
3191
|
+
fe(u);
|
|
3182
3192
|
let a = k.session(), o = O();
|
|
3183
3193
|
switch (d += 1, m = 0, h = 0, g = void 0, _ = void 0, v = void 0, l.setRetryInfo(void 0), C || l.release(), b = {
|
|
3184
3194
|
...a,
|
|
@@ -3223,7 +3233,7 @@ function fi(e) {
|
|
|
3223
3233
|
case "disposed": break;
|
|
3224
3234
|
default: oi(e);
|
|
3225
3235
|
}
|
|
3226
|
-
},
|
|
3236
|
+
}, R = () => {
|
|
3227
3237
|
if (u.kind !== "ended" || u.cause === "disposed" || f || T() !== "json") return;
|
|
3228
3238
|
let e = n.getTokens(), i = X(e?.refresh_token);
|
|
3229
3239
|
if (!e?.refresh_token || !e.access_token || !i || k.lineage.isEnded(i) || k.lineage.isRetired(i)) return;
|
|
@@ -3235,13 +3245,13 @@ function fi(e) {
|
|
|
3235
3245
|
tokens: s,
|
|
3236
3246
|
origin: "other-tab"
|
|
3237
3247
|
});
|
|
3238
|
-
}, fe = (e) => {
|
|
3239
|
-
u.kind === "ended" || f || T() === "json" && (R(e === "emptied" ? "emptied" : "identity-changed"), e === "identity-changed" && z());
|
|
3240
3248
|
}, pe = (e) => {
|
|
3241
|
-
|
|
3242
|
-
}, me = () => {
|
|
3249
|
+
u.kind === "ended" || f || T() === "json" && (L(e === "emptied" ? "emptied" : "identity-changed"), e === "identity-changed" && R());
|
|
3250
|
+
}, me = (e) => {
|
|
3251
|
+
e instanceof $r ? (L("identity-changed"), R()) : e instanceof Qr ? L(e.cause === "emptied" ? "emptied" : "stored-ended") : L("stored-ended", e);
|
|
3252
|
+
}, he = () => {
|
|
3243
3253
|
u = { kind: "idle" }, C || l.release();
|
|
3244
|
-
},
|
|
3254
|
+
}, ge = (e) => !e.from || T() !== "json" || e.from === E() || e.from === Jr(n.getTokens()?.refresh_token), _e = (e) => {
|
|
3245
3255
|
let t = g;
|
|
3246
3256
|
if (!t) return;
|
|
3247
3257
|
if (!l.holding) {
|
|
@@ -3258,10 +3268,10 @@ function fi(e) {
|
|
|
3258
3268
|
pending: e,
|
|
3259
3269
|
dueAt: r,
|
|
3260
3270
|
cancel: o.setTimeout(() => {
|
|
3261
|
-
n === d &&
|
|
3271
|
+
n === d && ve();
|
|
3262
3272
|
}, Math.max(0, r - w()))
|
|
3263
3273
|
};
|
|
3264
|
-
},
|
|
3274
|
+
}, ve = () => {
|
|
3265
3275
|
if (u.kind !== "backoff" || C) return;
|
|
3266
3276
|
let { pending: e, dueAt: t } = u;
|
|
3267
3277
|
!l.holding || l.foreignHolderHeard() || w() - t > 2e4 ? (l.release(), u = {
|
|
@@ -3270,18 +3280,18 @@ function fi(e) {
|
|
|
3270
3280
|
}, l.request((g?.nextAt ?? w()) + K)) : (u = {
|
|
3271
3281
|
kind: "waiting",
|
|
3272
3282
|
pending: e
|
|
3273
|
-
},
|
|
3274
|
-
}, ve = () => {
|
|
3275
|
-
u.kind === "idle" && l.release();
|
|
3283
|
+
}, be() || ye());
|
|
3276
3284
|
}, ye = () => {
|
|
3285
|
+
u.kind === "idle" && l.release();
|
|
3286
|
+
}, be = () => {
|
|
3277
3287
|
if (u.kind !== "waiting") return !1;
|
|
3278
3288
|
let e = u.pending;
|
|
3279
|
-
if (T() !== "json") return
|
|
3289
|
+
if (T() !== "json") return xe(e);
|
|
3280
3290
|
let t = k.session(), n;
|
|
3281
3291
|
try {
|
|
3282
3292
|
n = k.checkStoredBeforeSend();
|
|
3283
3293
|
} catch (e) {
|
|
3284
|
-
return
|
|
3294
|
+
return me(e), !1;
|
|
3285
3295
|
}
|
|
3286
3296
|
if (n === "held") {
|
|
3287
3297
|
let t = E();
|
|
@@ -3291,25 +3301,25 @@ function fi(e) {
|
|
|
3291
3301
|
}), u = { kind: "idle" }, N(e, void 0, !0), !1) : (v = {
|
|
3292
3302
|
fp: t,
|
|
3293
3303
|
at: w()
|
|
3294
|
-
}, k.beginHeldSend() ?
|
|
3304
|
+
}, k.beginHeldSend() ? Se(e, "held") : (u = { kind: "idle" }, N(e, void 0, !0), !1));
|
|
3295
3305
|
}
|
|
3296
3306
|
if (v = void 0, n === "adopted") {
|
|
3297
|
-
if (I("adopted", "other-tab"),
|
|
3307
|
+
if (I("adopted", "other-tab"), ue(t), e.fresh.length === 0) return u = { kind: "idle" }, N(e, void 0), !1;
|
|
3298
3308
|
e.plain.resolve(D());
|
|
3299
3309
|
}
|
|
3300
|
-
return g && !
|
|
3301
|
-
},
|
|
3310
|
+
return g && !ge(g) && (g = void 0), g && g.nextAt > w() ? (m = g.attempt, h = g.strikes, g.failingSince !== void 0 && le(g.failingSince, g.nextAt, "other-tab"), _e(e), !0) : (g && (m = g.attempt, h = g.strikes), Se(e, e.trigger === "held" ? "refresh-token" : e.trigger));
|
|
3311
|
+
}, xe = (e) => y !== void 0 && y >= e.startedAt ? (r.setTokensCache(n.getTokens()), I("adopted", "other-tab"), u = { kind: "idle" }, N(e, y), !1) : g && g.nextAt > w() ? (m = g.attempt, h = g.strikes, _e(e), !0) : Ce(e, e.trigger, void 0, void 0), Se = (e, t) => {
|
|
3302
3312
|
let r = n.getTokens(), i = r?.refresh_token;
|
|
3303
3313
|
if (!i) return u = { kind: "idle" }, N(e, void 0, !0), !1;
|
|
3304
3314
|
let a = k.beginSend(i);
|
|
3305
3315
|
switch (a.kind) {
|
|
3306
3316
|
case "superseded": return k.endHeldSend(), I("adopted", "other-tab"), u = { kind: "idle" }, N(e, void 0), !1;
|
|
3307
|
-
case "ended": return k.endHeldSend(),
|
|
3308
|
-
case "identity-changed": return k.endHeldSend(),
|
|
3309
|
-
case "send": return
|
|
3317
|
+
case "ended": return k.endHeldSend(), L("stored-ended"), !1;
|
|
3318
|
+
case "identity-changed": return k.endHeldSend(), L("identity-changed"), R(), !1;
|
|
3319
|
+
case "send": return Ce(e, t, a.sent, r);
|
|
3310
3320
|
default: return oi(a);
|
|
3311
3321
|
}
|
|
3312
|
-
},
|
|
3322
|
+
}, Ce = (e, n, r, a) => {
|
|
3313
3323
|
let o = {
|
|
3314
3324
|
generation: d,
|
|
3315
3325
|
sentAt: w(),
|
|
@@ -3328,27 +3338,27 @@ function fi(e) {
|
|
|
3328
3338
|
c = Promise.reject(e);
|
|
3329
3339
|
}
|
|
3330
3340
|
return c.then((e) => {
|
|
3331
|
-
|
|
3341
|
+
Te(o, e).catch((e) => s.error("[passflow] Applying a refresh result failed", e)).finally(() => o.settled.resolve());
|
|
3332
3342
|
}, (e) => {
|
|
3333
|
-
|
|
3343
|
+
Ee(o, e), o.settled.resolve();
|
|
3334
3344
|
}), !0;
|
|
3335
|
-
},
|
|
3336
|
-
if (e.sent?.held && k.endHeldSend(), !
|
|
3345
|
+
}, we = (e) => !f && e.generation === d && u.kind === "refreshing" && u.request === e, Te = async (e, t) => {
|
|
3346
|
+
if (e.sent?.held && k.endHeldSend(), !we(e) || u.kind !== "refreshing") return;
|
|
3337
3347
|
let { pending: a } = u;
|
|
3338
3348
|
if (!e.sent) {
|
|
3339
3349
|
let o = Z({ ...t.id_token ? { id_token: t.id_token } : {} }), s = O();
|
|
3340
3350
|
if (o !== void 0 && s !== void 0 && o !== s) {
|
|
3341
3351
|
let t = new Y(J.identityChanged);
|
|
3342
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3352
|
+
P("refresh", e.trigger, t, F("auth")), L("identity-changed", t);
|
|
3343
3353
|
return;
|
|
3344
3354
|
}
|
|
3345
3355
|
try {
|
|
3346
3356
|
await i.applyOpaque(t);
|
|
3347
3357
|
} catch (t) {
|
|
3348
|
-
|
|
3358
|
+
Ee(e, t);
|
|
3349
3359
|
return;
|
|
3350
3360
|
}
|
|
3351
|
-
if (!
|
|
3361
|
+
if (!we(e)) return;
|
|
3352
3362
|
r.setTokensCache({
|
|
3353
3363
|
...n.getTokens() ?? {},
|
|
3354
3364
|
...di(t, void 0)
|
|
@@ -3361,43 +3371,43 @@ function fi(e) {
|
|
|
3361
3371
|
type: "session-refreshed",
|
|
3362
3372
|
at: w(),
|
|
3363
3373
|
sub: c
|
|
3364
|
-
}),
|
|
3374
|
+
}), he(), N(a, e.sentAt);
|
|
3365
3375
|
return;
|
|
3366
3376
|
}
|
|
3367
3377
|
let o = E(), s = k.commitSave(e.sent, di(t, e.stored));
|
|
3368
3378
|
switch (s.kind) {
|
|
3369
3379
|
case "saved":
|
|
3370
|
-
I("refresh", "this-tab"),
|
|
3380
|
+
I("refresh", "this-tab"), ue(e.sent.order, e.sentAt), he(), N(a, e.sentAt);
|
|
3371
3381
|
return;
|
|
3372
3382
|
case "superseded":
|
|
3373
|
-
e.outcome && E() === o || I("adopted", "other-tab"), s.adopted &&
|
|
3383
|
+
e.outcome && E() === o || I("adopted", "other-tab"), s.adopted && ue(e.sent.order), he(), N(a, e.sentAt);
|
|
3374
3384
|
return;
|
|
3375
3385
|
case "ended": {
|
|
3376
3386
|
let t = new Y(s.cause === "emptied" ? J.signedOut : J.sessionEnded);
|
|
3377
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3387
|
+
P("refresh", e.trigger, t, F("auth")), L(s.cause === "emptied" ? "emptied" : "stored-ended", t);
|
|
3378
3388
|
return;
|
|
3379
3389
|
}
|
|
3380
3390
|
case "identity-changed": {
|
|
3381
3391
|
let t = new Y(J.identityChanged);
|
|
3382
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3392
|
+
P("refresh", e.trigger, t, F("auth")), L("identity-changed", t), R();
|
|
3383
3393
|
return;
|
|
3384
3394
|
}
|
|
3385
3395
|
default: oi(s);
|
|
3386
3396
|
}
|
|
3387
|
-
},
|
|
3388
|
-
if (e.sent?.held && k.endHeldSend(), !
|
|
3397
|
+
}, Ee = (e, t) => {
|
|
3398
|
+
if (e.sent?.held && k.endHeldSend(), !we(e) || u.kind !== "refreshing") return;
|
|
3389
3399
|
let { pending: n } = u, r, i = !1;
|
|
3390
3400
|
if (e.sent) {
|
|
3391
3401
|
let a = E(), o = k.judgeFailure(e.sent, t);
|
|
3392
3402
|
switch (o.kind) {
|
|
3393
3403
|
case "superseded":
|
|
3394
|
-
e.outcome && E() === a || I("adopted", "other-tab"),
|
|
3404
|
+
e.outcome && E() === a || I("adopted", "other-tab"), he(), N(n, e.sentAt);
|
|
3395
3405
|
return;
|
|
3396
3406
|
case "ended":
|
|
3397
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3407
|
+
P("refresh", e.trigger, t, F("auth")), L(o.cause === "emptied" ? "emptied" : "stored-ended", t);
|
|
3398
3408
|
return;
|
|
3399
3409
|
case "identity-changed":
|
|
3400
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3410
|
+
P("refresh", e.trigger, t, F("auth")), L("identity-changed", t), R();
|
|
3401
3411
|
return;
|
|
3402
3412
|
case "own":
|
|
3403
3413
|
r = o.failure, i = o.heldRefused;
|
|
@@ -3405,24 +3415,24 @@ function fi(e) {
|
|
|
3405
3415
|
default: oi(o);
|
|
3406
3416
|
}
|
|
3407
3417
|
} else r = Br(t, w());
|
|
3408
|
-
if (i) P("refresh", e.trigger, t, F(r.kind)), I("adopted", "other-tab"),
|
|
3418
|
+
if (i) P("refresh", e.trigger, t, F(r.kind)), I("adopted", "other-tab"), he(), N(n, void 0, !0);
|
|
3409
3419
|
else switch (r.kind) {
|
|
3410
3420
|
case "blocked":
|
|
3411
|
-
P("refresh", e.trigger, t, F("blocked")),
|
|
3421
|
+
P("refresh", e.trigger, t, F("blocked")), ke(n, e.sentAt, t, e.marker);
|
|
3412
3422
|
return;
|
|
3413
3423
|
case "auth":
|
|
3414
3424
|
if (h += 1, m += 1, h >= c) {
|
|
3415
|
-
P("refresh", e.trigger, t, F("auth")),
|
|
3425
|
+
P("refresh", e.trigger, t, F("auth")), Oe(e, t);
|
|
3416
3426
|
return;
|
|
3417
3427
|
}
|
|
3418
|
-
|
|
3428
|
+
De(e, n, t, r);
|
|
3419
3429
|
return;
|
|
3420
3430
|
case "transient":
|
|
3421
|
-
m += 1,
|
|
3431
|
+
m += 1, De(e, n, t, r);
|
|
3422
3432
|
return;
|
|
3423
3433
|
default: oi(r.kind);
|
|
3424
3434
|
}
|
|
3425
|
-
},
|
|
3435
|
+
}, De = (e, t, n, r) => {
|
|
3426
3436
|
let i = w() + Vr(m, o.random(), r.retryAfterMs), a = r.kind === "auth" ? "auth" : "transient";
|
|
3427
3437
|
P("refresh", e.trigger, n, F(a, i)), a === "transient" && le(w(), i, "this-tab");
|
|
3428
3438
|
let s = {
|
|
@@ -3435,8 +3445,8 @@ function fi(e) {
|
|
|
3435
3445
|
type: "retry-scheduled",
|
|
3436
3446
|
message: ci(n, "Token refresh failed"),
|
|
3437
3447
|
retry: s
|
|
3438
|
-
}),
|
|
3439
|
-
},
|
|
3448
|
+
}), _e(A("retry")), se(t, n, e.sentAt);
|
|
3449
|
+
}, Oe = (e, t) => {
|
|
3440
3450
|
let n = e.sent?.sub ?? O(), r = e.sent?.order, i = {};
|
|
3441
3451
|
r?.fp && (i.fp = r.fp), n && (i.sub = n), r?.sid && (i.sid = r.sid), r?.iat !== void 0 && (i.iat = r.iat), (i.fp || i.sub) && l.post({
|
|
3442
3452
|
type: "session-ended",
|
|
@@ -3444,8 +3454,8 @@ function fi(e) {
|
|
|
3444
3454
|
}), i.fp && (x = i.fp, k.endLineage({
|
|
3445
3455
|
...i,
|
|
3446
3456
|
fp: i.fp
|
|
3447
|
-
})), r && k.deleteIfStillDead(r),
|
|
3448
|
-
},
|
|
3457
|
+
})), r && k.deleteIfStillDead(r), L("strikes", t);
|
|
3458
|
+
}, ke = (e, t, n, r) => {
|
|
3449
3459
|
l.release(), s.warn(`[passflow] The refresh token was already used, most likely by another tab; waiting for its successor: ${ci(n, "blocked")}`);
|
|
3450
3460
|
let i = d, a = w() + cr, c = {
|
|
3451
3461
|
kind: "blocked-wait",
|
|
@@ -3455,15 +3465,15 @@ function fi(e) {
|
|
|
3455
3465
|
cancel: () => void 0,
|
|
3456
3466
|
marker: r
|
|
3457
3467
|
};
|
|
3458
|
-
if (u = c,
|
|
3468
|
+
if (u = c, Ae()) return;
|
|
3459
3469
|
let f = T() !== "json" && !l.coordinated && !e.cookieRetried, p = () => {
|
|
3460
|
-
i === d && u === c && (
|
|
3470
|
+
i === d && u === c && (Ae() || (f ? (e.cookieRetried = !0, u = {
|
|
3461
3471
|
kind: "waiting",
|
|
3462
3472
|
pending: e
|
|
3463
|
-
}, l.request()) : w() >= a ? (s.warn("[passflow] No successor of the used refresh token appeared; ending the session in this tab only."),
|
|
3473
|
+
}, l.request()) : w() >= a ? (s.warn("[passflow] No successor of the used refresh token appeared; ending the session in this tab only."), L("successor-timeout")) : c.cancel = o.setTimeout(p, lr)));
|
|
3464
3474
|
};
|
|
3465
3475
|
c.cancel = o.setTimeout(p, f ? dr : lr);
|
|
3466
|
-
},
|
|
3476
|
+
}, Ae = () => {
|
|
3467
3477
|
if (u.kind !== "blocked-wait") return !1;
|
|
3468
3478
|
let e = u;
|
|
3469
3479
|
if (T() === "json") {
|
|
@@ -3474,15 +3484,15 @@ function fi(e) {
|
|
|
3474
3484
|
r.setTokensCache(n.getTokens());
|
|
3475
3485
|
}
|
|
3476
3486
|
return u === e && (e.cancel(), I("adopted", "other-tab"), u = { kind: "idle" }, N(e.pending, void 0, !0), !0);
|
|
3477
|
-
},
|
|
3487
|
+
}, je = (e) => {
|
|
3478
3488
|
let t = O(), n = !e.sub || !t || e.sub === t;
|
|
3479
3489
|
return T() === "json" ? !!e.fp && e.fp === E() && n : !e.fp && n;
|
|
3480
|
-
},
|
|
3490
|
+
}, Me = (e, t) => {
|
|
3481
3491
|
if (e !== "signed-out" || !t.sub) return !1;
|
|
3482
3492
|
let n = O();
|
|
3483
3493
|
return n !== void 0 && t.sub === n;
|
|
3484
|
-
},
|
|
3485
|
-
if (u.kind === "ended" || !
|
|
3494
|
+
}, Ne = (e, t, n) => {
|
|
3495
|
+
if (u.kind === "ended" || !ge(e)) return;
|
|
3486
3496
|
let r = g?.nextAt;
|
|
3487
3497
|
if (g = e, e.failingSince !== void 0 && le(e.failingSince, e.nextAt, "other-tab"), !t || u.kind !== "waiting") return;
|
|
3488
3498
|
let i = new Y(e.kind === "transient" ? J.unavailable : J.authRetry, {
|
|
@@ -3490,12 +3500,12 @@ function fi(e) {
|
|
|
3490
3500
|
cause: n || void 0
|
|
3491
3501
|
}), a = u.pending;
|
|
3492
3502
|
u.pending = A(a.trigger), se(a, i, r);
|
|
3493
|
-
},
|
|
3503
|
+
}, Pe = (e, t) => {
|
|
3494
3504
|
switch (t && I("adopted", "other-tab"), u.kind) {
|
|
3495
3505
|
case "waiting":
|
|
3496
3506
|
case "backoff": {
|
|
3497
3507
|
let t = u.pending;
|
|
3498
|
-
|
|
3508
|
+
fe(u), he(), N(t, e);
|
|
3499
3509
|
return;
|
|
3500
3510
|
}
|
|
3501
3511
|
case "blocked-wait": {
|
|
@@ -3508,19 +3518,19 @@ function fi(e) {
|
|
|
3508
3518
|
case "ended": return;
|
|
3509
3519
|
default: oi(u);
|
|
3510
3520
|
}
|
|
3511
|
-
},
|
|
3521
|
+
}, Fe = (e) => {
|
|
3512
3522
|
let t = {};
|
|
3513
3523
|
e.fp && (t.fp = e.fp), e.sub && (t.sub = e.sub), e.sid && (t.sid = e.sid), e.iat !== void 0 && (t.iat = e.iat);
|
|
3514
|
-
let n = u.kind !== "ended" && (
|
|
3524
|
+
let n = u.kind !== "ended" && (je(t) || Me(e.type, t));
|
|
3515
3525
|
t.fp && k.endLineage({
|
|
3516
3526
|
...t,
|
|
3517
3527
|
fp: t.fp
|
|
3518
|
-
}), n &&
|
|
3519
|
-
},
|
|
3528
|
+
}), n && L(e.type === "signed-out" ? "signed-out" : "session-ended"), k.endedElsewhere(e.type, t);
|
|
3529
|
+
}, Ie = (e) => {
|
|
3520
3530
|
if (!f) switch (e.type) {
|
|
3521
3531
|
case "tokens-refreshed": {
|
|
3522
3532
|
if (u.kind === "ended") {
|
|
3523
|
-
|
|
3533
|
+
R();
|
|
3524
3534
|
return;
|
|
3525
3535
|
}
|
|
3526
3536
|
if (T() !== "json") return;
|
|
@@ -3528,7 +3538,7 @@ function fi(e) {
|
|
|
3528
3538
|
if (!k.adoptTokens(e)) return;
|
|
3529
3539
|
let n = E() !== t;
|
|
3530
3540
|
if (!n && u.kind === "idle") return;
|
|
3531
|
-
g = void 0,
|
|
3541
|
+
g = void 0, Pe(e.sentAt, n);
|
|
3532
3542
|
return;
|
|
3533
3543
|
}
|
|
3534
3544
|
case "session-refreshed": {
|
|
@@ -3536,17 +3546,17 @@ function fi(e) {
|
|
|
3536
3546
|
let t = O();
|
|
3537
3547
|
if (e.sub && t && e.sub !== t || (y = Math.max(y ?? 0, e.at), u.kind === "refreshing")) return;
|
|
3538
3548
|
if (r.setTokensCache(n.getTokens()), g = void 0, u.kind === "blocked-wait") {
|
|
3539
|
-
|
|
3549
|
+
Ae();
|
|
3540
3550
|
return;
|
|
3541
3551
|
}
|
|
3542
|
-
|
|
3552
|
+
Pe(e.at, !0);
|
|
3543
3553
|
return;
|
|
3544
3554
|
}
|
|
3545
3555
|
case "still-refreshing":
|
|
3546
|
-
e.retry &&
|
|
3556
|
+
e.retry && Ne(e.retry, !1, ""), Le();
|
|
3547
3557
|
return;
|
|
3548
3558
|
case "retry-scheduled":
|
|
3549
|
-
|
|
3559
|
+
Ne(e.retry, !0, e.message), Le();
|
|
3550
3560
|
return;
|
|
3551
3561
|
case "refresh-failed":
|
|
3552
3562
|
if (u.kind === "ended" || T() !== "json" || e.from !== E() && e.from !== Jr(n.getTokens()?.refresh_token)) return;
|
|
@@ -3566,13 +3576,13 @@ function fi(e) {
|
|
|
3566
3576
|
return;
|
|
3567
3577
|
case "session-ended":
|
|
3568
3578
|
case "signed-out":
|
|
3569
|
-
|
|
3579
|
+
Fe(e);
|
|
3570
3580
|
return;
|
|
3571
3581
|
case "takeover":
|
|
3572
3582
|
case "rate-limited": return;
|
|
3573
3583
|
default: oi(e);
|
|
3574
3584
|
}
|
|
3575
|
-
},
|
|
3585
|
+
}, Le = () => {
|
|
3576
3586
|
S && !l.holding && l.post({
|
|
3577
3587
|
type: "lock-wanted",
|
|
3578
3588
|
purpose: S.purpose
|
|
@@ -3585,7 +3595,7 @@ function fi(e) {
|
|
|
3585
3595
|
let e = S;
|
|
3586
3596
|
return S = void 0, e.granted(), !0;
|
|
3587
3597
|
}
|
|
3588
|
-
return u.kind === "waiting" &&
|
|
3598
|
+
return u.kind === "waiting" && be();
|
|
3589
3599
|
},
|
|
3590
3600
|
onLockLost: () => {
|
|
3591
3601
|
if (u.kind === "backoff") {
|
|
@@ -3596,16 +3606,16 @@ function fi(e) {
|
|
|
3596
3606
|
}, l.request((g?.nextAt ?? w()) + K);
|
|
3597
3607
|
}
|
|
3598
3608
|
},
|
|
3599
|
-
onMessage:
|
|
3609
|
+
onMessage: Ie
|
|
3600
3610
|
});
|
|
3601
|
-
let
|
|
3611
|
+
let Re = () => {
|
|
3602
3612
|
if (f) return;
|
|
3603
3613
|
if (u.kind === "ended") {
|
|
3604
|
-
|
|
3614
|
+
R();
|
|
3605
3615
|
return;
|
|
3606
3616
|
}
|
|
3607
3617
|
if (u.kind === "blocked-wait" && T() !== "json") {
|
|
3608
|
-
|
|
3618
|
+
Ae();
|
|
3609
3619
|
return;
|
|
3610
3620
|
}
|
|
3611
3621
|
if (u.kind !== "idle" || T() !== "json" || C) return;
|
|
@@ -3615,10 +3625,10 @@ function fi(e) {
|
|
|
3615
3625
|
} catch {
|
|
3616
3626
|
return;
|
|
3617
3627
|
}
|
|
3618
|
-
I("adopted", "other-tab"), l.coordinated &&
|
|
3628
|
+
I("adopted", "other-tab"), l.coordinated && ue(e);
|
|
3619
3629
|
};
|
|
3620
|
-
ne.add(
|
|
3621
|
-
let
|
|
3630
|
+
ne.add(Re), re.add(Re);
|
|
3631
|
+
let z = (e, t) => {
|
|
3622
3632
|
if (f) return Promise.reject(new Y(J.disposed));
|
|
3623
3633
|
switch (u.kind) {
|
|
3624
3634
|
case "ended": return Promise.reject(new Y(J.sessionEnded));
|
|
@@ -3629,7 +3639,7 @@ function fi(e) {
|
|
|
3629
3639
|
pending: n
|
|
3630
3640
|
};
|
|
3631
3641
|
let r = M(n, t);
|
|
3632
|
-
return l.holding && !C ?
|
|
3642
|
+
return l.holding && !C ? be() || ye() : l.request(g ? g.nextAt + K : void 0), r;
|
|
3633
3643
|
}
|
|
3634
3644
|
case "waiting":
|
|
3635
3645
|
case "refreshing":
|
|
@@ -3637,9 +3647,9 @@ function fi(e) {
|
|
|
3637
3647
|
case "blocked-wait": return M(u.pending, t);
|
|
3638
3648
|
default: return oi(u);
|
|
3639
3649
|
}
|
|
3640
|
-
},
|
|
3650
|
+
}, ze = (e) => {
|
|
3641
3651
|
if (f) return Promise.reject(new Y(J.disposed));
|
|
3642
|
-
if (
|
|
3652
|
+
if (de(), u.kind === "ended") return Promise.reject(new Y(J.sessionEnded));
|
|
3643
3653
|
if (T() === "json" && !r.getTokens()?.refresh_token) {
|
|
3644
3654
|
let t = n.getTokens();
|
|
3645
3655
|
if (!t?.refresh_token) {
|
|
@@ -3647,13 +3657,13 @@ function fi(e) {
|
|
|
3647
3657
|
return P("refresh", e.trigger, n), Promise.reject(n);
|
|
3648
3658
|
}
|
|
3649
3659
|
}
|
|
3650
|
-
return
|
|
3651
|
-
},
|
|
3660
|
+
return z(e.trigger, e.fresh ? w() : void 0);
|
|
3661
|
+
}, Be = (e) => {
|
|
3652
3662
|
if (f) return Promise.reject(new Y(J.disposed));
|
|
3653
3663
|
if (u.kind === "ended") return Promise.resolve(r.getTokens());
|
|
3654
3664
|
let t = u.kind === "backoff" || u.kind === "blocked-wait" || g !== void 0 && g.nextAt > w();
|
|
3655
|
-
return e.allowStale && t ? Promise.resolve(r.getTokens()) :
|
|
3656
|
-
},
|
|
3665
|
+
return e.allowStale && t ? Promise.resolve(r.getTokens()) : ze({ trigger: e.trigger }).then(() => r.getTokens());
|
|
3666
|
+
}, Ve = (e, t) => l.holding ? Promise.resolve("granted") : new Promise((n) => {
|
|
3657
3667
|
let r = () => void 0, i = {
|
|
3658
3668
|
purpose: e,
|
|
3659
3669
|
granted: () => {
|
|
@@ -3666,7 +3676,7 @@ function fi(e) {
|
|
|
3666
3676
|
}), l.request(), r = o.setTimeout(() => {
|
|
3667
3677
|
S === i && (S = void 0, u.kind !== "waiting" && l.release(), n("timeout"));
|
|
3668
3678
|
}, Math.max(0, t));
|
|
3669
|
-
}),
|
|
3679
|
+
}), He = async (e) => {
|
|
3670
3680
|
if (u.kind !== "refreshing") return;
|
|
3671
3681
|
let t = u.request.settled.promise;
|
|
3672
3682
|
await new Promise((n) => {
|
|
@@ -3675,34 +3685,34 @@ function fi(e) {
|
|
|
3675
3685
|
r(), n();
|
|
3676
3686
|
});
|
|
3677
3687
|
});
|
|
3678
|
-
},
|
|
3688
|
+
}, Ue = () => {
|
|
3679
3689
|
if (C = !1, !f && l.holding) {
|
|
3680
|
-
if (u.kind === "waiting")
|
|
3690
|
+
if (u.kind === "waiting") be() || ye();
|
|
3681
3691
|
else if (u.kind === "backoff") {
|
|
3682
3692
|
let e = u.pending;
|
|
3683
|
-
u.cancel(),
|
|
3684
|
-
} else u.kind === "idle" && g && g.nextAt > w() &&
|
|
3693
|
+
u.cancel(), _e(e);
|
|
3694
|
+
} else u.kind === "idle" && g && g.nextAt > w() && ge(g) ? (m = g.attempt, h = g.strikes, _e(A("retry"))) : u.kind === "idle" && l.release();
|
|
3685
3695
|
}
|
|
3686
|
-
},
|
|
3696
|
+
}, B = async (e, t) => {
|
|
3687
3697
|
if (f) throw new Y(J.disposed);
|
|
3688
|
-
|
|
3698
|
+
de();
|
|
3689
3699
|
let n = w() + fr;
|
|
3690
|
-
if (await
|
|
3700
|
+
if (await He(n - w()), (!l.holding || u.kind === "refreshing") && (u.kind === "refreshing" ? "timeout" : await Ve("commit", n - w())) === "timeout") {
|
|
3691
3701
|
let e = new qr("lock-timeout");
|
|
3692
3702
|
throw P("upgrade.commit", "upgrade", e), e;
|
|
3693
3703
|
}
|
|
3694
3704
|
C = !0;
|
|
3695
3705
|
try {
|
|
3696
|
-
return await
|
|
3706
|
+
return await We(e, t);
|
|
3697
3707
|
} finally {
|
|
3698
|
-
|
|
3708
|
+
Ue();
|
|
3699
3709
|
}
|
|
3700
|
-
},
|
|
3710
|
+
}, We = async (e, a) => {
|
|
3701
3711
|
let o, s;
|
|
3702
3712
|
if (T() === "json") {
|
|
3703
3713
|
let e = k.session();
|
|
3704
3714
|
try {
|
|
3705
|
-
k.checkStoredBeforeSend() === "adopted" && (I("adopted", "other-tab"),
|
|
3715
|
+
k.checkStoredBeforeSend() === "adopted" && (I("adopted", "other-tab"), ue(e));
|
|
3706
3716
|
} catch {}
|
|
3707
3717
|
s = n.getTokens();
|
|
3708
3718
|
let t = s?.refresh_token;
|
|
@@ -3736,7 +3746,7 @@ function fi(e) {
|
|
|
3736
3746
|
await i.applyOpaque(u), r.setTokensCache({
|
|
3737
3747
|
...n.getTokens() ?? {},
|
|
3738
3748
|
...di(u, void 0)
|
|
3739
|
-
}),
|
|
3749
|
+
}), Ge(c);
|
|
3740
3750
|
let e = O();
|
|
3741
3751
|
return l.post(e === void 0 ? {
|
|
3742
3752
|
type: "session-refreshed",
|
|
@@ -3748,15 +3758,15 @@ function fi(e) {
|
|
|
3748
3758
|
}), D();
|
|
3749
3759
|
}
|
|
3750
3760
|
let d = k.commitSave(o, di(u, s));
|
|
3751
|
-
if (d.kind === "saved") return
|
|
3761
|
+
if (d.kind === "saved") return Ge(c), ue(o.order, c), D();
|
|
3752
3762
|
let f = new qr("superseded");
|
|
3753
3763
|
throw P("upgrade.commit", "upgrade", f), d.kind === "superseded" && d.adopted && I("adopted", "other-tab"), f;
|
|
3754
|
-
},
|
|
3764
|
+
}, Ge = (e) => {
|
|
3755
3765
|
if (I("upgrade", "this-tab"), u.kind === "waiting" || u.kind === "backoff" || u.kind === "blocked-wait") {
|
|
3756
3766
|
let t = u.pending;
|
|
3757
|
-
|
|
3767
|
+
fe(u), u = { kind: "idle" }, N(t, e);
|
|
3758
3768
|
}
|
|
3759
|
-
},
|
|
3769
|
+
}, Ke = () => {
|
|
3760
3770
|
let e = k.storedSession(), t = e.fp ? e : k.session();
|
|
3761
3771
|
(T() === "json" ? !t.fp : !t.sub) || t.fp && t.fp === x || (l.post({
|
|
3762
3772
|
type: "signed-out",
|
|
@@ -3765,37 +3775,37 @@ function fi(e) {
|
|
|
3765
3775
|
...t,
|
|
3766
3776
|
fp: t.fp
|
|
3767
3777
|
}));
|
|
3768
|
-
},
|
|
3778
|
+
}, qe = () => {
|
|
3769
3779
|
let e = j(u);
|
|
3770
|
-
ce(e, new Y(J.signedOut)), (u.kind === "backoff" || u.kind === "blocked-wait" || u.kind === "waiting") && (
|
|
3780
|
+
ce(e, new Y(J.signedOut)), (u.kind === "backoff" || u.kind === "blocked-wait" || u.kind === "waiting") && (fe(u), u = { kind: "idle" });
|
|
3771
3781
|
};
|
|
3772
3782
|
return {
|
|
3773
|
-
refresh:
|
|
3774
|
-
ensureFresh:
|
|
3775
|
-
commitUpgrade:
|
|
3783
|
+
refresh: ze,
|
|
3784
|
+
ensureFresh: Be,
|
|
3785
|
+
commitUpgrade: B,
|
|
3776
3786
|
signOut: async (e) => {
|
|
3777
3787
|
if (f) return e(n.getTokens()?.refresh_token);
|
|
3778
3788
|
let t = w() + pr;
|
|
3779
|
-
|
|
3789
|
+
qe(), await He(t - w()), qe(), l.coordinated && !l.holding && await Ve("logout", t - w());
|
|
3780
3790
|
try {
|
|
3781
|
-
|
|
3791
|
+
Ke(), await e(n.getTokens()?.refresh_token);
|
|
3782
3792
|
} finally {
|
|
3783
|
-
u.kind !== "ended" &&
|
|
3793
|
+
u.kind !== "ended" && L("signed-out-here"), x = void 0, l.release();
|
|
3784
3794
|
}
|
|
3785
3795
|
},
|
|
3786
3796
|
signOutNow: (e) => {
|
|
3787
3797
|
if (f) return e(n.getTokens()?.refresh_token);
|
|
3788
|
-
|
|
3798
|
+
qe();
|
|
3789
3799
|
try {
|
|
3790
|
-
|
|
3800
|
+
Ke(), e(n.getTokens()?.refresh_token);
|
|
3791
3801
|
} finally {
|
|
3792
|
-
u.kind !== "ended" &&
|
|
3802
|
+
u.kind !== "ended" && L("signed-out-here"), x = void 0;
|
|
3793
3803
|
}
|
|
3794
3804
|
},
|
|
3795
3805
|
sessionStarted: () => {
|
|
3796
3806
|
if (f) return;
|
|
3797
3807
|
let e = j(u);
|
|
3798
|
-
|
|
3808
|
+
fe(u), d += 1, m = 0, h = 0, g = void 0, _ = void 0, v = void 0, b = void 0, x = void 0, ee = void 0, l.setRetryInfo(void 0), u = { kind: "idle" }, C || l.release(), e && N(e, void 0, !0);
|
|
3799
3809
|
},
|
|
3800
3810
|
identity: O,
|
|
3801
3811
|
get coordinated() {
|
|
@@ -3810,7 +3820,7 @@ function fi(e) {
|
|
|
3810
3820
|
dispose: () => {
|
|
3811
3821
|
if (f) return;
|
|
3812
3822
|
let e = j(u);
|
|
3813
|
-
|
|
3823
|
+
fe(u), f = !0, d += 1, u = {
|
|
3814
3824
|
kind: "ended",
|
|
3815
3825
|
cause: "disposed"
|
|
3816
3826
|
}, ce(e, new Y(J.disposed)), S = void 0, k.stop(), l.dispose(), ae?.(), oe?.();
|
|
@@ -4068,7 +4078,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4068
4078
|
return;
|
|
4069
4079
|
}
|
|
4070
4080
|
}, aa = class {
|
|
4071
|
-
constructor(e, t, n, r, i, a, o, s, c, l, u, d =
|
|
4081
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d = R, f, p = { coordination: jr() }, m) {
|
|
4072
4082
|
this.authApi = e, this.deviceService = t, this.storageManager = n, this.subscribeStore = r, this.tokenCacheService = i, this.scopes = a, this.createTenantForNewUser = o, this.url = s, this.sessionCallbacks = c, this.appId = l, this.platform = d, this.readPkceEnabled = f, this.readAppSettings = m, this.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ce(n), u?.enabled && this.tokenDeliveryManager.setMode(N.BFF), this.refresh = fi({
|
|
4073
4083
|
emit: this.createRefreshEmit(),
|
|
4074
4084
|
storage: n,
|
|
@@ -4113,11 +4123,11 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4113
4123
|
}
|
|
4114
4124
|
}
|
|
4115
4125
|
async processAuthResponse(e, t) {
|
|
4116
|
-
await this.applyAuthResponse(e, t), this.refresh.sessionStarted();
|
|
4126
|
+
await this.applyAuthResponse(e, t, { replace: !0 }), this.refresh.sessionStarted();
|
|
4117
4127
|
}
|
|
4118
|
-
async applyAuthResponse(e, t) {
|
|
4128
|
+
async applyAuthResponse(e, t, n) {
|
|
4119
4129
|
if (e.code && !e.access_token) throw Error("A PKCE authorization code was not exchanged, so there are no tokens to apply");
|
|
4120
|
-
this.tokenExchangeConfig?.enabled || "token_delivery" in e && e.token_delivery && this.tokenDeliveryManager.setMode(e.token_delivery), this.tokenDeliveryManager.setSessionValid(), this.tokenDeliveryManager.isBFFMode() && this.tokenExchangeConfig?.callbackUrl && await this.forwardTokensToBFF(e), e.scopes = t, this.storageManager.saveTokens(e, this.tokenDeliveryManager.getMode()), this.tokenCacheService.setTokensCache(e), e.csrf_token && this.storageManager.setCsrfToken(e.csrf_token);
|
|
4130
|
+
this.tokenExchangeConfig?.enabled || "token_delivery" in e && e.token_delivery && this.tokenDeliveryManager.setMode(e.token_delivery), this.tokenDeliveryManager.setSessionValid(), this.tokenDeliveryManager.isBFFMode() && this.tokenExchangeConfig?.callbackUrl && await this.forwardTokensToBFF(e), e.scopes = t, this.storageManager.saveTokens(e, this.tokenDeliveryManager.getMode(), n), this.tokenCacheService.setTokensCache(e), e.csrf_token && this.storageManager.setCsrfToken(e.csrf_token);
|
|
4121
4131
|
}
|
|
4122
4132
|
notifyRegisteredAndSignedIn(e) {
|
|
4123
4133
|
let t = {
|
|
@@ -4134,7 +4144,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4134
4144
|
}), !0) : !1;
|
|
4135
4145
|
}
|
|
4136
4146
|
handleEmailVerificationStep(e, t, n, r, i) {
|
|
4137
|
-
if (!
|
|
4147
|
+
if (!Ve(e)) return !1;
|
|
4138
4148
|
let a = e.challenge_id || void 0;
|
|
4139
4149
|
return a && r ? this.rememberPkceSignIn(r.verifier, i) : this.forgetPkceSignIn(), a && this.rememberEmailChallenge(a, {
|
|
4140
4150
|
operation: t,
|
|
@@ -4295,7 +4305,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4295
4305
|
throw W(this.subscribeStore, t), e;
|
|
4296
4306
|
}
|
|
4297
4307
|
this.subscribeStore.notify(G.SignInStart, { email: e.email });
|
|
4298
|
-
let n = this.deviceService.getDeviceId(), r =
|
|
4308
|
+
let n = this.deviceService.getDeviceId(), r = it(this.platform.getDeviceType());
|
|
4299
4309
|
e.scopes = e.scopes ?? this.scopes;
|
|
4300
4310
|
try {
|
|
4301
4311
|
let i = await this.startPkce(), a = await this.authApi.signIn(i ? {
|
|
@@ -4313,7 +4323,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4313
4323
|
operation: "sign-in",
|
|
4314
4324
|
message: e instanceof Error ? e.message : "Sign in failed",
|
|
4315
4325
|
originalError: e,
|
|
4316
|
-
code: e instanceof
|
|
4326
|
+
code: e instanceof B ? e.id : void 0
|
|
4317
4327
|
};
|
|
4318
4328
|
throw W(this.subscribeStore, t), e;
|
|
4319
4329
|
}
|
|
@@ -4351,7 +4361,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4351
4361
|
operation: "sign-up",
|
|
4352
4362
|
message: e instanceof Error ? e.message : "Sign up failed",
|
|
4353
4363
|
originalError: e,
|
|
4354
|
-
code: e instanceof
|
|
4364
|
+
code: e instanceof B ? e.id : void 0
|
|
4355
4365
|
};
|
|
4356
4366
|
throw W(this.subscribeStore, t), e;
|
|
4357
4367
|
}
|
|
@@ -4376,7 +4386,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4376
4386
|
throw W(this.subscribeStore, t), e;
|
|
4377
4387
|
}
|
|
4378
4388
|
this.subscribeStore.notify(G.SignInStart, { email: e.email });
|
|
4379
|
-
let n = e.scopes ?? this.scopes, r = this.deviceService.getDeviceId(), i =
|
|
4389
|
+
let n = e.scopes ?? this.scopes, r = this.deviceService.getDeviceId(), i = it(this.platform.getDeviceType());
|
|
4380
4390
|
try {
|
|
4381
4391
|
let a = await this.startPkce(), o = await this.authApi.passwordlessSignIn({
|
|
4382
4392
|
...e,
|
|
@@ -4397,7 +4407,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4397
4407
|
operation: "passwordless.start",
|
|
4398
4408
|
message: e instanceof Error ? e.message : "Failed to send passwordless sign-in link",
|
|
4399
4409
|
originalError: e,
|
|
4400
|
-
code: e instanceof
|
|
4410
|
+
code: e instanceof B ? e.id : void 0
|
|
4401
4411
|
};
|
|
4402
4412
|
throw W(this.subscribeStore, t), e;
|
|
4403
4413
|
}
|
|
@@ -4433,7 +4443,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4433
4443
|
operation: "passwordless.complete",
|
|
4434
4444
|
message: e instanceof Error ? e.message : "Passwordless sign in failed",
|
|
4435
4445
|
originalError: e,
|
|
4436
|
-
code: e instanceof
|
|
4446
|
+
code: e instanceof B ? e.id : void 0
|
|
4437
4447
|
};
|
|
4438
4448
|
throw W(this.subscribeStore, t), e;
|
|
4439
4449
|
}
|
|
@@ -4455,7 +4465,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4455
4465
|
}, { signal: n });
|
|
4456
4466
|
} catch (e) {
|
|
4457
4467
|
if (n?.aborted) throw n.reason;
|
|
4458
|
-
if (e instanceof
|
|
4468
|
+
if (e instanceof B && e.status >= 400 && e.status < 500 && e.status !== 429) throw this.forgetPendingPasswordless(), e;
|
|
4459
4469
|
}
|
|
4460
4470
|
if (r?.status === "denied" || r?.status === "expired" || r?.status === "completed") return this.forgetPendingPasswordless(), { status: r.status };
|
|
4461
4471
|
if (r?.status === "approved" && r.code) return await this.finishApprovedPasswordless(r.code, t);
|
|
@@ -4472,7 +4482,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4472
4482
|
operation: "passwordless.wait",
|
|
4473
4483
|
message: e instanceof Error ? e.message : "Waiting for the passwordless sign-in failed",
|
|
4474
4484
|
originalError: e,
|
|
4475
|
-
code: e instanceof
|
|
4485
|
+
code: e instanceof B ? e.id : void 0
|
|
4476
4486
|
};
|
|
4477
4487
|
throw W(this.subscribeStore, t), e;
|
|
4478
4488
|
}
|
|
@@ -4525,7 +4535,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4525
4535
|
operation: "passwordless.approval",
|
|
4526
4536
|
message: e instanceof Error ? e.message : "Passwordless approval failed",
|
|
4527
4537
|
originalError: e,
|
|
4528
|
-
code: e instanceof
|
|
4538
|
+
code: e instanceof B ? e.id : void 0
|
|
4529
4539
|
};
|
|
4530
4540
|
W(this.subscribeStore, t);
|
|
4531
4541
|
}
|
|
@@ -4556,7 +4566,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4556
4566
|
operation: "email-verification.complete",
|
|
4557
4567
|
message: e instanceof Error ? e.message : "Email verification failed",
|
|
4558
4568
|
originalError: e,
|
|
4559
|
-
code: e instanceof
|
|
4569
|
+
code: e instanceof B ? e.id : void 0
|
|
4560
4570
|
};
|
|
4561
4571
|
throw W(this.subscribeStore, t), e;
|
|
4562
4572
|
}
|
|
@@ -4695,7 +4705,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4695
4705
|
let e = await t.json();
|
|
4696
4706
|
typeof e?.error?.id == "string" && (n = e.error.id), typeof e?.error?.message == "string" && (r = e.error.message);
|
|
4697
4707
|
} catch {}
|
|
4698
|
-
throw new
|
|
4708
|
+
throw new B({
|
|
4699
4709
|
id: n ?? `error.http.${t.status}`,
|
|
4700
4710
|
message: r ?? "BFF token refresh failed",
|
|
4701
4711
|
status: t.status,
|
|
@@ -4736,7 +4746,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4736
4746
|
operation: "password-reset.send",
|
|
4737
4747
|
message: e instanceof Error ? e.message : "Failed to send password reset email",
|
|
4738
4748
|
originalError: e,
|
|
4739
|
-
code: e instanceof
|
|
4749
|
+
code: e instanceof B ? e.id : void 0
|
|
4740
4750
|
};
|
|
4741
4751
|
throw W(this.subscribeStore, t), e;
|
|
4742
4752
|
}
|
|
@@ -4762,7 +4772,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4762
4772
|
operation: "password-reset.complete",
|
|
4763
4773
|
message: e instanceof Error ? e.message : "Password reset failed",
|
|
4764
4774
|
originalError: e,
|
|
4765
|
-
code: e instanceof
|
|
4775
|
+
code: e instanceof B ? e.id : void 0
|
|
4766
4776
|
};
|
|
4767
4777
|
throw W(this.subscribeStore, t), e;
|
|
4768
4778
|
}
|
|
@@ -4770,7 +4780,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4770
4780
|
async passkeyRegister(e, t) {
|
|
4771
4781
|
if (!this.platform.passkeys) throw Error("Passkeys are not supported on this platform");
|
|
4772
4782
|
this.subscribeStore.notify(G.RegisterStart, {});
|
|
4773
|
-
let n = this.deviceService.getDeviceId(), r =
|
|
4783
|
+
let n = this.deviceService.getDeviceId(), r = it(this.platform.getDeviceType());
|
|
4774
4784
|
e.scopes = e.scopes ?? this.scopes, e.create_tenant = this.createTenantForNewUser;
|
|
4775
4785
|
try {
|
|
4776
4786
|
let i = await this.startPkce(), { challenge_id: a, publicKey: o } = await this.authApi.passkeyRegisterStart(i ? {
|
|
@@ -4789,7 +4799,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4789
4799
|
operation: "passkey.register",
|
|
4790
4800
|
message: e instanceof Error ? e.message : "Passkey registration failed",
|
|
4791
4801
|
originalError: e,
|
|
4792
|
-
code: e instanceof
|
|
4802
|
+
code: e instanceof B ? e.id : void 0
|
|
4793
4803
|
};
|
|
4794
4804
|
throw W(this.subscribeStore, t), e;
|
|
4795
4805
|
}
|
|
@@ -4797,7 +4807,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4797
4807
|
async passkeyAuthenticate(e, t) {
|
|
4798
4808
|
if (!this.platform.passkeys) throw Error("Passkeys are not supported on this platform");
|
|
4799
4809
|
this.subscribeStore.notify(G.SignInStart, {});
|
|
4800
|
-
let n = this.deviceService.getDeviceId(), r =
|
|
4810
|
+
let n = this.deviceService.getDeviceId(), r = it(this.platform.getDeviceType());
|
|
4801
4811
|
e.scopes = e.scopes ?? this.scopes;
|
|
4802
4812
|
try {
|
|
4803
4813
|
let i = await this.startPkce(), { challenge_id: a, publicKey: o } = await this.authApi.passkeyAuthenticateStart(i ? {
|
|
@@ -4817,7 +4827,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4817
4827
|
operation: "passkey.authenticate",
|
|
4818
4828
|
message: e instanceof Error ? e.message : "Passkey authentication failed",
|
|
4819
4829
|
originalError: e,
|
|
4820
|
-
code: e instanceof
|
|
4830
|
+
code: e instanceof B ? e.id : void 0
|
|
4821
4831
|
};
|
|
4822
4832
|
throw W(this.subscribeStore, t), e;
|
|
4823
4833
|
}
|
|
@@ -4924,7 +4934,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4924
4934
|
let t = {
|
|
4925
4935
|
operation: "federated.popup",
|
|
4926
4936
|
message: e instanceof Error ? e.message : "Authentication failed",
|
|
4927
|
-
code: e instanceof
|
|
4937
|
+
code: e instanceof fe ? "POPUP_CLOSED" : "AUTH_FAILED",
|
|
4928
4938
|
originalError: e
|
|
4929
4939
|
};
|
|
4930
4940
|
W(this.subscribeStore, t);
|
|
@@ -4969,7 +4979,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4969
4979
|
operation: "federated.redirect",
|
|
4970
4980
|
message: e instanceof Error ? e.message : "Federated sign-in failed",
|
|
4971
4981
|
originalError: e,
|
|
4972
|
-
code: e instanceof
|
|
4982
|
+
code: e instanceof B ? e.id : void 0
|
|
4973
4983
|
};
|
|
4974
4984
|
W(this.subscribeStore, t);
|
|
4975
4985
|
}
|
|
@@ -5018,7 +5028,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5018
5028
|
operation: "auth-redirect",
|
|
5019
5029
|
message: e instanceof Error ? e.message : "Failed to redirect to auth page",
|
|
5020
5030
|
originalError: e,
|
|
5021
|
-
code: e instanceof U ? e.code : e instanceof
|
|
5031
|
+
code: e instanceof U ? e.code : e instanceof B ? e.id : void 0
|
|
5022
5032
|
};
|
|
5023
5033
|
throw W(this.subscribeStore, t), e;
|
|
5024
5034
|
}
|
|
@@ -5090,7 +5100,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5090
5100
|
} catch (e) {
|
|
5091
5101
|
let n = {
|
|
5092
5102
|
operation: "session.check",
|
|
5093
|
-
message: e instanceof Error || e instanceof
|
|
5103
|
+
message: e instanceof Error || e instanceof B ? e.message : "Session check failed",
|
|
5094
5104
|
originalError: e
|
|
5095
5105
|
};
|
|
5096
5106
|
W(this.subscribeStore, n), t = void 0;
|
|
@@ -5113,7 +5123,15 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5113
5123
|
return t?.id_token ? this.tokenDeliveryManager.isSessionInvalid() && e ? await this.refreshForSession() : t : void 0;
|
|
5114
5124
|
}
|
|
5115
5125
|
let t = this.storageManager.getTokens();
|
|
5116
|
-
|
|
5126
|
+
if (!t || !t.access_token) return;
|
|
5127
|
+
if (A(j(t.access_token))) {
|
|
5128
|
+
if (e) {
|
|
5129
|
+
let e = await this.refreshForSession();
|
|
5130
|
+
return e?.refresh_token || this.storageManager.getTokens()?.refresh_token || !this.tokenCacheService.isExpired() ? e : void 0;
|
|
5131
|
+
}
|
|
5132
|
+
return;
|
|
5133
|
+
}
|
|
5134
|
+
return t;
|
|
5117
5135
|
} catch (e) {
|
|
5118
5136
|
let t = {
|
|
5119
5137
|
operation: "tokens.get",
|
|
@@ -5384,7 +5402,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5384
5402
|
}
|
|
5385
5403
|
}
|
|
5386
5404
|
}, la = class {
|
|
5387
|
-
constructor(e, t, n, r =
|
|
5405
|
+
constructor(e, t, n, r = R) {
|
|
5388
5406
|
this.storageManager = e, this.subscribeStore = n, this.platform = r, this.checkInterval = null, this.CHECK_INTERVAL = 6e4, this.unsubscribeForeground = null, this.unsubscribeUnload = null, this.tokenExpiredFlag = !1, this.storageManager = e, this.setupLifecycleListeners();
|
|
5389
5407
|
}
|
|
5390
5408
|
get isRefreshing() {
|
|
@@ -5795,7 +5813,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5795
5813
|
}
|
|
5796
5814
|
}
|
|
5797
5815
|
}, da = class {
|
|
5798
|
-
constructor(e, t, n =
|
|
5816
|
+
constructor(e, t, n = R) {
|
|
5799
5817
|
this.userAPI = e, this.deviceService = t, this.platform = n;
|
|
5800
5818
|
}
|
|
5801
5819
|
getUserPasskeys() {
|
|
@@ -5809,7 +5827,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5809
5827
|
}
|
|
5810
5828
|
async addUserPasskey({ relyingPartyId: e, passkeyUsername: t, passkeyDisplayName: n } = {}) {
|
|
5811
5829
|
if (!this.platform.passkeys) throw Error("Passkeys are not supported on this platform");
|
|
5812
|
-
let r = this.deviceService.getDeviceId(), i =
|
|
5830
|
+
let r = this.deviceService.getDeviceId(), i = it(this.platform.getDeviceType()), { challenge_id: a, publicKey: o } = await this.userAPI.addUserPasskeyStart({
|
|
5813
5831
|
relyingPartyId: (e || this.platform.getCurrentUrl()?.hostname) ?? "",
|
|
5814
5832
|
deviceId: r,
|
|
5815
5833
|
os: i,
|
|
@@ -5878,7 +5896,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5878
5896
|
email_otp: 2,
|
|
5879
5897
|
sms_otp: 3,
|
|
5880
5898
|
recovery_codes: 9
|
|
5881
|
-
}, xa = (e) => e.requiredLevel ??
|
|
5899
|
+
}, xa = (e) => e.requiredLevel ?? _e(e.acrValues), Sa = (e, t) => {
|
|
5882
5900
|
let n = ba[e.type] ?? 5, r = t !== void 0 && t >= ya, i = e.type === "passkey";
|
|
5883
5901
|
return (r && !i ? 100 : 0) + n;
|
|
5884
5902
|
}, Ca = (e, t) => {
|
|
@@ -6239,7 +6257,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6239
6257
|
} catch {
|
|
6240
6258
|
a = void 0;
|
|
6241
6259
|
}
|
|
6242
|
-
return
|
|
6260
|
+
return ke(i ? {
|
|
6243
6261
|
status: e.status,
|
|
6244
6262
|
getHeader: (t) => e.getHeader(t) ?? void 0,
|
|
6245
6263
|
body: a
|
|
@@ -6247,7 +6265,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6247
6265
|
status: e.status,
|
|
6248
6266
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
6249
6267
|
}, { requireChallengeChannel: t.requireChallengeChannel });
|
|
6250
|
-
}, Xa = (e) =>
|
|
6268
|
+
}, Xa = (e) => ke({
|
|
6251
6269
|
status: e.status,
|
|
6252
6270
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
6253
6271
|
}, { requireChallengeChannel: "header" }).challenge, Za = (e, t) => t.passflow === null ? `[passflow] a 401/403 from ${e} carried an upgrade challenge, but no Passflow endpoint is configured — set \`url\` on the Passflow config.` : `[passflow] a 401/403 from ${e} carried an upgrade challenge, but that URL is not covered by the provider's \`backend\` prop — add it there to enable step-up for this API.`, Qa = (e, t) => e instanceof wa ? { kind: "cancelled" } : e instanceof Ta ? { kind: "sign-in-required" } : e instanceof Aa ? {
|
|
@@ -6709,7 +6727,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6709
6727
|
readBody: async () => e?.data,
|
|
6710
6728
|
request: c,
|
|
6711
6729
|
replay: async (e) => {
|
|
6712
|
-
let t =
|
|
6730
|
+
let t = Ie(Xo(o ?? {}, c, e));
|
|
6713
6731
|
try {
|
|
6714
6732
|
let e = await r(t);
|
|
6715
6733
|
return Zo(e, e?.config ?? t, e, r, i, c);
|
|
@@ -6723,8 +6741,8 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6723
6741
|
}
|
|
6724
6742
|
},
|
|
6725
6743
|
markers: {
|
|
6726
|
-
...
|
|
6727
|
-
...
|
|
6744
|
+
...Fe(o) ? { upgradeTransaction: !0 } : {},
|
|
6745
|
+
...Le(o) ? { replayed: !0 } : {}
|
|
6728
6746
|
},
|
|
6729
6747
|
raw: n,
|
|
6730
6748
|
replayable: u,
|
|
@@ -6941,7 +6959,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6941
6959
|
};
|
|
6942
6960
|
}, d;
|
|
6943
6961
|
return Object.defineProperties(async (e) => {
|
|
6944
|
-
let t = e?.acrValues === void 0 ? void 0 :
|
|
6962
|
+
let t = e?.acrValues === void 0 ? void 0 : ge(e.acrValues).level, n = {
|
|
6945
6963
|
status: 401,
|
|
6946
6964
|
...e?.acrValues === void 0 ? {} : { acrValues: e.acrValues },
|
|
6947
6965
|
...t === void 0 ? {} : { requiredLevel: t },
|
|
@@ -7027,11 +7045,11 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7027
7045
|
this.createSessionCallback = e, this.expiredSessionCallback = t, this.doRefreshTokens = n, await this.submitSessionCheck();
|
|
7028
7046
|
};
|
|
7029
7047
|
let { url: t, appId: n, scopes: r } = e;
|
|
7030
|
-
this.url = t || "https://auth.passflow.cloud", this.appId = n, this.platform = e.platform ??
|
|
7048
|
+
this.url = t || "https://auth.passflow.cloud", this.appId = n, this.platform = e.platform ?? R, this.deferFederatedLanding = e.deferFederatedLanding ?? !1, this.storageManager = new ue({
|
|
7031
7049
|
prefix: e.keyStoragePrefix ?? "",
|
|
7032
7050
|
storage: this.platform.storage,
|
|
7033
7051
|
appId: n
|
|
7034
|
-
}), this.deviceService = new
|
|
7052
|
+
}), this.deviceService = new de(this.storageManager), this.authApi = new jt(e, this.storageManager, this.deviceService), this.appApi = new wt(e, this.storageManager, this.deviceService), this.userApi = new Ht(e, this.storageManager, this.deviceService), this.settingApi = new Pt(e, this.storageManager, this.deviceService), this.tenantApi = new Ft(e, this.storageManager, this.deviceService), this.invitationApi = new Nt(e, this.storageManager, this.deviceService), this.twoFactorApi = new Bt(e, this.storageManager, this.deviceService), this.upgradeApi = new Vt(e, this.storageManager, this.deviceService), this.upgradeDomain = Be(e.url), this.subscribeStore = new Rn(), this.tokenCacheService = new la(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? _, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
|
|
7035
7053
|
let i = Mr(e.refreshCoordination, this.platform, e.keyStoragePrefix, { tokenKeys: () => this.storageManager.tokenKeys() });
|
|
7036
7054
|
this.authService = new aa(this.authApi, this.deviceService, this.storageManager, this.subscribeStore, this.tokenCacheService, this.scopes, this.createTenantForNewUser, this.url, {
|
|
7037
7055
|
createSession: async (e) => {
|
|
@@ -7126,7 +7144,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7126
7144
|
if (e) try {
|
|
7127
7145
|
let t = j(e), n = typeof t.acr == "string" ? t.acr : void 0;
|
|
7128
7146
|
if (!n) return;
|
|
7129
|
-
let r =
|
|
7147
|
+
let r = ge(n).level;
|
|
7130
7148
|
return r === void 0 ? { acrValues: n } : {
|
|
7131
7149
|
acrValues: n,
|
|
7132
7150
|
level: r
|
|
@@ -7168,7 +7186,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7168
7186
|
} catch (t) {
|
|
7169
7187
|
let n = {
|
|
7170
7188
|
operation: "session.check",
|
|
7171
|
-
message: t instanceof Error || t instanceof
|
|
7189
|
+
message: t instanceof Error || t instanceof B ? t.message : "Session check failed",
|
|
7172
7190
|
originalError: t
|
|
7173
7191
|
};
|
|
7174
7192
|
W(this.subscribeStore, n), e = void 0;
|
|
@@ -7236,7 +7254,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7236
7254
|
if (e?.pkce_enabled !== !1) throw wn();
|
|
7237
7255
|
return _i(this.url, this.appId, t);
|
|
7238
7256
|
}).then(() => {
|
|
7239
|
-
this.storageManager.clearDeliveryMode(), this.storageManager.saveTokens(t), e && this.storageManager.setHostedSignIn(e.origin + e.pathname), this.tokenCacheService.setTokensCache(t), this.authService.refresh.sessionStarted();
|
|
7257
|
+
this.storageManager.clearDeliveryMode(), this.storageManager.saveTokens(t, void 0, { replace: !0 }), e && this.storageManager.setHostedSignIn(e.origin + e.pathname), this.tokenCacheService.setTokensCache(t), this.authService.refresh.sessionStarted();
|
|
7240
7258
|
}).then(() => (this.subscribeStore.notify(G.SignIn, {
|
|
7241
7259
|
tokens: t,
|
|
7242
7260
|
parsedTokens: this.getParsedTokens(),
|
|
@@ -7395,7 +7413,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7395
7413
|
operation: t,
|
|
7396
7414
|
message: e instanceof Error ? e.message : `${n} failed`,
|
|
7397
7415
|
originalError: e,
|
|
7398
|
-
code: e instanceof
|
|
7416
|
+
code: e instanceof B ? e.id : void 0
|
|
7399
7417
|
};
|
|
7400
7418
|
throw W(this.subscribeStore, r), e;
|
|
7401
7419
|
}
|
|
@@ -7482,7 +7500,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7482
7500
|
}
|
|
7483
7501
|
setTokens(e) {
|
|
7484
7502
|
let t = this.getDeliveryMode(), n = t === N.Cookie || t === N.BFF;
|
|
7485
|
-
this.storageManager.saveTokens(e, n ? t : void 0), this.tokenCacheService.setTokensCache(e), this.authService.refresh.sessionStarted(), this.subscribeStore.notify(G.SignIn, {
|
|
7503
|
+
this.storageManager.saveTokens(e, n ? t : void 0, { replace: !0 }), this.tokenCacheService.setTokensCache(e), this.authService.refresh.sessionStarted(), this.subscribeStore.notify(G.SignIn, {
|
|
7486
7504
|
tokens: e,
|
|
7487
7505
|
parsedTokens: this.tokenCacheService.getParsedTokens()
|
|
7488
7506
|
});
|
|
@@ -7733,6 +7751,6 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7733
7751
|
}
|
|
7734
7752
|
};
|
|
7735
7753
|
xs = Ss, xs.version = h;
|
|
7736
|
-
export { p as AGENT_TOOL_HEADER_KEY, m as ANTI_BOT_ACTION,
|
|
7754
|
+
export { p as AGENT_TOOL_HEADER_KEY, m as ANTI_BOT_ACTION, Ke as ANTI_BOT_FAILED_ERROR_ID, f as ANTI_BOT_HEADER_KEY, Ye as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, Je as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, Ge as ANTI_BOT_REQUIRED_ERROR_ID, Xe as ANTI_BOT_SOLVE_FAILED_ERROR_ID, qe as ANTI_BOT_UNAVAILABLE_ERROR_ID, c as APP_ID_HEADER_KEY, $e as APP_SECRET_NAMES, l as AUTHORIZATION_HEADER_KEY, wt as AppAPI, jt as AuthAPI, aa as AuthService, Mt as CLIAuthAPI, y as DEFAULT_GROUP_NAME, _ as DEFAULT_SCOPES, _a as DEFAULT_UPGRADE_FACTORS, u as DEVICE_ID_HEADER_KEY, d as DEVICE_TYPE_HEADER_KEY, E as ERROR_MESSAGE_MAX_LENGTH, Ut as FETCH_PRIORITY_OIDC, Wt as FETCH_PRIORITY_UPGRADE, Gt as FetchMiddlewareContractError, ve as INSUFFICIENT_USER_AUTHENTICATION, Nt as InvitationAPI, oa as InvitationService, fn as M2MClient, sn as M2MConfigError, H as M2MError, cn as M2MErrorCodes, an as M2MNetworkError, on as M2MTokenParseError, ln as M2M_DEFAULTS, et as MASKED_SECRET_PREFIX, g as MINIMAL_DEFAULT_SCOPES, rt as OS, v as PASSFLOW_CLOUD_URL, We as PASSWORD_CHANGE_REQUIRED_ERROR_ID, x as POPUP_HEIGHT, ee as POPUP_POLL_INTERVAL_MS, S as POPUP_TIMEOUT_MS, b as POPUP_WIDTH, Ss as Passflow, ze as PassflowAdminEndpointPaths, z as PassflowEndpointPaths, B as PassflowError, G as PassflowEvent, U as PassflowOidcError, Ze as PassflowPasswordChangeRequiredError, Y as PassflowRefreshError, fe as PopupClosedError, Qe as Providers, vi as RECOVERABLE_COMMIT_ERROR_IDS, Fr as REFRESH_AUTH_FAILURE_IDS, J as RefreshErrorId, Re as RequestMethod, h as SDK_VERSION, He as SERVICE_UNAVAILABLE_ERROR_ID, Ue as SERVICE_UNAVAILABLE_MESSAGE, yi as SESSION_INVALIDATING_COMMIT_ERROR_IDS, tt as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, se as SessionState, Pt as SettingAPI, C as TOKEN_EXPIRY_BUFFER_SECONDS, Ft as TenantAPI, ca as TenantService, sa as TenantUserMembership, la as TokenCacheService, N as TokenDeliveryMode, M as TokenType, Bt as TwoFactorApiClient, ot as TwoFactorPolicy, ua as TwoFactorService, ye as UPGRADE_REQUIRED, T as USERNAME_MAX_LENGTH, w as USERNAME_MIN_LENGTH, Vt as UpgradeAPI, wa as UpgradeCancelledError, qr as UpgradeCommitInterruptedError, Ra as UpgradeController, Q as UpgradeErrorIds, fa as UpgradeFactorError, Pi as UpgradeInsufficientError, Ii as UpgradeSessionChangedError, Ta as UpgradeSignInRequiredError, $ as UpgradeTransportError, Fi as UpgradeUnavailableError, Aa as UpgradeUnsatisfiableError, Ht as UserAPI, da as UserService, L as WebAdapter, ji as classifyUpgradeError, va as factorRegistry, rn as fetchRegistryState, it as getOSFromDeviceType, Ni as invalidatesSessionOnCommit, Ve as isEmailVerificationStep, nt as isMaskedSecret, Mi as isRecoverableCommitFailure, xi as isRetryableUpgradeKind, A as isTokenExpired, ho as isUpgradeCancelled, go as isUpgradeExhausted, _o as isUpgradeInsufficient, xo as isUpgradeSessionChanged, yo as isUpgradeSignInRequired, Ti as isUpgradeTransportError, So as isUpgradeTransportFailure, bo as isUpgradeUnavailable, vo as isUpgradeUnsatisfiable, Vi as isValidEmail, zi as isValidJWTFormat, Hi as isValidPhoneNumber, Ui as isValidUsername, Ee as parseChallengeBody, Te as parseChallengeHeader, j as parseToken, Ae as parseUpgradeChallenge, ga as passkeyFactor, at as pathWithParams, ha as recoveryCodesFactor, nn as registerFetchMiddleware, _e as requiredAcrLevel, Be as resolveUpgradeDomain, Bi as sanitizeErrorMessage, Ca as selectFactors, ma as totpFactor, R as webAdapter };
|
|
7737
7755
|
|
|
7738
7756
|
//# sourceMappingURL=index.mjs.map
|