@passflow/core 0.24.0 → 0.26.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 +35 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -7
- package/dist/index.d.ts +130 -7
- package/dist/index.mjs +783 -660
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "axios";
|
|
2
2
|
import { startAuthentication as t, startRegistration as n } from "@simplewebauthn/browser";
|
|
3
3
|
// package.json
|
|
4
|
-
var r = "0.
|
|
4
|
+
var r = "0.26.0", i = "X-Passflow-Clientid", a = "Authorization", o = "X-Passflow-DeviceId", s = "X-Passflow-DeviceType", c = r, l = [
|
|
5
5
|
"id",
|
|
6
6
|
"offline",
|
|
7
7
|
"openid"
|
|
@@ -567,7 +567,7 @@ var j = /* @__PURE__ */ function(e) {
|
|
|
567
567
|
}), Ee = (e) => Se(e, xe), De = /* @__PURE__ */ function(e) {
|
|
568
568
|
return e.GET = "get", e.POST = "post", e.PUT = "put", e.PATCH = "patch", e.DELETE = "delete", e;
|
|
569
569
|
}({}), z = /* @__PURE__ */ function(e) {
|
|
570
|
-
return e.signin = "/auth/login", e.signup = "/auth/register", e.pkceExchange = "/auth/pkce_exchange", 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.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.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;
|
|
570
|
+
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.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;
|
|
571
571
|
}({}), Oe = /* @__PURE__ */ function(e) {
|
|
572
572
|
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;
|
|
573
573
|
}({}), ke = (e) => {
|
|
@@ -608,7 +608,10 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
608
608
|
}({}), ze = 3, Be = 1e3, Ve = (e) => (t) => {
|
|
609
609
|
let n = e.headers?.[t] ?? e.headers?.[t.toLowerCase()];
|
|
610
610
|
return Array.isArray(n) ? n.join(", ") : n;
|
|
611
|
-
}, He = (e) => ye(e.status, Ve(e), e.data), Ue = (e) => He(e) !== void 0, We = (e) => e?.includes(z.refresh) ?? !1, Ge = (e) => e?.includes("logout") ?? !1,
|
|
611
|
+
}, He = (e) => ye(e.status, Ve(e), e.data), Ue = (e) => He(e) !== void 0, We = (e) => e?.includes(z.refresh) ?? !1, Ge = (e) => e?.includes("logout") ?? !1, Ke = "__passflowOwnBearer", qe = (e) => typeof e == "object" && !!e && e[Ke] === !0, Je = (e) => e ? {
|
|
612
|
+
headers: { [a]: `Bearer ${e}` },
|
|
613
|
+
[Ke]: !0
|
|
614
|
+
} : {}, Ye = class {
|
|
612
615
|
get origin() {
|
|
613
616
|
return this._platform.getCurrentUrl()?.origin ?? "";
|
|
614
617
|
}
|
|
@@ -639,7 +642,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
639
642
|
baseURL: this.url,
|
|
640
643
|
headers: { ...this.defaultHeaders }
|
|
641
644
|
}), this.instance.interceptors.request.use(async (e) => {
|
|
642
|
-
if (this.isNonAuthEndpoint(e.url)) return e;
|
|
645
|
+
if (this.isNonAuthEndpoint(e.url) || qe(e)) return e;
|
|
643
646
|
if (this.tokenDeliveryManager.isCookieMode()) {
|
|
644
647
|
e.withCredentials = !0;
|
|
645
648
|
let t = this.storageManager.getCsrfToken();
|
|
@@ -665,7 +668,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
665
668
|
}
|
|
666
669
|
return e.headers[a] = `Bearer ${n}`, e;
|
|
667
670
|
}), this.instance.interceptors.response.use((e) => e, async (e) => {
|
|
668
|
-
if (e.response?.status
|
|
671
|
+
if (e.response?.status !== 401 || We(e.config?.url) || qe(e.config) || this.isUpgradeTransactionError(e) || this.tokenDeliveryManager.setSessionInvalid(), e.response && this.upgradeHandler) {
|
|
669
672
|
let t = He(e.response);
|
|
670
673
|
if (t) try {
|
|
671
674
|
return await this.upgradeHandler(e, t);
|
|
@@ -771,9 +774,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
771
774
|
[i]: e
|
|
772
775
|
}, this.instance.defaults.headers.common[i] = e;
|
|
773
776
|
}
|
|
774
|
-
},
|
|
777
|
+
}, Xe = class {
|
|
775
778
|
constructor(e, t, n) {
|
|
776
|
-
this.axiosClient = new
|
|
779
|
+
this.axiosClient = new Ye(e, t, n);
|
|
777
780
|
}
|
|
778
781
|
setAppId(e) {
|
|
779
782
|
this.axiosClient.setAppId(e);
|
|
@@ -781,7 +784,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
781
784
|
getAppSettings() {
|
|
782
785
|
return this.axiosClient.get(z.appSettings);
|
|
783
786
|
}
|
|
784
|
-
},
|
|
787
|
+
}, Ze = { withCredentials: !0 }, Qe = 15e3, $e = "Sign-in failed. Start again.", et = "Something went wrong. Try again later.", tt = (e, t, n, r) => {
|
|
785
788
|
if (e instanceof B) return e;
|
|
786
789
|
let i = e?.response?.data?.error;
|
|
787
790
|
return new B({
|
|
@@ -791,9 +794,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
791
794
|
location: t,
|
|
792
795
|
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
793
796
|
});
|
|
794
|
-
},
|
|
797
|
+
}, nt = class {
|
|
795
798
|
constructor(e, t, n) {
|
|
796
|
-
this.axiosClient = new
|
|
799
|
+
this.axiosClient = new Ye(e, t, n);
|
|
797
800
|
}
|
|
798
801
|
setAppId(e) {
|
|
799
802
|
this.axiosClient.setAppId(e);
|
|
@@ -812,7 +815,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
812
815
|
device: t,
|
|
813
816
|
os: n
|
|
814
817
|
};
|
|
815
|
-
return this.axiosClient.post(z.signin, r,
|
|
818
|
+
return this.axiosClient.post(z.signin, r, Ze);
|
|
816
819
|
}
|
|
817
820
|
signUp(e) {
|
|
818
821
|
let { create_tenant: t, anonymous: n } = e, r = {
|
|
@@ -820,16 +823,16 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
820
823
|
create_tenant: t ?? !1,
|
|
821
824
|
anonymous: n ?? !1
|
|
822
825
|
};
|
|
823
|
-
return this.axiosClient.post(z.signup, r,
|
|
826
|
+
return this.axiosClient.post(z.signup, r, Ze);
|
|
824
827
|
}
|
|
825
828
|
async pkceExchange(e, t) {
|
|
826
829
|
try {
|
|
827
830
|
return await this.axiosClient.post(z.pkceExchange, {
|
|
828
831
|
authz_code: e,
|
|
829
832
|
verifier: t
|
|
830
|
-
},
|
|
833
|
+
}, Ze);
|
|
831
834
|
} catch (e) {
|
|
832
|
-
throw
|
|
835
|
+
throw tt(e, z.pkceExchange, "error.pkce.exchange", $e);
|
|
833
836
|
}
|
|
834
837
|
}
|
|
835
838
|
async passwordlessSignIn(e, t, n) {
|
|
@@ -842,46 +845,53 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
842
845
|
try {
|
|
843
846
|
return await this.axiosClient.post(z.passwordless, i);
|
|
844
847
|
} catch (e) {
|
|
845
|
-
throw
|
|
848
|
+
throw tt(e, z.passwordless, "error.passwordless.start", et);
|
|
846
849
|
}
|
|
847
850
|
}
|
|
848
851
|
async passwordlessSignInComplete(e) {
|
|
849
852
|
try {
|
|
850
|
-
return await this.axiosClient.post(z.passwordlessComplete, e,
|
|
853
|
+
return await this.axiosClient.post(z.passwordlessComplete, e, Ze);
|
|
851
854
|
} catch (e) {
|
|
852
|
-
throw
|
|
855
|
+
throw tt(e, z.passwordlessComplete, "error.passwordless.complete", et);
|
|
853
856
|
}
|
|
854
857
|
}
|
|
855
858
|
async passwordlessStatus(e, t) {
|
|
856
859
|
try {
|
|
857
860
|
return await this.axiosClient.post(z.passwordlessStatus, e, {
|
|
858
|
-
...
|
|
859
|
-
timeout:
|
|
861
|
+
...Ze,
|
|
862
|
+
timeout: Qe,
|
|
860
863
|
signal: t?.signal
|
|
861
864
|
});
|
|
862
865
|
} catch (e) {
|
|
863
|
-
throw
|
|
866
|
+
throw tt(e, z.passwordlessStatus, "error.passwordless.status", $e);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
async checkRedirectUrl(e) {
|
|
870
|
+
try {
|
|
871
|
+
return (await this.axiosClient.post(z.redirectCheck, { redirect_url: e })).redirect_url;
|
|
872
|
+
} catch (e) {
|
|
873
|
+
throw tt(e, z.redirectCheck, "error.redirect.check", et);
|
|
864
874
|
}
|
|
865
875
|
}
|
|
866
876
|
async passwordlessApprovalInfo(e) {
|
|
867
877
|
try {
|
|
868
878
|
return await this.axiosClient.post(z.passwordlessApprovalInfo, e);
|
|
869
879
|
} catch (e) {
|
|
870
|
-
throw
|
|
880
|
+
throw tt(e, z.passwordlessApprovalInfo, "error.passwordless.approval", et);
|
|
871
881
|
}
|
|
872
882
|
}
|
|
873
883
|
async passwordlessApprovalDecide(e) {
|
|
874
884
|
try {
|
|
875
885
|
return await this.axiosClient.post(z.passwordlessApprovalDecide, e);
|
|
876
886
|
} catch (e) {
|
|
877
|
-
throw
|
|
887
|
+
throw tt(e, z.passwordlessApprovalDecide, "error.passwordless.approval", et);
|
|
878
888
|
}
|
|
879
889
|
}
|
|
880
890
|
validateEmailCode(e) {
|
|
881
891
|
return this.axiosClient.post(z.passkeyValidate, {
|
|
882
892
|
challenge_id: e.challenge_id,
|
|
883
893
|
otp: e.otp
|
|
884
|
-
},
|
|
894
|
+
}, Ze);
|
|
885
895
|
}
|
|
886
896
|
logOut(e, t, n = !1) {
|
|
887
897
|
let r = n ? void 0 : {
|
|
@@ -922,7 +932,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
922
932
|
device: t,
|
|
923
933
|
passkey_data: e
|
|
924
934
|
}, a = r ? Oe.passkeyRegisterComplete : z.passkeyRegisterComplete;
|
|
925
|
-
return this.axiosClient.post(a, i,
|
|
935
|
+
return this.axiosClient.post(a, i, Ze);
|
|
926
936
|
}
|
|
927
937
|
passkeyAuthenticateStart(e, t, n, r = !1) {
|
|
928
938
|
let i = {
|
|
@@ -939,7 +949,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
939
949
|
device: t,
|
|
940
950
|
passkey_data: e
|
|
941
951
|
}, a = r ? Oe.passkeyAuthenticateComplete : z.passkeyAuthenticateComplete;
|
|
942
|
-
return this.axiosClient.post(a, i,
|
|
952
|
+
return this.axiosClient.post(a, i, Ze);
|
|
943
953
|
}
|
|
944
954
|
passkeyValidate(e, t, n, r = !1, a) {
|
|
945
955
|
let o = {
|
|
@@ -951,9 +961,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
951
961
|
let c = a ? { [i]: a } : {};
|
|
952
962
|
return this.axiosClient.post(s, o, { headers: c });
|
|
953
963
|
}
|
|
954
|
-
},
|
|
964
|
+
}, rt = class {
|
|
955
965
|
constructor(e, t, n) {
|
|
956
|
-
this.axiosClient = new
|
|
966
|
+
this.axiosClient = new Ye(e, t, n);
|
|
957
967
|
}
|
|
958
968
|
setAppId(e) {
|
|
959
969
|
this.axiosClient.setAppId(e);
|
|
@@ -965,9 +975,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
965
975
|
completeCLIAuth(e) {
|
|
966
976
|
return this.axiosClient.post(z.cliAuthComplete, e);
|
|
967
977
|
}
|
|
968
|
-
},
|
|
978
|
+
}, it = class {
|
|
969
979
|
constructor(e, t, n) {
|
|
970
|
-
this.axiosClient = new
|
|
980
|
+
this.axiosClient = new Ye(e, t, n);
|
|
971
981
|
}
|
|
972
982
|
setAppId(e) {
|
|
973
983
|
this.axiosClient.setAppId(e);
|
|
@@ -996,9 +1006,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
996
1006
|
let t = V(z.invitationGetLink, { invitationID: e });
|
|
997
1007
|
return this.axiosClient.get(t);
|
|
998
1008
|
}
|
|
999
|
-
},
|
|
1009
|
+
}, at = class {
|
|
1000
1010
|
constructor(e, t, n) {
|
|
1001
|
-
this.axiosClient = new
|
|
1011
|
+
this.axiosClient = new Ye(e, t, n);
|
|
1002
1012
|
}
|
|
1003
1013
|
setAppId(e) {
|
|
1004
1014
|
this.axiosClient.setAppId(e);
|
|
@@ -1012,9 +1022,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1012
1022
|
getPasskeySettings() {
|
|
1013
1023
|
return this.axiosClient.get(z.settingsPasskey);
|
|
1014
1024
|
}
|
|
1015
|
-
},
|
|
1025
|
+
}, ot = class {
|
|
1016
1026
|
constructor(e, t, n) {
|
|
1017
|
-
this.axiosClient = new
|
|
1027
|
+
this.axiosClient = new Ye(e, t, n);
|
|
1018
1028
|
}
|
|
1019
1029
|
setAppId(e) {
|
|
1020
1030
|
this.axiosClient.setAppId(e);
|
|
@@ -1128,38 +1138,58 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1128
1138
|
let r = `${z.tenantPath}/${e}/group/${t}/invite/email/${n}`;
|
|
1129
1139
|
return this.axiosClient.delete(r);
|
|
1130
1140
|
}
|
|
1131
|
-
},
|
|
1141
|
+
}, st = (e) => e ? { headers: { Authorization: `Bearer ${e}` } } : {}, ct = (e) => ({
|
|
1132
1142
|
withCredentials: !0,
|
|
1133
|
-
...
|
|
1134
|
-
}),
|
|
1143
|
+
...st(e)
|
|
1144
|
+
}), lt = ({ qr_code_image: e, qr_code: t, ...n }) => ({
|
|
1145
|
+
...n,
|
|
1146
|
+
qr_code: (t ?? e ?? "").replace(/^data:image\/png;base64,/, "")
|
|
1147
|
+
}), ut = {
|
|
1148
|
+
"error.2fa.setup.token.expired": "EXPIRED_TOKEN",
|
|
1149
|
+
"error.2fa.setup.token.revoked": "REVOKED_TOKEN",
|
|
1150
|
+
"error.2fa.setup.token.already_used": "ALREADY_USED",
|
|
1151
|
+
"error.2fa.setup.token.rate.limit.exceeded": "RATE_LIMITED"
|
|
1152
|
+
}, dt = class {
|
|
1135
1153
|
constructor(e, t, n) {
|
|
1136
|
-
this.axiosClient = new
|
|
1154
|
+
this.axiosClient = new Ye(e, t, n);
|
|
1137
1155
|
}
|
|
1138
1156
|
setAppId(e) {
|
|
1139
1157
|
this.axiosClient.setAppId(e);
|
|
1140
1158
|
}
|
|
1141
|
-
getStatus() {
|
|
1142
|
-
return this.axiosClient.get(z.twoFactorStatus);
|
|
1159
|
+
getStatus(e) {
|
|
1160
|
+
return this.axiosClient.get(z.twoFactorStatus, Je(e));
|
|
1143
1161
|
}
|
|
1144
|
-
beginSetup() {
|
|
1145
|
-
return this.axiosClient.post(z.twoFactorSetupBegin, {});
|
|
1162
|
+
async beginSetup(e) {
|
|
1163
|
+
return lt(await this.axiosClient.post(z.twoFactorSetupBegin, {}, Je(e)));
|
|
1146
1164
|
}
|
|
1147
|
-
confirmSetup(e) {
|
|
1148
|
-
return this.axiosClient.post(z.twoFactorSetupConfirm, e);
|
|
1165
|
+
confirmSetup(e, t) {
|
|
1166
|
+
return this.axiosClient.post(z.twoFactorSetupConfirm, e, Je(t));
|
|
1167
|
+
}
|
|
1168
|
+
async getEnrollment(e) {
|
|
1169
|
+
return (await this.axiosClient.get(z.twoFactorEnrollment, Je(e))).enrollment;
|
|
1170
|
+
}
|
|
1171
|
+
sendSetupLink(e) {
|
|
1172
|
+
return this.axiosClient.post(z.twoFactorEnrollmentEmailLink, void 0, Je(e));
|
|
1173
|
+
}
|
|
1174
|
+
async beginEnrollment(e) {
|
|
1175
|
+
return lt(await this.axiosClient.post(z.twoFactorEnrollmentBegin, void 0, Je(e)));
|
|
1176
|
+
}
|
|
1177
|
+
confirmEnrollment(e, t) {
|
|
1178
|
+
return this.axiosClient.post(z.twoFactorEnrollmentConfirm, t, Je(e));
|
|
1149
1179
|
}
|
|
1150
1180
|
verify(e) {
|
|
1151
1181
|
let { tfa_token: t, code: n, trust_device: r } = e;
|
|
1152
1182
|
return this.axiosClient.post(z.twoFactorVerify, {
|
|
1153
1183
|
code: n,
|
|
1154
1184
|
...r ? { trust_device: !0 } : {}
|
|
1155
|
-
},
|
|
1185
|
+
}, ct(t));
|
|
1156
1186
|
}
|
|
1157
1187
|
useRecoveryCode(e) {
|
|
1158
1188
|
let { tfa_token: t, recovery_code: n, trust_device: r } = e;
|
|
1159
1189
|
return this.axiosClient.post(z.twoFactorRecovery, {
|
|
1160
1190
|
recovery_code: n,
|
|
1161
1191
|
...r ? { trust_device: !0 } : {}
|
|
1162
|
-
},
|
|
1192
|
+
}, ct(t));
|
|
1163
1193
|
}
|
|
1164
1194
|
disable(e) {
|
|
1165
1195
|
return this.axiosClient.delete(z.twoFactor, { data: e });
|
|
@@ -1171,7 +1201,13 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1171
1201
|
let t = `${z.twoFactorSetupMagicLink}/${e}`;
|
|
1172
1202
|
return this.axiosClient.get(t, { transformRequest: [(e, t) => (t && delete t.Authorization, e)] }).then((e) => {
|
|
1173
1203
|
let t = e;
|
|
1174
|
-
return {
|
|
1204
|
+
return t.valid === !1 ? {
|
|
1205
|
+
success: !1,
|
|
1206
|
+
error: {
|
|
1207
|
+
code: "INVALID_TOKEN",
|
|
1208
|
+
message: this.getDefaultErrorMessage(400)
|
|
1209
|
+
}
|
|
1210
|
+
} : {
|
|
1175
1211
|
success: !0,
|
|
1176
1212
|
sessionToken: t.session_token,
|
|
1177
1213
|
userId: t.user_id,
|
|
@@ -1179,6 +1215,13 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1179
1215
|
appId: t.app_id
|
|
1180
1216
|
};
|
|
1181
1217
|
}).catch((e) => {
|
|
1218
|
+
if (e instanceof B) return {
|
|
1219
|
+
success: !1,
|
|
1220
|
+
error: {
|
|
1221
|
+
code: ut[e.id] ?? this.mapStatusToErrorCode(e.status),
|
|
1222
|
+
message: e.message || this.getDefaultErrorMessage(e.status)
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1182
1225
|
if (e.response) {
|
|
1183
1226
|
let t = e.response.status, n = e.response.data || {}, r = e.response.headers?.["retry-after"] ? parseInt(e.response.headers["retry-after"], 10) : void 0;
|
|
1184
1227
|
return {
|
|
@@ -1240,17 +1283,17 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1240
1283
|
return this.axiosClient.delete(t);
|
|
1241
1284
|
}
|
|
1242
1285
|
requestChallenge(e, t) {
|
|
1243
|
-
return this.axiosClient.post(z.TwoFactorChallenge, e,
|
|
1286
|
+
return this.axiosClient.post(z.TwoFactorChallenge, e, st(t));
|
|
1244
1287
|
}
|
|
1245
1288
|
verifyV2(e, t) {
|
|
1246
1289
|
let { trust_device: n, ...r } = e;
|
|
1247
1290
|
return this.axiosClient.post(z.TwoFactorVerifyV2, {
|
|
1248
1291
|
...r,
|
|
1249
1292
|
...n ? { trust_device: !0 } : {}
|
|
1250
|
-
},
|
|
1293
|
+
}, ct(t));
|
|
1251
1294
|
}
|
|
1252
1295
|
switchToAlternative(e, t) {
|
|
1253
|
-
return this.axiosClient.post(z.TwoFactorAlternative, e,
|
|
1296
|
+
return this.axiosClient.post(z.TwoFactorAlternative, e, st(t));
|
|
1254
1297
|
}
|
|
1255
1298
|
async getTrustedDevices() {
|
|
1256
1299
|
return (await this.axiosClient.get(z.TwoFactorTrustedDevices, { withCredentials: !0 }))?.devices ?? [];
|
|
@@ -1259,9 +1302,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1259
1302
|
let t = V(z.TwoFactorTrustedDeviceRevoke, { id: e });
|
|
1260
1303
|
return this.axiosClient.delete(t);
|
|
1261
1304
|
}
|
|
1262
|
-
},
|
|
1305
|
+
}, ft = class {
|
|
1263
1306
|
constructor(e, t, n) {
|
|
1264
|
-
this.axiosClient = new
|
|
1307
|
+
this.axiosClient = new Ye(e, t, n);
|
|
1265
1308
|
}
|
|
1266
1309
|
setAppId(e) {
|
|
1267
1310
|
this.axiosClient.setAppId(e);
|
|
@@ -1269,9 +1312,9 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1269
1312
|
startUpgrade(e) {
|
|
1270
1313
|
return this.axiosClient.post(z.upgradeStart, e, Ce({}));
|
|
1271
1314
|
}
|
|
1272
|
-
},
|
|
1315
|
+
}, pt = class {
|
|
1273
1316
|
constructor(e, t, n) {
|
|
1274
|
-
this.axiosClient = new
|
|
1317
|
+
this.axiosClient = new Ye(e, t, n);
|
|
1275
1318
|
}
|
|
1276
1319
|
setAppId(e) {
|
|
1277
1320
|
this.axiosClient.setAppId(e);
|
|
@@ -1302,50 +1345,50 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1302
1345
|
passkey_data: e
|
|
1303
1346
|
});
|
|
1304
1347
|
}
|
|
1305
|
-
},
|
|
1348
|
+
}, mt = 10, ht = 20, gt = class extends Error {
|
|
1306
1349
|
constructor(e) {
|
|
1307
1350
|
super(`Passflow fetch middleware '${e}' resolved without calling next(). Every registered middleware must delegate exactly once; swallowing a request would drop a caller's fetch inside the Passflow wrapper.`), this.name = "FetchMiddlewareContractError", this.middlewareName = e;
|
|
1308
1351
|
}
|
|
1309
|
-
},
|
|
1352
|
+
}, _t = [], vt = 0, yt = !1, bt, xt, St = (e, t) => e.priority - t.priority || e.seq - t.seq, Ct = () => typeof globalThis > "u" ? void 0 : globalThis, wt = async (e, t, n, r) => {
|
|
1310
1353
|
if (t >= e.length) {
|
|
1311
|
-
let e =
|
|
1354
|
+
let e = bt;
|
|
1312
1355
|
if (!e) throw Error("Passflow fetch registry: no captured fetch to delegate to.");
|
|
1313
1356
|
return e(n, r);
|
|
1314
1357
|
}
|
|
1315
1358
|
let i = e[t];
|
|
1316
|
-
if (!i) return
|
|
1317
|
-
let a = !1, o = await i.middleware((n, r) => (a = !0,
|
|
1318
|
-
if (!a) throw new
|
|
1359
|
+
if (!i) return wt(e, e.length, n, r);
|
|
1360
|
+
let a = !1, o = await i.middleware((n, r) => (a = !0, wt(e, t + 1, n, r)), n, r);
|
|
1361
|
+
if (!a) throw new gt(i.name);
|
|
1319
1362
|
return o;
|
|
1320
|
-
},
|
|
1321
|
-
let e =
|
|
1363
|
+
}, Tt = () => {
|
|
1364
|
+
let e = Ct();
|
|
1322
1365
|
if (!e || typeof e.fetch != "function") return !1;
|
|
1323
|
-
let t = e.fetch.bind(e), n = (e, t) =>
|
|
1324
|
-
return
|
|
1325
|
-
},
|
|
1326
|
-
let e =
|
|
1327
|
-
e &&
|
|
1328
|
-
},
|
|
1329
|
-
if (!
|
|
1366
|
+
let t = e.fetch.bind(e), n = (e, t) => wt([..._t].sort(St), 0, e, t);
|
|
1367
|
+
return bt = t, xt = n, e.fetch = n, yt = !0, !0;
|
|
1368
|
+
}, Et = () => {
|
|
1369
|
+
let e = Ct();
|
|
1370
|
+
e && xt && e.fetch === xt && (bt && (e.fetch = bt), yt = !1, xt = void 0, bt = void 0);
|
|
1371
|
+
}, Dt = (e, t) => {
|
|
1372
|
+
if (!yt && !Tt()) return () => {};
|
|
1330
1373
|
let n = {
|
|
1331
1374
|
middleware: e,
|
|
1332
1375
|
name: t.name,
|
|
1333
1376
|
priority: t.priority,
|
|
1334
|
-
seq:
|
|
1377
|
+
seq: vt++
|
|
1335
1378
|
};
|
|
1336
|
-
|
|
1379
|
+
_t.push(n);
|
|
1337
1380
|
let r = !1;
|
|
1338
1381
|
return () => {
|
|
1339
|
-
r || (r = !0,
|
|
1382
|
+
r || (r = !0, _t = _t.filter((e) => e !== n), _t.length === 0 && Et());
|
|
1340
1383
|
};
|
|
1341
|
-
},
|
|
1342
|
-
let e =
|
|
1384
|
+
}, Ot = () => {
|
|
1385
|
+
let e = Ct();
|
|
1343
1386
|
return {
|
|
1344
|
-
installed:
|
|
1345
|
-
names: [...
|
|
1346
|
-
foreignPatch:
|
|
1387
|
+
installed: yt,
|
|
1388
|
+
names: [..._t].sort(St).map((e) => e.name),
|
|
1389
|
+
foreignPatch: yt && !!e && !!xt && e.fetch !== xt
|
|
1347
1390
|
};
|
|
1348
|
-
},
|
|
1391
|
+
}, H = class e extends Error {
|
|
1349
1392
|
constructor(t) {
|
|
1350
1393
|
super(t.message), this.name = "M2MError", this.code = t.code, this.status = t.status ?? 400, this.errorUri = t.errorUri, this.rateLimitInfo = t.rateLimitInfo, this.headers = t.headers, this.cause = t.cause, this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), Error.captureStackTrace && Error.captureStackTrace(this, e);
|
|
1351
1394
|
}
|
|
@@ -1414,7 +1457,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1414
1457
|
let e = `M2MError [${this.code}]: ${this.message}`;
|
|
1415
1458
|
return this.status && (e += ` (HTTP ${this.status})`), e;
|
|
1416
1459
|
}
|
|
1417
|
-
},
|
|
1460
|
+
}, kt = class extends H {
|
|
1418
1461
|
constructor(e, t) {
|
|
1419
1462
|
super({
|
|
1420
1463
|
code: "temporarily_unavailable",
|
|
@@ -1423,7 +1466,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1423
1466
|
cause: t
|
|
1424
1467
|
}), this.name = "M2MNetworkError";
|
|
1425
1468
|
}
|
|
1426
|
-
},
|
|
1469
|
+
}, At = class extends H {
|
|
1427
1470
|
constructor(e, t) {
|
|
1428
1471
|
super({
|
|
1429
1472
|
code: "invalid_request",
|
|
@@ -1432,7 +1475,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1432
1475
|
cause: t
|
|
1433
1476
|
}), this.name = "M2MTokenParseError";
|
|
1434
1477
|
}
|
|
1435
|
-
},
|
|
1478
|
+
}, jt = class extends H {
|
|
1436
1479
|
constructor(e) {
|
|
1437
1480
|
super({
|
|
1438
1481
|
code: "invalid_request",
|
|
@@ -1440,7 +1483,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1440
1483
|
status: 400
|
|
1441
1484
|
}), this.name = "M2MConfigError";
|
|
1442
1485
|
}
|
|
1443
|
-
},
|
|
1486
|
+
}, Mt = {
|
|
1444
1487
|
InvalidRequest: "invalid_request",
|
|
1445
1488
|
InvalidClient: "invalid_client",
|
|
1446
1489
|
InvalidGrant: "invalid_grant",
|
|
@@ -1450,14 +1493,14 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1450
1493
|
RateLimitExceeded: "rate_limit_exceeded",
|
|
1451
1494
|
ServerError: "server_error",
|
|
1452
1495
|
TemporarilyUnavailable: "temporarily_unavailable"
|
|
1453
|
-
},
|
|
1496
|
+
}, Nt = {
|
|
1454
1497
|
TOKEN_ENDPOINT: "/oauth2/token",
|
|
1455
1498
|
TIMEOUT: 1e4,
|
|
1456
1499
|
RETRIES: 3,
|
|
1457
1500
|
RETRY_DELAY: 1e3,
|
|
1458
1501
|
REFRESH_THRESHOLD: 30,
|
|
1459
1502
|
CONTENT_TYPE: "application/x-www-form-urlencoded"
|
|
1460
|
-
},
|
|
1503
|
+
}, Pt = class {
|
|
1461
1504
|
constructor() {
|
|
1462
1505
|
this.cache = /* @__PURE__ */ new Map();
|
|
1463
1506
|
}
|
|
@@ -1474,18 +1517,18 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1474
1517
|
delete(e) {
|
|
1475
1518
|
return this.cache.delete(e), Promise.resolve();
|
|
1476
1519
|
}
|
|
1477
|
-
},
|
|
1520
|
+
}, Ft = {
|
|
1478
1521
|
shouldRetry(e, t) {
|
|
1479
1522
|
return t >= 3 ? !1 : e.code === "server_error" || e.code === "temporarily_unavailable" || e.code === "rate_limit_exceeded" || e.status !== void 0 && e.status >= 500;
|
|
1480
1523
|
},
|
|
1481
1524
|
getDelay(e) {
|
|
1482
1525
|
return 2 ** (e - 1) * 1e3;
|
|
1483
1526
|
}
|
|
1484
|
-
},
|
|
1527
|
+
}, It = class {
|
|
1485
1528
|
constructor(e) {
|
|
1486
|
-
if (!e.url) throw new
|
|
1487
|
-
if (!e.clientId) throw new
|
|
1488
|
-
if (!e.clientSecret) throw new
|
|
1529
|
+
if (!e.url) throw new jt("M2M client requires a URL");
|
|
1530
|
+
if (!e.clientId) throw new jt("M2M client requires a clientId");
|
|
1531
|
+
if (!e.clientSecret) throw new jt("M2M client requires a clientSecret");
|
|
1489
1532
|
let t = e.url.replace(/\/$/, "");
|
|
1490
1533
|
this.config = {
|
|
1491
1534
|
url: t,
|
|
@@ -1494,16 +1537,16 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1494
1537
|
scopes: e.scopes,
|
|
1495
1538
|
audience: e.audience,
|
|
1496
1539
|
autoRefresh: e.autoRefresh ?? !1,
|
|
1497
|
-
refreshThreshold: e.refreshThreshold ??
|
|
1498
|
-
timeout: e.timeout ??
|
|
1499
|
-
retries: e.retries ??
|
|
1500
|
-
retryDelay: e.retryDelay ??
|
|
1540
|
+
refreshThreshold: e.refreshThreshold ?? Nt.REFRESH_THRESHOLD,
|
|
1541
|
+
timeout: e.timeout ?? Nt.TIMEOUT,
|
|
1542
|
+
retries: e.retries ?? Nt.RETRIES,
|
|
1543
|
+
retryDelay: e.retryDelay ?? Nt.RETRY_DELAY,
|
|
1501
1544
|
retryStrategy: e.retryStrategy,
|
|
1502
1545
|
cache: e.cache,
|
|
1503
1546
|
onTokenRequest: e.onTokenRequest,
|
|
1504
1547
|
onTokenResponse: e.onTokenResponse,
|
|
1505
1548
|
onError: e.onError
|
|
1506
|
-
}, this.cache = e.cache ?? new
|
|
1549
|
+
}, this.cache = e.cache ?? new Pt(), this.retryStrategy = e.retryStrategy ?? Ft, this.tokenEndpoint = `${t}${Nt.TOKEN_ENDPOINT}`;
|
|
1507
1550
|
}
|
|
1508
1551
|
getCacheKey(e, t) {
|
|
1509
1552
|
let n = e?.sort().join(",") || "", r = t?.sort().join(",") || "";
|
|
@@ -1548,7 +1591,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1548
1591
|
let e = await fetch(this.tokenEndpoint, {
|
|
1549
1592
|
method: "POST",
|
|
1550
1593
|
headers: {
|
|
1551
|
-
"Content-Type":
|
|
1594
|
+
"Content-Type": Nt.CONTENT_TYPE,
|
|
1552
1595
|
Accept: "application/json"
|
|
1553
1596
|
},
|
|
1554
1597
|
body: t.toString(),
|
|
@@ -1561,7 +1604,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1561
1604
|
});
|
|
1562
1605
|
let a = await e.json();
|
|
1563
1606
|
if (!e.ok) {
|
|
1564
|
-
let t =
|
|
1607
|
+
let t = H.fromOAuthError({
|
|
1565
1608
|
error: a.error || "server_error",
|
|
1566
1609
|
error_description: a.error_description || a.message,
|
|
1567
1610
|
error_uri: a.error_uri
|
|
@@ -1573,7 +1616,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1573
1616
|
}
|
|
1574
1617
|
return a;
|
|
1575
1618
|
} catch (e) {
|
|
1576
|
-
throw clearTimeout(r), e instanceof Error && e.name === "AbortError" ? new
|
|
1619
|
+
throw clearTimeout(r), e instanceof Error && e.name === "AbortError" ? new kt(`Request timed out after ${this.config.timeout}ms`) : e instanceof TypeError && e.message.includes("fetch") ? new kt(`Network error: ${e.message}`, e) : e instanceof H ? e : H.fromError(e instanceof Error ? e : Error(String(e)));
|
|
1577
1620
|
}
|
|
1578
1621
|
}
|
|
1579
1622
|
async executeWithRetry(e) {
|
|
@@ -1581,7 +1624,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1581
1624
|
for (let n = 1; n <= this.config.retries; n++) try {
|
|
1582
1625
|
return await e();
|
|
1583
1626
|
} catch (e) {
|
|
1584
|
-
if (!(e instanceof
|
|
1627
|
+
if (!(e instanceof H)) throw e;
|
|
1585
1628
|
if (t = e, n < this.config.retries && this.retryStrategy.shouldRetry({
|
|
1586
1629
|
code: e.code,
|
|
1587
1630
|
status: e.status
|
|
@@ -1592,7 +1635,7 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1592
1635
|
}
|
|
1593
1636
|
throw e;
|
|
1594
1637
|
}
|
|
1595
|
-
throw t ?? new
|
|
1638
|
+
throw t ?? new H({
|
|
1596
1639
|
code: "server_error",
|
|
1597
1640
|
message: "Request failed after retries"
|
|
1598
1641
|
});
|
|
@@ -1616,13 +1659,13 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1616
1659
|
parseToken(e) {
|
|
1617
1660
|
try {
|
|
1618
1661
|
let t = e.split(".");
|
|
1619
|
-
if (t.length !== 3) throw new
|
|
1662
|
+
if (t.length !== 3) throw new At("Invalid JWT format: expected 3 parts");
|
|
1620
1663
|
let n = t[1];
|
|
1621
|
-
if (!n) throw new
|
|
1664
|
+
if (!n) throw new At("Invalid JWT format: missing payload");
|
|
1622
1665
|
let r = atob(n.replace(/-/g, "+").replace(/_/g, "/")), i = JSON.parse(r);
|
|
1623
1666
|
return i.scopes && typeof i.scopes == "string" ? i.scopes = i.scopes.split(" ") : i.scopes || (i.scopes = []), i;
|
|
1624
1667
|
} catch (e) {
|
|
1625
|
-
throw e instanceof
|
|
1668
|
+
throw e instanceof At ? e : new At(`Failed to parse token: ${e instanceof Error ? e.message : "Unknown error"}`);
|
|
1626
1669
|
}
|
|
1627
1670
|
}
|
|
1628
1671
|
clearCache() {
|
|
@@ -1637,19 +1680,19 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1637
1680
|
try {
|
|
1638
1681
|
let e = await fetch(t, {
|
|
1639
1682
|
method: "POST",
|
|
1640
|
-
headers: { "Content-Type":
|
|
1683
|
+
headers: { "Content-Type": Nt.CONTENT_TYPE },
|
|
1641
1684
|
body: n.toString()
|
|
1642
1685
|
});
|
|
1643
1686
|
if (!e.ok && e.status !== 200) {
|
|
1644
1687
|
let t = await e.json().catch(() => ({}));
|
|
1645
|
-
throw
|
|
1688
|
+
throw H.fromOAuthError({
|
|
1646
1689
|
error: t.error || "server_error",
|
|
1647
1690
|
error_description: t.error_description || "Token revocation failed"
|
|
1648
1691
|
}, e.status);
|
|
1649
1692
|
}
|
|
1650
1693
|
this.clearCache();
|
|
1651
1694
|
} catch (e) {
|
|
1652
|
-
throw e instanceof
|
|
1695
|
+
throw e instanceof H ? e : H.fromError(e instanceof Error ? e : Error(String(e)));
|
|
1653
1696
|
}
|
|
1654
1697
|
}
|
|
1655
1698
|
get url() {
|
|
@@ -1664,101 +1707,101 @@ var Re = /* @__PURE__ */ function(e) {
|
|
|
1664
1707
|
get audience() {
|
|
1665
1708
|
return this.config.audience;
|
|
1666
1709
|
}
|
|
1667
|
-
},
|
|
1710
|
+
}, Lt = "error", Rt = /* @__PURE__ */ new WeakMap(), zt = (e, t) => {
|
|
1668
1711
|
if (typeof t != "object" && typeof t != "function" || t === null) return !0;
|
|
1669
|
-
let n =
|
|
1670
|
-
return n || (n = /* @__PURE__ */ new WeakSet(),
|
|
1671
|
-
},
|
|
1712
|
+
let n = Rt.get(e);
|
|
1713
|
+
return n || (n = /* @__PURE__ */ new WeakSet(), Rt.set(e, n)), !n.has(t) && (n.add(t), !0);
|
|
1714
|
+
}, U = (e, t) => zt(e, t.originalError) ? (e.notify(Lt, t), !0) : !1, Bt = "passflow-refresh", Vt = "passflow-refresh-takeover", Ht = "passflow-auth", Ut = Object.freeze([
|
|
1672
1715
|
1e3,
|
|
1673
1716
|
3e3,
|
|
1674
1717
|
1e4,
|
|
1675
1718
|
3e4,
|
|
1676
1719
|
6e4
|
|
1677
|
-
]),
|
|
1720
|
+
]), Wt = .2, Gt = 6e5, Kt = 5e3, W = 2e4, qt = 2e4, Jt = 1e3, Yt = 2e3, Xt = 1e3, Zt = 1e4, Qt = 5e3;
|
|
1678
1721
|
// lib/refresh/protocol.ts
|
|
1679
|
-
function
|
|
1722
|
+
function $t(e) {
|
|
1680
1723
|
let t = e ? `:${e}` : "";
|
|
1681
1724
|
return {
|
|
1682
|
-
lock: `${
|
|
1683
|
-
takeoverLock: `${
|
|
1684
|
-
channel: `${
|
|
1725
|
+
lock: `${Bt}${t}`,
|
|
1726
|
+
takeoverLock: `${Vt}${t}`,
|
|
1727
|
+
channel: `${Ht}${t}`
|
|
1685
1728
|
};
|
|
1686
1729
|
}
|
|
1687
|
-
function
|
|
1730
|
+
function G(e) {
|
|
1688
1731
|
return typeof e == "string" && e !== "" ? e : void 0;
|
|
1689
1732
|
}
|
|
1690
|
-
function
|
|
1733
|
+
function en(e) {
|
|
1691
1734
|
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
1692
1735
|
}
|
|
1693
|
-
function
|
|
1736
|
+
function tn(e) {
|
|
1694
1737
|
return typeof e == "object" && !!e;
|
|
1695
1738
|
}
|
|
1696
|
-
function
|
|
1739
|
+
function nn(e, t) {
|
|
1697
1740
|
for (let [n, r] of Object.entries(t)) r !== void 0 && (e[n] = r);
|
|
1698
1741
|
return e;
|
|
1699
1742
|
}
|
|
1700
|
-
function
|
|
1701
|
-
if (!
|
|
1743
|
+
function rn(e) {
|
|
1744
|
+
if (!tn(e)) return null;
|
|
1702
1745
|
let t = Array.isArray(e.scopes) ? e.scopes.filter((e) => typeof e == "string") : void 0;
|
|
1703
|
-
return
|
|
1704
|
-
access_token:
|
|
1705
|
-
refresh_token:
|
|
1706
|
-
id_token:
|
|
1746
|
+
return nn({}, {
|
|
1747
|
+
access_token: G(e.access_token),
|
|
1748
|
+
refresh_token: G(e.refresh_token),
|
|
1749
|
+
id_token: G(e.id_token),
|
|
1707
1750
|
scopes: Array.isArray(e.scopes) && t?.length === e.scopes.length ? t : void 0
|
|
1708
1751
|
});
|
|
1709
1752
|
}
|
|
1710
|
-
function
|
|
1711
|
-
if (!
|
|
1753
|
+
function an(e) {
|
|
1754
|
+
if (!tn(e)) return null;
|
|
1712
1755
|
let { kind: t, attempt: n, nextAt: r, strikes: i } = e;
|
|
1713
|
-
return t !== "transient" && t !== "auth" || typeof n != "number" || !Number.isInteger(n) || n < 1 ||
|
|
1756
|
+
return t !== "transient" && t !== "auth" || typeof n != "number" || !Number.isInteger(n) || n < 1 || en(r) === void 0 || typeof i != "number" || !Number.isFinite(i) || i < 0 ? null : nn({
|
|
1714
1757
|
kind: t,
|
|
1715
1758
|
attempt: n,
|
|
1716
1759
|
nextAt: r,
|
|
1717
1760
|
strikes: i
|
|
1718
1761
|
}, {
|
|
1719
|
-
from:
|
|
1720
|
-
failingSince:
|
|
1762
|
+
from: G(e.from),
|
|
1763
|
+
failingSince: en(e.failingSince)
|
|
1721
1764
|
});
|
|
1722
1765
|
}
|
|
1723
|
-
function
|
|
1724
|
-
return
|
|
1725
|
-
fp:
|
|
1726
|
-
sub:
|
|
1727
|
-
sid:
|
|
1728
|
-
iat:
|
|
1766
|
+
function on(e) {
|
|
1767
|
+
return nn({}, {
|
|
1768
|
+
fp: G(e.fp),
|
|
1769
|
+
sub: G(e.sub),
|
|
1770
|
+
sid: G(e.sid),
|
|
1771
|
+
iat: en(e.iat)
|
|
1729
1772
|
});
|
|
1730
1773
|
}
|
|
1731
|
-
function
|
|
1732
|
-
if (!
|
|
1774
|
+
function sn(e) {
|
|
1775
|
+
if (!tn(e)) return null;
|
|
1733
1776
|
let t = e;
|
|
1734
1777
|
if (t.v !== void 0 && t.v !== 1) return null;
|
|
1735
|
-
let n =
|
|
1778
|
+
let n = G(t.tabId);
|
|
1736
1779
|
if (!n) return null;
|
|
1737
1780
|
switch (t.type) {
|
|
1738
1781
|
case "tokens-refreshed": {
|
|
1739
|
-
let e =
|
|
1740
|
-
return !e || !r || !i ? null :
|
|
1782
|
+
let e = rn(t.tokens), r = G(t.from), i = G(t.to);
|
|
1783
|
+
return !e || !r || !i ? null : nn({
|
|
1741
1784
|
type: t.type,
|
|
1742
1785
|
tabId: n,
|
|
1743
1786
|
tokens: e,
|
|
1744
1787
|
from: r,
|
|
1745
1788
|
to: i
|
|
1746
1789
|
}, {
|
|
1747
|
-
fromIat:
|
|
1790
|
+
fromIat: en(t.fromIat),
|
|
1748
1791
|
fromSid: typeof t.fromSid == "string" ? t.fromSid : void 0,
|
|
1749
|
-
sentAt:
|
|
1792
|
+
sentAt: en(t.sentAt)
|
|
1750
1793
|
});
|
|
1751
1794
|
}
|
|
1752
1795
|
case "session-refreshed": {
|
|
1753
|
-
let e =
|
|
1754
|
-
return e === void 0 ? null :
|
|
1796
|
+
let e = en(t.at);
|
|
1797
|
+
return e === void 0 ? null : nn({
|
|
1755
1798
|
type: t.type,
|
|
1756
1799
|
tabId: n,
|
|
1757
1800
|
at: e
|
|
1758
|
-
}, { sub:
|
|
1801
|
+
}, { sub: G(t.sub) });
|
|
1759
1802
|
}
|
|
1760
1803
|
case "still-refreshing": {
|
|
1761
|
-
let e = t.retry === void 0 ? null :
|
|
1804
|
+
let e = t.retry === void 0 ? null : an(t.retry);
|
|
1762
1805
|
return e ? {
|
|
1763
1806
|
type: t.type,
|
|
1764
1807
|
tabId: n,
|
|
@@ -1769,7 +1812,7 @@ function en(e) {
|
|
|
1769
1812
|
};
|
|
1770
1813
|
}
|
|
1771
1814
|
case "retry-scheduled": {
|
|
1772
|
-
let e =
|
|
1815
|
+
let e = an(t);
|
|
1773
1816
|
return e ? {
|
|
1774
1817
|
type: t.type,
|
|
1775
1818
|
tabId: n,
|
|
@@ -1790,10 +1833,10 @@ function en(e) {
|
|
|
1790
1833
|
case "signed-out": return {
|
|
1791
1834
|
type: t.type,
|
|
1792
1835
|
tabId: n,
|
|
1793
|
-
|
|
1836
|
+
...on(t)
|
|
1794
1837
|
};
|
|
1795
1838
|
case "rate-limited": {
|
|
1796
|
-
let e =
|
|
1839
|
+
let e = en(t.until);
|
|
1797
1840
|
return e === void 0 ? null : {
|
|
1798
1841
|
type: t.type,
|
|
1799
1842
|
tabId: n,
|
|
@@ -1801,7 +1844,7 @@ function en(e) {
|
|
|
1801
1844
|
};
|
|
1802
1845
|
}
|
|
1803
1846
|
case "refresh-failed": {
|
|
1804
|
-
let e =
|
|
1847
|
+
let e = G(t.from);
|
|
1805
1848
|
return e ? {
|
|
1806
1849
|
type: t.type,
|
|
1807
1850
|
tabId: n,
|
|
@@ -1812,22 +1855,22 @@ function en(e) {
|
|
|
1812
1855
|
default: return null;
|
|
1813
1856
|
}
|
|
1814
1857
|
}
|
|
1815
|
-
function
|
|
1858
|
+
function cn(e, t) {
|
|
1816
1859
|
let n = {
|
|
1817
1860
|
v: 1,
|
|
1818
1861
|
tabId: e
|
|
1819
1862
|
};
|
|
1820
1863
|
if (t.type === "retry-scheduled") {
|
|
1821
1864
|
let { retry: e, ...r } = t;
|
|
1822
|
-
return
|
|
1865
|
+
return nn(n, {
|
|
1823
1866
|
...r,
|
|
1824
1867
|
...e
|
|
1825
1868
|
});
|
|
1826
1869
|
}
|
|
1827
|
-
return
|
|
1870
|
+
return nn(n, { ...t });
|
|
1828
1871
|
}
|
|
1829
1872
|
// lib/refresh/resolve.ts
|
|
1830
|
-
var
|
|
1873
|
+
var ln = "[passflow] navigator.locks or BroadcastChannel is unavailable (they need a secure context); each tab refreshes on its own, with the save checks only", un = {
|
|
1831
1874
|
now: () => Date.now(),
|
|
1832
1875
|
random: () => Math.random(),
|
|
1833
1876
|
setTimeout: (e, t) => {
|
|
@@ -1835,28 +1878,28 @@ var nn = "[passflow] navigator.locks or BroadcastChannel is unavailable (they ne
|
|
|
1835
1878
|
return n.unref?.(), () => clearTimeout(n);
|
|
1836
1879
|
}
|
|
1837
1880
|
};
|
|
1838
|
-
function
|
|
1881
|
+
function dn() {
|
|
1839
1882
|
let e = globalThis.crypto;
|
|
1840
1883
|
return typeof e?.randomUUID == "function" ? e.randomUUID() : `tab-${Math.random().toString(36).slice(2)}-${Date.now()}`;
|
|
1841
1884
|
}
|
|
1842
|
-
function
|
|
1885
|
+
function fn(e) {
|
|
1843
1886
|
return e ? {
|
|
1844
1887
|
now: () => e.now(),
|
|
1845
1888
|
setTimeout: (t, n) => e.setTimeout(t, n),
|
|
1846
|
-
random: e.random ? () => e.random?.() ?? Math.random() :
|
|
1847
|
-
} :
|
|
1889
|
+
random: e.random ? () => e.random?.() ?? Math.random() : un.random
|
|
1890
|
+
} : un;
|
|
1848
1891
|
}
|
|
1849
|
-
function
|
|
1892
|
+
function pn(e) {
|
|
1850
1893
|
return typeof window < "u" && typeof document < "u" && e.getDeviceType() === "web";
|
|
1851
1894
|
}
|
|
1852
|
-
function
|
|
1895
|
+
function mn(e) {
|
|
1853
1896
|
try {
|
|
1854
1897
|
return e.storageSharedAcrossTabs === !0;
|
|
1855
1898
|
} catch {
|
|
1856
1899
|
return !1;
|
|
1857
1900
|
}
|
|
1858
1901
|
}
|
|
1859
|
-
function
|
|
1902
|
+
function hn() {
|
|
1860
1903
|
try {
|
|
1861
1904
|
let e = globalThis.navigator?.locks;
|
|
1862
1905
|
return e && typeof e.request == "function" ? e : void 0;
|
|
@@ -1864,7 +1907,7 @@ function ln() {
|
|
|
1864
1907
|
return;
|
|
1865
1908
|
}
|
|
1866
1909
|
}
|
|
1867
|
-
function
|
|
1910
|
+
function gn(e) {
|
|
1868
1911
|
return (t) => {
|
|
1869
1912
|
let n = (n) => {
|
|
1870
1913
|
let r = n.key;
|
|
@@ -1873,20 +1916,20 @@ function un(e) {
|
|
|
1873
1916
|
return window.addEventListener("storage", n), () => window.removeEventListener("storage", n);
|
|
1874
1917
|
};
|
|
1875
1918
|
}
|
|
1876
|
-
function
|
|
1919
|
+
function _n(e) {
|
|
1877
1920
|
return {
|
|
1878
1921
|
transports: null,
|
|
1879
|
-
names:
|
|
1880
|
-
clock:
|
|
1922
|
+
names: $t(e),
|
|
1923
|
+
clock: un,
|
|
1881
1924
|
warnOnFirstCycle: !1
|
|
1882
1925
|
};
|
|
1883
1926
|
}
|
|
1884
|
-
function
|
|
1885
|
-
let i =
|
|
1927
|
+
function vn(e, t, n, r) {
|
|
1928
|
+
let i = $t(n), a = pn(t), o = a ? gn(r.tokenKeys) : void 0, s = (e) => {
|
|
1886
1929
|
let t = {
|
|
1887
1930
|
transports: null,
|
|
1888
1931
|
names: i,
|
|
1889
|
-
clock:
|
|
1932
|
+
clock: un,
|
|
1890
1933
|
warnOnFirstCycle: e
|
|
1891
1934
|
};
|
|
1892
1935
|
return o && (t.onStorageChange = o), t;
|
|
@@ -1896,16 +1939,16 @@ function fn(e, t, n, r) {
|
|
|
1896
1939
|
transports: {
|
|
1897
1940
|
locks: e.locks,
|
|
1898
1941
|
channel: e.channel,
|
|
1899
|
-
tabId: e.tabId ??
|
|
1942
|
+
tabId: e.tabId ?? dn()
|
|
1900
1943
|
},
|
|
1901
1944
|
names: i,
|
|
1902
|
-
clock:
|
|
1945
|
+
clock: fn(e.clock),
|
|
1903
1946
|
warnOnFirstCycle: !1
|
|
1904
1947
|
};
|
|
1905
1948
|
return e.onStorageChange && (t.onStorageChange = e.onStorageChange), t;
|
|
1906
1949
|
}
|
|
1907
|
-
if (e === "none" || !a || !
|
|
1908
|
-
let c =
|
|
1950
|
+
if (e === "none" || !a || !mn(t)) return s(!1);
|
|
1951
|
+
let c = hn();
|
|
1909
1952
|
if (!c || typeof BroadcastChannel != "function") return s(!0);
|
|
1910
1953
|
let l;
|
|
1911
1954
|
try {
|
|
@@ -1917,36 +1960,36 @@ function fn(e, t, n, r) {
|
|
|
1917
1960
|
transports: {
|
|
1918
1961
|
locks: c,
|
|
1919
1962
|
channel: l,
|
|
1920
|
-
tabId:
|
|
1963
|
+
tabId: dn()
|
|
1921
1964
|
},
|
|
1922
1965
|
names: i,
|
|
1923
|
-
clock:
|
|
1966
|
+
clock: un,
|
|
1924
1967
|
warnOnFirstCycle: !1
|
|
1925
1968
|
};
|
|
1926
1969
|
return o && (u.onStorageChange = o), u;
|
|
1927
1970
|
}
|
|
1928
1971
|
// lib/pkce.ts
|
|
1929
|
-
var
|
|
1972
|
+
var yn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", bn = 32, xn = (e) => {
|
|
1930
1973
|
let t = "";
|
|
1931
1974
|
for (let n = 0; n < e.length; n += 3) {
|
|
1932
1975
|
let r = e[n], i = e[n + 1], a = e[n + 2];
|
|
1933
|
-
t +=
|
|
1976
|
+
t += yn.charAt(r >> 2), t += yn.charAt((r & 3) << 4 | (i ?? 0) >> 4), i !== void 0 && (t += yn.charAt((i & 15) << 2 | (a ?? 0) >> 6)), a !== void 0 && (t += yn.charAt(a & 63));
|
|
1934
1977
|
}
|
|
1935
1978
|
return t;
|
|
1936
|
-
},
|
|
1979
|
+
}, Sn = () => {
|
|
1937
1980
|
let e = globalThis.crypto;
|
|
1938
1981
|
if (!e?.subtle) throw Error("PKCE needs the Web Crypto API, which is available only in a secure context (https or localhost)");
|
|
1939
1982
|
return e;
|
|
1940
|
-
},
|
|
1941
|
-
let t = await
|
|
1942
|
-
return
|
|
1943
|
-
},
|
|
1944
|
-
let e =
|
|
1983
|
+
}, Cn = async (e) => {
|
|
1984
|
+
let t = await Sn().subtle.digest("SHA-256", new TextEncoder().encode(e));
|
|
1985
|
+
return xn(new Uint8Array(t));
|
|
1986
|
+
}, wn = async () => {
|
|
1987
|
+
let e = xn(Sn().getRandomValues(new Uint8Array(bn)));
|
|
1945
1988
|
return {
|
|
1946
1989
|
verifier: e,
|
|
1947
|
-
challenge: await
|
|
1990
|
+
challenge: await Cn(e)
|
|
1948
1991
|
};
|
|
1949
|
-
},
|
|
1992
|
+
}, Tn = class {
|
|
1950
1993
|
error(e, ...t) {
|
|
1951
1994
|
console.error(e, ...t);
|
|
1952
1995
|
}
|
|
@@ -1960,10 +2003,10 @@ var pn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", mn
|
|
|
1960
2003
|
console.debug(e, ...t);
|
|
1961
2004
|
}
|
|
1962
2005
|
};
|
|
1963
|
-
function
|
|
1964
|
-
return new
|
|
2006
|
+
function En() {
|
|
2007
|
+
return new Tn();
|
|
1965
2008
|
}
|
|
1966
|
-
var
|
|
2009
|
+
var Dn = Object.freeze([
|
|
1967
2010
|
"error.token.invalid.error",
|
|
1968
2011
|
"error.api.token.parse.error",
|
|
1969
2012
|
"error.api.user.blocked",
|
|
@@ -1971,25 +2014,25 @@ var xn = Object.freeze([
|
|
|
1971
2014
|
"error.validation.token.invalid.subject",
|
|
1972
2015
|
"error.not.found"
|
|
1973
2016
|
]);
|
|
1974
|
-
function
|
|
2017
|
+
function On(e) {
|
|
1975
2018
|
if (typeof e != "object" || !e) return;
|
|
1976
2019
|
let t = e;
|
|
1977
2020
|
return typeof t.get == "function" ? t.get("retry-after") : t["retry-after"] ?? t["Retry-After"];
|
|
1978
2021
|
}
|
|
1979
|
-
function
|
|
1980
|
-
if (typeof e == "number") return !Number.isFinite(e) || e < 0 ? void 0 : Math.min(
|
|
2022
|
+
function kn(e, t) {
|
|
2023
|
+
if (typeof e == "number") return !Number.isFinite(e) || e < 0 ? void 0 : Math.min(Gt, Math.floor(e) * 1e3);
|
|
1981
2024
|
if (typeof e != "string") return;
|
|
1982
2025
|
let n = e.trim();
|
|
1983
2026
|
if (n === "") return;
|
|
1984
|
-
if (/^\d+$/.test(n)) return Math.min(
|
|
2027
|
+
if (/^\d+$/.test(n)) return Math.min(Gt, Number.parseInt(n, 10) * 1e3);
|
|
1985
2028
|
if (!/[a-z]/i.test(n)) return;
|
|
1986
2029
|
let r = Date.parse(n);
|
|
1987
|
-
if (!Number.isNaN(r)) return Math.min(
|
|
2030
|
+
if (!Number.isNaN(r)) return Math.min(Gt, Math.max(0, r - t));
|
|
1988
2031
|
}
|
|
1989
|
-
function
|
|
2032
|
+
function An(e) {
|
|
1990
2033
|
return typeof e == "number" && Number.isInteger(e) && e >= 100 && e <= 599 ? e : void 0;
|
|
1991
2034
|
}
|
|
1992
|
-
function
|
|
2035
|
+
function jn(e) {
|
|
1993
2036
|
if (typeof e.id == "string" && e.id !== "") return e.id;
|
|
1994
2037
|
let t = e.response?.data;
|
|
1995
2038
|
if (typeof t != "object" || !t) return;
|
|
@@ -1998,14 +2041,14 @@ function Tn(e) {
|
|
|
1998
2041
|
let r = n.id;
|
|
1999
2042
|
return typeof r == "string" && r !== "" ? r : void 0;
|
|
2000
2043
|
}
|
|
2001
|
-
function
|
|
2044
|
+
function Mn(e, t = Date.now()) {
|
|
2002
2045
|
if (typeof e != "object" || !e) return { kind: "transient" };
|
|
2003
|
-
let n = e, r =
|
|
2046
|
+
let n = e, r = jn(n), i = An(n.response?.status) ?? An(n.status), a = {};
|
|
2004
2047
|
if (i !== void 0 && (a.status = i), r !== void 0 && (a.id = r), r === "error.token.blocked") return {
|
|
2005
2048
|
kind: "blocked",
|
|
2006
2049
|
...a
|
|
2007
2050
|
};
|
|
2008
|
-
if (r !== void 0 &&
|
|
2051
|
+
if (r !== void 0 && Dn.includes(r) || i !== void 0 && i >= 400 && i <= 499 && i !== 429) return {
|
|
2009
2052
|
kind: "auth",
|
|
2010
2053
|
...a
|
|
2011
2054
|
};
|
|
@@ -2013,7 +2056,7 @@ function En(e, t = Date.now()) {
|
|
|
2013
2056
|
kind: "transient",
|
|
2014
2057
|
...a
|
|
2015
2058
|
};
|
|
2016
|
-
let o =
|
|
2059
|
+
let o = kn(n.retryAfter ?? On(n.response?.headers), t);
|
|
2017
2060
|
return o === void 0 ? {
|
|
2018
2061
|
kind: "transient",
|
|
2019
2062
|
...a
|
|
@@ -2023,19 +2066,19 @@ function En(e, t = Date.now()) {
|
|
|
2023
2066
|
retryAfterMs: o
|
|
2024
2067
|
};
|
|
2025
2068
|
}
|
|
2026
|
-
function
|
|
2027
|
-
let r =
|
|
2028
|
-
return Math.max(o, n !== void 0 && Number.isFinite(n) ? Math.min(Math.max(n, 0),
|
|
2069
|
+
function Nn(e, t, n) {
|
|
2070
|
+
let r = Ut.length, i = Ut[(Number.isFinite(e) ? Math.min(Math.max(Math.floor(e), 1), r) : 1) - 1] ?? Ut[r - 1] ?? 6e4, a = Number.isFinite(t) ? Math.min(Math.max(t, 0), .999) : 0, o = i + Math.floor(i * Wt * a);
|
|
2071
|
+
return Math.max(o, n !== void 0 && Number.isFinite(n) ? Math.min(Math.max(n, 0), Gt) : 0);
|
|
2029
2072
|
}
|
|
2030
2073
|
// lib/refresh/coordinator.ts
|
|
2031
|
-
var
|
|
2074
|
+
var Pn = {
|
|
2032
2075
|
onGranted: () => !1,
|
|
2033
2076
|
onLockLost: () => void 0,
|
|
2034
2077
|
onMessage: () => void 0
|
|
2035
2078
|
};
|
|
2036
|
-
function
|
|
2037
|
-
let { locks: t, channel: n, tabId: r, names: i, clock: a } = e, o =
|
|
2038
|
-
g || n.postMessage(
|
|
2079
|
+
function Fn(e) {
|
|
2080
|
+
let { locks: t, channel: n, tabId: r, names: i, clock: a } = e, o = Pn, s = null, c = null, l = null, u = null, d = null, f = null, p = 0, m, h = !1, g = !1, _ = (e) => {
|
|
2081
|
+
g || n.postMessage(cn(r, e));
|
|
2039
2082
|
}, v = () => s !== null && c === null, y = () => {
|
|
2040
2083
|
f?.(), f = null;
|
|
2041
2084
|
}, b = (e) => {
|
|
@@ -2050,7 +2093,7 @@ function kn(e) {
|
|
|
2050
2093
|
type: "still-refreshing",
|
|
2051
2094
|
retry: m
|
|
2052
2095
|
} : { type: "still-refreshing" }), S());
|
|
2053
|
-
},
|
|
2096
|
+
}, Kt);
|
|
2054
2097
|
}, C = () => {
|
|
2055
2098
|
y(), x(), u?.(), u = null;
|
|
2056
2099
|
let e = s;
|
|
@@ -2091,29 +2134,29 @@ function kn(e) {
|
|
|
2091
2134
|
let e = s;
|
|
2092
2135
|
t.request(i.takeoverLock, { ifAvailable: !0 }, (t) => {
|
|
2093
2136
|
if (s === e && v()) {
|
|
2094
|
-
if (t === null) b(a.now() +
|
|
2137
|
+
if (t === null) b(a.now() + W);
|
|
2095
2138
|
else return _({ type: "takeover" }), new Promise((t) => {
|
|
2096
2139
|
u = t, e && (e.dead = !0, e.abort.abort()), D(!0);
|
|
2097
2140
|
});
|
|
2098
2141
|
}
|
|
2099
2142
|
}).catch(() => {
|
|
2100
|
-
v() && b(a.now() +
|
|
2143
|
+
v() && b(a.now() + W);
|
|
2101
2144
|
});
|
|
2102
2145
|
}, ee = (e) => {
|
|
2103
2146
|
if (g) return;
|
|
2104
|
-
let t =
|
|
2147
|
+
let t = sn(e.data);
|
|
2105
2148
|
if (t && t.tabId !== r) {
|
|
2106
2149
|
switch (t.type) {
|
|
2107
2150
|
case "still-refreshing":
|
|
2108
|
-
h = !0, v() && (b(a.now() +
|
|
2151
|
+
h = !0, v() && (b(a.now() + W), t.retry && b(t.retry.nextAt + W));
|
|
2109
2152
|
break;
|
|
2110
2153
|
case "takeover":
|
|
2111
|
-
h = !0, v() && b(a.now() +
|
|
2154
|
+
h = !0, v() && b(a.now() + W);
|
|
2112
2155
|
break;
|
|
2113
2156
|
case "retry-scheduled":
|
|
2114
|
-
h = !0, v() && b(Math.max(a.now(), t.retry.nextAt) +
|
|
2157
|
+
h = !0, v() && b(Math.max(a.now(), t.retry.nextAt) + W);
|
|
2115
2158
|
break;
|
|
2116
|
-
case "rate-limited": v() && b(t.until +
|
|
2159
|
+
case "rate-limited": v() && b(t.until + W);
|
|
2117
2160
|
}
|
|
2118
2161
|
o.onMessage(t);
|
|
2119
2162
|
}
|
|
@@ -2131,7 +2174,7 @@ function kn(e) {
|
|
|
2131
2174
|
o = e;
|
|
2132
2175
|
},
|
|
2133
2176
|
request: (e) => {
|
|
2134
|
-
g || s || (p = 0, b(Math.max(a.now() +
|
|
2177
|
+
g || s || (p = 0, b(Math.max(a.now() + W, e ?? 0)), D(!1));
|
|
2135
2178
|
},
|
|
2136
2179
|
release: C,
|
|
2137
2180
|
post: _,
|
|
@@ -2144,8 +2187,8 @@ function kn(e) {
|
|
|
2144
2187
|
}
|
|
2145
2188
|
};
|
|
2146
2189
|
}
|
|
2147
|
-
function
|
|
2148
|
-
let t =
|
|
2190
|
+
function In(e = "local") {
|
|
2191
|
+
let t = Pn, n = !1, r = !1, i = 0, a = !1, o = () => {
|
|
2149
2192
|
n = !1, r = !1, i += 1;
|
|
2150
2193
|
};
|
|
2151
2194
|
return {
|
|
@@ -2185,7 +2228,7 @@ function An(e = "local") {
|
|
|
2185
2228
|
};
|
|
2186
2229
|
}
|
|
2187
2230
|
// lib/refresh/errors.ts
|
|
2188
|
-
var
|
|
2231
|
+
var K = {
|
|
2189
2232
|
unavailable: "error.refresh.unavailable",
|
|
2190
2233
|
authRetry: "error.refresh.auth_retry",
|
|
2191
2234
|
sessionEnded: "error.refresh.session_ended",
|
|
@@ -2193,7 +2236,7 @@ var q = {
|
|
|
2193
2236
|
successorTimeout: "error.refresh.successor_timeout",
|
|
2194
2237
|
identityChanged: "error.refresh.identity_changed",
|
|
2195
2238
|
disposed: "error.refresh.disposed"
|
|
2196
|
-
},
|
|
2239
|
+
}, Ln = {
|
|
2197
2240
|
"error.refresh.unavailable": 503,
|
|
2198
2241
|
"error.refresh.auth_retry": 401,
|
|
2199
2242
|
"error.refresh.session_ended": 401,
|
|
@@ -2201,7 +2244,7 @@ var q = {
|
|
|
2201
2244
|
"error.refresh.successor_timeout": 401,
|
|
2202
2245
|
"error.refresh.identity_changed": 401,
|
|
2203
2246
|
"error.refresh.disposed": 499
|
|
2204
|
-
},
|
|
2247
|
+
}, Rn = {
|
|
2205
2248
|
"error.refresh.unavailable": "Token refresh is unavailable; a retry is scheduled",
|
|
2206
2249
|
"error.refresh.auth_retry": "Token refresh was refused; a retry is scheduled",
|
|
2207
2250
|
"error.refresh.session_ended": "The session has ended",
|
|
@@ -2209,23 +2252,23 @@ var q = {
|
|
|
2209
2252
|
"error.refresh.successor_timeout": "The refresh token was already used and no successor arrived",
|
|
2210
2253
|
"error.refresh.identity_changed": "Storage holds another user's tokens",
|
|
2211
2254
|
"error.refresh.disposed": "The Passflow instance was disposed"
|
|
2212
|
-
},
|
|
2255
|
+
}, q = class extends B {
|
|
2213
2256
|
constructor(e, t = {}) {
|
|
2214
2257
|
super({
|
|
2215
2258
|
id: e,
|
|
2216
|
-
message: t.message ??
|
|
2217
|
-
status:
|
|
2259
|
+
message: t.message ?? Rn[e],
|
|
2260
|
+
status: Ln[e],
|
|
2218
2261
|
location: "/auth/refresh",
|
|
2219
2262
|
time: (/* @__PURE__ */ new Date()).toISOString()
|
|
2220
2263
|
}), this.name = "PassflowRefreshError", t.nextRetryAt !== void 0 && (this.nextRetryAt = t.nextRetryAt), t.cause !== void 0 && (this.cause = t.cause);
|
|
2221
2264
|
}
|
|
2222
|
-
},
|
|
2265
|
+
}, zn = class extends Error {
|
|
2223
2266
|
constructor(e, t) {
|
|
2224
2267
|
super(t ?? (e === "lock-timeout" ? "Step-up commit could not take the refresh lock in time" : "Step-up commit answer arrived after the stored session moved on")), this.name = "UpgradeCommitInterruptedError", this.reason = e;
|
|
2225
2268
|
}
|
|
2226
2269
|
};
|
|
2227
2270
|
// lib/refresh/lineage.ts
|
|
2228
|
-
function
|
|
2271
|
+
function J(e) {
|
|
2229
2272
|
if (!e) return;
|
|
2230
2273
|
let t = 3735928559, n = 1103547991;
|
|
2231
2274
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -2234,24 +2277,24 @@ function Pn(e) {
|
|
|
2234
2277
|
}
|
|
2235
2278
|
return t = Math.imul(t ^ t >>> 16, 2246822507), t ^= Math.imul(n ^ n >>> 13, 3266489909), n = Math.imul(n ^ n >>> 16, 2246822507), n ^= Math.imul(t ^ t >>> 13, 3266489909), (4294967296 * (2097151 & n) + (t >>> 0)).toString(16);
|
|
2236
2279
|
}
|
|
2237
|
-
function
|
|
2280
|
+
function Bn(e) {
|
|
2238
2281
|
return typeof e == "string" && e !== "" ? e : void 0;
|
|
2239
2282
|
}
|
|
2240
2283
|
function Y(e) {
|
|
2241
|
-
let t =
|
|
2284
|
+
let t = J(e);
|
|
2242
2285
|
if (!e || !t) return;
|
|
2243
2286
|
let n = {};
|
|
2244
2287
|
try {
|
|
2245
2288
|
let t = A(e);
|
|
2246
2289
|
typeof t == "object" && t && (n = t);
|
|
2247
2290
|
} catch {}
|
|
2248
|
-
let r = typeof n.iat == "number" && Number.isFinite(n.iat) ? n.iat : void 0, i = { fp: t }, a =
|
|
2291
|
+
let r = typeof n.iat == "number" && Number.isFinite(n.iat) ? n.iat : void 0, i = { fp: t }, a = Bn(n.sub), o = Bn(n.sid);
|
|
2249
2292
|
return a !== void 0 && (i.sub = a), o !== void 0 && (i.sid = o), r !== void 0 && (i.iat = r), i;
|
|
2250
2293
|
}
|
|
2251
|
-
var
|
|
2252
|
-
function
|
|
2294
|
+
var Vn = "[passflow] A refresh token carries no iat claim: it is never taken over an ordered one, and cross-tab adoption falls back to fingerprints";
|
|
2295
|
+
function Hn(e = (e) => En().warn(e)) {
|
|
2253
2296
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1, i = [], a = !1, o = () => {
|
|
2254
|
-
a || (a = !0, e(
|
|
2297
|
+
a || (a = !0, e(Vn));
|
|
2255
2298
|
}, s = (e, t) => e.has(t) ? !0 : e.size >= 32 ? !1 : (e.add(t), !0), c = (e) => {
|
|
2256
2299
|
if (!e) return;
|
|
2257
2300
|
if (e.iat === void 0) {
|
|
@@ -2292,16 +2335,16 @@ function Ln(e = (e) => bn().warn(e)) {
|
|
|
2292
2335
|
};
|
|
2293
2336
|
}
|
|
2294
2337
|
// lib/refresh/fence.ts
|
|
2295
|
-
var
|
|
2338
|
+
var Un = class extends Error {
|
|
2296
2339
|
constructor(e) {
|
|
2297
2340
|
super(e === "emptied" ? "The shared token storage was emptied" : "The stored refresh token belongs to an ended session"), this.name = "SessionEnded", this.cause = e;
|
|
2298
2341
|
}
|
|
2299
|
-
},
|
|
2342
|
+
}, Wn = class extends Error {
|
|
2300
2343
|
constructor() {
|
|
2301
2344
|
super("The shared token storage holds another user's tokens"), this.name = "IdentityChanged";
|
|
2302
2345
|
}
|
|
2303
2346
|
};
|
|
2304
|
-
function
|
|
2347
|
+
function Gn(e) {
|
|
2305
2348
|
if (e) try {
|
|
2306
2349
|
let t = A(e).sub;
|
|
2307
2350
|
return typeof t == "string" && t !== "" ? t : void 0;
|
|
@@ -2310,20 +2353,20 @@ function Bn(e) {
|
|
|
2310
2353
|
}
|
|
2311
2354
|
}
|
|
2312
2355
|
function X(e) {
|
|
2313
|
-
return
|
|
2356
|
+
return Gn(e?.access_token) ?? Gn(e?.refresh_token) ?? Gn(e?.id_token);
|
|
2314
2357
|
}
|
|
2315
|
-
function
|
|
2358
|
+
function Kn(e, t) {
|
|
2316
2359
|
return !t || e.iat === void 0 || t.iat === void 0 ? !1 : e.sid === t.sid && e.iat < t.iat;
|
|
2317
2360
|
}
|
|
2318
|
-
function
|
|
2361
|
+
function qn(e) {
|
|
2319
2362
|
return typeof e == "object" && !!e;
|
|
2320
2363
|
}
|
|
2321
|
-
function
|
|
2322
|
-
let { storage: t, cache: n, schedule: r } = e, i = e.identity ?? (() => void 0), a = e.warn ?? ((e) =>
|
|
2364
|
+
function Jn(e) {
|
|
2365
|
+
let { storage: t, cache: n, schedule: r } = e, i = e.identity ?? (() => void 0), a = e.warn ?? ((e) => En().warn(e)), o = e.lineage ?? Hn(a), s = e.onSessionLost, c, l = 0, u = [], d = [], f = 0, p, m = 0, h, g, _, v, y = () => {
|
|
2323
2366
|
let e = t.getTokens(), n = e?.refresh_token;
|
|
2324
2367
|
if (!n) return p = l, e;
|
|
2325
2368
|
p !== void 0 && (f = Math.max(f, p, m), p = void 0);
|
|
2326
|
-
let r =
|
|
2369
|
+
let r = J(n) ?? "";
|
|
2327
2370
|
return r !== c?.fp && (c = {
|
|
2328
2371
|
fp: r,
|
|
2329
2372
|
seq: l
|
|
@@ -2356,7 +2399,7 @@ function Un(e) {
|
|
|
2356
2399
|
let t = E();
|
|
2357
2400
|
t === "wait" && e && (t = "end"), t !== "wait" && D(), t === "wait" && !h && (h = r(() => {
|
|
2358
2401
|
h = void 0, y()?.refresh_token ? N() : O(!0) === "end" && s?.("emptied");
|
|
2359
|
-
},
|
|
2402
|
+
}, Yt));
|
|
2360
2403
|
let n = t === "keep" ? T() : void 0;
|
|
2361
2404
|
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;
|
|
2362
2405
|
}, ee = (e) => e.held !== void 0 && b()?.fp === e.held.cachedFp, k = (e) => {
|
|
@@ -2369,7 +2412,7 @@ function Un(e) {
|
|
|
2369
2412
|
return e.iat !== void 0 && t?.iat !== void 0 && t.sid === e.sid;
|
|
2370
2413
|
}, j = (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), M = (e) => {
|
|
2371
2414
|
let t = b();
|
|
2372
|
-
t && t.fp !==
|
|
2415
|
+
t && t.fp !== J(e.refresh_token) && o.retire(t), n.setTokensCache(e);
|
|
2373
2416
|
}, te = (e) => {
|
|
2374
2417
|
let t = y(), n = t?.refresh_token;
|
|
2375
2418
|
if (n === e.refreshToken) return null;
|
|
@@ -2380,7 +2423,7 @@ function Un(e) {
|
|
|
2380
2423
|
kind: "superseded",
|
|
2381
2424
|
adopted: !1
|
|
2382
2425
|
};
|
|
2383
|
-
let r =
|
|
2426
|
+
let r = Gn(t.access_token) ?? Gn(n);
|
|
2384
2427
|
if (e.sub && r && e.sub !== r) return {
|
|
2385
2428
|
kind: "identity-changed",
|
|
2386
2429
|
saved: !1
|
|
@@ -2420,22 +2463,22 @@ function Un(e) {
|
|
|
2420
2463
|
}, re = !!s || !!e.onStoredSessionSeen, ie = re && e.onStorageChange ? e.onStorageChange(N) : void 0, ae = re && e.onWake ? e.onWake(N) : void 0, P = () => {
|
|
2421
2464
|
let e = y();
|
|
2422
2465
|
if (!e?.refresh_token) {
|
|
2423
|
-
if (O() === "end") throw new
|
|
2466
|
+
if (O() === "end") throw new Un("emptied");
|
|
2424
2467
|
return "held";
|
|
2425
2468
|
}
|
|
2426
2469
|
let t = n.getTokens();
|
|
2427
2470
|
if (e.refresh_token === t?.refresh_token) return "send";
|
|
2428
2471
|
let r = i() ?? X(t), a = X(e);
|
|
2429
|
-
if (r && a && r !== a) throw new
|
|
2472
|
+
if (r && a && r !== a) throw new Wn();
|
|
2430
2473
|
let s = Y(e.refresh_token);
|
|
2431
2474
|
if (o.isEnded(s)) {
|
|
2432
2475
|
if (s && C(s)) return "held";
|
|
2433
|
-
throw new
|
|
2476
|
+
throw new Un("ended");
|
|
2434
2477
|
}
|
|
2435
2478
|
let c = Y(t?.refresh_token);
|
|
2436
2479
|
return j(s, c) ? (M(e), "adopted") : s && c && s.sid !== c.sid ? "send" : s && k(s) ? "held" : "send";
|
|
2437
2480
|
}, oe = (e) => {
|
|
2438
|
-
let t = i(), r =
|
|
2481
|
+
let t = i(), r = Gn(e);
|
|
2439
2482
|
if (t && r && t !== r) return { kind: "identity-changed" };
|
|
2440
2483
|
let a = Y(e) ?? { fp: e };
|
|
2441
2484
|
if (o.isEnded(a)) return C(a) ? { kind: "superseded" } : { kind: "ended" };
|
|
@@ -2443,7 +2486,7 @@ function Un(e) {
|
|
|
2443
2486
|
let s = {
|
|
2444
2487
|
refreshToken: e,
|
|
2445
2488
|
order: a
|
|
2446
|
-
}, c = t ?? r ??
|
|
2489
|
+
}, c = t ?? r ?? Gn(n.getTokens()?.access_token);
|
|
2447
2490
|
return c !== void 0 && (s.sub = c), v && v.fp === a.fp && (s.held = { cachedFp: v.cachedFp }), {
|
|
2448
2491
|
kind: "send",
|
|
2449
2492
|
sent: s
|
|
@@ -2452,7 +2495,7 @@ function Un(e) {
|
|
|
2452
2495
|
if (o.isEnded(e.order)) return ne(e.order);
|
|
2453
2496
|
let i = te(e);
|
|
2454
2497
|
if (i) return i;
|
|
2455
|
-
if (!ee(e) && A(e.order)) return o.retire(e.order), a(`[passflow] Refused to save a late refresh result: it rotated ${e.order.fp} into ${
|
|
2498
|
+
if (!ee(e) && A(e.order)) return o.retire(e.order), a(`[passflow] Refused to save a late refresh result: it rotated ${e.order.fp} into ${J(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.`), {
|
|
2456
2499
|
kind: "superseded",
|
|
2457
2500
|
adopted: !1
|
|
2458
2501
|
};
|
|
@@ -2462,7 +2505,7 @@ function Un(e) {
|
|
|
2462
2505
|
saved: !0
|
|
2463
2506
|
};
|
|
2464
2507
|
let c = Y(r.refresh_token);
|
|
2465
|
-
return c && (
|
|
2508
|
+
return c && (Kn(c, e.order) || Kn(c, b())) ? (a(`[passflow] Refused to save a refresh result older than the token this tab holds: ${e.order.fp} was answered with ${c.fp}. Neither saved nor adopted.`), {
|
|
2466
2509
|
kind: "superseded",
|
|
2467
2510
|
adopted: !1
|
|
2468
2511
|
}) : (o.retire(e.order), t.saveTokens(r), n.setTokensCache(r), { kind: "saved" });
|
|
@@ -2474,7 +2517,7 @@ function Un(e) {
|
|
|
2474
2517
|
kind: "superseded",
|
|
2475
2518
|
adopted: !1
|
|
2476
2519
|
};
|
|
2477
|
-
let r =
|
|
2520
|
+
let r = Mn(t), i = r.kind === "blocked" || r.kind === "auth";
|
|
2478
2521
|
return ee(e) && i ? (o.retire(e.order), _ = e.order, {
|
|
2479
2522
|
kind: "own",
|
|
2480
2523
|
failure: r,
|
|
@@ -2485,11 +2528,11 @@ function Un(e) {
|
|
|
2485
2528
|
heldRefused: !1
|
|
2486
2529
|
});
|
|
2487
2530
|
}, I = (e) => {
|
|
2488
|
-
if (!
|
|
2531
|
+
if (!qn(e)) return !1;
|
|
2489
2532
|
let { from: t, fromIat: r, fromSid: a, to: c, tokens: l } = e;
|
|
2490
|
-
if (typeof t != "string" || typeof c != "string" || !
|
|
2533
|
+
if (typeof t != "string" || typeof c != "string" || !qn(l)) return !1;
|
|
2491
2534
|
let u = l;
|
|
2492
|
-
if (typeof u.access_token != "string" || u.access_token === "" || typeof u.refresh_token != "string" || u.refresh_token === "" ||
|
|
2535
|
+
if (typeof u.access_token != "string" || u.access_token === "" || typeof u.refresh_token != "string" || u.refresh_token === "" || J(u.refresh_token) !== c) return !1;
|
|
2493
2536
|
let d = y();
|
|
2494
2537
|
if (!d?.refresh_token) return !1;
|
|
2495
2538
|
let f = n.getTokens(), p = i() ?? X(f), m = X(u);
|
|
@@ -2506,7 +2549,7 @@ function Un(e) {
|
|
|
2506
2549
|
}
|
|
2507
2550
|
return !0;
|
|
2508
2551
|
};
|
|
2509
|
-
return g?.fp === c ? _() : !o.isForward(h, g) || g?.fp !== t &&
|
|
2552
|
+
return g?.fp === c ? _() : !o.isForward(h, g) || g?.fp !== t && J(d.refresh_token) !== c ? !1 : (M({ ...u }), _());
|
|
2510
2553
|
}, L = (e) => {
|
|
2511
2554
|
if (!e || !_) return !1;
|
|
2512
2555
|
let t = _;
|
|
@@ -2572,7 +2615,7 @@ function Un(e) {
|
|
|
2572
2615
|
};
|
|
2573
2616
|
}
|
|
2574
2617
|
// lib/refresh/controller.ts
|
|
2575
|
-
function
|
|
2618
|
+
function Yn() {
|
|
2576
2619
|
let e, t, n = new Promise((n, r) => {
|
|
2577
2620
|
e = n, t = r;
|
|
2578
2621
|
});
|
|
@@ -2582,53 +2625,53 @@ function Wn() {
|
|
|
2582
2625
|
reject: t
|
|
2583
2626
|
};
|
|
2584
2627
|
}
|
|
2585
|
-
var
|
|
2586
|
-
strikes:
|
|
2587
|
-
"session-ended":
|
|
2588
|
-
"stored-ended":
|
|
2589
|
-
"signed-out":
|
|
2590
|
-
emptied:
|
|
2591
|
-
"signed-out-here":
|
|
2592
|
-
"successor-timeout":
|
|
2593
|
-
"identity-changed":
|
|
2594
|
-
disposed:
|
|
2628
|
+
var Xn = {
|
|
2629
|
+
strikes: K.sessionEnded,
|
|
2630
|
+
"session-ended": K.sessionEnded,
|
|
2631
|
+
"stored-ended": K.sessionEnded,
|
|
2632
|
+
"signed-out": K.signedOut,
|
|
2633
|
+
emptied: K.signedOut,
|
|
2634
|
+
"signed-out-here": K.signedOut,
|
|
2635
|
+
"successor-timeout": K.successorTimeout,
|
|
2636
|
+
"identity-changed": K.identityChanged,
|
|
2637
|
+
disposed: K.disposed
|
|
2595
2638
|
};
|
|
2596
|
-
function
|
|
2639
|
+
function Zn(e) {
|
|
2597
2640
|
throw Error(`Unexpected refresh state: ${JSON.stringify(e)}`);
|
|
2598
2641
|
}
|
|
2599
|
-
function
|
|
2642
|
+
function Qn(e) {
|
|
2600
2643
|
if (e === void 0 || !Number.isFinite(e)) return 3;
|
|
2601
2644
|
let t = Math.floor(e);
|
|
2602
2645
|
return t >= 1 ? t : 3;
|
|
2603
2646
|
}
|
|
2604
|
-
function
|
|
2647
|
+
function $n(e, t) {
|
|
2605
2648
|
return e instanceof Error && e.message ? e.message : t;
|
|
2606
2649
|
}
|
|
2607
|
-
function
|
|
2650
|
+
function er(e) {
|
|
2608
2651
|
if (typeof e != "object" || !e) return;
|
|
2609
2652
|
let t = e.id;
|
|
2610
2653
|
return typeof t == "string" || typeof t == "number" ? t : void 0;
|
|
2611
2654
|
}
|
|
2612
|
-
function
|
|
2655
|
+
function tr(e) {
|
|
2613
2656
|
let t = {};
|
|
2614
2657
|
return e?.access_token && (t.access_token = e.access_token), e?.refresh_token && (t.refresh_token = e.refresh_token), e?.id_token && (t.id_token = e.id_token), e?.scopes && (t.scopes = [...e.scopes]), t;
|
|
2615
2658
|
}
|
|
2616
|
-
function
|
|
2659
|
+
function nr(e, t) {
|
|
2617
2660
|
let n = {};
|
|
2618
2661
|
e.access_token && (n.access_token = e.access_token), e.refresh_token && (n.refresh_token = e.refresh_token), e.id_token && (n.id_token = e.id_token);
|
|
2619
2662
|
let r = t?.scopes ?? e.scopes;
|
|
2620
2663
|
return r && (n.scopes = r), n;
|
|
2621
2664
|
}
|
|
2622
|
-
function
|
|
2623
|
-
let { emit: t, storage: n, cache: r, transport: i, coordination: a } = e, o = a.clock, s = e.logger ??
|
|
2665
|
+
function rr(e) {
|
|
2666
|
+
let { emit: t, storage: n, cache: r, transport: i, coordination: a } = e, o = a.clock, s = e.logger ?? En(), c = Qn(e.strikes), l = a.transports ? Fn({
|
|
2624
2667
|
locks: a.transports.locks,
|
|
2625
2668
|
channel: a.transports.channel,
|
|
2626
2669
|
tabId: a.transports.tabId,
|
|
2627
2670
|
names: a.names,
|
|
2628
2671
|
clock: o
|
|
2629
|
-
}) :
|
|
2672
|
+
}) : In(), u = { kind: "idle" }, d = 0, f = !1, p = !a.warnOnFirstCycle, m = 0, h = 0, g, _, v, y, b, x, S, C, w = !1, T = () => o.now(), E = () => i.mode(), D = () => J(r.getTokens()?.refresh_token), O = () => ({ ...r.getTokens() ?? {} }), ee = () => i.opaqueMarker ? i.opaqueMarker() : n.getTokens()?.id_token, k = () => (S === void 0 && (S = X(r.getTokens() ?? n.getTokens())), S), A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), M = (e) => () => {
|
|
2630
2673
|
for (let t of Array.from(e)) t();
|
|
2631
|
-
}, te = a.onStorageChange?.(M(A)), ne = e.platform?.onForeground(M(j)), N =
|
|
2674
|
+
}, te = a.onStorageChange?.(M(A)), ne = e.platform?.onForeground(M(j)), N = Jn({
|
|
2632
2675
|
storage: n,
|
|
2633
2676
|
cache: r,
|
|
2634
2677
|
identity: k,
|
|
@@ -2643,13 +2686,13 @@ function Qn(e) {
|
|
|
2643
2686
|
}), re = (e) => ({
|
|
2644
2687
|
trigger: e,
|
|
2645
2688
|
startedAt: T(),
|
|
2646
|
-
plain:
|
|
2689
|
+
plain: Yn(),
|
|
2647
2690
|
fresh: []
|
|
2648
2691
|
}), ie = (e) => e.kind === "idle" || e.kind === "ended" ? void 0 : e.pending, ae = (e, t) => {
|
|
2649
2692
|
if (t === void 0) return e.plain.promise;
|
|
2650
2693
|
let n = {
|
|
2651
2694
|
callTime: t,
|
|
2652
|
-
deferred:
|
|
2695
|
+
deferred: Yn()
|
|
2653
2696
|
};
|
|
2654
2697
|
return e.fresh.push(n), n.deferred.promise;
|
|
2655
2698
|
}, P = (e, t, n = !1) => {
|
|
@@ -2668,11 +2711,11 @@ function Qn(e) {
|
|
|
2668
2711
|
}
|
|
2669
2712
|
}, F = (e, n, r, i) => {
|
|
2670
2713
|
let a = {
|
|
2671
|
-
message:
|
|
2714
|
+
message: $n(r, "Token refresh failed"),
|
|
2672
2715
|
originalError: r,
|
|
2673
2716
|
operation: e,
|
|
2674
2717
|
source: n
|
|
2675
|
-
}, o =
|
|
2718
|
+
}, o = er(r);
|
|
2676
2719
|
o !== void 0 && (a.code = o), i && (a.refresh = i), t("error", a);
|
|
2677
2720
|
}, I = (e, t) => {
|
|
2678
2721
|
let n = {
|
|
@@ -2702,10 +2745,10 @@ function Qn(e) {
|
|
|
2702
2745
|
};
|
|
2703
2746
|
n !== void 0 && (i.nextRetryAt = n), t("refresh:failing", i);
|
|
2704
2747
|
}, le = (e, t) => {
|
|
2705
|
-
let n = r.getTokens(), i =
|
|
2748
|
+
let n = r.getTokens(), i = J(n?.refresh_token);
|
|
2706
2749
|
e.fp && i && l.post({
|
|
2707
2750
|
type: "tokens-refreshed",
|
|
2708
|
-
tokens:
|
|
2751
|
+
tokens: tr(n),
|
|
2709
2752
|
from: e.fp,
|
|
2710
2753
|
...e.iat === void 0 ? {} : { fromIat: e.iat },
|
|
2711
2754
|
fromSid: e.sid ?? "",
|
|
@@ -2713,7 +2756,7 @@ function Qn(e) {
|
|
|
2713
2756
|
...t === void 0 ? {} : { sentAt: t }
|
|
2714
2757
|
});
|
|
2715
2758
|
}, ue = () => {
|
|
2716
|
-
p || (p = !0, s.warn(
|
|
2759
|
+
p || (p = !0, s.warn(ln));
|
|
2717
2760
|
}, de = (e) => {
|
|
2718
2761
|
(e.kind === "backoff" || e.kind === "blocked-wait") && e.cancel();
|
|
2719
2762
|
}, R = (e, n) => {
|
|
@@ -2727,7 +2770,7 @@ function Qn(e) {
|
|
|
2727
2770
|
}, e !== "disposed" && N.dropSession(), (e === "strikes" || e === "successor-timeout") && E() !== "json" && i.invalidate(), u = {
|
|
2728
2771
|
kind: "ended",
|
|
2729
2772
|
cause: e
|
|
2730
|
-
}, se(r, n ?? new
|
|
2773
|
+
}, se(r, n ?? new q(Xn[e])), e) {
|
|
2731
2774
|
case "strikes":
|
|
2732
2775
|
t("session:expired", {
|
|
2733
2776
|
reason: "refresh_failed",
|
|
@@ -2762,7 +2805,7 @@ function Qn(e) {
|
|
|
2762
2805
|
break;
|
|
2763
2806
|
case "signed-out-here":
|
|
2764
2807
|
case "disposed": break;
|
|
2765
|
-
default:
|
|
2808
|
+
default: Zn(e);
|
|
2766
2809
|
}
|
|
2767
2810
|
}, fe = () => {
|
|
2768
2811
|
if (u.kind !== "ended" || u.cause === "disposed" || f || E() !== "json") return;
|
|
@@ -2779,17 +2822,17 @@ function Qn(e) {
|
|
|
2779
2822
|
}, pe = (e) => {
|
|
2780
2823
|
u.kind === "ended" || f || E() === "json" && (R(e === "emptied" ? "emptied" : "identity-changed"), e === "identity-changed" && fe());
|
|
2781
2824
|
}, me = (e) => {
|
|
2782
|
-
e instanceof
|
|
2825
|
+
e instanceof Wn ? (R("identity-changed"), fe()) : e instanceof Un ? R(e.cause === "emptied" ? "emptied" : "stored-ended") : R("stored-ended", e);
|
|
2783
2826
|
}, he = () => {
|
|
2784
2827
|
u = { kind: "idle" }, w || l.release();
|
|
2785
|
-
}, ge = (e) => !e.from || E() !== "json" || e.from === D() || e.from ===
|
|
2828
|
+
}, ge = (e) => !e.from || E() !== "json" || e.from === D() || e.from === J(n.getTokens()?.refresh_token), _e = (e) => {
|
|
2786
2829
|
let t = g;
|
|
2787
2830
|
if (!t) return;
|
|
2788
2831
|
if (!l.holding) {
|
|
2789
2832
|
u = {
|
|
2790
2833
|
kind: "waiting",
|
|
2791
2834
|
pending: e
|
|
2792
|
-
}, l.request(t.nextAt +
|
|
2835
|
+
}, l.request(t.nextAt + W);
|
|
2793
2836
|
return;
|
|
2794
2837
|
}
|
|
2795
2838
|
l.setRetryInfo(t);
|
|
@@ -2808,7 +2851,7 @@ function Qn(e) {
|
|
|
2808
2851
|
!l.holding || l.foreignHolderHeard() || T() - t > 2e4 ? (l.release(), u = {
|
|
2809
2852
|
kind: "waiting",
|
|
2810
2853
|
pending: e
|
|
2811
|
-
}, l.request((g?.nextAt ?? T()) +
|
|
2854
|
+
}, l.request((g?.nextAt ?? T()) + W)) : (u = {
|
|
2812
2855
|
kind: "waiting",
|
|
2813
2856
|
pending: e
|
|
2814
2857
|
}, be() || ye());
|
|
@@ -2848,14 +2891,14 @@ function Qn(e) {
|
|
|
2848
2891
|
case "ended": return N.endHeldSend(), R("stored-ended"), !1;
|
|
2849
2892
|
case "identity-changed": return N.endHeldSend(), R("identity-changed"), fe(), !1;
|
|
2850
2893
|
case "send": return Ce(e, t, a.sent, r);
|
|
2851
|
-
default: return
|
|
2894
|
+
default: return Zn(a);
|
|
2852
2895
|
}
|
|
2853
2896
|
}, Ce = (e, n, r, a) => {
|
|
2854
2897
|
let o = {
|
|
2855
2898
|
generation: d,
|
|
2856
2899
|
sentAt: T(),
|
|
2857
2900
|
trigger: n,
|
|
2858
|
-
settled:
|
|
2901
|
+
settled: Yn()
|
|
2859
2902
|
};
|
|
2860
2903
|
r ? o.sent = r : o.marker = ee(), a && (o.stored = a), u = {
|
|
2861
2904
|
kind: "refreshing",
|
|
@@ -2879,7 +2922,7 @@ function Qn(e) {
|
|
|
2879
2922
|
if (!e.sent) {
|
|
2880
2923
|
let o = X({ ...t.id_token ? { id_token: t.id_token } : {} }), s = k();
|
|
2881
2924
|
if (o !== void 0 && s !== void 0 && o !== s) {
|
|
2882
|
-
let t = new
|
|
2925
|
+
let t = new q(K.identityChanged);
|
|
2883
2926
|
F("refresh", e.trigger, t, I("auth")), R("identity-changed", t);
|
|
2884
2927
|
return;
|
|
2885
2928
|
}
|
|
@@ -2892,7 +2935,7 @@ function Qn(e) {
|
|
|
2892
2935
|
if (!we(e)) return;
|
|
2893
2936
|
r.setTokensCache({
|
|
2894
2937
|
...n.getTokens() ?? {},
|
|
2895
|
-
...
|
|
2938
|
+
...nr(t, void 0)
|
|
2896
2939
|
}), L("refresh", "this-tab");
|
|
2897
2940
|
let c = k();
|
|
2898
2941
|
l.post(c === void 0 ? {
|
|
@@ -2905,7 +2948,7 @@ function Qn(e) {
|
|
|
2905
2948
|
}), he(), P(a, e.sentAt);
|
|
2906
2949
|
return;
|
|
2907
2950
|
}
|
|
2908
|
-
let o = D(), s = N.commitSave(e.sent,
|
|
2951
|
+
let o = D(), s = N.commitSave(e.sent, nr(t, e.stored));
|
|
2909
2952
|
switch (s.kind) {
|
|
2910
2953
|
case "saved":
|
|
2911
2954
|
L("refresh", "this-tab"), le(e.sent.order, e.sentAt), he(), P(a, e.sentAt);
|
|
@@ -2914,16 +2957,16 @@ function Qn(e) {
|
|
|
2914
2957
|
e.outcome && D() === o || L("adopted", "other-tab"), s.adopted && le(e.sent.order), he(), P(a, e.sentAt);
|
|
2915
2958
|
return;
|
|
2916
2959
|
case "ended": {
|
|
2917
|
-
let t = new
|
|
2960
|
+
let t = new q(s.cause === "emptied" ? K.signedOut : K.sessionEnded);
|
|
2918
2961
|
F("refresh", e.trigger, t, I("auth")), R(s.cause === "emptied" ? "emptied" : "stored-ended", t);
|
|
2919
2962
|
return;
|
|
2920
2963
|
}
|
|
2921
2964
|
case "identity-changed": {
|
|
2922
|
-
let t = new
|
|
2965
|
+
let t = new q(K.identityChanged);
|
|
2923
2966
|
F("refresh", e.trigger, t, I("auth")), R("identity-changed", t), fe();
|
|
2924
2967
|
return;
|
|
2925
2968
|
}
|
|
2926
|
-
default:
|
|
2969
|
+
default: Zn(s);
|
|
2927
2970
|
}
|
|
2928
2971
|
}, Ee = (e, t) => {
|
|
2929
2972
|
if (e.sent?.held && N.endHeldSend(), !we(e) || u.kind !== "refreshing") return;
|
|
@@ -2943,9 +2986,9 @@ function Qn(e) {
|
|
|
2943
2986
|
case "own":
|
|
2944
2987
|
r = o.failure, i = o.heldRefused;
|
|
2945
2988
|
break;
|
|
2946
|
-
default:
|
|
2989
|
+
default: Zn(o);
|
|
2947
2990
|
}
|
|
2948
|
-
} else r =
|
|
2991
|
+
} else r = Mn(t, T());
|
|
2949
2992
|
if (i) F("refresh", e.trigger, t, I(r.kind)), L("adopted", "other-tab"), he(), P(n, void 0, !0);
|
|
2950
2993
|
else switch (r.kind) {
|
|
2951
2994
|
case "blocked":
|
|
@@ -2961,10 +3004,10 @@ function Qn(e) {
|
|
|
2961
3004
|
case "transient":
|
|
2962
3005
|
m += 1, De(e, n, t, r);
|
|
2963
3006
|
return;
|
|
2964
|
-
default:
|
|
3007
|
+
default: Zn(r.kind);
|
|
2965
3008
|
}
|
|
2966
3009
|
}, De = (e, t, n, r) => {
|
|
2967
|
-
let i = T() +
|
|
3010
|
+
let i = T() + Nn(m, o.random(), r.retryAfterMs), a = r.kind === "auth" ? "auth" : "transient";
|
|
2968
3011
|
F("refresh", e.trigger, n, I(a, i)), a === "transient" && ce(T(), i, "this-tab");
|
|
2969
3012
|
let s = {
|
|
2970
3013
|
kind: a,
|
|
@@ -2974,7 +3017,7 @@ function Qn(e) {
|
|
|
2974
3017
|
}, c = e.sent?.order.fp;
|
|
2975
3018
|
c && (s.from = c), _ && (s.failingSince = _.since), g = s, l.holding && l.post({
|
|
2976
3019
|
type: "retry-scheduled",
|
|
2977
|
-
message:
|
|
3020
|
+
message: $n(n, "Token refresh failed"),
|
|
2978
3021
|
retry: s
|
|
2979
3022
|
}), _e(re("retry")), oe(t, n, e.sentAt);
|
|
2980
3023
|
}, z = (e, t) => {
|
|
@@ -2987,8 +3030,8 @@ function Qn(e) {
|
|
|
2987
3030
|
fp: i.fp
|
|
2988
3031
|
})), r && N.deleteIfStillDead(r), R("strikes", t);
|
|
2989
3032
|
}, Oe = (e, t, n, r) => {
|
|
2990
|
-
l.release(), s.warn(`[passflow] The refresh token was already used, most likely by another tab; waiting for its successor: ${
|
|
2991
|
-
let i = d, a = T() +
|
|
3033
|
+
l.release(), s.warn(`[passflow] The refresh token was already used, most likely by another tab; waiting for its successor: ${$n(n, "blocked")}`);
|
|
3034
|
+
let i = d, a = T() + qt, c = {
|
|
2992
3035
|
kind: "blocked-wait",
|
|
2993
3036
|
pending: e,
|
|
2994
3037
|
deadline: a,
|
|
@@ -3001,9 +3044,9 @@ function Qn(e) {
|
|
|
3001
3044
|
i === d && u === c && (ke() || (f ? (e.cookieRetried = !0, u = {
|
|
3002
3045
|
kind: "waiting",
|
|
3003
3046
|
pending: e
|
|
3004
|
-
}, l.request()) : T() >= a ? (s.warn("[passflow] No successor of the used refresh token appeared; ending the session in this tab only."), R("successor-timeout")) : c.cancel = o.setTimeout(p,
|
|
3047
|
+
}, l.request()) : T() >= a ? (s.warn("[passflow] No successor of the used refresh token appeared; ending the session in this tab only."), R("successor-timeout")) : c.cancel = o.setTimeout(p, Jt)));
|
|
3005
3048
|
};
|
|
3006
|
-
c.cancel = o.setTimeout(p, f ?
|
|
3049
|
+
c.cancel = o.setTimeout(p, f ? Xt : Jt);
|
|
3007
3050
|
}, ke = () => {
|
|
3008
3051
|
if (u.kind !== "blocked-wait") return !1;
|
|
3009
3052
|
let e = u;
|
|
@@ -3026,7 +3069,7 @@ function Qn(e) {
|
|
|
3026
3069
|
if (u.kind === "ended" || !ge(e)) return;
|
|
3027
3070
|
let r = g?.nextAt;
|
|
3028
3071
|
if (g = e, e.failingSince !== void 0 && ce(e.failingSince, e.nextAt, "other-tab"), !t || u.kind !== "waiting") return;
|
|
3029
|
-
let i = new
|
|
3072
|
+
let i = new q(e.kind === "transient" ? K.unavailable : K.authRetry, {
|
|
3030
3073
|
nextRetryAt: e.nextAt,
|
|
3031
3074
|
cause: n || void 0
|
|
3032
3075
|
}), a = u.pending;
|
|
@@ -3047,7 +3090,7 @@ function Qn(e) {
|
|
|
3047
3090
|
case "idle":
|
|
3048
3091
|
case "refreshing":
|
|
3049
3092
|
case "ended": return;
|
|
3050
|
-
default:
|
|
3093
|
+
default: Zn(u);
|
|
3051
3094
|
}
|
|
3052
3095
|
}, Ne = (e) => {
|
|
3053
3096
|
let t = {};
|
|
@@ -3090,10 +3133,10 @@ function Qn(e) {
|
|
|
3090
3133
|
je(e.retry, !0, e.message), Fe();
|
|
3091
3134
|
return;
|
|
3092
3135
|
case "refresh-failed":
|
|
3093
|
-
if (u.kind === "ended" || E() !== "json" || e.from !== D() && e.from !==
|
|
3136
|
+
if (u.kind === "ended" || E() !== "json" || e.from !== D() && e.from !== J(n.getTokens()?.refresh_token)) return;
|
|
3094
3137
|
if (ce(T(), void 0, "other-tab"), u.kind === "waiting") {
|
|
3095
3138
|
let t = u.pending;
|
|
3096
|
-
u.pending = re(t.trigger), oe(t, new
|
|
3139
|
+
u.pending = re(t.trigger), oe(t, new q(K.unavailable, { cause: e.message }), void 0);
|
|
3097
3140
|
}
|
|
3098
3141
|
return;
|
|
3099
3142
|
case "lock-wanted":
|
|
@@ -3102,7 +3145,7 @@ function Qn(e) {
|
|
|
3102
3145
|
u.cancel(), l.release(), u = {
|
|
3103
3146
|
kind: "waiting",
|
|
3104
3147
|
pending: e
|
|
3105
|
-
}, l.request((g?.nextAt ?? T()) +
|
|
3148
|
+
}, l.request((g?.nextAt ?? T()) + W);
|
|
3106
3149
|
}
|
|
3107
3150
|
return;
|
|
3108
3151
|
case "session-ended":
|
|
@@ -3111,7 +3154,7 @@ function Qn(e) {
|
|
|
3111
3154
|
return;
|
|
3112
3155
|
case "takeover":
|
|
3113
3156
|
case "rate-limited": return;
|
|
3114
|
-
default:
|
|
3157
|
+
default: Zn(e);
|
|
3115
3158
|
}
|
|
3116
3159
|
}, Fe = () => {
|
|
3117
3160
|
C && !l.holding && l.post({
|
|
@@ -3134,7 +3177,7 @@ function Qn(e) {
|
|
|
3134
3177
|
u.cancel(), u = {
|
|
3135
3178
|
kind: "waiting",
|
|
3136
3179
|
pending: e
|
|
3137
|
-
}, l.request((g?.nextAt ?? T()) +
|
|
3180
|
+
}, l.request((g?.nextAt ?? T()) + W);
|
|
3138
3181
|
}
|
|
3139
3182
|
},
|
|
3140
3183
|
onMessage: Pe
|
|
@@ -3160,9 +3203,9 @@ function Qn(e) {
|
|
|
3160
3203
|
};
|
|
3161
3204
|
A.add(Ie), j.add(Ie);
|
|
3162
3205
|
let Le = (e, t) => {
|
|
3163
|
-
if (f) return Promise.reject(new
|
|
3206
|
+
if (f) return Promise.reject(new q(K.disposed));
|
|
3164
3207
|
switch (u.kind) {
|
|
3165
|
-
case "ended": return Promise.reject(new
|
|
3208
|
+
case "ended": return Promise.reject(new q(K.sessionEnded));
|
|
3166
3209
|
case "idle": {
|
|
3167
3210
|
let n = re(e);
|
|
3168
3211
|
u = {
|
|
@@ -3170,17 +3213,17 @@ function Qn(e) {
|
|
|
3170
3213
|
pending: n
|
|
3171
3214
|
};
|
|
3172
3215
|
let r = ae(n, t);
|
|
3173
|
-
return l.holding && !w ? be() || ye() : l.request(g ? g.nextAt +
|
|
3216
|
+
return l.holding && !w ? be() || ye() : l.request(g ? g.nextAt + W : void 0), r;
|
|
3174
3217
|
}
|
|
3175
3218
|
case "waiting":
|
|
3176
3219
|
case "refreshing":
|
|
3177
3220
|
case "backoff":
|
|
3178
3221
|
case "blocked-wait": return ae(u.pending, t);
|
|
3179
|
-
default: return
|
|
3222
|
+
default: return Zn(u);
|
|
3180
3223
|
}
|
|
3181
3224
|
}, V = (e) => {
|
|
3182
|
-
if (f) return Promise.reject(new
|
|
3183
|
-
if (ue(), u.kind === "ended") return Promise.reject(new
|
|
3225
|
+
if (f) return Promise.reject(new q(K.disposed));
|
|
3226
|
+
if (ue(), u.kind === "ended") return Promise.reject(new q(K.sessionEnded));
|
|
3184
3227
|
if (E() === "json" && !r.getTokens()?.refresh_token) {
|
|
3185
3228
|
let t = n.getTokens();
|
|
3186
3229
|
if (!t?.refresh_token) {
|
|
@@ -3190,7 +3233,7 @@ function Qn(e) {
|
|
|
3190
3233
|
}
|
|
3191
3234
|
return Le(e.trigger, e.fresh ? T() : void 0);
|
|
3192
3235
|
}, Re = (e) => {
|
|
3193
|
-
if (f) return Promise.reject(new
|
|
3236
|
+
if (f) return Promise.reject(new q(K.disposed));
|
|
3194
3237
|
if (u.kind === "ended") return Promise.resolve(r.getTokens());
|
|
3195
3238
|
let t = u.kind === "backoff" || u.kind === "blocked-wait" || g !== void 0 && g.nextAt > T();
|
|
3196
3239
|
return e.allowStale && t ? Promise.resolve(r.getTokens()) : V({ trigger: e.trigger }).then(() => r.getTokens());
|
|
@@ -3225,11 +3268,11 @@ function Qn(e) {
|
|
|
3225
3268
|
} else u.kind === "idle" && g && g.nextAt > T() && ge(g) ? (m = g.attempt, h = g.strikes, _e(re("retry"))) : u.kind === "idle" && l.release();
|
|
3226
3269
|
}
|
|
3227
3270
|
}, He = async (e, t) => {
|
|
3228
|
-
if (f) throw new
|
|
3271
|
+
if (f) throw new q(K.disposed);
|
|
3229
3272
|
ue();
|
|
3230
|
-
let n = T() +
|
|
3273
|
+
let n = T() + Zt;
|
|
3231
3274
|
if (await Be(n - T()), (!l.holding || u.kind === "refreshing") && (u.kind === "refreshing" ? "timeout" : await ze("commit", n - T())) === "timeout") {
|
|
3232
|
-
let e = new
|
|
3275
|
+
let e = new zn("lock-timeout");
|
|
3233
3276
|
throw F("upgrade.commit", "upgrade", e), e;
|
|
3234
3277
|
}
|
|
3235
3278
|
w = !0;
|
|
@@ -3276,7 +3319,7 @@ function Qn(e) {
|
|
|
3276
3319
|
if (!o) {
|
|
3277
3320
|
await i.applyOpaque(u), r.setTokensCache({
|
|
3278
3321
|
...n.getTokens() ?? {},
|
|
3279
|
-
...
|
|
3322
|
+
...nr(u, void 0)
|
|
3280
3323
|
}), We(c);
|
|
3281
3324
|
let e = k();
|
|
3282
3325
|
return l.post(e === void 0 ? {
|
|
@@ -3288,9 +3331,9 @@ function Qn(e) {
|
|
|
3288
3331
|
sub: e
|
|
3289
3332
|
}), O();
|
|
3290
3333
|
}
|
|
3291
|
-
let d = N.commitSave(o,
|
|
3334
|
+
let d = N.commitSave(o, nr(u, s));
|
|
3292
3335
|
if (d.kind === "saved") return We(c), le(o.order, c), O();
|
|
3293
|
-
let f = new
|
|
3336
|
+
let f = new zn("superseded");
|
|
3294
3337
|
throw F("upgrade.commit", "upgrade", f), d.kind === "superseded" && d.adopted && L("adopted", "other-tab"), f;
|
|
3295
3338
|
}, We = (e) => {
|
|
3296
3339
|
if (L("upgrade", "this-tab"), u.kind === "waiting" || u.kind === "backoff" || u.kind === "blocked-wait") {
|
|
@@ -3306,9 +3349,9 @@ function Qn(e) {
|
|
|
3306
3349
|
...t,
|
|
3307
3350
|
fp: t.fp
|
|
3308
3351
|
}));
|
|
3309
|
-
},
|
|
3352
|
+
}, Ke = () => {
|
|
3310
3353
|
let e = ie(u);
|
|
3311
|
-
se(e, new
|
|
3354
|
+
se(e, new q(K.signedOut)), (u.kind === "backoff" || u.kind === "blocked-wait" || u.kind === "waiting") && (de(u), u = { kind: "idle" });
|
|
3312
3355
|
};
|
|
3313
3356
|
return {
|
|
3314
3357
|
refresh: V,
|
|
@@ -3316,8 +3359,8 @@ function Qn(e) {
|
|
|
3316
3359
|
commitUpgrade: He,
|
|
3317
3360
|
signOut: async (e) => {
|
|
3318
3361
|
if (f) return e(n.getTokens()?.refresh_token);
|
|
3319
|
-
let t = T() +
|
|
3320
|
-
|
|
3362
|
+
let t = T() + Qt;
|
|
3363
|
+
Ke(), await Be(t - T()), Ke(), l.coordinated && !l.holding && await ze("logout", t - T());
|
|
3321
3364
|
try {
|
|
3322
3365
|
Ge(), await e(n.getTokens()?.refresh_token);
|
|
3323
3366
|
} finally {
|
|
@@ -3326,7 +3369,7 @@ function Qn(e) {
|
|
|
3326
3369
|
},
|
|
3327
3370
|
signOutNow: (e) => {
|
|
3328
3371
|
if (f) return e(n.getTokens()?.refresh_token);
|
|
3329
|
-
|
|
3372
|
+
Ke();
|
|
3330
3373
|
try {
|
|
3331
3374
|
Ge(), e(n.getTokens()?.refresh_token);
|
|
3332
3375
|
} finally {
|
|
@@ -3354,14 +3397,14 @@ function Qn(e) {
|
|
|
3354
3397
|
de(u), f = !0, d += 1, u = {
|
|
3355
3398
|
kind: "ended",
|
|
3356
3399
|
cause: "disposed"
|
|
3357
|
-
}, se(e, new
|
|
3400
|
+
}, se(e, new q(K.disposed)), C = void 0, N.stop(), l.dispose(), te?.(), ne?.();
|
|
3358
3401
|
}
|
|
3359
3402
|
};
|
|
3360
3403
|
}
|
|
3361
3404
|
// lib/store.ts
|
|
3362
3405
|
var Z = /* @__PURE__ */ function(e) {
|
|
3363
3406
|
return e.SignIn = "signin", e.SignInStart = "signin:start", e.Register = "register", e.RegisterStart = "register:start", e.EmailVerificationRequired = "email-verification:required", e.SignOut = "signout", e.SessionRestored = "session:restored", e.SessionExpired = "session:expired", e.Error = "error", e.Refresh = "refresh", e.RefreshStart = "refresh:start", e.TokenCacheExpired = "token-cache-expired", e.TwoFactorRequired = "2fa:required", e.TwoFactorSetupStarted = "2fa:setup_started", e.TwoFactorEnabled = "2fa:enabled", e.TwoFactorDisabled = "2fa:disabled", e.TwoFactorVerified = "2fa:verified", e.TwoFactorRecoveryUsed = "2fa:recovery_used", e.TwoFactorRecoveryCodesLow = "2fa:recovery_low", e.TwoFactorRecoveryCodesExhausted = "2fa:recovery_exhausted", e.TwoFactorSetupMagicLinkValidated = "2fa:magic_link_validated", e.TwoFactorSetupMagicLinkFailed = "2fa:magic_link_failed", e.TwoFactorChallengeReceived = "two_factor_challenge_received", e.TwoFactorMethodSwitched = "two_factor_method_switched", e.TwoFactorDeviceTrusted = "two_factor_device_trusted", e.RefreshFailing = "refresh:failing", e.RefreshRecovered = "refresh:recovered", e;
|
|
3364
|
-
}({}),
|
|
3407
|
+
}({}), ir = class {
|
|
3365
3408
|
constructor() {
|
|
3366
3409
|
this.subscribers = /* @__PURE__ */ new Map();
|
|
3367
3410
|
}
|
|
@@ -3380,12 +3423,12 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3380
3423
|
n && (t.forEach((e) => n.delete(e)), n.size === 0 && this.subscribers.delete(e));
|
|
3381
3424
|
}
|
|
3382
3425
|
notify(e, t) {
|
|
3383
|
-
e === "error" &&
|
|
3426
|
+
e === "error" && zt(this, t?.originalError), this.subscribers.forEach((n, r) => {
|
|
3384
3427
|
(!n || n.has(e)) && r.onAuthChange?.(e, t);
|
|
3385
3428
|
});
|
|
3386
3429
|
}
|
|
3387
3430
|
notifyError(e) {
|
|
3388
|
-
return
|
|
3431
|
+
return U(this, e);
|
|
3389
3432
|
}
|
|
3390
3433
|
}, Q = {
|
|
3391
3434
|
twoFactorCodeInvalid: "error.api.request.2fa_code.invalid",
|
|
@@ -3401,18 +3444,18 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3401
3444
|
twoFactorNotEnabled: "error.2fa.not_enabled",
|
|
3402
3445
|
notImplemented: "error.not.implemented",
|
|
3403
3446
|
tokenInvalid: "error.api.request.token.invalid"
|
|
3404
|
-
},
|
|
3447
|
+
}, ar = Object.freeze([
|
|
3405
3448
|
Q.twoFactorCodeInvalid,
|
|
3406
3449
|
Q.twoFactorNotEnabled,
|
|
3407
3450
|
Q.challengeInvalid,
|
|
3408
3451
|
Q.challengeSessionMismatch,
|
|
3409
3452
|
Q.challengeTooManyAttempts
|
|
3410
|
-
]),
|
|
3453
|
+
]), or = Object.freeze([Q.tokenInvalid]), sr = Object.freeze([
|
|
3411
3454
|
"wrong_code",
|
|
3412
3455
|
"challenge_spent",
|
|
3413
3456
|
"not_registered",
|
|
3414
3457
|
"prepare_not_required"
|
|
3415
|
-
]),
|
|
3458
|
+
]), cr = (e) => sr.includes(e), lr = {
|
|
3416
3459
|
wrong_code: "That code was not accepted. Try again.",
|
|
3417
3460
|
challenge_spent: "That verification challenge is no longer valid. Start again.",
|
|
3418
3461
|
exhausted: "Too many attempts. Try again later.",
|
|
@@ -3426,16 +3469,16 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3426
3469
|
session_changed: "The session ended during verification."
|
|
3427
3470
|
}, $ = class extends Error {
|
|
3428
3471
|
constructor(e) {
|
|
3429
|
-
super(e.message ||
|
|
3472
|
+
super(e.message || lr[e.kind]), this.name = "UpgradeTransportError", this.code = "upgrade_transport", this.kind = e.kind, this.status = e.status, this.errorId = e.errorId, this.retryable = cr(e.kind), e.cause !== void 0 && (this.cause = e.cause);
|
|
3430
3473
|
}
|
|
3431
|
-
},
|
|
3474
|
+
}, ur = Object.freeze([
|
|
3432
3475
|
"upgrade_transport",
|
|
3433
3476
|
"upgrade_insufficient",
|
|
3434
3477
|
"upgrade_unavailable",
|
|
3435
3478
|
"upgrade_session_changed",
|
|
3436
3479
|
"upgrade_cancelled",
|
|
3437
3480
|
"upgrade_unsatisfiable"
|
|
3438
|
-
]),
|
|
3481
|
+
]), dr = (e) => typeof e == "object" && !!e && typeof e.code == "string" && ur.includes(e.code), fr = (e) => e instanceof $ || typeof e == "object" && !!e && e.code === "upgrade_transport", pr = (e) => {
|
|
3439
3482
|
if (typeof e != "object" || !e) return {
|
|
3440
3483
|
hasResponse: !1,
|
|
3441
3484
|
message: typeof e == "string" ? e : void 0
|
|
@@ -3447,7 +3490,7 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3447
3490
|
message: typeof t.message == "string" ? t.message : void 0,
|
|
3448
3491
|
hasResponse: n !== void 0 || typeof t.status == "number"
|
|
3449
3492
|
};
|
|
3450
|
-
},
|
|
3493
|
+
}, mr = (e, t) => {
|
|
3451
3494
|
switch (e) {
|
|
3452
3495
|
case Q.twoFactorCodeInvalid: return "wrong_code";
|
|
3453
3496
|
case Q.challengeInvalid:
|
|
@@ -3464,11 +3507,11 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3464
3507
|
case Q.tokenInvalid: return t === "refresh" ? "session_changed" : "fatal";
|
|
3465
3508
|
default: return;
|
|
3466
3509
|
}
|
|
3467
|
-
},
|
|
3510
|
+
}, hr = (e, t) => e === void 0 ? "network" : e === 501 ? "unavailable" : e === 400 ? "fatal" : e === 401 || e === 403 ? t === "start" ? "challenge_spent" : "session_changed" : e >= 500 ? "network" : "fatal", gr = (e, t) => {
|
|
3468
3511
|
if (e instanceof $) return e;
|
|
3469
|
-
let n =
|
|
3512
|
+
let n = pr(e);
|
|
3470
3513
|
return n.hasResponse ? new $({
|
|
3471
|
-
kind:
|
|
3514
|
+
kind: mr(n.errorId, t) ?? hr(n.status, t),
|
|
3472
3515
|
message: n.message,
|
|
3473
3516
|
status: n.status,
|
|
3474
3517
|
errorId: n.errorId,
|
|
@@ -3478,60 +3521,60 @@ var Z = /* @__PURE__ */ function(e) {
|
|
|
3478
3521
|
message: n.message,
|
|
3479
3522
|
cause: e
|
|
3480
3523
|
});
|
|
3481
|
-
},
|
|
3524
|
+
}, _r = (e) => e.errorId !== void 0 && ar.includes(e.errorId), vr = (e) => e.errorId !== void 0 && or.includes(e.errorId), yr = class extends Error {
|
|
3482
3525
|
constructor(e, t, n) {
|
|
3483
3526
|
super(n ?? "The session was elevated, but this action requires a higher assurance level"), this.name = "UpgradeInsufficientError", this.code = "upgrade_insufficient", this.obtained = e, this.required = t;
|
|
3484
3527
|
}
|
|
3485
|
-
},
|
|
3528
|
+
}, br = class extends Error {
|
|
3486
3529
|
constructor(e = "Step-up verification is not available on this deployment") {
|
|
3487
3530
|
super(e), this.name = "UpgradeUnavailableError", this.code = "upgrade_unavailable";
|
|
3488
3531
|
}
|
|
3489
|
-
},
|
|
3532
|
+
}, xr = class extends Error {
|
|
3490
3533
|
constructor(e = "The session changed during verification") {
|
|
3491
3534
|
super(e), this.name = "UpgradeSessionChangedError", this.code = "upgrade_session_changed";
|
|
3492
3535
|
}
|
|
3493
|
-
},
|
|
3536
|
+
}, Sr = (e) => {
|
|
3494
3537
|
if (e && typeof e.sub == "string" && e.sub !== "") return typeof e.sid == "string" && e.sid !== "" ? {
|
|
3495
3538
|
sub: e.sub,
|
|
3496
3539
|
sid: e.sid
|
|
3497
3540
|
} : { sub: e.sub };
|
|
3498
|
-
},
|
|
3541
|
+
}, Cr = (e, t) => !t || t.sub !== e.sub ? !1 : e.sid !== void 0 && t.sid !== void 0 ? e.sid === t.sid : !0;
|
|
3499
3542
|
// lib/utils/validation.ts
|
|
3500
|
-
function
|
|
3543
|
+
function wr(e) {
|
|
3501
3544
|
if (!e || typeof e != "string") return !1;
|
|
3502
3545
|
let t = e.split(".");
|
|
3503
3546
|
if (t.length !== 3) return !1;
|
|
3504
3547
|
let n = /^[A-Za-z0-9_-]+$/;
|
|
3505
3548
|
return t.every((e) => n.test(e) && e.length > 0);
|
|
3506
3549
|
}
|
|
3507
|
-
function
|
|
3550
|
+
function Tr(e) {
|
|
3508
3551
|
return e.replace(/<[^>]*>/g, "").substring(0, 200);
|
|
3509
3552
|
}
|
|
3510
|
-
function
|
|
3553
|
+
function Er(e) {
|
|
3511
3554
|
if (!e || typeof e != "string") return !1;
|
|
3512
3555
|
let t = e.trim();
|
|
3513
3556
|
return t.length !== 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
|
|
3514
3557
|
}
|
|
3515
|
-
function
|
|
3558
|
+
function Dr(e) {
|
|
3516
3559
|
if (!e || typeof e != "string") return !1;
|
|
3517
3560
|
let t = e.trim();
|
|
3518
3561
|
return /^\+[1-9]\d{1,14}$/.test(t);
|
|
3519
3562
|
}
|
|
3520
|
-
function
|
|
3563
|
+
function Or(e) {
|
|
3521
3564
|
if (!e || typeof e != "string") return !1;
|
|
3522
3565
|
let t = e.trim();
|
|
3523
3566
|
return t.length < 3 || t.length > 30 ? !1 : /^[a-zA-Z0-9_-]+$/.test(t);
|
|
3524
3567
|
}
|
|
3525
|
-
function
|
|
3568
|
+
function kr(e, t = 6) {
|
|
3526
3569
|
return !e || typeof e != "string" ? !1 : (t === 8 ? /^\d{8}$/ : /^\d{6}$/).test(e);
|
|
3527
3570
|
}
|
|
3528
|
-
function
|
|
3571
|
+
function Ar(e) {
|
|
3529
3572
|
if (!e || typeof e != "string") return null;
|
|
3530
3573
|
let t = e.toUpperCase().replace(/\s+/g, "");
|
|
3531
3574
|
return /^[A-Z0-9-]{4,16}$/.test(t) ? t : null;
|
|
3532
3575
|
}
|
|
3533
3576
|
// lib/services/auth-service.ts
|
|
3534
|
-
var
|
|
3577
|
+
var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3, Fr = "passflow_federated_pkce", Ir = 6e5, Lr = "AppId is required for federated auth", Rr = 10, zr = "The sign-in answered with a PKCE code, but its verifier is gone", Br = (e, t) => new Promise((n, r) => {
|
|
3535
3578
|
if (t?.aborted) {
|
|
3536
3579
|
r(t.reason);
|
|
3537
3580
|
return;
|
|
@@ -3542,21 +3585,21 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3542
3585
|
t?.removeEventListener("abort", i), n();
|
|
3543
3586
|
}, e);
|
|
3544
3587
|
t?.addEventListener("abort", i, { once: !0 });
|
|
3545
|
-
}),
|
|
3588
|
+
}), Vr = (e) => {
|
|
3546
3589
|
if (!e) return;
|
|
3547
3590
|
let t = new URLSearchParams(e.search).get("token");
|
|
3548
3591
|
if (t) return t;
|
|
3549
3592
|
let n = e.hash.indexOf("?");
|
|
3550
3593
|
return n < 0 ? void 0 : new URLSearchParams(e.hash.slice(n + 1)).get("token") ?? void 0;
|
|
3551
|
-
},
|
|
3594
|
+
}, Hr = (e) => {
|
|
3552
3595
|
if (e) try {
|
|
3553
3596
|
return A(e).email;
|
|
3554
3597
|
} catch {
|
|
3555
3598
|
return;
|
|
3556
3599
|
}
|
|
3557
|
-
},
|
|
3558
|
-
constructor(e, t, n, r, i, a, o, s, c, l, u, d = P, f, p = { coordination:
|
|
3559
|
-
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.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ne(n), u?.enabled && this.tokenDeliveryManager.setMode(M.BFF), this.refresh =
|
|
3600
|
+
}, Ur = class {
|
|
3601
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d = P, f, p = { coordination: _n() }) {
|
|
3602
|
+
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.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ne(n), u?.enabled && this.tokenDeliveryManager.setMode(M.BFF), this.refresh = rr({
|
|
3560
3603
|
emit: this.createRefreshEmit(),
|
|
3561
3604
|
storage: n,
|
|
3562
3605
|
cache: i,
|
|
@@ -3564,7 +3607,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3564
3607
|
coordination: p.coordination,
|
|
3565
3608
|
platform: d,
|
|
3566
3609
|
...p.strikes === void 0 ? {} : { strikes: p.strikes },
|
|
3567
|
-
logger:
|
|
3610
|
+
logger: En()
|
|
3568
3611
|
}), this.initializeSession();
|
|
3569
3612
|
}
|
|
3570
3613
|
async initializeSession() {
|
|
@@ -3619,7 +3662,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3619
3662
|
rememberEmailChallenge(e, t) {
|
|
3620
3663
|
this.emailChallenges.delete(e), this.emailChallenges.set(e, t);
|
|
3621
3664
|
for (let e of this.emailChallenges.keys()) {
|
|
3622
|
-
if (this.emailChallenges.size <=
|
|
3665
|
+
if (this.emailChallenges.size <= Rr) break;
|
|
3623
3666
|
this.emailChallenges.delete(e);
|
|
3624
3667
|
}
|
|
3625
3668
|
}
|
|
@@ -3627,14 +3670,14 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3627
3670
|
if (this.pendingPkce = {
|
|
3628
3671
|
verifier: e,
|
|
3629
3672
|
scopes: t,
|
|
3630
|
-
expiresAt: Date.now() +
|
|
3673
|
+
expiresAt: Date.now() + Mr
|
|
3631
3674
|
}, typeof sessionStorage < "u") try {
|
|
3632
|
-
sessionStorage.setItem(
|
|
3675
|
+
sessionStorage.setItem(jr, JSON.stringify(this.pendingPkce));
|
|
3633
3676
|
} catch {}
|
|
3634
3677
|
}
|
|
3635
3678
|
readPendingPkce() {
|
|
3636
3679
|
if (!this.pendingPkce && typeof sessionStorage < "u") try {
|
|
3637
|
-
let e = sessionStorage.getItem(
|
|
3680
|
+
let e = sessionStorage.getItem(jr);
|
|
3638
3681
|
this.pendingPkce = e ? JSON.parse(e) : void 0;
|
|
3639
3682
|
} catch {
|
|
3640
3683
|
this.pendingPkce = void 0;
|
|
@@ -3646,17 +3689,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3646
3689
|
}
|
|
3647
3690
|
forgetPkceSignIn() {
|
|
3648
3691
|
if (this.pendingPkce = void 0, typeof sessionStorage < "u") try {
|
|
3649
|
-
sessionStorage.removeItem(
|
|
3692
|
+
sessionStorage.removeItem(jr);
|
|
3650
3693
|
} catch {}
|
|
3651
3694
|
}
|
|
3652
3695
|
rememberPendingPasswordless(e) {
|
|
3653
3696
|
if (this.pendingPasswordless = e, typeof sessionStorage < "u") try {
|
|
3654
|
-
sessionStorage.setItem(
|
|
3697
|
+
sessionStorage.setItem(Nr, JSON.stringify(e));
|
|
3655
3698
|
} catch {}
|
|
3656
3699
|
}
|
|
3657
3700
|
readPendingPasswordless() {
|
|
3658
3701
|
if (!this.pendingPasswordless && typeof sessionStorage < "u") try {
|
|
3659
|
-
let e = sessionStorage.getItem(
|
|
3702
|
+
let e = sessionStorage.getItem(Nr);
|
|
3660
3703
|
this.pendingPasswordless = e ? JSON.parse(e) : void 0;
|
|
3661
3704
|
} catch {
|
|
3662
3705
|
this.pendingPasswordless = void 0;
|
|
@@ -3665,21 +3708,21 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3665
3708
|
}
|
|
3666
3709
|
forgetPendingPasswordless() {
|
|
3667
3710
|
if (this.pendingPasswordless = void 0, typeof sessionStorage < "u") try {
|
|
3668
|
-
sessionStorage.removeItem(
|
|
3711
|
+
sessionStorage.removeItem(Nr);
|
|
3669
3712
|
} catch {}
|
|
3670
3713
|
}
|
|
3671
3714
|
rememberFederatedSlot(e, t) {
|
|
3672
3715
|
if (this.federatedSlot = {
|
|
3673
3716
|
verifier: e,
|
|
3674
3717
|
scopes: t,
|
|
3675
|
-
expiresAt: Date.now() +
|
|
3718
|
+
expiresAt: Date.now() + Ir
|
|
3676
3719
|
}, typeof sessionStorage < "u") try {
|
|
3677
|
-
sessionStorage.setItem(
|
|
3720
|
+
sessionStorage.setItem(Fr, JSON.stringify(this.federatedSlot));
|
|
3678
3721
|
} catch {}
|
|
3679
3722
|
}
|
|
3680
3723
|
readFederatedSlot() {
|
|
3681
3724
|
if (!this.federatedSlot && typeof sessionStorage < "u") try {
|
|
3682
|
-
let e = sessionStorage.getItem(
|
|
3725
|
+
let e = sessionStorage.getItem(Fr);
|
|
3683
3726
|
this.federatedSlot = e ? JSON.parse(e) : void 0;
|
|
3684
3727
|
} catch {
|
|
3685
3728
|
this.federatedSlot = void 0;
|
|
@@ -3688,7 +3731,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3688
3731
|
}
|
|
3689
3732
|
forgetFederatedSlot() {
|
|
3690
3733
|
if (this.federatedSlot = void 0, typeof sessionStorage < "u") try {
|
|
3691
|
-
sessionStorage.removeItem(
|
|
3734
|
+
sessionStorage.removeItem(Fr);
|
|
3692
3735
|
} catch {}
|
|
3693
3736
|
}
|
|
3694
3737
|
async startPkce() {
|
|
@@ -3696,17 +3739,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3696
3739
|
try {
|
|
3697
3740
|
e = await this.readPkceEnabled?.() ?? !1;
|
|
3698
3741
|
} catch (e) {
|
|
3699
|
-
|
|
3742
|
+
En().warn("Passflow: could not read the app settings, so this sign-in sends no PKCE challenge", e);
|
|
3700
3743
|
return;
|
|
3701
3744
|
}
|
|
3702
|
-
return e ?
|
|
3745
|
+
return e ? wn() : void 0;
|
|
3703
3746
|
}
|
|
3704
3747
|
async exchangeCode(e, t) {
|
|
3705
3748
|
return !e.code || !t ? e : await this.authApi.pkceExchange(e.code, t.verifier);
|
|
3706
3749
|
}
|
|
3707
3750
|
async completePkceSignIn(e) {
|
|
3708
3751
|
let t = this.readPendingPkce();
|
|
3709
|
-
if (!t) throw Error(
|
|
3752
|
+
if (!t) throw Error(zr);
|
|
3710
3753
|
let n = await this.authApi.pkceExchange(e, t.verifier);
|
|
3711
3754
|
return await this.processAuthResponse(n, t.scopes ?? this.scopes), n;
|
|
3712
3755
|
}
|
|
@@ -3730,32 +3773,32 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3730
3773
|
if (!t.ok) throw Error(`BFF token storage failed: ${t.status}`);
|
|
3731
3774
|
}
|
|
3732
3775
|
async signIn(e) {
|
|
3733
|
-
if ("email" in e && e.email && !
|
|
3776
|
+
if ("email" in e && e.email && !Er(e.email)) {
|
|
3734
3777
|
let e = /* @__PURE__ */ Error("Invalid email format"), t = {
|
|
3735
3778
|
operation: "sign-in",
|
|
3736
3779
|
message: "Invalid email format",
|
|
3737
3780
|
originalError: e,
|
|
3738
3781
|
code: "VALIDATION_ERROR"
|
|
3739
3782
|
};
|
|
3740
|
-
throw
|
|
3783
|
+
throw U(this.subscribeStore, t), e;
|
|
3741
3784
|
}
|
|
3742
|
-
if ("username" in e && e.username && !
|
|
3785
|
+
if ("username" in e && e.username && !Or(e.username)) {
|
|
3743
3786
|
let e = /* @__PURE__ */ Error("Invalid username format. Username must be 3-30 characters and contain only letters, numbers, underscores, and hyphens"), t = {
|
|
3744
3787
|
operation: "sign-in",
|
|
3745
3788
|
message: "Invalid username format. Username must be 3-30 characters and contain only letters, numbers, underscores, and hyphens",
|
|
3746
3789
|
originalError: e,
|
|
3747
3790
|
code: "VALIDATION_ERROR"
|
|
3748
3791
|
};
|
|
3749
|
-
throw
|
|
3792
|
+
throw U(this.subscribeStore, t), e;
|
|
3750
3793
|
}
|
|
3751
|
-
if ("phone" in e && e.phone && !
|
|
3794
|
+
if ("phone" in e && e.phone && !Dr(e.phone)) {
|
|
3752
3795
|
let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
|
|
3753
3796
|
operation: "sign-in",
|
|
3754
3797
|
message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
|
|
3755
3798
|
originalError: e,
|
|
3756
3799
|
code: "VALIDATION_ERROR"
|
|
3757
3800
|
};
|
|
3758
|
-
throw
|
|
3801
|
+
throw U(this.subscribeStore, t), e;
|
|
3759
3802
|
}
|
|
3760
3803
|
this.subscribeStore.notify(Z.SignInStart, { email: e.email });
|
|
3761
3804
|
let t = this.deviceService.getDeviceId(), n = Le(this.platform.getDeviceType());
|
|
@@ -3778,27 +3821,27 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3778
3821
|
originalError: e,
|
|
3779
3822
|
code: e instanceof B ? e.id : void 0
|
|
3780
3823
|
};
|
|
3781
|
-
throw
|
|
3824
|
+
throw U(this.subscribeStore, t), e;
|
|
3782
3825
|
}
|
|
3783
3826
|
}
|
|
3784
3827
|
async signUp(e) {
|
|
3785
|
-
if (e.user.email && !
|
|
3828
|
+
if (e.user.email && !Er(e.user.email)) {
|
|
3786
3829
|
let e = /* @__PURE__ */ Error("Invalid email format"), t = {
|
|
3787
3830
|
operation: "sign-up",
|
|
3788
3831
|
message: "Invalid email format",
|
|
3789
3832
|
originalError: e,
|
|
3790
3833
|
code: "VALIDATION_ERROR"
|
|
3791
3834
|
};
|
|
3792
|
-
throw
|
|
3835
|
+
throw U(this.subscribeStore, t), e;
|
|
3793
3836
|
}
|
|
3794
|
-
if (e.user.phone_number && !
|
|
3837
|
+
if (e.user.phone_number && !Dr(e.user.phone_number)) {
|
|
3795
3838
|
let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
|
|
3796
3839
|
operation: "sign-up",
|
|
3797
3840
|
message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
|
|
3798
3841
|
originalError: e,
|
|
3799
3842
|
code: "VALIDATION_ERROR"
|
|
3800
3843
|
};
|
|
3801
|
-
throw
|
|
3844
|
+
throw U(this.subscribeStore, t), e;
|
|
3802
3845
|
}
|
|
3803
3846
|
this.subscribeStore.notify(Z.RegisterStart, { email: e.user.email }), e.scopes = e.scopes ?? this.scopes, e.create_tenant = this.createTenantForNewUser;
|
|
3804
3847
|
try {
|
|
@@ -3819,27 +3862,27 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3819
3862
|
originalError: e,
|
|
3820
3863
|
code: e instanceof B ? e.id : void 0
|
|
3821
3864
|
};
|
|
3822
|
-
throw
|
|
3865
|
+
throw U(this.subscribeStore, t), e;
|
|
3823
3866
|
}
|
|
3824
3867
|
}
|
|
3825
3868
|
async passwordlessSignIn(e) {
|
|
3826
|
-
if (e.email && !
|
|
3869
|
+
if (e.email && !Er(e.email)) {
|
|
3827
3870
|
let e = /* @__PURE__ */ Error("Invalid email format"), t = {
|
|
3828
3871
|
operation: "passwordless.start",
|
|
3829
3872
|
message: "Invalid email format",
|
|
3830
3873
|
originalError: e,
|
|
3831
3874
|
code: "VALIDATION_ERROR"
|
|
3832
3875
|
};
|
|
3833
|
-
throw
|
|
3876
|
+
throw U(this.subscribeStore, t), e;
|
|
3834
3877
|
}
|
|
3835
|
-
if (e.phone && !
|
|
3878
|
+
if (e.phone && !Dr(e.phone)) {
|
|
3836
3879
|
let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
|
|
3837
3880
|
operation: "passwordless.start",
|
|
3838
3881
|
message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
|
|
3839
3882
|
originalError: e,
|
|
3840
3883
|
code: "VALIDATION_ERROR"
|
|
3841
3884
|
};
|
|
3842
|
-
throw
|
|
3885
|
+
throw U(this.subscribeStore, t), e;
|
|
3843
3886
|
}
|
|
3844
3887
|
this.subscribeStore.notify(Z.SignInStart, { email: e.email });
|
|
3845
3888
|
let t = e.scopes ?? this.scopes, n = this.deviceService.getDeviceId(), r = Le(this.platform.getDeviceType());
|
|
@@ -3865,7 +3908,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3865
3908
|
originalError: e,
|
|
3866
3909
|
code: e instanceof B ? e.id : void 0
|
|
3867
3910
|
};
|
|
3868
|
-
throw
|
|
3911
|
+
throw U(this.subscribeStore, t), e;
|
|
3869
3912
|
}
|
|
3870
3913
|
}
|
|
3871
3914
|
async passwordlessSignInComplete(e) {
|
|
@@ -3876,7 +3919,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3876
3919
|
if (r = !0, this.handlePendingSecondFactor(t, n?.email, n && { verifier: n.verifier }, n?.scopes)) return this.forgetPendingPasswordless(), t;
|
|
3877
3920
|
let i = t;
|
|
3878
3921
|
if (t.code) {
|
|
3879
|
-
if (!n) throw Error(
|
|
3922
|
+
if (!n) throw Error(zr);
|
|
3880
3923
|
if (i = await this.authApi.pkceExchange(t.code, n.verifier), this.handlePendingSecondFactor(i)) return this.forgetPendingPasswordless(), {
|
|
3881
3924
|
...i,
|
|
3882
3925
|
redirect_url: t.redirect_url ?? ""
|
|
@@ -3901,18 +3944,18 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3901
3944
|
originalError: e,
|
|
3902
3945
|
code: e instanceof B ? e.id : void 0
|
|
3903
3946
|
};
|
|
3904
|
-
throw
|
|
3947
|
+
throw U(this.subscribeStore, t), e;
|
|
3905
3948
|
}
|
|
3906
3949
|
}
|
|
3907
3950
|
async waitForPasswordlessSignIn(e, t) {
|
|
3908
3951
|
let n = t?.signal;
|
|
3909
3952
|
try {
|
|
3910
3953
|
let t = this.readPendingPasswordless();
|
|
3911
|
-
if (t?.challengeId !== e) throw Error(
|
|
3954
|
+
if (t?.challengeId !== e) throw Error(zr);
|
|
3912
3955
|
for (;;) {
|
|
3913
3956
|
if (n?.aborted) throw n.reason;
|
|
3914
3957
|
if (Date.now() >= t.expiresAt) return this.forgetPendingPasswordless(), { status: "expired" };
|
|
3915
|
-
if (this.readPendingPasswordless()?.challengeId !== e) throw Error(
|
|
3958
|
+
if (this.readPendingPasswordless()?.challengeId !== e) throw Error(zr);
|
|
3916
3959
|
let r;
|
|
3917
3960
|
try {
|
|
3918
3961
|
r = await this.authApi.passwordlessStatus({
|
|
@@ -3925,7 +3968,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3925
3968
|
}
|
|
3926
3969
|
if (r?.status === "denied" || r?.status === "expired" || r?.status === "completed") return this.forgetPendingPasswordless(), { status: r.status };
|
|
3927
3970
|
if (r?.status === "approved" && r.code) return await this.finishApprovedPasswordless(r.code, t);
|
|
3928
|
-
await
|
|
3971
|
+
await Br(Pr, n);
|
|
3929
3972
|
}
|
|
3930
3973
|
} catch (e) {
|
|
3931
3974
|
if (n?.aborted && e === n.reason) throw e;
|
|
@@ -3935,7 +3978,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3935
3978
|
originalError: e,
|
|
3936
3979
|
code: e instanceof B ? e.id : void 0
|
|
3937
3980
|
};
|
|
3938
|
-
throw
|
|
3981
|
+
throw U(this.subscribeStore, t), e;
|
|
3939
3982
|
}
|
|
3940
3983
|
}
|
|
3941
3984
|
async finishApprovedPasswordless(e, t) {
|
|
@@ -3959,6 +4002,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3959
4002
|
expiresAt: t.expiresAt
|
|
3960
4003
|
};
|
|
3961
4004
|
}
|
|
4005
|
+
checkRedirectUrl(e) {
|
|
4006
|
+
return this.authApi.checkRedirectUrl(e);
|
|
4007
|
+
}
|
|
3962
4008
|
async getPasswordlessApproval(e) {
|
|
3963
4009
|
try {
|
|
3964
4010
|
return await this.authApi.passwordlessApprovalInfo({ challenge_id: e });
|
|
@@ -3985,20 +4031,20 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
3985
4031
|
originalError: e,
|
|
3986
4032
|
code: e instanceof B ? e.id : void 0
|
|
3987
4033
|
};
|
|
3988
|
-
|
|
4034
|
+
U(this.subscribeStore, t);
|
|
3989
4035
|
}
|
|
3990
4036
|
async verifyEmailCode(e) {
|
|
3991
4037
|
let t = this.emailChallenges.get(e.challenge_id), n = t?.email;
|
|
3992
4038
|
try {
|
|
3993
4039
|
let r = t?.pkce === !1 ? void 0 : this.readPendingPkce();
|
|
3994
|
-
if (t?.pkce && !r) throw Error(
|
|
4040
|
+
if (t?.pkce && !r) throw Error(zr);
|
|
3995
4041
|
let i = await this.authApi.validateEmailCode(e);
|
|
3996
4042
|
this.emailChallenges.delete(e.challenge_id);
|
|
3997
4043
|
let a = r?.scopes ?? t?.scopes ?? this.scopes;
|
|
3998
4044
|
if (this.handleEmailVerificationStep(i, t?.operation ?? "sign-in", n, r, a) || this.handlePendingSecondFactor(i, n, r, a)) return i;
|
|
3999
4045
|
let o = i;
|
|
4000
4046
|
if (i.code) {
|
|
4001
|
-
if (!r) throw Error(
|
|
4047
|
+
if (!r) throw Error(zr);
|
|
4002
4048
|
if (o = await this.authApi.pkceExchange(i.code, r.verifier), this.handlePendingSecondFactor(o, n)) return o;
|
|
4003
4049
|
}
|
|
4004
4050
|
let s = i.redirect_url ? {
|
|
@@ -4016,7 +4062,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4016
4062
|
originalError: e,
|
|
4017
4063
|
code: e instanceof B ? e.id : void 0
|
|
4018
4064
|
};
|
|
4019
|
-
throw
|
|
4065
|
+
throw U(this.subscribeStore, t), e;
|
|
4020
4066
|
}
|
|
4021
4067
|
}
|
|
4022
4068
|
async logOut() {
|
|
@@ -4052,13 +4098,13 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4052
4098
|
readSessionPin() {
|
|
4053
4099
|
try {
|
|
4054
4100
|
let e = this.storageManager.getToken(j.access_token);
|
|
4055
|
-
return e ?
|
|
4101
|
+
return e ? Sr(A(e)) : void 0;
|
|
4056
4102
|
} catch {
|
|
4057
4103
|
return;
|
|
4058
4104
|
}
|
|
4059
4105
|
}
|
|
4060
4106
|
assertSessionPin(e) {
|
|
4061
|
-
if (e && !
|
|
4107
|
+
if (e && !Cr(e, this.readSessionPin())) throw console.warn("[passflow] the session or user changed while a step-up upgrade was in flight; the elevated tokens were discarded and the live session was left untouched."), new xr("The session changed during verification, so the elevated tokens were discarded");
|
|
4062
4108
|
}
|
|
4063
4109
|
refreshMode() {
|
|
4064
4110
|
return this.tokenDeliveryManager.isBFFMode() && this.tokenExchangeConfig?.refreshUrl ? "bff" : this.tokenDeliveryManager.isCookieMode() ? "cookie" : "json";
|
|
@@ -4086,7 +4132,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4086
4132
|
return;
|
|
4087
4133
|
}
|
|
4088
4134
|
case "error":
|
|
4089
|
-
|
|
4135
|
+
U(n, t);
|
|
4090
4136
|
return;
|
|
4091
4137
|
case "refresh:start":
|
|
4092
4138
|
n.notify(Z.RefreshStart, {});
|
|
@@ -4106,7 +4152,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4106
4152
|
case "signout":
|
|
4107
4153
|
n.notify(Z.SignOut, t);
|
|
4108
4154
|
return;
|
|
4109
|
-
default:
|
|
4155
|
+
default: En().warn(`[passflow] Unknown refresh event: ${String(e)}`);
|
|
4110
4156
|
}
|
|
4111
4157
|
};
|
|
4112
4158
|
}
|
|
@@ -4164,7 +4210,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4164
4210
|
let e = this.storageManager.getTokens();
|
|
4165
4211
|
if (!e?.refresh_token) {
|
|
4166
4212
|
let t = /* @__PURE__ */ Error(e ? "No refresh token found" : "No tokens found");
|
|
4167
|
-
throw
|
|
4213
|
+
throw U(this.subscribeStore, {
|
|
4168
4214
|
operation: "refresh",
|
|
4169
4215
|
source: "refresh-token",
|
|
4170
4216
|
message: t.message,
|
|
@@ -4187,15 +4233,15 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4187
4233
|
originalError: e,
|
|
4188
4234
|
code: e instanceof B ? e.id : void 0
|
|
4189
4235
|
};
|
|
4190
|
-
throw
|
|
4236
|
+
throw U(this.subscribeStore, t), e;
|
|
4191
4237
|
}
|
|
4192
4238
|
}
|
|
4193
4239
|
async resetPassword(e, t, n) {
|
|
4194
4240
|
this.subscribeStore.notify(Z.SignInStart, {});
|
|
4195
|
-
let r = n ??
|
|
4241
|
+
let r = n ?? Vr(this.platform.getCurrentUrl()), i = t ?? this.scopes;
|
|
4196
4242
|
try {
|
|
4197
4243
|
let t = await this.startPkce(), n = t ? await this.authApi.resetPassword(e, i, r, t.challenge) : await this.authApi.resetPassword(e, i, r);
|
|
4198
|
-
if (this.handleEmailVerificationStep(n, "reset-password",
|
|
4244
|
+
if (this.handleEmailVerificationStep(n, "reset-password", Hr(r), t, i) || this.handlePendingSecondFactor(n, void 0, t, i)) return n;
|
|
4199
4245
|
let a = await this.exchangeCode(n, t);
|
|
4200
4246
|
if (this.handlePendingSecondFactor(a)) return a;
|
|
4201
4247
|
let o = n.redirect_url ? {
|
|
@@ -4213,7 +4259,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4213
4259
|
originalError: e,
|
|
4214
4260
|
code: e instanceof B ? e.id : void 0
|
|
4215
4261
|
};
|
|
4216
|
-
throw
|
|
4262
|
+
throw U(this.subscribeStore, t), e;
|
|
4217
4263
|
}
|
|
4218
4264
|
}
|
|
4219
4265
|
async passkeyRegister(e) {
|
|
@@ -4243,7 +4289,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4243
4289
|
originalError: e,
|
|
4244
4290
|
code: e instanceof B ? e.id : void 0
|
|
4245
4291
|
};
|
|
4246
|
-
throw
|
|
4292
|
+
throw U(this.subscribeStore, t), e;
|
|
4247
4293
|
}
|
|
4248
4294
|
}
|
|
4249
4295
|
async passkeyAuthenticate(e) {
|
|
@@ -4271,12 +4317,12 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4271
4317
|
originalError: e,
|
|
4272
4318
|
code: e instanceof B ? e.id : void 0
|
|
4273
4319
|
};
|
|
4274
|
-
throw
|
|
4320
|
+
throw U(this.subscribeStore, t), e;
|
|
4275
4321
|
}
|
|
4276
4322
|
}
|
|
4277
4323
|
createFederatedAuthUrl(e) {
|
|
4278
4324
|
let t = `/auth/federated/start/${e.provider}`;
|
|
4279
|
-
if (!this.appId) throw Error(
|
|
4325
|
+
if (!this.appId) throw Error(Lr);
|
|
4280
4326
|
let n = {
|
|
4281
4327
|
scopes: (e.scopes ?? this.scopes).join(" "),
|
|
4282
4328
|
redirect_url: e.redirect_url ?? this.platform.getCurrentUrl()?.origin ?? "",
|
|
@@ -4290,7 +4336,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4290
4336
|
return r.search = new URLSearchParams(n).toString(), r.toString();
|
|
4291
4337
|
}
|
|
4292
4338
|
async federatedAuthWithPopup(e) {
|
|
4293
|
-
if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(
|
|
4339
|
+
if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Lr);
|
|
4294
4340
|
let t = e.scopes ?? this.scopes, n = this.deviceService.getDeviceId();
|
|
4295
4341
|
try {
|
|
4296
4342
|
this.forgetFederatedSlot();
|
|
@@ -4330,11 +4376,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4330
4376
|
code: e instanceof ie ? "POPUP_CLOSED" : "AUTH_FAILED",
|
|
4331
4377
|
originalError: e
|
|
4332
4378
|
};
|
|
4333
|
-
|
|
4379
|
+
U(this.subscribeStore, t);
|
|
4334
4380
|
}
|
|
4335
4381
|
}
|
|
4336
4382
|
federatedAuthWithRedirect(e) {
|
|
4337
|
-
if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(
|
|
4383
|
+
if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Lr);
|
|
4338
4384
|
let t = e.scopes ?? this.scopes, n = this.deviceService.getDeviceId();
|
|
4339
4385
|
this.startPkce().then((r) => {
|
|
4340
4386
|
let i = this.createFederatedAuthUrl({
|
|
@@ -4374,7 +4420,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4374
4420
|
originalError: e,
|
|
4375
4421
|
code: e instanceof B ? e.id : void 0
|
|
4376
4422
|
};
|
|
4377
|
-
|
|
4423
|
+
U(this.subscribeStore, t);
|
|
4378
4424
|
}
|
|
4379
4425
|
authRedirectUrl(e = {}) {
|
|
4380
4426
|
try {
|
|
@@ -4392,7 +4438,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4392
4438
|
message: e instanceof Error ? e.message : "Failed to create auth redirect URL",
|
|
4393
4439
|
originalError: e
|
|
4394
4440
|
};
|
|
4395
|
-
throw
|
|
4441
|
+
throw U(this.subscribeStore, t), e;
|
|
4396
4442
|
}
|
|
4397
4443
|
}
|
|
4398
4444
|
authRedirect(e = {}) {
|
|
@@ -4404,7 +4450,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4404
4450
|
message: e instanceof Error ? e.message : "Failed to redirect to auth page",
|
|
4405
4451
|
originalError: e
|
|
4406
4452
|
};
|
|
4407
|
-
throw
|
|
4453
|
+
throw U(this.subscribeStore, t), e;
|
|
4408
4454
|
}
|
|
4409
4455
|
}
|
|
4410
4456
|
isAuthenticated(e) {
|
|
@@ -4420,7 +4466,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4420
4466
|
message: e instanceof Error ? e.message : "Failed to check authentication status",
|
|
4421
4467
|
originalError: e
|
|
4422
4468
|
};
|
|
4423
|
-
return
|
|
4469
|
+
return U(this.subscribeStore, t), !1;
|
|
4424
4470
|
}
|
|
4425
4471
|
}
|
|
4426
4472
|
async submitSessionCheck(e = !1) {
|
|
@@ -4433,7 +4479,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4433
4479
|
message: e instanceof Error || e instanceof B ? e.message : "Session check failed",
|
|
4434
4480
|
originalError: e
|
|
4435
4481
|
};
|
|
4436
|
-
|
|
4482
|
+
U(this.subscribeStore, n), t = void 0;
|
|
4437
4483
|
}
|
|
4438
4484
|
return t && this.sessionCallbacks.createSession && await this.sessionCallbacks.createSession({
|
|
4439
4485
|
tokens: t,
|
|
@@ -4460,11 +4506,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4460
4506
|
message: e instanceof Error ? e.message : "Failed to get tokens",
|
|
4461
4507
|
originalError: e
|
|
4462
4508
|
};
|
|
4463
|
-
|
|
4509
|
+
U(this.subscribeStore, t);
|
|
4464
4510
|
return;
|
|
4465
4511
|
}
|
|
4466
4512
|
}
|
|
4467
|
-
},
|
|
4513
|
+
}, Wr = class {
|
|
4468
4514
|
constructor(e) {
|
|
4469
4515
|
this.invitationApi = e;
|
|
4470
4516
|
}
|
|
@@ -4483,7 +4529,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4483
4529
|
getInvitationLink(e) {
|
|
4484
4530
|
return this.invitationApi.getInvitationLink(e);
|
|
4485
4531
|
}
|
|
4486
|
-
},
|
|
4532
|
+
}, Gr = class {
|
|
4487
4533
|
constructor(e) {
|
|
4488
4534
|
this.data = this.normalize(e);
|
|
4489
4535
|
}
|
|
@@ -4540,9 +4586,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4540
4586
|
getData() {
|
|
4541
4587
|
return this.data;
|
|
4542
4588
|
}
|
|
4543
|
-
},
|
|
4589
|
+
}, Kr = class {
|
|
4544
4590
|
constructor(e, t, n) {
|
|
4545
|
-
this.tenantApi = e, this.scopes = t, this.logger = n ||
|
|
4591
|
+
this.tenantApi = e, this.scopes = t, this.logger = n || En();
|
|
4546
4592
|
}
|
|
4547
4593
|
handlePassflowError(t, n) {
|
|
4548
4594
|
if (e.isAxiosError(t) && t.response?.data) {
|
|
@@ -4578,7 +4624,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4578
4624
|
}
|
|
4579
4625
|
async getTenantUserMembership(e) {
|
|
4580
4626
|
try {
|
|
4581
|
-
return new
|
|
4627
|
+
return new Gr(await this.tenantApi.getTenantDetails(e));
|
|
4582
4628
|
} catch (t) {
|
|
4583
4629
|
this.handlePassflowError(t, `Get tenant user membership failed for tenant ID ${e}`);
|
|
4584
4630
|
}
|
|
@@ -4723,7 +4769,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4723
4769
|
this.handlePassflowError(r, `Invalidate invite by email failed for tenant ID ${e}, group ID ${t}, email ${n}`);
|
|
4724
4770
|
}
|
|
4725
4771
|
}
|
|
4726
|
-
},
|
|
4772
|
+
}, qr = class {
|
|
4727
4773
|
constructor(e, t, n, r = P) {
|
|
4728
4774
|
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();
|
|
4729
4775
|
}
|
|
@@ -4748,7 +4794,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4748
4794
|
message: e instanceof Error ? e.message : "Failed to get tokens",
|
|
4749
4795
|
originalError: e
|
|
4750
4796
|
};
|
|
4751
|
-
|
|
4797
|
+
U(this.subscribeStore, t), this.setTokensCache(void 0);
|
|
4752
4798
|
}
|
|
4753
4799
|
}
|
|
4754
4800
|
startTokenCheck() {
|
|
@@ -4793,7 +4839,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4793
4839
|
message: e instanceof Error ? e.message : "Failed to get tokens",
|
|
4794
4840
|
originalError: e
|
|
4795
4841
|
};
|
|
4796
|
-
|
|
4842
|
+
U(this.subscribeStore, t);
|
|
4797
4843
|
return;
|
|
4798
4844
|
}
|
|
4799
4845
|
}
|
|
@@ -4803,14 +4849,14 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4803
4849
|
isExpired() {
|
|
4804
4850
|
return this.tokensCache ? this.tokensCache.access_token ? k(A(this.tokensCache.access_token)) : !1 : !0;
|
|
4805
4851
|
}
|
|
4806
|
-
},
|
|
4852
|
+
}, Jr = class {
|
|
4807
4853
|
constructor(e, t, n) {
|
|
4808
4854
|
this.twoFactorApi = e, this.subscribeStore = t, this.signInCompleter = n, this.PARTIAL_AUTH_TIMEOUT_MS = 3e5, this.SESSION_STORAGE_KEY = "passflow_2fa_challenge", this.totpDigits = 6, this.subscribeStore.subscribe({ onAuthChange: (e, t) => {
|
|
4809
4855
|
if (e === Z.TwoFactorRequired) {
|
|
4810
4856
|
let e = t;
|
|
4811
4857
|
this.setPartialAuthState(e.email, e.challengeId, e.tfaToken);
|
|
4812
4858
|
}
|
|
4813
|
-
(e === Z.SignIn || e === Z.Register) && this.clearPartialAuthState();
|
|
4859
|
+
(e === Z.SignIn || e === Z.Register) && (this.clearPartialAuthState(), this.clearMagicLinkSession());
|
|
4814
4860
|
} }, [
|
|
4815
4861
|
Z.TwoFactorRequired,
|
|
4816
4862
|
Z.SignIn,
|
|
@@ -4824,11 +4870,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4824
4870
|
originalError: e,
|
|
4825
4871
|
code: r?.id || void 0
|
|
4826
4872
|
};
|
|
4827
|
-
throw
|
|
4873
|
+
throw U(this.subscribeStore, i), e;
|
|
4828
4874
|
}
|
|
4829
4875
|
async getStatus() {
|
|
4830
4876
|
try {
|
|
4831
|
-
let e = await this.twoFactorApi.getStatus();
|
|
4877
|
+
let e = await this.twoFactorApi.getStatus(this.getMagicLinkSessionToken() ?? void 0);
|
|
4832
4878
|
return e.totp_digits && (this.totpDigits = e.totp_digits), e;
|
|
4833
4879
|
} catch (e) {
|
|
4834
4880
|
this.emitErrorAndThrow(e, "2fa.status", "Get 2FA status");
|
|
@@ -4836,28 +4882,70 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4836
4882
|
}
|
|
4837
4883
|
async beginSetup() {
|
|
4838
4884
|
try {
|
|
4839
|
-
|
|
4840
|
-
return e.totp_digits && (this.totpDigits = e.totp_digits), this.subscribeStore.notify(Z.TwoFactorSetupStarted, { secret: e.secret }), e;
|
|
4885
|
+
return this.setupStarted(await this.twoFactorApi.beginSetup(this.getMagicLinkSessionToken() ?? void 0));
|
|
4841
4886
|
} catch (e) {
|
|
4842
4887
|
this.emitErrorAndThrow(e, "2fa.setup.begin", "Begin 2FA setup");
|
|
4843
4888
|
}
|
|
4844
4889
|
}
|
|
4845
4890
|
async confirmSetup(e) {
|
|
4846
|
-
|
|
4891
|
+
this.assertTotpCode(e);
|
|
4847
4892
|
try {
|
|
4848
|
-
let t = await this.twoFactorApi.confirmSetup({ code: e });
|
|
4849
|
-
return this.
|
|
4850
|
-
recoveryCodes: t.recovery_codes,
|
|
4851
|
-
clearRecoveryCodes: () => {
|
|
4852
|
-
t.recovery_codes.length = 0;
|
|
4853
|
-
}
|
|
4854
|
-
}), t;
|
|
4893
|
+
let t = await this.twoFactorApi.confirmSetup({ code: e }, this.getMagicLinkSessionToken() ?? void 0);
|
|
4894
|
+
return this.clearMagicLinkSession(), this.setupConfirmed(t);
|
|
4855
4895
|
} catch (e) {
|
|
4856
4896
|
this.emitErrorAndThrow(e, "2fa.setup.confirm", "Confirm 2FA setup");
|
|
4857
4897
|
}
|
|
4858
4898
|
}
|
|
4899
|
+
async getEnrollment() {
|
|
4900
|
+
try {
|
|
4901
|
+
return await this.twoFactorApi.getEnrollment(this.requirePendingTfaToken());
|
|
4902
|
+
} catch (e) {
|
|
4903
|
+
this.emitErrorAndThrow(e, "2fa.enrollment.read", "Read 2FA enrollment");
|
|
4904
|
+
}
|
|
4905
|
+
}
|
|
4906
|
+
async sendSetupLink() {
|
|
4907
|
+
try {
|
|
4908
|
+
return await this.twoFactorApi.sendSetupLink(this.requirePendingTfaToken());
|
|
4909
|
+
} catch (e) {
|
|
4910
|
+
this.emitErrorAndThrow(e, "2fa.enrollment.setup-link", "Send 2FA setup link");
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
async beginEnrollment() {
|
|
4914
|
+
try {
|
|
4915
|
+
return this.setupStarted(await this.twoFactorApi.beginEnrollment(this.requirePendingTfaToken()));
|
|
4916
|
+
} catch (e) {
|
|
4917
|
+
this.emitErrorAndThrow(e, "2fa.setup.begin", "Begin 2FA enrollment");
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
async confirmEnrollment(e) {
|
|
4921
|
+
this.assertTotpCode(e);
|
|
4922
|
+
try {
|
|
4923
|
+
return this.setupConfirmed(await this.twoFactorApi.confirmEnrollment(this.requirePendingTfaToken(), { code: e }));
|
|
4924
|
+
} catch (e) {
|
|
4925
|
+
this.emitErrorAndThrow(e, "2fa.setup.confirm", "Confirm 2FA enrollment");
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
assertTotpCode(e) {
|
|
4929
|
+
if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
|
|
4930
|
+
}
|
|
4931
|
+
requirePendingTfaToken() {
|
|
4932
|
+
let e = this.pendingTfaToken();
|
|
4933
|
+
if (!e) throw Error("2FA verification expired or not required. User must sign in first.");
|
|
4934
|
+
return e;
|
|
4935
|
+
}
|
|
4936
|
+
setupStarted(e) {
|
|
4937
|
+
return e.totp_digits && (this.totpDigits = e.totp_digits), this.subscribeStore.notify(Z.TwoFactorSetupStarted, { secret: e.secret }), e;
|
|
4938
|
+
}
|
|
4939
|
+
setupConfirmed(e) {
|
|
4940
|
+
return this.subscribeStore.notify(Z.TwoFactorEnabled, {
|
|
4941
|
+
recoveryCodes: e.recovery_codes,
|
|
4942
|
+
clearRecoveryCodes: () => {
|
|
4943
|
+
e.recovery_codes.length = 0;
|
|
4944
|
+
}
|
|
4945
|
+
}), e;
|
|
4946
|
+
}
|
|
4859
4947
|
async verify(e, t) {
|
|
4860
|
-
if (!
|
|
4948
|
+
if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
|
|
4861
4949
|
if (this.recoverPartialAuthState(), !this.isVerificationRequired()) throw Error("2FA verification expired or not required. User must sign in first.");
|
|
4862
4950
|
if (!this.partialAuthState?.tfaToken) throw Error("No TFA token found. User must sign in first.");
|
|
4863
4951
|
try {
|
|
@@ -4873,7 +4961,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4873
4961
|
}
|
|
4874
4962
|
async useRecoveryCode(e, t) {
|
|
4875
4963
|
try {
|
|
4876
|
-
let n =
|
|
4964
|
+
let n = Ar(e);
|
|
4877
4965
|
if (!n) throw Error("Invalid recovery code format. Expected format: XXXX-XXXX or XXXXXXXX (alphanumeric).");
|
|
4878
4966
|
if (this.recoverPartialAuthState(), !this.isVerificationRequired()) throw Error("2FA verification expired or not required. User must sign in first.");
|
|
4879
4967
|
if (!this.partialAuthState?.tfaToken) throw Error("No TFA token found. User must sign in first.");
|
|
@@ -4894,7 +4982,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4894
4982
|
}
|
|
4895
4983
|
}
|
|
4896
4984
|
async disable(e) {
|
|
4897
|
-
if (!
|
|
4985
|
+
if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
|
|
4898
4986
|
try {
|
|
4899
4987
|
let t = await this.twoFactorApi.disable({ code: e });
|
|
4900
4988
|
return this.subscribeStore.notify(Z.TwoFactorDisabled, {}), t;
|
|
@@ -4903,7 +4991,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
4903
4991
|
}
|
|
4904
4992
|
}
|
|
4905
4993
|
async regenerateRecoveryCodes(e) {
|
|
4906
|
-
if (!
|
|
4994
|
+
if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
|
|
4907
4995
|
try {
|
|
4908
4996
|
let t = await this.twoFactorApi.regenerateRecoveryCodes({ code: e }), n = [...t.recovery_codes];
|
|
4909
4997
|
return t.recovery_codes = [], t.recovery_codes = n, t;
|
|
@@ -5087,7 +5175,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5087
5175
|
this.emitErrorAndThrow(e, "2fa.trusted-devices.revoke", "Revoke trusted device");
|
|
5088
5176
|
}
|
|
5089
5177
|
}
|
|
5090
|
-
},
|
|
5178
|
+
}, Yr = class {
|
|
5091
5179
|
constructor(e, t, n = P) {
|
|
5092
5180
|
this.userAPI = e, this.deviceService = t, this.platform = n;
|
|
5093
5181
|
}
|
|
@@ -5114,69 +5202,69 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5114
5202
|
if (!s) throw Error("Passkey registration was not completed");
|
|
5115
5203
|
return await this.userAPI.addUserPasskeyComplete(s, r, a);
|
|
5116
5204
|
}
|
|
5117
|
-
},
|
|
5205
|
+
}, Xr = class extends Error {
|
|
5118
5206
|
constructor(e, t, n = !1) {
|
|
5119
5207
|
super(t), this.name = "UpgradeFactorError", this.factor = e, this.cancelled = n;
|
|
5120
5208
|
}
|
|
5121
|
-
},
|
|
5209
|
+
}, Zr = (e, t) => {
|
|
5122
5210
|
let n = t?.trim();
|
|
5123
|
-
if (!n) throw new
|
|
5211
|
+
if (!n) throw new Xr(e, "A verification code is required");
|
|
5124
5212
|
return n;
|
|
5125
|
-
},
|
|
5213
|
+
}, Qr = {
|
|
5126
5214
|
type: "totp",
|
|
5127
5215
|
requiresPrepare: !1,
|
|
5128
5216
|
input: "code",
|
|
5129
|
-
assert: async ({ code: e }) => ({ code:
|
|
5130
|
-
},
|
|
5217
|
+
assert: async ({ code: e }) => ({ code: Zr("totp", e) })
|
|
5218
|
+
}, $r = {
|
|
5131
5219
|
type: "recovery_codes",
|
|
5132
5220
|
requiresPrepare: !1,
|
|
5133
5221
|
input: "code",
|
|
5134
|
-
assert: async ({ code: e }) => ({ code:
|
|
5135
|
-
},
|
|
5222
|
+
assert: async ({ code: e }) => ({ code: Zr("recovery_codes", e) })
|
|
5223
|
+
}, ei = {
|
|
5136
5224
|
type: "passkey",
|
|
5137
5225
|
requiresPrepare: !0,
|
|
5138
5226
|
input: "none",
|
|
5139
5227
|
assert: async ({ prepared: e, platform: t }) => {
|
|
5140
|
-
if (!e?.webauthn) throw new
|
|
5228
|
+
if (!e?.webauthn) throw new Xr("passkey", "The upgrade challenge carried no WebAuthn options");
|
|
5141
5229
|
let n = t.passkeys;
|
|
5142
|
-
if (!n) throw new
|
|
5230
|
+
if (!n) throw new Xr("passkey", "This platform does not support passkeys");
|
|
5143
5231
|
let r;
|
|
5144
5232
|
try {
|
|
5145
5233
|
r = await n.startAuthentication(e.webauthn);
|
|
5146
5234
|
} catch (e) {
|
|
5147
|
-
throw new
|
|
5235
|
+
throw new Xr("passkey", e?.message || "Passkey verification was cancelled", !0);
|
|
5148
5236
|
}
|
|
5149
|
-
if (!r) throw new
|
|
5237
|
+
if (!r) throw new Xr("passkey", "Passkey verification was cancelled", !0);
|
|
5150
5238
|
return {
|
|
5151
5239
|
challenge_id: e.challengeId,
|
|
5152
5240
|
credential: r
|
|
5153
5241
|
};
|
|
5154
5242
|
}
|
|
5155
|
-
},
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
]),
|
|
5243
|
+
}, ti = Object.freeze([
|
|
5244
|
+
Qr,
|
|
5245
|
+
ei,
|
|
5246
|
+
$r
|
|
5247
|
+
]), ni = (e = ti) => new Map(e.map((e) => [e.type, e])), ri = 3, ii = {
|
|
5160
5248
|
passkey: 0,
|
|
5161
5249
|
totp: 1,
|
|
5162
5250
|
email_otp: 2,
|
|
5163
5251
|
sms_otp: 3,
|
|
5164
5252
|
recovery_codes: 9
|
|
5165
|
-
},
|
|
5166
|
-
let n =
|
|
5253
|
+
}, ai = (e) => e.requiredLevel ?? L(e.acrValues), oi = (e, t) => {
|
|
5254
|
+
let n = ii[e.type] ?? 5, r = t !== void 0 && t >= ri, i = e.type === "passkey";
|
|
5167
5255
|
return (r && !i ? 100 : 0) + n;
|
|
5168
|
-
},
|
|
5169
|
-
let n =
|
|
5170
|
-
return [...e].sort((e, t) =>
|
|
5171
|
-
},
|
|
5256
|
+
}, si = (e, t) => {
|
|
5257
|
+
let n = ai(t);
|
|
5258
|
+
return [...e].sort((e, t) => oi(e, n) - oi(t, n));
|
|
5259
|
+
}, ci = class extends Error {
|
|
5172
5260
|
constructor(e) {
|
|
5173
5261
|
super("Upgrade authentication was cancelled"), this.code = "upgrade_cancelled", this.name = "UpgradeCancelledError", e !== void 0 && (this.cause = e);
|
|
5174
5262
|
}
|
|
5175
|
-
},
|
|
5263
|
+
}, li = class extends Error {
|
|
5176
5264
|
constructor(e = "No available authentication factor can satisfy this challenge") {
|
|
5177
5265
|
super(e), this.code = "upgrade_unsatisfiable", this.name = "UpgradeUnsatisfiableError";
|
|
5178
5266
|
}
|
|
5179
|
-
},
|
|
5267
|
+
}, ui = 4, di = 3e4, fi = () => {
|
|
5180
5268
|
let e = () => void 0, t = () => void 0;
|
|
5181
5269
|
return {
|
|
5182
5270
|
promise: new Promise((n, r) => {
|
|
@@ -5185,11 +5273,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5185
5273
|
resolve: e,
|
|
5186
5274
|
reject: t
|
|
5187
5275
|
};
|
|
5188
|
-
},
|
|
5276
|
+
}, pi = (e) => ({
|
|
5189
5277
|
acrValues: e.acrValues,
|
|
5190
5278
|
level: e.requiredLevel,
|
|
5191
5279
|
maxAge: e.maxAge
|
|
5192
|
-
}),
|
|
5280
|
+
}), mi = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, hi = (e, t) => {
|
|
5193
5281
|
let n = e.requiredLevel === void 0 ? t.requiredLevel : t.requiredLevel === void 0 ? e.requiredLevel : Math.max(e.requiredLevel, t.requiredLevel), r = n === void 0 ? e.acrValues ?? t.acrValues : n === e.requiredLevel ? e.acrValues : t.acrValues, i = e.maxAge === void 0 ? t.maxAge : t.maxAge === void 0 ? e.maxAge : Math.min(e.maxAge, t.maxAge), a = Array.from(/* @__PURE__ */ new Set([...e.channels ?? [], ...t.channels ?? []]));
|
|
5194
5282
|
return {
|
|
5195
5283
|
acrValues: r,
|
|
@@ -5198,12 +5286,12 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5198
5286
|
status: e.status,
|
|
5199
5287
|
...a.length > 0 ? { channels: a } : {}
|
|
5200
5288
|
};
|
|
5201
|
-
},
|
|
5289
|
+
}, gi = (e, t) => {
|
|
5202
5290
|
let n = t.requiredLevel !== void 0 && (e.requiredLevel === void 0 || t.requiredLevel > e.requiredLevel), r = t.maxAge !== void 0 && (e.maxAge === void 0 || t.maxAge < e.maxAge);
|
|
5203
5291
|
return n || r;
|
|
5204
|
-
},
|
|
5292
|
+
}, _i = class {
|
|
5205
5293
|
constructor(e) {
|
|
5206
|
-
this.state = "idle", this.inFlight = null, this.requirement = null, this.selected = null, this.rankedRequirement = null, this.registrations = [], this.proof = null, this.pruned = /* @__PURE__ */ new Set(), this.openPrompt = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ??
|
|
5294
|
+
this.state = "idle", this.inFlight = null, this.requirement = null, this.selected = null, this.rankedRequirement = null, this.registrations = [], this.proof = null, this.pruned = /* @__PURE__ */ new Set(), this.openPrompt = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ?? ti, this.registry = ni(this.available), this.maxAttempts = e.maxAttempts ?? ui, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? di;
|
|
5207
5295
|
}
|
|
5208
5296
|
get currentState() {
|
|
5209
5297
|
return this.state;
|
|
@@ -5223,9 +5311,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5223
5311
|
}
|
|
5224
5312
|
register(e, t) {
|
|
5225
5313
|
let n = t.kind === "imperative" && t.requested !== void 0, r = {
|
|
5226
|
-
demanded: t.kind === "imperative" && t.requested ? t.requested :
|
|
5314
|
+
demanded: t.kind === "imperative" && t.requested ? t.requested : pi(e),
|
|
5227
5315
|
statedBar: n,
|
|
5228
|
-
settlement:
|
|
5316
|
+
settlement: fi(),
|
|
5229
5317
|
reported: !1,
|
|
5230
5318
|
entry: {
|
|
5231
5319
|
...t,
|
|
@@ -5241,15 +5329,15 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5241
5329
|
this.requirement = e;
|
|
5242
5330
|
return;
|
|
5243
5331
|
}
|
|
5244
|
-
let n =
|
|
5245
|
-
this.requirement =
|
|
5332
|
+
let n = gi(t, e);
|
|
5333
|
+
this.requirement = hi(t, e), n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
|
|
5246
5334
|
challenge: this.requirement,
|
|
5247
5335
|
factors: this.offeredFactors()
|
|
5248
5336
|
});
|
|
5249
5337
|
}
|
|
5250
5338
|
offeredFactors() {
|
|
5251
5339
|
let e = this.available.filter((e) => !this.pruned.has(e.type)), t = this.requirement;
|
|
5252
|
-
return t ?
|
|
5340
|
+
return t ? si(e, t) : e;
|
|
5253
5341
|
}
|
|
5254
5342
|
receiveReport(e, t) {
|
|
5255
5343
|
e.reported || (e.reported = !0, e.entry.outcome = t.outcome, t.obtained && (e.entry.obtained = t.obtained), t.required && (e.entry.required = t.required), this.notifyReportsSettled());
|
|
@@ -5284,12 +5372,12 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5284
5372
|
}
|
|
5285
5373
|
release(e, t) {
|
|
5286
5374
|
if (e.entry.kind === "imperative") {
|
|
5287
|
-
if (e.statedBar && !
|
|
5375
|
+
if (e.statedBar && !mi(t, e.demanded)) {
|
|
5288
5376
|
this.receiveReport(e, {
|
|
5289
5377
|
outcome: "insufficient",
|
|
5290
5378
|
obtained: t,
|
|
5291
5379
|
required: e.demanded
|
|
5292
|
-
}), e.settlement.reject(new
|
|
5380
|
+
}), e.settlement.reject(new yr(t, e.demanded));
|
|
5293
5381
|
return;
|
|
5294
5382
|
}
|
|
5295
5383
|
this.receiveReport(e, {
|
|
@@ -5362,7 +5450,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5362
5450
|
let t = this.offeredFactors();
|
|
5363
5451
|
if (t.length === 0) return {
|
|
5364
5452
|
status: "failed",
|
|
5365
|
-
reason: new
|
|
5453
|
+
reason: new li()
|
|
5366
5454
|
};
|
|
5367
5455
|
let n = this.requirement, r;
|
|
5368
5456
|
try {
|
|
@@ -5370,24 +5458,24 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5370
5458
|
} catch (e) {
|
|
5371
5459
|
return {
|
|
5372
5460
|
status: "failed",
|
|
5373
|
-
reason: new
|
|
5461
|
+
reason: new ci(e)
|
|
5374
5462
|
};
|
|
5375
5463
|
}
|
|
5376
5464
|
if (r.type === "cancel") return {
|
|
5377
5465
|
status: "failed",
|
|
5378
|
-
reason: new
|
|
5466
|
+
reason: new ci()
|
|
5379
5467
|
};
|
|
5380
5468
|
let i = this.registry.get(r.factor);
|
|
5381
|
-
if (!i) e = new
|
|
5469
|
+
if (!i) e = new li(`Unknown authentication factor: ${r.factor}`), this.state = "collecting", this.selected = null;
|
|
5382
5470
|
else try {
|
|
5383
5471
|
return await this.proveAndCommit(i, r.code), {
|
|
5384
5472
|
status: "proven",
|
|
5385
|
-
obtained: this.readObtainedBar?.() ??
|
|
5473
|
+
obtained: this.readObtainedBar?.() ?? pi(this.rankedRequirement ?? n)
|
|
5386
5474
|
};
|
|
5387
5475
|
} catch (t) {
|
|
5388
|
-
if (t instanceof
|
|
5476
|
+
if (t instanceof Xr && t.cancelled) return {
|
|
5389
5477
|
status: "failed",
|
|
5390
|
-
reason: new
|
|
5478
|
+
reason: new ci()
|
|
5391
5479
|
};
|
|
5392
5480
|
let n = this.classifyProofFailure(t);
|
|
5393
5481
|
if (n) return {
|
|
@@ -5417,15 +5505,15 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5417
5505
|
return this.openPrompt = r, this.prompt(r);
|
|
5418
5506
|
}
|
|
5419
5507
|
classifyProofFailure(e) {
|
|
5420
|
-
if (e instanceof
|
|
5508
|
+
if (e instanceof yr || e instanceof br || e instanceof xr) return e;
|
|
5421
5509
|
if (e instanceof $) switch (e.kind) {
|
|
5422
|
-
case "unavailable": return new
|
|
5510
|
+
case "unavailable": return new br(e.message);
|
|
5423
5511
|
case "exhausted":
|
|
5424
5512
|
case "attempts_exhausted":
|
|
5425
5513
|
case "fatal":
|
|
5426
5514
|
case "protocol":
|
|
5427
5515
|
case "network": return e;
|
|
5428
|
-
case "session_changed": return new
|
|
5516
|
+
case "session_changed": return new xr(e.message);
|
|
5429
5517
|
default: return;
|
|
5430
5518
|
}
|
|
5431
5519
|
}
|
|
@@ -5437,28 +5525,28 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5437
5525
|
});
|
|
5438
5526
|
await this.transport.commit(e.type, r);
|
|
5439
5527
|
}
|
|
5440
|
-
},
|
|
5528
|
+
}, vi = (e) => typeof e == "function" ? e() : e, yi = (e) => {
|
|
5441
5529
|
try {
|
|
5442
5530
|
return new URL(e);
|
|
5443
5531
|
} catch {
|
|
5444
5532
|
return;
|
|
5445
5533
|
}
|
|
5446
|
-
},
|
|
5534
|
+
}, bi = (e, t) => {
|
|
5447
5535
|
if (!t || t === "/") return !0;
|
|
5448
5536
|
let n = t.replace(/\/+$/, "");
|
|
5449
5537
|
return e === n || e.startsWith(`${n}/`);
|
|
5450
|
-
},
|
|
5538
|
+
}, xi = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && bi(e.pathname, t.pathPrefix), Si = (e, t) => {
|
|
5451
5539
|
for (let n of t) {
|
|
5452
5540
|
if (n === "") continue;
|
|
5453
5541
|
if (n.startsWith("/")) {
|
|
5454
|
-
if (e.relativeToBase &&
|
|
5542
|
+
if (e.relativeToBase && bi(e.pathname, n)) return !0;
|
|
5455
5543
|
continue;
|
|
5456
5544
|
}
|
|
5457
|
-
let t =
|
|
5458
|
-
if (t && e.origin !== void 0 && e.origin === t.origin &&
|
|
5545
|
+
let t = yi(n) ?? yi(`https://${n}`);
|
|
5546
|
+
if (t && e.origin !== void 0 && e.origin === t.origin && bi(e.pathname, t.pathname)) return !0;
|
|
5459
5547
|
}
|
|
5460
5548
|
return !1;
|
|
5461
|
-
},
|
|
5549
|
+
}, Ci = (e, t, n) => xi(e, t.passflow) || Si(e, t.backend) ? !n || n(e.href) !== !1 : !1, wi = (e) => {
|
|
5462
5550
|
let t = e.detail, n = t?.message ?? `[passflow] upgrade challenge not actioned: ${e.reason}`;
|
|
5463
5551
|
console.warn(n, {
|
|
5464
5552
|
status: e.status,
|
|
@@ -5466,8 +5554,8 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5466
5554
|
reason: e.reason,
|
|
5467
5555
|
detail: t
|
|
5468
5556
|
});
|
|
5469
|
-
},
|
|
5470
|
-
let n = t.onUpgradeDiagnostic ??
|
|
5557
|
+
}, Ti = (e, t) => {
|
|
5558
|
+
let n = t.onUpgradeDiagnostic ?? wi;
|
|
5471
5559
|
return (t, r) => {
|
|
5472
5560
|
n({
|
|
5473
5561
|
status: e.status,
|
|
@@ -5479,8 +5567,8 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5479
5567
|
}
|
|
5480
5568
|
});
|
|
5481
5569
|
};
|
|
5482
|
-
},
|
|
5483
|
-
let r = n.onUpgradeDiagnostic ??
|
|
5570
|
+
}, Ei = (e, t, n) => {
|
|
5571
|
+
let r = n.onUpgradeDiagnostic ?? wi;
|
|
5484
5572
|
for (let n of e) r({
|
|
5485
5573
|
...n,
|
|
5486
5574
|
url: t.request.href,
|
|
@@ -5489,8 +5577,8 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5489
5577
|
...n.detail ?? {}
|
|
5490
5578
|
}
|
|
5491
5579
|
});
|
|
5492
|
-
},
|
|
5493
|
-
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n &&
|
|
5580
|
+
}, Di = /\bjson\b/i, Oi = async (e, t) => {
|
|
5581
|
+
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && Di.test(r), a;
|
|
5494
5582
|
if (i) try {
|
|
5495
5583
|
a = await e.readBody();
|
|
5496
5584
|
} catch {
|
|
@@ -5504,10 +5592,10 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5504
5592
|
status: e.status,
|
|
5505
5593
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
5506
5594
|
}, { requireChallengeChannel: t.requireChallengeChannel });
|
|
5507
|
-
},
|
|
5595
|
+
}, ki = (e) => ve({
|
|
5508
5596
|
status: e.status,
|
|
5509
5597
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
5510
|
-
}, { requireChallengeChannel: "header" }).challenge,
|
|
5598
|
+
}, { requireChallengeChannel: "header" }).challenge, Ai = (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.`, ji = (e, t) => e instanceof ci ? { kind: "cancelled" } : e instanceof li ? { kind: "unsatisfiable" } : e instanceof br ? { kind: "unavailable" } : e instanceof xr ? { kind: "session-changed" } : e instanceof yr ? {
|
|
5511
5599
|
kind: "insufficient",
|
|
5512
5600
|
obtained: e.obtained,
|
|
5513
5601
|
required: e.required
|
|
@@ -5523,17 +5611,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5523
5611
|
kind: "transport-failure",
|
|
5524
5612
|
retryable: !1,
|
|
5525
5613
|
error: e instanceof Error ? e : Error(String(e))
|
|
5526
|
-
},
|
|
5614
|
+
}, Mi = async (e, t, n, r) => {
|
|
5527
5615
|
if (e.status !== 401 && e.status !== 403) return {
|
|
5528
5616
|
kind: "replayed",
|
|
5529
5617
|
response: e
|
|
5530
5618
|
};
|
|
5531
|
-
let { challenge: i, diagnostics: a } = await
|
|
5532
|
-
if (
|
|
5619
|
+
let { challenge: i, diagnostics: a } = await Oi(e, t);
|
|
5620
|
+
if (Ei(a, e, t), !i) return {
|
|
5533
5621
|
kind: "replayed",
|
|
5534
5622
|
response: e
|
|
5535
5623
|
};
|
|
5536
|
-
let o =
|
|
5624
|
+
let o = pi(i);
|
|
5537
5625
|
return r("elevated-insufficient", {
|
|
5538
5626
|
obtained: n,
|
|
5539
5627
|
required: o
|
|
@@ -5543,7 +5631,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5543
5631
|
required: o,
|
|
5544
5632
|
response: e
|
|
5545
5633
|
};
|
|
5546
|
-
},
|
|
5634
|
+
}, Ni = async (e, t) => {
|
|
5547
5635
|
if (!t) return {
|
|
5548
5636
|
aborted: !1,
|
|
5549
5637
|
value: await e
|
|
@@ -5570,14 +5658,14 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5570
5658
|
} finally {
|
|
5571
5659
|
n && t.removeEventListener?.("abort", n);
|
|
5572
5660
|
}
|
|
5573
|
-
},
|
|
5661
|
+
}, Pi = async (e, t) => {
|
|
5574
5662
|
if (e.status !== 401 && e.status !== 403 || e.markers.upgradeTransaction) return { kind: "not-a-challenge" };
|
|
5575
|
-
let n =
|
|
5663
|
+
let n = Ti(e, t);
|
|
5576
5664
|
if (e.markers.replayed) {
|
|
5577
|
-
if (!
|
|
5578
|
-
let { challenge: r, diagnostics: i } = await
|
|
5579
|
-
if (
|
|
5580
|
-
let a = t.readObtainedBar?.() ?? {}, o =
|
|
5665
|
+
if (!Ci(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
|
|
5666
|
+
let { challenge: r, diagnostics: i } = await Oi(e, t);
|
|
5667
|
+
if (Ei(i, e, t), !r) return { kind: "not-a-challenge" };
|
|
5668
|
+
let a = t.readObtainedBar?.() ?? {}, o = pi(r);
|
|
5581
5669
|
return n("elevated-insufficient", {
|
|
5582
5670
|
obtained: a,
|
|
5583
5671
|
required: o
|
|
@@ -5588,12 +5676,12 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5588
5676
|
response: e
|
|
5589
5677
|
};
|
|
5590
5678
|
}
|
|
5591
|
-
if (!
|
|
5679
|
+
if (!Ci(e.request, t.scope, t.shouldIntercept)) return ki(e) ? (n("challenge-out-of-scope", {
|
|
5592
5680
|
header: e.getHeader("www-authenticate") ?? void 0,
|
|
5593
|
-
message:
|
|
5681
|
+
message: Ai(e.request.href, t.scope)
|
|
5594
5682
|
}), { kind: "out-of-scope" }) : { kind: "not-a-challenge" };
|
|
5595
|
-
let { challenge: r, diagnostics: i } = await
|
|
5596
|
-
if (
|
|
5683
|
+
let { challenge: r, diagnostics: i } = await Oi(e, t);
|
|
5684
|
+
if (Ei(i, e, t), !r) {
|
|
5597
5685
|
let r = e.getHeader("www-authenticate");
|
|
5598
5686
|
return t.requireChallengeChannel !== "header" && n("no-channel", {
|
|
5599
5687
|
...r ? { header: r } : {},
|
|
@@ -5607,9 +5695,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5607
5695
|
method: e.request.method
|
|
5608
5696
|
}, s, c;
|
|
5609
5697
|
try {
|
|
5610
|
-
s = Promise.resolve(t.elevate(r, o)), c = await
|
|
5698
|
+
s = Promise.resolve(t.elevate(r, o)), c = await Ni(s, e.signal);
|
|
5611
5699
|
} catch (e) {
|
|
5612
|
-
return
|
|
5700
|
+
return ji(e, void 0);
|
|
5613
5701
|
}
|
|
5614
5702
|
if (c.aborted) return s?.then((e) => e?.waiter.report({ outcome: "failed" }), () => {}), {
|
|
5615
5703
|
kind: "aborted",
|
|
@@ -5620,7 +5708,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5620
5708
|
kind: "aborted",
|
|
5621
5709
|
reason: e.signal.reason
|
|
5622
5710
|
};
|
|
5623
|
-
let u = l?.obtained ?? t.readObtainedBar?.() ??
|
|
5711
|
+
let u = l?.obtained ?? t.readObtainedBar?.() ?? pi(r), d = t.authorizationSwap?.(), f = d ? {
|
|
5624
5712
|
from: a?.from ?? d.from,
|
|
5625
5713
|
to: d.to
|
|
5626
5714
|
} : void 0;
|
|
@@ -5629,7 +5717,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5629
5717
|
try {
|
|
5630
5718
|
p = await e.replay(f ? { authorizationSwap: f } : void 0);
|
|
5631
5719
|
} catch (t) {
|
|
5632
|
-
if (t instanceof
|
|
5720
|
+
if (t instanceof yr) return l?.waiter.report({
|
|
5633
5721
|
outcome: "insufficient",
|
|
5634
5722
|
obtained: t.obtained,
|
|
5635
5723
|
required: t.required
|
|
@@ -5647,7 +5735,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5647
5735
|
};
|
|
5648
5736
|
throw t;
|
|
5649
5737
|
}
|
|
5650
|
-
let m = await
|
|
5738
|
+
let m = await Mi(p, t, u, n);
|
|
5651
5739
|
return m.kind === "insufficient" ? l?.waiter.report({
|
|
5652
5740
|
outcome: "insufficient",
|
|
5653
5741
|
obtained: m.obtained,
|
|
@@ -5656,18 +5744,18 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5656
5744
|
outcome: "replayed",
|
|
5657
5745
|
obtained: u
|
|
5658
5746
|
}), m;
|
|
5659
|
-
},
|
|
5747
|
+
}, Fi = (e) => {
|
|
5660
5748
|
switch (e.kind) {
|
|
5661
|
-
case "cancelled": return new
|
|
5662
|
-
case "unsatisfiable": return new
|
|
5663
|
-
case "unavailable": return new
|
|
5664
|
-
case "session-changed": return new
|
|
5665
|
-
case "insufficient": return new
|
|
5749
|
+
case "cancelled": return new ci();
|
|
5750
|
+
case "unsatisfiable": return new li();
|
|
5751
|
+
case "unavailable": return new br();
|
|
5752
|
+
case "session-changed": return new xr();
|
|
5753
|
+
case "insufficient": return new yr(e.obtained, e.required);
|
|
5666
5754
|
case "exhausted": return e.error;
|
|
5667
5755
|
case "transport-failure": return e.error;
|
|
5668
5756
|
default: return;
|
|
5669
5757
|
}
|
|
5670
|
-
},
|
|
5758
|
+
}, Ii = (e, t, n) => {
|
|
5671
5759
|
switch (e.kind) {
|
|
5672
5760
|
case "replayed": return {
|
|
5673
5761
|
settle: "resolve",
|
|
@@ -5685,21 +5773,21 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5685
5773
|
};
|
|
5686
5774
|
case "cancelled": return n.onCancel === "reject" ? {
|
|
5687
5775
|
settle: "reject",
|
|
5688
|
-
error: new
|
|
5776
|
+
error: new ci()
|
|
5689
5777
|
} : {
|
|
5690
5778
|
settle: "resolve",
|
|
5691
|
-
value:
|
|
5779
|
+
value: Gi(t, e)
|
|
5692
5780
|
};
|
|
5693
5781
|
case "insufficient": return {
|
|
5694
5782
|
settle: "resolve",
|
|
5695
|
-
value:
|
|
5783
|
+
value: Gi(e.response?.raw ?? t, e)
|
|
5696
5784
|
};
|
|
5697
5785
|
default: return {
|
|
5698
5786
|
settle: "resolve",
|
|
5699
|
-
value:
|
|
5787
|
+
value: Gi(t, e)
|
|
5700
5788
|
};
|
|
5701
5789
|
}
|
|
5702
|
-
},
|
|
5790
|
+
}, Li = (e, t) => {
|
|
5703
5791
|
switch (e.kind) {
|
|
5704
5792
|
case "replayed": return e.response.rejected ? {
|
|
5705
5793
|
settle: "reject",
|
|
@@ -5714,39 +5802,39 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5714
5802
|
};
|
|
5715
5803
|
default: return {
|
|
5716
5804
|
settle: "reject",
|
|
5717
|
-
error:
|
|
5805
|
+
error: Fi(e) ?? t
|
|
5718
5806
|
};
|
|
5719
5807
|
}
|
|
5720
|
-
},
|
|
5808
|
+
}, Ri = /* @__PURE__ */ new WeakSet(), zi = /* @__PURE__ */ new WeakSet(), Bi = /* @__PURE__ */ new WeakSet(), Vi = /* @__PURE__ */ new WeakSet(), Hi = /* @__PURE__ */ new WeakSet(), Ui = /* @__PURE__ */ new WeakSet(), Wi = /* @__PURE__ */ new WeakSet(), Gi = (e, t) => {
|
|
5721
5809
|
switch (t.kind) {
|
|
5722
5810
|
case "cancelled":
|
|
5723
|
-
|
|
5811
|
+
Ri.add(e);
|
|
5724
5812
|
break;
|
|
5725
5813
|
case "exhausted":
|
|
5726
|
-
|
|
5814
|
+
zi.add(e);
|
|
5727
5815
|
break;
|
|
5728
5816
|
case "insufficient":
|
|
5729
|
-
|
|
5817
|
+
Bi.add(e);
|
|
5730
5818
|
break;
|
|
5731
5819
|
case "unsatisfiable":
|
|
5732
|
-
|
|
5820
|
+
Vi.add(e);
|
|
5733
5821
|
break;
|
|
5734
5822
|
case "unavailable":
|
|
5735
|
-
|
|
5823
|
+
Hi.add(e);
|
|
5736
5824
|
break;
|
|
5737
5825
|
case "session-changed":
|
|
5738
|
-
|
|
5826
|
+
Ui.add(e);
|
|
5739
5827
|
break;
|
|
5740
|
-
case "transport-failure":
|
|
5828
|
+
case "transport-failure": Wi.add(e);
|
|
5741
5829
|
}
|
|
5742
5830
|
return e;
|
|
5743
|
-
},
|
|
5831
|
+
}, Ki = (e) => Ri.has(e), qi = (e) => zi.has(e), Ji = (e) => Bi.has(e), Yi = (e) => Vi.has(e), Xi = (e) => Hi.has(e), Zi = (e) => Ui.has(e), Qi = (e) => Wi.has(e), $i = "https://passflow-relative.invalid", ea = () => {
|
|
5744
5832
|
let e = globalThis, t = e.document?.baseURI;
|
|
5745
5833
|
if (typeof t == "string" && t !== "") return t;
|
|
5746
5834
|
let n = e.location?.href;
|
|
5747
|
-
return typeof n == "string" && n !== "" && n !== "about:blank" ? n :
|
|
5748
|
-
},
|
|
5749
|
-
let n = t ===
|
|
5835
|
+
return typeof n == "string" && n !== "" && n !== "about:blank" ? n : $i;
|
|
5836
|
+
}, ta = (e, t = ea()) => {
|
|
5837
|
+
let n = t === $i, r;
|
|
5750
5838
|
try {
|
|
5751
5839
|
r = new URL(t).origin;
|
|
5752
5840
|
} catch {
|
|
@@ -5772,28 +5860,28 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5772
5860
|
relativeToBase: !1,
|
|
5773
5861
|
sentinelBase: n
|
|
5774
5862
|
};
|
|
5775
|
-
},
|
|
5863
|
+
}, na = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, ra = (e) => {
|
|
5776
5864
|
let t = [];
|
|
5777
5865
|
if (e == null) return Object.freeze(t);
|
|
5778
5866
|
let n = e;
|
|
5779
5867
|
if (typeof n.forEach == "function" && typeof n.entries == "function") return e.forEach((e, n) => {
|
|
5780
|
-
let r =
|
|
5868
|
+
let r = na(n, e);
|
|
5781
5869
|
r && t.push(r);
|
|
5782
5870
|
}), Object.freeze(t);
|
|
5783
5871
|
if (Array.isArray(e)) {
|
|
5784
5872
|
for (let n of e) if (Array.isArray(n) && n.length >= 2) {
|
|
5785
|
-
let e =
|
|
5873
|
+
let e = na(String(n[0]), n[1]);
|
|
5786
5874
|
e && t.push(e);
|
|
5787
5875
|
}
|
|
5788
5876
|
return Object.freeze(t);
|
|
5789
5877
|
}
|
|
5790
5878
|
if (typeof e == "object") for (let [n, r] of Object.entries(e)) {
|
|
5791
|
-
let e =
|
|
5879
|
+
let e = na(n, Array.isArray(r) ? r.join(", ") : r);
|
|
5792
5880
|
e && t.push(e);
|
|
5793
5881
|
}
|
|
5794
5882
|
return Object.freeze(t);
|
|
5795
|
-
},
|
|
5796
|
-
let t = e.base === void 0 ?
|
|
5883
|
+
}, ia = (e) => {
|
|
5884
|
+
let t = e.base === void 0 ? ta(e.url) : ta(e.url, e.base), n = {
|
|
5797
5885
|
raw: e.url,
|
|
5798
5886
|
href: t.href,
|
|
5799
5887
|
dispatchUrl: t.sentinelBase || !t.resolved ? e.url : t.href,
|
|
@@ -5802,29 +5890,29 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5802
5890
|
resolved: t.resolved,
|
|
5803
5891
|
relativeToBase: t.relativeToBase,
|
|
5804
5892
|
method: (e.method ?? "GET").toUpperCase(),
|
|
5805
|
-
headers:
|
|
5893
|
+
headers: ra(e.headers),
|
|
5806
5894
|
bodyKind: e.bodyKind,
|
|
5807
5895
|
..."body" in e ? { body: e.body } : {}
|
|
5808
5896
|
};
|
|
5809
5897
|
return Object.freeze(n);
|
|
5810
|
-
},
|
|
5898
|
+
}, aa = (e, t) => {
|
|
5811
5899
|
if (!t || t.from === t.to) return e;
|
|
5812
5900
|
let n = !1, r = e.map(([e, r]) => e === "authorization" && r === t.from ? (n = !0, [e, t.to]) : [e, r]);
|
|
5813
5901
|
return n ? Object.freeze(r) : e;
|
|
5814
|
-
},
|
|
5902
|
+
}, oa = (e) => {
|
|
5815
5903
|
let t = {};
|
|
5816
5904
|
for (let [n, r] of e) t[n] = r;
|
|
5817
5905
|
return t;
|
|
5818
|
-
},
|
|
5906
|
+
}, sa = /* @__PURE__ */ new Set([
|
|
5819
5907
|
"GET",
|
|
5820
5908
|
"HEAD",
|
|
5821
5909
|
"OPTIONS"
|
|
5822
|
-
]),
|
|
5910
|
+
]), ca = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, la = (e) => typeof e == "string" ? e : ca(e) ? e.url : String(e), ua = (e, t) => (t?.method ?? (ca(e) ? e.method : void 0) ?? "GET").toUpperCase(), da = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", fa = (e) => {
|
|
5823
5911
|
if (typeof e == "string") return e.length;
|
|
5824
5912
|
let t = e;
|
|
5825
5913
|
if (typeof t?.size == "number") return t.size;
|
|
5826
5914
|
if (typeof t?.byteLength == "number") return t.byteLength;
|
|
5827
|
-
},
|
|
5915
|
+
}, pa = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? sa.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), ma = (e, t, n, r, i) => ({
|
|
5828
5916
|
replayable: !1,
|
|
5829
5917
|
bodyKind: e,
|
|
5830
5918
|
reason: t,
|
|
@@ -5832,11 +5920,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5832
5920
|
forwardInit: i,
|
|
5833
5921
|
snapshot: r,
|
|
5834
5922
|
replay: () => Promise.reject(/* @__PURE__ */ Error(`This request cannot be replayed: ${t}`))
|
|
5835
|
-
}),
|
|
5923
|
+
}), ha = (e, t) => oa(aa(e.headers, t?.authorizationSwap)), ga = (e) => {
|
|
5836
5924
|
if (!e || !("headers" in e)) return e;
|
|
5837
5925
|
let { headers: t, ...n } = e;
|
|
5838
5926
|
return n;
|
|
5839
|
-
},
|
|
5927
|
+
}, _a = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : ca(e) ? e.headers : void 0, va = (e) => {
|
|
5840
5928
|
if (e === null || typeof e == "string") return e;
|
|
5841
5929
|
if (typeof FormData < "u" && e instanceof FormData) {
|
|
5842
5930
|
let t = new FormData();
|
|
@@ -5844,18 +5932,18 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5844
5932
|
return t;
|
|
5845
5933
|
}
|
|
5846
5934
|
return typeof URLSearchParams < "u" && e instanceof URLSearchParams ? new URLSearchParams(e) : e instanceof ArrayBuffer ? e.slice(0) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength).slice() : e;
|
|
5847
|
-
},
|
|
5848
|
-
let r =
|
|
5935
|
+
}, ya = (e, t, n) => new Request(e, { headers: ha(t, n) }), ba = (e, t, n) => {
|
|
5936
|
+
let r = la(e), i = ua(e, t), a = _a(e, t), o = (e, t) => ia({
|
|
5849
5937
|
url: r,
|
|
5850
5938
|
method: i,
|
|
5851
5939
|
headers: a,
|
|
5852
5940
|
bodyKind: e,
|
|
5853
5941
|
...t === void 0 ? {} : { body: t }
|
|
5854
5942
|
});
|
|
5855
|
-
if (
|
|
5943
|
+
if (ca(e)) {
|
|
5856
5944
|
if (e.body === null || e.body === void 0) {
|
|
5857
5945
|
let a = o("none");
|
|
5858
|
-
return
|
|
5946
|
+
return pa(n, {
|
|
5859
5947
|
url: r,
|
|
5860
5948
|
method: i,
|
|
5861
5949
|
bodyKind: "none"
|
|
@@ -5865,20 +5953,20 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5865
5953
|
forwardInput: e,
|
|
5866
5954
|
forwardInit: t,
|
|
5867
5955
|
snapshot: a,
|
|
5868
|
-
replay: (n, r) => n(
|
|
5869
|
-
} :
|
|
5956
|
+
replay: (n, r) => n(ya(e, a, r), ga(t))
|
|
5957
|
+
} : ma("none", "the replay policy refused this request", e, a, t);
|
|
5870
5958
|
}
|
|
5871
5959
|
let a = o("request-clone");
|
|
5872
|
-
if (!
|
|
5960
|
+
if (!pa(n, {
|
|
5873
5961
|
url: r,
|
|
5874
5962
|
method: i,
|
|
5875
5963
|
bodyKind: "request-clone"
|
|
5876
|
-
})) return
|
|
5964
|
+
})) return ma("request-clone", "the replay policy refused this request", e, a, t);
|
|
5877
5965
|
let s;
|
|
5878
5966
|
try {
|
|
5879
5967
|
s = e.clone();
|
|
5880
5968
|
} catch {
|
|
5881
|
-
return
|
|
5969
|
+
return ma("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
|
|
5882
5970
|
}
|
|
5883
5971
|
return {
|
|
5884
5972
|
replayable: !0,
|
|
@@ -5886,17 +5974,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5886
5974
|
forwardInput: e,
|
|
5887
5975
|
forwardInit: t,
|
|
5888
5976
|
snapshot: a,
|
|
5889
|
-
replay: (e, n) => e(
|
|
5977
|
+
replay: (e, n) => e(ya(s, a, n), ga(t))
|
|
5890
5978
|
};
|
|
5891
5979
|
}
|
|
5892
|
-
let s =
|
|
5893
|
-
if (s === "one-shot") return
|
|
5894
|
-
if (!
|
|
5980
|
+
let s = da(t?.body);
|
|
5981
|
+
if (s === "one-shot") return ma("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
|
|
5982
|
+
if (!pa(n, {
|
|
5895
5983
|
url: r,
|
|
5896
5984
|
method: i,
|
|
5897
5985
|
bodyKind: s
|
|
5898
|
-
},
|
|
5899
|
-
let c = t && "body" in t ?
|
|
5986
|
+
}, fa(t?.body))) return ma(s, "the replay policy refused this request", e, o(s), t);
|
|
5987
|
+
let c = t && "body" in t ? va(t.body ?? null) : void 0, l = o(s, c);
|
|
5900
5988
|
return {
|
|
5901
5989
|
replayable: !0,
|
|
5902
5990
|
bodyKind: s,
|
|
@@ -5904,21 +5992,21 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5904
5992
|
forwardInit: t,
|
|
5905
5993
|
snapshot: l,
|
|
5906
5994
|
replay: (e, n) => e(l.dispatchUrl, {
|
|
5907
|
-
...
|
|
5995
|
+
...ga(t),
|
|
5908
5996
|
...c === void 0 ? {} : { body: c },
|
|
5909
|
-
headers:
|
|
5997
|
+
headers: ha(l, n),
|
|
5910
5998
|
method: l.method
|
|
5911
5999
|
})
|
|
5912
6000
|
};
|
|
5913
|
-
},
|
|
5914
|
-
if (!
|
|
6001
|
+
}, xa = (e) => typeof e == "object" && !!e, Sa = (e) => (t) => {
|
|
6002
|
+
if (!xa(e)) return;
|
|
5915
6003
|
let n = e[t] ?? e[t.toLowerCase()] ?? (typeof e.get == "function" ? e.get(t) : void 0);
|
|
5916
6004
|
return Array.isArray(n) ? n.join(", ") : typeof n == "string" ? n : void 0;
|
|
5917
|
-
},
|
|
6005
|
+
}, Ca = (e) => {
|
|
5918
6006
|
let t = e?.url ?? "", n = e?.baseURL;
|
|
5919
6007
|
return !n || /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t) ? t : `${n.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
5920
|
-
},
|
|
5921
|
-
let r =
|
|
6008
|
+
}, wa = (e) => (e?.method ?? "GET").toUpperCase(), Ta = (e) => e == null ? "none" : xa(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", Ea = (e, t, n) => {
|
|
6009
|
+
let r = oa(aa(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
|
|
5922
6010
|
return {
|
|
5923
6011
|
...e,
|
|
5924
6012
|
...i ? { baseURL: void 0 } : {},
|
|
@@ -5927,10 +6015,10 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5927
6015
|
headers: r,
|
|
5928
6016
|
..."body" in t ? { data: t.body } : {}
|
|
5929
6017
|
};
|
|
5930
|
-
},
|
|
5931
|
-
let o = t ?? e?.config, s =
|
|
5932
|
-
url:
|
|
5933
|
-
method:
|
|
6018
|
+
}, Da = (e, t, n, r, i, a) => {
|
|
6019
|
+
let o = t ?? e?.config, s = Ta(o?.data), c = a ?? ia({
|
|
6020
|
+
url: Ca(o),
|
|
6021
|
+
method: wa(o),
|
|
5934
6022
|
headers: o?.headers,
|
|
5935
6023
|
bodyKind: s,
|
|
5936
6024
|
body: o?.data
|
|
@@ -5938,22 +6026,22 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5938
6026
|
url: c.href,
|
|
5939
6027
|
method: c.method,
|
|
5940
6028
|
bodyKind: s
|
|
5941
|
-
}, u = s !== "one-shot" &&
|
|
6029
|
+
}, u = s !== "one-shot" && pa(i.replay, l);
|
|
5942
6030
|
return {
|
|
5943
6031
|
status: e?.status ?? 0,
|
|
5944
|
-
getHeader:
|
|
6032
|
+
getHeader: Sa(e?.headers),
|
|
5945
6033
|
readBody: async () => e?.data,
|
|
5946
6034
|
request: c,
|
|
5947
6035
|
replay: async (e) => {
|
|
5948
|
-
let t = Te(
|
|
6036
|
+
let t = Te(Ea(o ?? {}, c, e));
|
|
5949
6037
|
try {
|
|
5950
6038
|
let e = await r(t);
|
|
5951
|
-
return
|
|
6039
|
+
return Da(e, e?.config ?? t, e, r, i, c);
|
|
5952
6040
|
} catch (e) {
|
|
5953
|
-
let n =
|
|
5954
|
-
if (!n.response || typeof n.response.status != "number" ||
|
|
6041
|
+
let n = xa(e) ? e : {};
|
|
6042
|
+
if (!n.response || typeof n.response.status != "number" || dr(e)) throw e;
|
|
5955
6043
|
return {
|
|
5956
|
-
...
|
|
6044
|
+
...Da(n.response, n.config ?? t, e, r, i, c),
|
|
5957
6045
|
rejected: !0
|
|
5958
6046
|
};
|
|
5959
6047
|
}
|
|
@@ -5967,19 +6055,19 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5967
6055
|
replayUnsupportedReason: s === "one-shot" ? "a streaming request body is consumed by the first send" : "the replay policy refused this request",
|
|
5968
6056
|
signal: o?.signal
|
|
5969
6057
|
};
|
|
5970
|
-
},
|
|
5971
|
-
let r =
|
|
6058
|
+
}, Oa = (e, t) => async (n) => {
|
|
6059
|
+
let r = vi(e), i = xa(n) ? n : {}, a = Li(await Pi(Da(i.response, i.config, i.response, t, r), r), n);
|
|
5972
6060
|
if (a.settle === "reject") throw a.error;
|
|
5973
6061
|
return a.value;
|
|
5974
|
-
},
|
|
5975
|
-
let r = e.request, i = n ?? (typeof r == "function" ? (t) => r.call(e, t) : () => Promise.reject(/* @__PURE__ */ Error("Passflow: this client exposes no request() to replay through."))), a = e.interceptors.response.use(void 0,
|
|
6062
|
+
}, ka = (e, t, n) => {
|
|
6063
|
+
let r = e.request, i = n ?? (typeof r == "function" ? (t) => r.call(e, t) : () => Promise.reject(/* @__PURE__ */ Error("Passflow: this client exposes no request() to replay through."))), a = e.interceptors.response.use(void 0, Oa(t, i)), o = !1;
|
|
5976
6064
|
return () => {
|
|
5977
6065
|
o || (o = !0, e.interceptors.response.eject(a));
|
|
5978
6066
|
};
|
|
5979
|
-
},
|
|
6067
|
+
}, Aa = (t, n) => {
|
|
5980
6068
|
let r = e.create(t);
|
|
5981
6069
|
return n(r), r;
|
|
5982
|
-
},
|
|
6070
|
+
}, ja = 0, Ma = (e, t) => {
|
|
5983
6071
|
let n = t?.signal ?? (typeof e == "object" && e ? e.signal : void 0) ?? void 0;
|
|
5984
6072
|
if (n) return {
|
|
5985
6073
|
get aborted() {
|
|
@@ -5993,34 +6081,34 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
5993
6081
|
removeEventListener: (e, t) => n.removeEventListener(e, t)
|
|
5994
6082
|
} : {}
|
|
5995
6083
|
};
|
|
5996
|
-
},
|
|
6084
|
+
}, Na = (e) => (t) => e.headers?.get(t), Pa = (e, t, n, r, i) => ({
|
|
5997
6085
|
status: e.status,
|
|
5998
|
-
getHeader:
|
|
6086
|
+
getHeader: Na(e),
|
|
5999
6087
|
readBody: () => e.clone().json(),
|
|
6000
6088
|
request: t.snapshot,
|
|
6001
|
-
replay: async (e) =>
|
|
6089
|
+
replay: async (e) => Pa(await t.replay(n, e), t, n, r, i),
|
|
6002
6090
|
markers: r,
|
|
6003
6091
|
raw: e,
|
|
6004
6092
|
replayable: t.replayable,
|
|
6005
6093
|
replayUnsupportedReason: t.reason,
|
|
6006
6094
|
signal: i,
|
|
6007
6095
|
responseType: e.type
|
|
6008
|
-
}),
|
|
6096
|
+
}), Fa = (e, t) => {
|
|
6009
6097
|
let n = (t, n) => {
|
|
6010
|
-
|
|
6098
|
+
ja += 1;
|
|
6011
6099
|
try {
|
|
6012
6100
|
return e(t, n);
|
|
6013
6101
|
} finally {
|
|
6014
|
-
--
|
|
6102
|
+
--ja;
|
|
6015
6103
|
}
|
|
6016
6104
|
};
|
|
6017
6105
|
return async (e, r) => {
|
|
6018
|
-
if (
|
|
6019
|
-
let i =
|
|
6106
|
+
if (ja > 0) return n(e, r);
|
|
6107
|
+
let i = vi(t), a = ba(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = Ii(await Pi(Pa(o, a, n, {}, Ma(e, r)), i), o, i);
|
|
6020
6108
|
if (s.settle === "reject") throw s.error;
|
|
6021
6109
|
return s.value;
|
|
6022
6110
|
};
|
|
6023
|
-
},
|
|
6111
|
+
}, Ia = new Set(ti.filter((e) => !e.requiresPrepare).map((e) => e.type)), La = (e) => {
|
|
6024
6112
|
if (!e || typeof e != "object" || !e.challenge_id || !e.expires_at) throw new $({
|
|
6025
6113
|
kind: "protocol",
|
|
6026
6114
|
message: "The upgrade start response is missing challenge_id or expires_at"
|
|
@@ -6032,17 +6120,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6032
6120
|
webauthn: e.webauthn,
|
|
6033
6121
|
codeSentTo: e.code_sent_to
|
|
6034
6122
|
};
|
|
6035
|
-
},
|
|
6123
|
+
}, Ra = (e) => dr(e) && !fr(e), za = (e) => ({
|
|
6036
6124
|
async prepare(t) {
|
|
6037
|
-
if (!
|
|
6125
|
+
if (!Ia.has(t)) try {
|
|
6038
6126
|
let n = e.relyingPartyId?.();
|
|
6039
|
-
return
|
|
6127
|
+
return La(await e.startUpgrade(n ? {
|
|
6040
6128
|
method: t,
|
|
6041
6129
|
relying_party_id: n
|
|
6042
6130
|
} : { method: t }));
|
|
6043
6131
|
} catch (e) {
|
|
6044
|
-
if (
|
|
6045
|
-
let t =
|
|
6132
|
+
if (Ra(e)) throw e;
|
|
6133
|
+
let t = gr(e, "start");
|
|
6046
6134
|
if (t.kind === "prepare_not_required") return;
|
|
6047
6135
|
throw t;
|
|
6048
6136
|
}
|
|
@@ -6059,17 +6147,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6059
6147
|
assertion: n
|
|
6060
6148
|
});
|
|
6061
6149
|
} catch (t) {
|
|
6062
|
-
if (
|
|
6063
|
-
let n =
|
|
6064
|
-
throw n.status === 401 &&
|
|
6150
|
+
if (Ra(t)) throw t;
|
|
6151
|
+
let n = gr(t, "refresh");
|
|
6152
|
+
throw n.status === 401 && vr(n) && e.markSessionInvalid?.(), n;
|
|
6065
6153
|
}
|
|
6066
6154
|
}
|
|
6067
|
-
}),
|
|
6155
|
+
}), Ba = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Va = (e) => {
|
|
6068
6156
|
let t, n = (e) => e !== void 0 && t === e, r = (r) => {
|
|
6069
6157
|
let i = () => {
|
|
6070
6158
|
if (!n(r())) throw new $({ kind: "session_changed" });
|
|
6071
6159
|
};
|
|
6072
|
-
return
|
|
6160
|
+
return za({
|
|
6073
6161
|
...e,
|
|
6074
6162
|
relyingPartyId: () => t?.options.relyingPartyId ?? e.relyingPartyId?.(),
|
|
6075
6163
|
startUpgrade: (t) => (i(), e.startUpgrade(t)),
|
|
@@ -6080,7 +6168,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6080
6168
|
});
|
|
6081
6169
|
}, i = (t, n) => {
|
|
6082
6170
|
let i = {}, a = {
|
|
6083
|
-
controller: new
|
|
6171
|
+
controller: new _i({
|
|
6084
6172
|
transport: r(() => i.current),
|
|
6085
6173
|
prompt: t.prompt,
|
|
6086
6174
|
platform: e.platform,
|
|
@@ -6092,17 +6180,17 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6092
6180
|
options: t,
|
|
6093
6181
|
scope: {
|
|
6094
6182
|
passflow: e.passflowDomain,
|
|
6095
|
-
backend:
|
|
6183
|
+
backend: Ba(t.backend)
|
|
6096
6184
|
},
|
|
6097
6185
|
generation: n
|
|
6098
6186
|
};
|
|
6099
6187
|
return i.current = a, a;
|
|
6100
6188
|
}, a = async (r, i) => {
|
|
6101
6189
|
let a = t;
|
|
6102
|
-
if (!a) throw new
|
|
6190
|
+
if (!a) throw new br("Step-up verification is not enabled on this Passflow instance");
|
|
6103
6191
|
a.controller.active || (a.pin = e.readSessionPin?.());
|
|
6104
6192
|
let o = await a.controller.elevate(r, i);
|
|
6105
|
-
if (!n(a)) throw new
|
|
6193
|
+
if (!n(a)) throw new xr();
|
|
6106
6194
|
return o;
|
|
6107
6195
|
}, o = () => {
|
|
6108
6196
|
let n = t, r = n?.scope ?? {
|
|
@@ -6146,9 +6234,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6146
6234
|
let r = [];
|
|
6147
6235
|
if (e.attachInternalSeam) {
|
|
6148
6236
|
let t = e.attachInternalSeam;
|
|
6149
|
-
t((e) =>
|
|
6237
|
+
t((e) => Oa(o, e)), r.push(() => t(void 0));
|
|
6150
6238
|
}
|
|
6151
|
-
n.interceptFetch && r.push(
|
|
6239
|
+
n.interceptFetch && r.push(Dt((e, t, n) => Fa(e, o)(t, n), {
|
|
6152
6240
|
priority: 20,
|
|
6153
6241
|
name: "passflow-upgrade"
|
|
6154
6242
|
})), e.onSessionChange && r.push(e.onSessionChange(() => {
|
|
@@ -6179,18 +6267,18 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6179
6267
|
withAuth: {
|
|
6180
6268
|
enumerable: !0,
|
|
6181
6269
|
value: (e) => {
|
|
6182
|
-
if (e) return
|
|
6270
|
+
if (e) return Fa(e, o);
|
|
6183
6271
|
let t = typeof globalThis > "u" ? void 0 : globalThis;
|
|
6184
6272
|
if (!t || typeof t.fetch != "function") throw Error("Passflow: withAuth() needs a fetch to wrap — this runtime has none.");
|
|
6185
|
-
return
|
|
6273
|
+
return Fa(t.fetch.bind(t), o);
|
|
6186
6274
|
}
|
|
6187
6275
|
},
|
|
6188
6276
|
attachAuth: {
|
|
6189
6277
|
enumerable: !0,
|
|
6190
|
-
value: (e) =>
|
|
6278
|
+
value: (e) => ka(e, o)
|
|
6191
6279
|
}
|
|
6192
6280
|
});
|
|
6193
|
-
},
|
|
6281
|
+
}, Ha, Ua = class {
|
|
6194
6282
|
get origin() {
|
|
6195
6283
|
return this.platform.getCurrentUrl()?.origin ?? "";
|
|
6196
6284
|
}
|
|
@@ -6202,9 +6290,9 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6202
6290
|
this.url = t || "https://auth.passflow.cloud", this.appId = n, this.platform = e.platform ?? P, this.deferFederatedLanding = e.deferFederatedLanding ?? !1, this.storageManager = new N({
|
|
6203
6291
|
prefix: e.keyStoragePrefix ?? "",
|
|
6204
6292
|
storage: this.platform.storage
|
|
6205
|
-
}), this.deviceService = new re(this.storageManager), this.authApi = new
|
|
6206
|
-
let i =
|
|
6207
|
-
this.authService = new
|
|
6293
|
+
}), this.deviceService = new re(this.storageManager), this.authApi = new nt(e, this.storageManager, this.deviceService), this.appApi = new Xe(e, this.storageManager, this.deviceService), this.userApi = new pt(e, this.storageManager, this.deviceService), this.settingApi = new at(e, this.storageManager, this.deviceService), this.tenantApi = new ot(e, this.storageManager, this.deviceService), this.invitationApi = new it(e, this.storageManager, this.deviceService), this.twoFactorApi = new dt(e, this.storageManager, this.deviceService), this.upgradeApi = new ft(e, this.storageManager, this.deviceService), this.upgradeDomain = ke(e.url), this.subscribeStore = new ir(), this.tokenCacheService = new qr(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? u, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
|
|
6294
|
+
let i = vn(e.refreshCoordination, this.platform, e.keyStoragePrefix, { tokenKeys: () => this.storageManager.tokenKeys() });
|
|
6295
|
+
this.authService = new Ur(this.authApi, this.deviceService, this.storageManager, this.subscribeStore, this.tokenCacheService, this.scopes, this.createTenantForNewUser, this.url, {
|
|
6208
6296
|
createSession: this.createSessionCallback,
|
|
6209
6297
|
expiredSession: this.expiredSessionCallback
|
|
6210
6298
|
}, this.appId ?? "", e.tokenExchange, this.platform, () => this.readPkceEnabled(), {
|
|
@@ -6212,7 +6300,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6212
6300
|
...e.refreshStrikes === void 0 ? {} : { strikes: e.refreshStrikes }
|
|
6213
6301
|
}), this.tokenCacheService.attachRefreshController(this.authService.refresh);
|
|
6214
6302
|
for (let e of this.axiosClients()) e.setRefreshHandler((e) => this.authService.refresh.ensureFresh(e));
|
|
6215
|
-
this.userService = new
|
|
6303
|
+
this.userService = new Yr(this.userApi, this.deviceService, this.platform), this.tenantService = new Kr(this.tenantApi, this.scopes), this.tenant = this.tenantService, this.invitationService = new Wr(this.invitationApi), this.twoFactorService = new Jr(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Va({
|
|
6216
6304
|
startUpgrade: (e) => this.upgradeApi.startUpgrade(e),
|
|
6217
6305
|
commitRefresh: async (e, t) => {
|
|
6218
6306
|
await this.authService.refreshToken(e, t);
|
|
@@ -6259,7 +6347,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6259
6347
|
return this.upgrade.attachAuth(e);
|
|
6260
6348
|
}
|
|
6261
6349
|
createClient(e) {
|
|
6262
|
-
return
|
|
6350
|
+
return Aa(e, (e) => this.upgrade.attachAuth(e));
|
|
6263
6351
|
}
|
|
6264
6352
|
readAssuranceBar() {
|
|
6265
6353
|
let e = this.storageManager.getToken(j.access_token);
|
|
@@ -6311,7 +6399,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6311
6399
|
message: t instanceof Error || t instanceof B ? t.message : "Session check failed",
|
|
6312
6400
|
originalError: t
|
|
6313
6401
|
};
|
|
6314
|
-
|
|
6402
|
+
U(this.subscribeStore, n), e = void 0;
|
|
6315
6403
|
}
|
|
6316
6404
|
e && this.createSessionCallback && await this.createSessionCallback({
|
|
6317
6405
|
tokens: e,
|
|
@@ -6342,24 +6430,24 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6342
6430
|
}
|
|
6343
6431
|
let r = t.get("access_token"), i = t.get("refresh_token"), a = t.get("id_token"), o = t.get("scopes")?.split(",") ?? this.scopes, s;
|
|
6344
6432
|
if (r) {
|
|
6345
|
-
if (!
|
|
6346
|
-
|
|
6433
|
+
if (!wr(r)) {
|
|
6434
|
+
U(this.subscribeStore, {
|
|
6347
6435
|
operation: "tokens.from-url",
|
|
6348
6436
|
message: "Invalid access token format received",
|
|
6349
6437
|
code: "INVALID_TOKEN_FORMAT"
|
|
6350
6438
|
}), this.cleanupUrlParams(n, e);
|
|
6351
6439
|
return;
|
|
6352
6440
|
}
|
|
6353
|
-
if (i && !
|
|
6354
|
-
|
|
6441
|
+
if (i && !wr(i)) {
|
|
6442
|
+
U(this.subscribeStore, {
|
|
6355
6443
|
operation: "tokens.from-url",
|
|
6356
6444
|
message: "Invalid refresh token format received",
|
|
6357
6445
|
code: "INVALID_TOKEN_FORMAT"
|
|
6358
6446
|
}), this.cleanupUrlParams(n, e);
|
|
6359
6447
|
return;
|
|
6360
6448
|
}
|
|
6361
|
-
if (a && !
|
|
6362
|
-
|
|
6449
|
+
if (a && !wr(a)) {
|
|
6450
|
+
U(this.subscribeStore, {
|
|
6363
6451
|
operation: "tokens.from-url",
|
|
6364
6452
|
message: "Invalid ID token format received",
|
|
6365
6453
|
code: "INVALID_TOKEN_FORMAT"
|
|
@@ -6393,11 +6481,11 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6393
6481
|
if (!n) return !1;
|
|
6394
6482
|
t.delete("tfa_token");
|
|
6395
6483
|
let r = t.toString();
|
|
6396
|
-
return this.platform.replaceUrl(e.pathname + e.search + (r ? `#${r}` : "")),
|
|
6484
|
+
return this.platform.replaceUrl(e.pathname + e.search + (r ? `#${r}` : "")), wr(n) ? (this.subscribeStore.notify(Z.TwoFactorRequired, {
|
|
6397
6485
|
email: "",
|
|
6398
6486
|
challengeId: "",
|
|
6399
6487
|
tfaToken: n
|
|
6400
|
-
}), !0) : (
|
|
6488
|
+
}), !0) : (U(this.subscribeStore, {
|
|
6401
6489
|
operation: "tokens.from-url",
|
|
6402
6490
|
message: "Invalid 2FA token format received",
|
|
6403
6491
|
code: "INVALID_TOKEN_FORMAT"
|
|
@@ -6406,7 +6494,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6406
6494
|
checkErrorsFromURL() {
|
|
6407
6495
|
let e = new URLSearchParams(this.platform.getCurrentUrl()?.search ?? "").get("error");
|
|
6408
6496
|
if (e) {
|
|
6409
|
-
let t =
|
|
6497
|
+
let t = Tr(e);
|
|
6410
6498
|
return Error(t);
|
|
6411
6499
|
}
|
|
6412
6500
|
}
|
|
@@ -6482,6 +6570,13 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6482
6570
|
async verifyEmailCode(e) {
|
|
6483
6571
|
return await this.authService.verifyEmailCode(e);
|
|
6484
6572
|
}
|
|
6573
|
+
async checkRedirectUrl(e) {
|
|
6574
|
+
try {
|
|
6575
|
+
return await this.authService.checkRedirectUrl(e);
|
|
6576
|
+
} catch (e) {
|
|
6577
|
+
this.handleError(e, "redirect.check", "Redirect check");
|
|
6578
|
+
}
|
|
6579
|
+
}
|
|
6485
6580
|
handleError(e, t, n) {
|
|
6486
6581
|
let r = {
|
|
6487
6582
|
operation: t,
|
|
@@ -6489,7 +6584,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6489
6584
|
originalError: e,
|
|
6490
6585
|
code: e instanceof B ? e.id : void 0
|
|
6491
6586
|
};
|
|
6492
|
-
throw
|
|
6587
|
+
throw U(this.subscribeStore, r), e;
|
|
6493
6588
|
}
|
|
6494
6589
|
async logOut() {
|
|
6495
6590
|
try {
|
|
@@ -6513,7 +6608,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6513
6608
|
message: e,
|
|
6514
6609
|
code: "RESET_ERROR"
|
|
6515
6610
|
};
|
|
6516
|
-
throw
|
|
6611
|
+
throw U(this.subscribeStore, t), this.error;
|
|
6517
6612
|
}
|
|
6518
6613
|
}
|
|
6519
6614
|
notifySignedOut(e) {
|
|
@@ -6693,6 +6788,34 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6693
6788
|
this.handleError(e, "2fa.setup.confirm", "Confirm 2FA setup");
|
|
6694
6789
|
}
|
|
6695
6790
|
}
|
|
6791
|
+
async getTwoFactorEnrollment() {
|
|
6792
|
+
try {
|
|
6793
|
+
return await this.twoFactorService.getEnrollment();
|
|
6794
|
+
} catch (e) {
|
|
6795
|
+
this.handleError(e, "2fa.enrollment.read", "Read 2FA enrollment");
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6798
|
+
async sendTwoFactorSetupLink() {
|
|
6799
|
+
try {
|
|
6800
|
+
return await this.twoFactorService.sendSetupLink();
|
|
6801
|
+
} catch (e) {
|
|
6802
|
+
this.handleError(e, "2fa.enrollment.setup-link", "Send 2FA setup link");
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
async beginTwoFactorEnrollment() {
|
|
6806
|
+
try {
|
|
6807
|
+
return await this.twoFactorService.beginEnrollment();
|
|
6808
|
+
} catch (e) {
|
|
6809
|
+
this.handleError(e, "2fa.setup.begin", "Begin 2FA enrollment");
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
6812
|
+
async confirmTwoFactorEnrollment(e) {
|
|
6813
|
+
try {
|
|
6814
|
+
return await this.twoFactorService.confirmEnrollment(e);
|
|
6815
|
+
} catch (e) {
|
|
6816
|
+
this.handleError(e, "2fa.setup.confirm", "Confirm 2FA enrollment");
|
|
6817
|
+
}
|
|
6818
|
+
}
|
|
6696
6819
|
async verifyTwoFactor(e, t) {
|
|
6697
6820
|
try {
|
|
6698
6821
|
let n = await this.twoFactorService.verify(e, t);
|
|
@@ -6762,7 +6885,7 @@ var Er = "passflow_2fa_pkce", Dr = 3e5, Or = "passflow_pwless_pending", kr = 3e3
|
|
|
6762
6885
|
this.twoFactorService.clearMagicLinkSession();
|
|
6763
6886
|
}
|
|
6764
6887
|
};
|
|
6765
|
-
|
|
6766
|
-
export { i as APP_ID_HEADER_KEY, Me as APP_SECRET_NAMES, a as AUTHORIZATION_HEADER_KEY,
|
|
6888
|
+
Ha = Ua, Ha.version = c;
|
|
6889
|
+
export { i as APP_ID_HEADER_KEY, Me as APP_SECRET_NAMES, a as AUTHORIZATION_HEADER_KEY, Xe as AppAPI, nt as AuthAPI, Ur as AuthService, rt as CLIAuthAPI, f as DEFAULT_GROUP_NAME, u as DEFAULT_SCOPES, ti as DEFAULT_UPGRADE_FACTORS, o as DEVICE_ID_HEADER_KEY, s as DEVICE_TYPE_HEADER_KEY, b as ERROR_MESSAGE_MAX_LENGTH, mt as FETCH_PRIORITY_OIDC, ht as FETCH_PRIORITY_UPGRADE, gt as FetchMiddlewareContractError, ce as INSUFFICIENT_USER_AUTHENTICATION, it as InvitationAPI, Wr as InvitationService, It as M2MClient, jt as M2MConfigError, H as M2MError, Mt as M2MErrorCodes, kt as M2MNetworkError, At as M2MTokenParseError, Nt as M2M_DEFAULTS, Ne as MASKED_SECRET_PREFIX, l as MINIMAL_DEFAULT_SCOPES, Ie as OS, d as PASSFLOW_CLOUD_URL, m as POPUP_HEIGHT, h as POPUP_POLL_INTERVAL_MS, g as POPUP_TIMEOUT_MS, p as POPUP_WIDTH, Ua as Passflow, Oe as PassflowAdminEndpointPaths, z as PassflowEndpointPaths, B as PassflowError, Z as PassflowEvent, q as PassflowRefreshError, ie as PopupClosedError, je as Providers, ar as RECOVERABLE_COMMIT_ERROR_IDS, Dn as REFRESH_AUTH_FAILURE_IDS, K as RefreshErrorId, De as RequestMethod, c as SDK_VERSION, or as SESSION_INVALIDATING_COMMIT_ERROR_IDS, Pe as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, te as SessionState, at as SettingAPI, _ as TOKEN_EXPIRY_BUFFER_SECONDS, ot as TenantAPI, Kr as TenantService, Gr as TenantUserMembership, qr as TokenCacheService, M as TokenDeliveryMode, j as TokenType, dt as TwoFactorApiClient, Re as TwoFactorPolicy, Jr as TwoFactorService, le as UPGRADE_REQUIRED, y as USERNAME_MAX_LENGTH, v as USERNAME_MIN_LENGTH, ft as UpgradeAPI, ci as UpgradeCancelledError, zn as UpgradeCommitInterruptedError, _i as UpgradeController, Q as UpgradeErrorIds, Xr as UpgradeFactorError, yr as UpgradeInsufficientError, xr as UpgradeSessionChangedError, $ as UpgradeTransportError, br as UpgradeUnavailableError, li as UpgradeUnsatisfiableError, pt as UserAPI, Yr as UserService, ae as WebAdapter, gr as classifyUpgradeError, ni as factorRegistry, Ot as fetchRegistryState, Le as getOSFromDeviceType, vr as invalidatesSessionOnCommit, Ae as isEmailVerificationStep, Fe as isMaskedSecret, _r as isRecoverableCommitFailure, cr as isRetryableUpgradeKind, k as isTokenExpired, Ki as isUpgradeCancelled, qi as isUpgradeExhausted, Ji as isUpgradeInsufficient, Zi as isUpgradeSessionChanged, fr as isUpgradeTransportError, Qi as isUpgradeTransportFailure, Xi as isUpgradeUnavailable, Yi as isUpgradeUnsatisfiable, Er as isValidEmail, wr as isValidJWTFormat, Dr as isValidPhoneNumber, Or as isValidUsername, he as parseChallengeBody, me as parseChallengeHeader, A as parseToken, ye as parseUpgradeChallenge, ei as passkeyFactor, V as pathWithParams, $r as recoveryCodesFactor, Dt as registerFetchMiddleware, L as requiredAcrLevel, ke as resolveUpgradeDomain, Tr as sanitizeErrorMessage, si as selectFactors, Qr as totpFactor, P as webAdapter };
|
|
6767
6890
|
|
|
6768
6891
|
//# sourceMappingURL=index.mjs.map
|