@passflow/core 0.49.0 → 0.49.1
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 +23 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.mjs +246 -238
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var a = "__passflowAntiBot", o = (e, t) => {
|
|
|
11
11
|
if (typeof e != "object" || !e) return;
|
|
12
12
|
let t = e[a];
|
|
13
13
|
return typeof t == "object" && t ? t : void 0;
|
|
14
|
-
}, c = "0.49.
|
|
14
|
+
}, c = "0.49.1", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "X-Passflow-Device-Proof", g = "X-Passflow-Fingerprint-Event", _ = "X-Passflow-Stytch-Telemetry", v = "passflow_auth", y = c, b = [
|
|
15
15
|
"id",
|
|
16
16
|
"offline",
|
|
17
17
|
"openid"
|
|
@@ -5921,13 +5921,27 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
5921
5921
|
getInvitationLink(e) {
|
|
5922
5922
|
return this.invitationApi.getInvitationLink(e);
|
|
5923
5923
|
}
|
|
5924
|
-
}
|
|
5924
|
+
};
|
|
5925
|
+
// lib/services/tenant-user-membership.ts
|
|
5926
|
+
function wo(e) {
|
|
5927
|
+
return {
|
|
5928
|
+
id: e.id,
|
|
5929
|
+
name: To(e),
|
|
5930
|
+
email: e.email || null,
|
|
5931
|
+
phone: e.phone || null
|
|
5932
|
+
};
|
|
5933
|
+
}
|
|
5934
|
+
function To(e) {
|
|
5935
|
+
let t = [e.given_name, e.family_name].filter(Boolean).join(" ");
|
|
5936
|
+
return e.preferred_username || t || e.nickname || e.username || null;
|
|
5937
|
+
}
|
|
5938
|
+
var Eo = class {
|
|
5925
5939
|
constructor(e) {
|
|
5926
5940
|
this.data = this.normalize(e);
|
|
5927
5941
|
}
|
|
5928
5942
|
normalize(e) {
|
|
5929
5943
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = [];
|
|
5930
|
-
|
|
5944
|
+
e.groups?.forEach((e) => {
|
|
5931
5945
|
n.set(e.id, {
|
|
5932
5946
|
id: e.id,
|
|
5933
5947
|
name: e.name,
|
|
@@ -5941,19 +5955,13 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
5941
5955
|
tenant_id: e.tenant_id,
|
|
5942
5956
|
name: e.name
|
|
5943
5957
|
});
|
|
5944
|
-
})
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
}), r && e.group_id && n.has(e.group_id) && i.push({
|
|
5952
|
-
userId: r.id,
|
|
5953
|
-
groupId: e.group_id,
|
|
5954
|
-
roleIds: e.roles?.map((e) => e.id) ?? []
|
|
5955
|
-
});
|
|
5956
|
-
}), {
|
|
5958
|
+
});
|
|
5959
|
+
for (let [r, a] of Object.entries(e.users_in_groups ?? {})) for (let e of a ?? []) e?.id && (t.has(e.id) || t.set(e.id, wo(e)), n.has(r) && i.push({
|
|
5960
|
+
userId: e.id,
|
|
5961
|
+
groupId: r,
|
|
5962
|
+
roleIds: Object.keys(e.roles ?? {})
|
|
5963
|
+
}));
|
|
5964
|
+
return {
|
|
5957
5965
|
tenant_id: e.tenant_id,
|
|
5958
5966
|
tenant_name: e.tenant_name,
|
|
5959
5967
|
users: Array.from(t.values()),
|
|
@@ -5978,7 +5986,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
5978
5986
|
getData() {
|
|
5979
5987
|
return this.data;
|
|
5980
5988
|
}
|
|
5981
|
-
},
|
|
5989
|
+
}, Do = "[passflow] The access token has no tenant membership (no passflow_tm claim): the sign-in did not ask for the tenant scope. Add 'access:tenant:all' to your scopes (for example PassflowProvider `scopes`) and sign in again. A token refresh keeps the old scopes, so refreshing does not fix this.", Oo = class {
|
|
5982
5990
|
constructor(e, t, n, r) {
|
|
5983
5991
|
this.tenantApi = e, this.scopes = t, this.readStoredAccessToken = r, this.tenantScopeWarned = !1, this.logger = n || li();
|
|
5984
5992
|
}
|
|
@@ -5992,7 +6000,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
5992
6000
|
} catch {
|
|
5993
6001
|
return;
|
|
5994
6002
|
}
|
|
5995
|
-
t.passflow_tm === void 0 && (this.tenantScopeWarned = !0, this.logger.warn(
|
|
6003
|
+
t.passflow_tm === void 0 && (this.tenantScopeWarned = !0, this.logger.warn(Do));
|
|
5996
6004
|
}
|
|
5997
6005
|
handlePassflowError(t, n) {
|
|
5998
6006
|
if (e.isAxiosError(t) && t.response?.data) {
|
|
@@ -6031,7 +6039,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6031
6039
|
async getTenantUserMembership(e) {
|
|
6032
6040
|
this.warnIfNoTenantMembership();
|
|
6033
6041
|
try {
|
|
6034
|
-
return new
|
|
6042
|
+
return new Eo(await this.tenantApi.getTenantDetails(e));
|
|
6035
6043
|
} catch (t) {
|
|
6036
6044
|
this.handlePassflowError(t, `Get tenant user membership failed for tenant ID ${e}`);
|
|
6037
6045
|
}
|
|
@@ -6177,7 +6185,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6177
6185
|
this.handlePassflowError(r, `Invalidate invite by email failed for tenant ID ${e}, group ID ${t}, email ${n}`);
|
|
6178
6186
|
}
|
|
6179
6187
|
}
|
|
6180
|
-
},
|
|
6188
|
+
}, ko = class {
|
|
6181
6189
|
constructor(e, t, n, r = Ee) {
|
|
6182
6190
|
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();
|
|
6183
6191
|
}
|
|
@@ -6257,7 +6265,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6257
6265
|
isExpired() {
|
|
6258
6266
|
return this.tokensCache ? this.tokensCache.access_token ? j(M(this.tokensCache.access_token)) : !1 : !0;
|
|
6259
6267
|
}
|
|
6260
|
-
},
|
|
6268
|
+
}, Ao = class {
|
|
6261
6269
|
constructor(e, t, n) {
|
|
6262
6270
|
this.twoFactorApi = e, this.subscribeStore = t, this.signInCompleter = n, this.PARTIAL_AUTH_TIMEOUT_MS = 3e5, this.SESSION_STORAGE_KEY = "passflow_2fa_challenge", this.subscribeStore.subscribe({ onAuthChange: (e, t) => {
|
|
6263
6271
|
if (e === G.TwoFactorRequired) {
|
|
@@ -6639,7 +6647,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6639
6647
|
this.emitErrorAndThrow(e, "2fa.preferred-method.clear", "Clear preferred 2FA method");
|
|
6640
6648
|
}
|
|
6641
6649
|
}
|
|
6642
|
-
},
|
|
6650
|
+
}, jo = class {
|
|
6643
6651
|
constructor(e, t, n = Ee) {
|
|
6644
6652
|
this.userAPI = e, this.deviceService = t, this.platform = n;
|
|
6645
6653
|
}
|
|
@@ -6681,90 +6689,90 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6681
6689
|
updateProfile(e, t) {
|
|
6682
6690
|
return this.userAPI.updateProfile(e, t);
|
|
6683
6691
|
}
|
|
6684
|
-
},
|
|
6692
|
+
}, Mo = class extends Error {
|
|
6685
6693
|
constructor(e, t, n = !1) {
|
|
6686
6694
|
super(t), this.name = "UpgradeFactorError", this.factor = e, this.cancelled = n;
|
|
6687
6695
|
}
|
|
6688
|
-
},
|
|
6696
|
+
}, No = (e, t) => {
|
|
6689
6697
|
let n = t?.trim();
|
|
6690
|
-
if (!n) throw new
|
|
6698
|
+
if (!n) throw new Mo(e, "A verification code is required");
|
|
6691
6699
|
return n;
|
|
6692
|
-
},
|
|
6700
|
+
}, Po = {
|
|
6693
6701
|
type: "totp",
|
|
6694
6702
|
requiresPrepare: !1,
|
|
6695
6703
|
input: "code",
|
|
6696
|
-
assert: async ({ code: e }) => ({ code:
|
|
6697
|
-
},
|
|
6704
|
+
assert: async ({ code: e }) => ({ code: No("totp", e) })
|
|
6705
|
+
}, Fo = {
|
|
6698
6706
|
type: "recovery_codes",
|
|
6699
6707
|
requiresPrepare: !1,
|
|
6700
6708
|
input: "code",
|
|
6701
|
-
assert: async ({ code: e }) => ({ code:
|
|
6702
|
-
},
|
|
6709
|
+
assert: async ({ code: e }) => ({ code: No("recovery_codes", e) })
|
|
6710
|
+
}, Io = {
|
|
6703
6711
|
type: "passkey",
|
|
6704
6712
|
requiresPrepare: !0,
|
|
6705
6713
|
input: "none",
|
|
6706
6714
|
assert: async ({ prepared: e, platform: t }) => {
|
|
6707
|
-
if (!e?.webauthn) throw new
|
|
6715
|
+
if (!e?.webauthn) throw new Mo("passkey", "The upgrade challenge carried no WebAuthn options");
|
|
6708
6716
|
let n = t.passkeys;
|
|
6709
|
-
if (!n) throw new
|
|
6717
|
+
if (!n) throw new Mo("passkey", "This platform does not support passkeys");
|
|
6710
6718
|
let r;
|
|
6711
6719
|
try {
|
|
6712
6720
|
r = await n.startAuthentication(e.webauthn);
|
|
6713
6721
|
} catch (e) {
|
|
6714
|
-
throw new
|
|
6722
|
+
throw new Mo("passkey", e?.message || "Passkey verification was cancelled", !0);
|
|
6715
6723
|
}
|
|
6716
|
-
if (!r) throw new
|
|
6724
|
+
if (!r) throw new Mo("passkey", "Passkey verification was cancelled", !0);
|
|
6717
6725
|
return {
|
|
6718
6726
|
challenge_id: e.challengeId,
|
|
6719
6727
|
credential: r
|
|
6720
6728
|
};
|
|
6721
6729
|
}
|
|
6722
|
-
},
|
|
6730
|
+
}, Lo = (e) => ({
|
|
6723
6731
|
type: e,
|
|
6724
6732
|
requiresPrepare: !0,
|
|
6725
6733
|
input: "code",
|
|
6726
6734
|
assert: ({ code: t, prepared: n }) => new Promise((r) => {
|
|
6727
|
-
if (!n?.challengeId) throw new
|
|
6735
|
+
if (!n?.challengeId) throw new Mo(e, "No verification code has been sent yet");
|
|
6728
6736
|
r({
|
|
6729
6737
|
challenge_id: n.challengeId,
|
|
6730
|
-
code:
|
|
6738
|
+
code: No(e, t)
|
|
6731
6739
|
});
|
|
6732
6740
|
})
|
|
6733
|
-
}),
|
|
6734
|
-
Mo,
|
|
6741
|
+
}), Ro = Lo("email_otp"), zo = Lo("sms_otp"), Bo = (e) => e.requiresPrepare && e.input === "code", Vo = Object.freeze([
|
|
6735
6742
|
Po,
|
|
6736
6743
|
Io,
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6744
|
+
Ro,
|
|
6745
|
+
zo,
|
|
6746
|
+
Fo
|
|
6747
|
+
]), Ho = (e = Vo) => new Map(e.map((e) => [e.type, e])), Uo = 3, Wo = {
|
|
6740
6748
|
totp: 0,
|
|
6741
6749
|
passkey: 1,
|
|
6742
6750
|
email_otp: 2,
|
|
6743
6751
|
sms_otp: 3,
|
|
6744
6752
|
recovery_codes: 9
|
|
6745
|
-
},
|
|
6746
|
-
let n =
|
|
6753
|
+
}, Go = (e) => e.requiredLevel ?? je(e.acrValues), Ko = (e, t) => {
|
|
6754
|
+
let n = Wo[e.type] ?? 5, r = t !== void 0 && t >= Uo, i = e.type === "passkey";
|
|
6747
6755
|
return (r && !i ? 100 : 0) + n;
|
|
6748
|
-
},
|
|
6756
|
+
}, qo = (e, t) => {
|
|
6749
6757
|
if (t.availableFactors) return t.availableFactors.flatMap((t) => e.find((e) => e.type === t) ?? []);
|
|
6750
|
-
let n =
|
|
6751
|
-
return [...e].sort((e, t) =>
|
|
6752
|
-
},
|
|
6758
|
+
let n = Go(t);
|
|
6759
|
+
return [...e].sort((e, t) => Ko(e, n) - Ko(t, n));
|
|
6760
|
+
}, Jo = class extends Error {
|
|
6753
6761
|
constructor(e) {
|
|
6754
6762
|
super("Upgrade authentication was cancelled"), this.code = "upgrade_cancelled", this.name = "UpgradeCancelledError", e !== void 0 && (this.cause = e);
|
|
6755
6763
|
}
|
|
6756
|
-
},
|
|
6764
|
+
}, Yo = class extends Error {
|
|
6757
6765
|
constructor(e = "Only a fresh sign-in can meet this challenge") {
|
|
6758
6766
|
super(e), this.code = "upgrade_sign_in_required", this.name = "UpgradeSignInRequiredError";
|
|
6759
6767
|
}
|
|
6760
|
-
},
|
|
6761
|
-
if (
|
|
6762
|
-
if (
|
|
6763
|
-
},
|
|
6768
|
+
}, Xo = (e) => e?.signInRequired === !0 || e?.signInRequired === void 0 && e?.availableFactors?.length === 0, Zo = (e) => e?.signInRequired === !1 && e.availableFactors?.length === 0, Qo = "This account has no factor that reaches the required level (it may need a device-bound passkey)", $o = (e) => {
|
|
6769
|
+
if (Xo(e)) return new Yo();
|
|
6770
|
+
if (Zo(e)) return new es(Qo);
|
|
6771
|
+
}, es = class extends Error {
|
|
6764
6772
|
constructor(e = "No available authentication factor can satisfy this challenge") {
|
|
6765
6773
|
super(e), this.code = "upgrade_unsatisfiable", this.name = "UpgradeUnsatisfiableError";
|
|
6766
6774
|
}
|
|
6767
|
-
},
|
|
6775
|
+
}, ts = 4, ns = 3e4, rs = () => {
|
|
6768
6776
|
let e = () => void 0, t = () => void 0;
|
|
6769
6777
|
return {
|
|
6770
6778
|
promise: new Promise((n, r) => {
|
|
@@ -6773,12 +6781,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6773
6781
|
resolve: e,
|
|
6774
6782
|
reject: t
|
|
6775
6783
|
};
|
|
6776
|
-
},
|
|
6784
|
+
}, is = (e) => ({
|
|
6777
6785
|
acrValues: e.acrValues,
|
|
6778
6786
|
level: e.requiredLevel,
|
|
6779
6787
|
maxAge: e.maxAge
|
|
6780
|
-
}),
|
|
6781
|
-
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 ?? []])), { availableFactors: o, signInRequired: s } =
|
|
6788
|
+
}), as = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, os = (e, t) => {
|
|
6789
|
+
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 ?? []])), { availableFactors: o, signInRequired: s } = ss(t, e) && !ss(e, t) || !t.availableFactors ? e : t;
|
|
6782
6790
|
return {
|
|
6783
6791
|
acrValues: r,
|
|
6784
6792
|
requiredLevel: n,
|
|
@@ -6788,12 +6796,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6788
6796
|
...o ? { availableFactors: o } : {},
|
|
6789
6797
|
...s === void 0 ? {} : { signInRequired: s }
|
|
6790
6798
|
};
|
|
6791
|
-
},
|
|
6799
|
+
}, ss = (e, t) => {
|
|
6792
6800
|
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);
|
|
6793
6801
|
return n || r;
|
|
6794
|
-
},
|
|
6802
|
+
}, cs = class {
|
|
6795
6803
|
constructor(e) {
|
|
6796
|
-
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.heldCode = null, this.codeSent = null, this.codeSentChallenge = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ??
|
|
6804
|
+
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.heldCode = null, this.codeSent = null, this.codeSentChallenge = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ?? Vo, this.registry = Ho(this.available), this.maxAttempts = e.maxAttempts ?? ts, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? ns;
|
|
6797
6805
|
}
|
|
6798
6806
|
get currentState() {
|
|
6799
6807
|
return this.state;
|
|
@@ -6813,9 +6821,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6813
6821
|
}
|
|
6814
6822
|
register(e, t) {
|
|
6815
6823
|
let n = t.kind === "imperative" && t.requested !== void 0, r = {
|
|
6816
|
-
demanded: t.kind === "imperative" && t.requested ? t.requested :
|
|
6824
|
+
demanded: t.kind === "imperative" && t.requested ? t.requested : is(e),
|
|
6817
6825
|
statedBar: n,
|
|
6818
|
-
settlement:
|
|
6826
|
+
settlement: rs(),
|
|
6819
6827
|
reported: !1,
|
|
6820
6828
|
entry: {
|
|
6821
6829
|
...t,
|
|
@@ -6831,15 +6839,15 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6831
6839
|
this.requirement = e;
|
|
6832
6840
|
return;
|
|
6833
6841
|
}
|
|
6834
|
-
let n =
|
|
6835
|
-
this.requirement =
|
|
6842
|
+
let n = ss(t, e);
|
|
6843
|
+
this.requirement = os(t, e), $o(this.requirement) ? this.state === "collecting" && this.selected === null && (this.openPrompt?.onClosed?.(), this.closeOpenPrompt?.()) : n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
|
|
6836
6844
|
challenge: this.requirement,
|
|
6837
6845
|
factors: this.offeredFactors()
|
|
6838
6846
|
});
|
|
6839
6847
|
}
|
|
6840
6848
|
offeredFactors() {
|
|
6841
6849
|
let e = this.available.filter((e) => !this.pruned.has(e.type)), t = this.requirement;
|
|
6842
|
-
return t ?
|
|
6850
|
+
return t ? qo(e, t) : e;
|
|
6843
6851
|
}
|
|
6844
6852
|
receiveReport(e, t) {
|
|
6845
6853
|
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());
|
|
@@ -6874,7 +6882,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6874
6882
|
}
|
|
6875
6883
|
release(e, t) {
|
|
6876
6884
|
if (e.entry.kind === "imperative") {
|
|
6877
|
-
if (e.statedBar && !
|
|
6885
|
+
if (e.statedBar && !as(t, e.demanded)) {
|
|
6878
6886
|
this.receiveReport(e, {
|
|
6879
6887
|
outcome: "insufficient",
|
|
6880
6888
|
obtained: t,
|
|
@@ -6949,7 +6957,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6949
6957
|
async prove() {
|
|
6950
6958
|
let e;
|
|
6951
6959
|
for (let t = 0; t < this.maxAttempts; t++) {
|
|
6952
|
-
let n =
|
|
6960
|
+
let n = $o(this.requirement);
|
|
6953
6961
|
if (n) return {
|
|
6954
6962
|
status: "failed",
|
|
6955
6963
|
reason: n
|
|
@@ -6957,7 +6965,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6957
6965
|
let r = this.offeredFactors();
|
|
6958
6966
|
if (r.length === 0) return {
|
|
6959
6967
|
status: "failed",
|
|
6960
|
-
reason: new
|
|
6968
|
+
reason: new es()
|
|
6961
6969
|
};
|
|
6962
6970
|
let i = this.requirement, a;
|
|
6963
6971
|
try {
|
|
@@ -6965,29 +6973,29 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
6965
6973
|
} catch (e) {
|
|
6966
6974
|
return {
|
|
6967
6975
|
status: "failed",
|
|
6968
|
-
reason: new
|
|
6976
|
+
reason: new Jo(e)
|
|
6969
6977
|
};
|
|
6970
6978
|
}
|
|
6971
|
-
let o =
|
|
6979
|
+
let o = $o(this.requirement);
|
|
6972
6980
|
if (o) return {
|
|
6973
6981
|
status: "failed",
|
|
6974
6982
|
reason: o
|
|
6975
6983
|
};
|
|
6976
6984
|
if (a.type === "cancel") return {
|
|
6977
6985
|
status: "failed",
|
|
6978
|
-
reason: new
|
|
6986
|
+
reason: new Jo()
|
|
6979
6987
|
};
|
|
6980
6988
|
let s = this.registry.get(a.factor);
|
|
6981
|
-
if (!s) e = new
|
|
6989
|
+
if (!s) e = new es(`Unknown authentication factor: ${a.factor}`), this.state = "collecting", this.selected = null;
|
|
6982
6990
|
else try {
|
|
6983
6991
|
return await this.proveAndCommit(s, a.code, t < this.maxAttempts - 1), {
|
|
6984
6992
|
status: "proven",
|
|
6985
|
-
obtained: this.readObtainedBar?.() ??
|
|
6993
|
+
obtained: this.readObtainedBar?.() ?? is(this.rankedRequirement ?? i)
|
|
6986
6994
|
};
|
|
6987
6995
|
} catch (t) {
|
|
6988
|
-
if (t instanceof
|
|
6996
|
+
if (t instanceof Mo && t.cancelled) return {
|
|
6989
6997
|
status: "failed",
|
|
6990
|
-
reason: new
|
|
6998
|
+
reason: new Jo()
|
|
6991
6999
|
};
|
|
6992
7000
|
let n = this.classifyProofFailure(t);
|
|
6993
7001
|
if (n) return {
|
|
@@ -7014,13 +7022,13 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7014
7022
|
onFactorSelected: (e) => {
|
|
7015
7023
|
this.state === "collecting" && (this.state = "proving"), this.selected = e, this.rankedRequirement = this.requirement;
|
|
7016
7024
|
let t = this.registry.get(e);
|
|
7017
|
-
this.openPrompt === r && t &&
|
|
7025
|
+
this.openPrompt === r && t && Bo(t) && this.heldCode?.factor !== e && this.sendCode(e).catch(() => void 0);
|
|
7018
7026
|
},
|
|
7019
7027
|
resend: async (e) => {
|
|
7020
7028
|
let t = this.registry.get(e);
|
|
7021
|
-
if (!t || !
|
|
7022
|
-
if (this.openPrompt !== r) throw new
|
|
7023
|
-
if (await this.sendCode(e, !0), !this.codeSent || this.codeSent.factor !== e) throw new
|
|
7029
|
+
if (!t || !Bo(t)) throw new Mo(e, "This factor does not send a code");
|
|
7030
|
+
if (this.openPrompt !== r) throw new Mo(e, "This step-up has ended");
|
|
7031
|
+
if (await this.sendCode(e, !0), !this.codeSent || this.codeSent.factor !== e) throw new Mo(e, "The server sent no code");
|
|
7024
7032
|
return this.codeSent;
|
|
7025
7033
|
}
|
|
7026
7034
|
};
|
|
@@ -7047,7 +7055,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7047
7055
|
}
|
|
7048
7056
|
}
|
|
7049
7057
|
async proveAndCommit(e, t, n) {
|
|
7050
|
-
if (
|
|
7058
|
+
if (Bo(e)) {
|
|
7051
7059
|
await this.proveSentCode(e, t, n);
|
|
7052
7060
|
return;
|
|
7053
7061
|
}
|
|
@@ -7107,28 +7115,28 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7107
7115
|
throw this.heldCode === i && n && t && (this.heldCode = n.hold, this.codeSent = n.codeSent, this.codeSentChallenge = n.challenge), e;
|
|
7108
7116
|
});
|
|
7109
7117
|
}
|
|
7110
|
-
},
|
|
7118
|
+
}, ls = (e) => typeof e == "function" ? e() : e, us = (e) => {
|
|
7111
7119
|
try {
|
|
7112
7120
|
return new URL(e);
|
|
7113
7121
|
} catch {
|
|
7114
7122
|
return;
|
|
7115
7123
|
}
|
|
7116
|
-
},
|
|
7124
|
+
}, ds = (e, t) => {
|
|
7117
7125
|
if (!t || t === "/") return !0;
|
|
7118
7126
|
let n = t.replace(/\/+$/, "");
|
|
7119
7127
|
return e === n || e.startsWith(`${n}/`);
|
|
7120
|
-
},
|
|
7128
|
+
}, fs = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && ds(e.pathname, t.pathPrefix), ps = (e, t) => {
|
|
7121
7129
|
for (let n of t) {
|
|
7122
7130
|
if (n === "") continue;
|
|
7123
7131
|
if (n.startsWith("/")) {
|
|
7124
|
-
if (e.relativeToBase &&
|
|
7132
|
+
if (e.relativeToBase && ds(e.pathname, n)) return !0;
|
|
7125
7133
|
continue;
|
|
7126
7134
|
}
|
|
7127
|
-
let t =
|
|
7128
|
-
if (t && e.origin !== void 0 && e.origin === t.origin &&
|
|
7135
|
+
let t = us(n) ?? us(`https://${n}`);
|
|
7136
|
+
if (t && e.origin !== void 0 && e.origin === t.origin && ds(e.pathname, t.pathname)) return !0;
|
|
7129
7137
|
}
|
|
7130
7138
|
return !1;
|
|
7131
|
-
},
|
|
7139
|
+
}, ms = (e, t, n) => fs(e, t.passflow) || ps(e, t.backend) ? !n || n(e.href) !== !1 : !1, hs = (e) => {
|
|
7132
7140
|
let t = e.detail, n = t?.message ?? `[passflow] upgrade challenge not actioned: ${e.reason}`;
|
|
7133
7141
|
console.warn(n, {
|
|
7134
7142
|
status: e.status,
|
|
@@ -7136,8 +7144,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7136
7144
|
reason: e.reason,
|
|
7137
7145
|
detail: t
|
|
7138
7146
|
});
|
|
7139
|
-
},
|
|
7140
|
-
let n = t.onUpgradeDiagnostic ??
|
|
7147
|
+
}, gs = (e, t) => {
|
|
7148
|
+
let n = t.onUpgradeDiagnostic ?? hs;
|
|
7141
7149
|
return (t, r) => {
|
|
7142
7150
|
n({
|
|
7143
7151
|
status: e.status,
|
|
@@ -7149,8 +7157,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7149
7157
|
}
|
|
7150
7158
|
});
|
|
7151
7159
|
};
|
|
7152
|
-
},
|
|
7153
|
-
let r = n.onUpgradeDiagnostic ??
|
|
7160
|
+
}, _s = (e, t, n) => {
|
|
7161
|
+
let r = n.onUpgradeDiagnostic ?? hs;
|
|
7154
7162
|
for (let n of e) r({
|
|
7155
7163
|
...n,
|
|
7156
7164
|
url: t.request.href,
|
|
@@ -7159,8 +7167,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7159
7167
|
...n.detail ?? {}
|
|
7160
7168
|
}
|
|
7161
7169
|
});
|
|
7162
|
-
},
|
|
7163
|
-
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n &&
|
|
7170
|
+
}, vs = /\bjson\b/i, ys = async (e, t) => {
|
|
7171
|
+
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && vs.test(r), a;
|
|
7164
7172
|
if (i) try {
|
|
7165
7173
|
a = await e.readBody();
|
|
7166
7174
|
} catch {
|
|
@@ -7174,10 +7182,10 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7174
7182
|
status: e.status,
|
|
7175
7183
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
7176
7184
|
}, { requireChallengeChannel: t.requireChallengeChannel });
|
|
7177
|
-
},
|
|
7185
|
+
}, bs = (e) => Ue({
|
|
7178
7186
|
status: e.status,
|
|
7179
7187
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
7180
|
-
}, { requireChallengeChannel: "header" }).challenge,
|
|
7188
|
+
}, { requireChallengeChannel: "header" }).challenge, xs = (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.`, Ss = (e, t) => e instanceof Jo ? { kind: "cancelled" } : e instanceof Yo ? { kind: "sign-in-required" } : e instanceof es ? {
|
|
7181
7189
|
kind: "unsatisfiable",
|
|
7182
7190
|
error: e
|
|
7183
7191
|
} : e instanceof Ga ? { kind: "unavailable" } : e instanceof Ka ? { kind: "session-changed" } : e instanceof Wa ? {
|
|
@@ -7196,26 +7204,26 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7196
7204
|
kind: "transport-failure",
|
|
7197
7205
|
retryable: !1,
|
|
7198
7206
|
error: e instanceof Error ? e : Error(String(e))
|
|
7199
|
-
},
|
|
7207
|
+
}, Cs = async (e, t, n, r) => {
|
|
7200
7208
|
if (e.status !== 401 && e.status !== 403) return {
|
|
7201
7209
|
kind: "replayed",
|
|
7202
7210
|
response: e
|
|
7203
7211
|
};
|
|
7204
|
-
let { challenge: i, diagnostics: a } = await
|
|
7205
|
-
if (
|
|
7212
|
+
let { challenge: i, diagnostics: a } = await ys(e, t);
|
|
7213
|
+
if (_s(a, e, t), !i) return {
|
|
7206
7214
|
kind: "replayed",
|
|
7207
7215
|
response: e
|
|
7208
7216
|
};
|
|
7209
|
-
if (
|
|
7217
|
+
if (Xo(i)) return {
|
|
7210
7218
|
kind: "sign-in-required",
|
|
7211
7219
|
response: e
|
|
7212
7220
|
};
|
|
7213
|
-
if (
|
|
7221
|
+
if (Zo(i)) return {
|
|
7214
7222
|
kind: "unsatisfiable",
|
|
7215
|
-
error:
|
|
7223
|
+
error: $o(i),
|
|
7216
7224
|
response: e
|
|
7217
7225
|
};
|
|
7218
|
-
let o =
|
|
7226
|
+
let o = is(i);
|
|
7219
7227
|
return r("elevated-insufficient", {
|
|
7220
7228
|
obtained: n,
|
|
7221
7229
|
required: o
|
|
@@ -7225,7 +7233,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7225
7233
|
required: o,
|
|
7226
7234
|
response: e
|
|
7227
7235
|
};
|
|
7228
|
-
},
|
|
7236
|
+
}, ws = async (e, t) => {
|
|
7229
7237
|
if (!t) return {
|
|
7230
7238
|
aborted: !1,
|
|
7231
7239
|
value: await e
|
|
@@ -7252,14 +7260,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7252
7260
|
} finally {
|
|
7253
7261
|
n && t.removeEventListener?.("abort", n);
|
|
7254
7262
|
}
|
|
7255
|
-
},
|
|
7263
|
+
}, Ts = async (e, t) => {
|
|
7256
7264
|
if (e.status !== 401 && e.status !== 403 || e.markers.upgradeTransaction) return { kind: "not-a-challenge" };
|
|
7257
|
-
let n =
|
|
7265
|
+
let n = gs(e, t);
|
|
7258
7266
|
if (e.markers.replayed) {
|
|
7259
|
-
if (!
|
|
7260
|
-
let { challenge: r, diagnostics: i } = await
|
|
7261
|
-
if (
|
|
7262
|
-
let a = t.readObtainedBar?.() ?? {}, o =
|
|
7267
|
+
if (!ms(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
|
|
7268
|
+
let { challenge: r, diagnostics: i } = await ys(e, t);
|
|
7269
|
+
if (_s(i, e, t), !r) return { kind: "not-a-challenge" };
|
|
7270
|
+
let a = t.readObtainedBar?.() ?? {}, o = is(r);
|
|
7263
7271
|
return n("elevated-insufficient", {
|
|
7264
7272
|
obtained: a,
|
|
7265
7273
|
required: o
|
|
@@ -7270,12 +7278,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7270
7278
|
response: e
|
|
7271
7279
|
};
|
|
7272
7280
|
}
|
|
7273
|
-
if (!
|
|
7281
|
+
if (!ms(e.request, t.scope, t.shouldIntercept)) return bs(e) ? (n("challenge-out-of-scope", {
|
|
7274
7282
|
header: e.getHeader("www-authenticate") ?? void 0,
|
|
7275
|
-
message:
|
|
7283
|
+
message: xs(e.request.href, t.scope)
|
|
7276
7284
|
}), { kind: "out-of-scope" }) : { kind: "not-a-challenge" };
|
|
7277
|
-
let { challenge: r, diagnostics: i } = await
|
|
7278
|
-
if (
|
|
7285
|
+
let { challenge: r, diagnostics: i } = await ys(e, t);
|
|
7286
|
+
if (_s(i, e, t), !r) {
|
|
7279
7287
|
let r = e.getHeader("www-authenticate");
|
|
7280
7288
|
return t.requireChallengeChannel !== "header" && n("no-channel", {
|
|
7281
7289
|
...r ? { header: r } : {},
|
|
@@ -7289,9 +7297,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7289
7297
|
method: e.request.method
|
|
7290
7298
|
}, s, c;
|
|
7291
7299
|
try {
|
|
7292
|
-
s = Promise.resolve(t.elevate(r, o)), c = await
|
|
7300
|
+
s = Promise.resolve(t.elevate(r, o)), c = await ws(s, e.signal);
|
|
7293
7301
|
} catch (e) {
|
|
7294
|
-
return
|
|
7302
|
+
return Ss(e, void 0);
|
|
7295
7303
|
}
|
|
7296
7304
|
if (c.aborted) return s?.then((e) => e?.waiter.report({ outcome: "failed" }), () => {}), {
|
|
7297
7305
|
kind: "aborted",
|
|
@@ -7302,7 +7310,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7302
7310
|
kind: "aborted",
|
|
7303
7311
|
reason: e.signal.reason
|
|
7304
7312
|
};
|
|
7305
|
-
let u = l?.obtained ?? t.readObtainedBar?.() ??
|
|
7313
|
+
let u = l?.obtained ?? t.readObtainedBar?.() ?? is(r), d = t.authorizationSwap?.(), f = d ? {
|
|
7306
7314
|
from: a?.from ?? d.from,
|
|
7307
7315
|
to: d.to
|
|
7308
7316
|
} : void 0;
|
|
@@ -7329,7 +7337,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7329
7337
|
};
|
|
7330
7338
|
throw t;
|
|
7331
7339
|
}
|
|
7332
|
-
let m = await
|
|
7340
|
+
let m = await Cs(p, t, u, n);
|
|
7333
7341
|
return m.kind === "insufficient" ? l?.waiter.report({
|
|
7334
7342
|
outcome: "insufficient",
|
|
7335
7343
|
obtained: m.obtained,
|
|
@@ -7338,11 +7346,11 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7338
7346
|
outcome: "replayed",
|
|
7339
7347
|
obtained: u
|
|
7340
7348
|
}), m;
|
|
7341
|
-
},
|
|
7349
|
+
}, Es = (e) => {
|
|
7342
7350
|
switch (e.kind) {
|
|
7343
|
-
case "cancelled": return new
|
|
7344
|
-
case "unsatisfiable": return e.error ?? new
|
|
7345
|
-
case "sign-in-required": return new
|
|
7351
|
+
case "cancelled": return new Jo();
|
|
7352
|
+
case "unsatisfiable": return e.error ?? new es();
|
|
7353
|
+
case "sign-in-required": return new Yo();
|
|
7346
7354
|
case "unavailable": return new Ga();
|
|
7347
7355
|
case "session-changed": return new Ka();
|
|
7348
7356
|
case "insufficient": return new Wa(e.obtained, e.required);
|
|
@@ -7350,7 +7358,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7350
7358
|
case "transport-failure": return e.error;
|
|
7351
7359
|
default: return;
|
|
7352
7360
|
}
|
|
7353
|
-
},
|
|
7361
|
+
}, Ds = (e, t, n) => {
|
|
7354
7362
|
switch (e.kind) {
|
|
7355
7363
|
case "replayed": return {
|
|
7356
7364
|
settle: "resolve",
|
|
@@ -7368,26 +7376,26 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7368
7376
|
};
|
|
7369
7377
|
case "cancelled": return n.onCancel === "reject" ? {
|
|
7370
7378
|
settle: "reject",
|
|
7371
|
-
error: new
|
|
7379
|
+
error: new Jo()
|
|
7372
7380
|
} : {
|
|
7373
7381
|
settle: "resolve",
|
|
7374
|
-
value:
|
|
7382
|
+
value: Ls(t, e)
|
|
7375
7383
|
};
|
|
7376
7384
|
case "unsatisfiable":
|
|
7377
7385
|
case "sign-in-required": return {
|
|
7378
7386
|
settle: "resolve",
|
|
7379
|
-
value:
|
|
7387
|
+
value: Ls(e.response?.raw ?? t, e)
|
|
7380
7388
|
};
|
|
7381
7389
|
case "insufficient": return {
|
|
7382
7390
|
settle: "resolve",
|
|
7383
|
-
value:
|
|
7391
|
+
value: Ls(e.response?.raw ?? t, e)
|
|
7384
7392
|
};
|
|
7385
7393
|
default: return {
|
|
7386
7394
|
settle: "resolve",
|
|
7387
|
-
value:
|
|
7395
|
+
value: Ls(t, e)
|
|
7388
7396
|
};
|
|
7389
7397
|
}
|
|
7390
|
-
},
|
|
7398
|
+
}, Os = (e, t) => {
|
|
7391
7399
|
switch (e.kind) {
|
|
7392
7400
|
case "replayed": return e.response.rejected ? {
|
|
7393
7401
|
settle: "reject",
|
|
@@ -7402,42 +7410,42 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7402
7410
|
};
|
|
7403
7411
|
default: return {
|
|
7404
7412
|
settle: "reject",
|
|
7405
|
-
error:
|
|
7413
|
+
error: Es(e) ?? t
|
|
7406
7414
|
};
|
|
7407
7415
|
}
|
|
7408
|
-
},
|
|
7416
|
+
}, ks = /* @__PURE__ */ new WeakSet(), As = /* @__PURE__ */ new WeakSet(), js = /* @__PURE__ */ new WeakSet(), Ms = /* @__PURE__ */ new WeakSet(), Ns = /* @__PURE__ */ new WeakSet(), Ps = /* @__PURE__ */ new WeakSet(), Fs = /* @__PURE__ */ new WeakSet(), Is = /* @__PURE__ */ new WeakSet(), Ls = (e, t) => {
|
|
7409
7417
|
switch (t.kind) {
|
|
7410
7418
|
case "cancelled":
|
|
7411
|
-
|
|
7419
|
+
ks.add(e);
|
|
7412
7420
|
break;
|
|
7413
7421
|
case "exhausted":
|
|
7414
|
-
|
|
7422
|
+
As.add(e);
|
|
7415
7423
|
break;
|
|
7416
7424
|
case "insufficient":
|
|
7417
|
-
|
|
7425
|
+
js.add(e);
|
|
7418
7426
|
break;
|
|
7419
7427
|
case "unsatisfiable":
|
|
7420
|
-
|
|
7428
|
+
Ms.add(e);
|
|
7421
7429
|
break;
|
|
7422
7430
|
case "sign-in-required":
|
|
7423
|
-
|
|
7431
|
+
Ns.add(e);
|
|
7424
7432
|
break;
|
|
7425
7433
|
case "unavailable":
|
|
7426
|
-
|
|
7434
|
+
Ps.add(e);
|
|
7427
7435
|
break;
|
|
7428
7436
|
case "session-changed":
|
|
7429
|
-
|
|
7437
|
+
Fs.add(e);
|
|
7430
7438
|
break;
|
|
7431
|
-
case "transport-failure":
|
|
7439
|
+
case "transport-failure": Is.add(e);
|
|
7432
7440
|
}
|
|
7433
7441
|
return e;
|
|
7434
|
-
},
|
|
7442
|
+
}, Rs = (e) => ks.has(e), zs = (e) => As.has(e), Bs = (e) => js.has(e), Vs = (e) => Ms.has(e), Hs = (e) => Ns.has(e), Us = (e) => Ps.has(e), Ws = (e) => Fs.has(e), Gs = (e) => Is.has(e), Ks = "https://passflow-relative.invalid", qs = () => {
|
|
7435
7443
|
let e = globalThis, t = e.document?.baseURI;
|
|
7436
7444
|
if (typeof t == "string" && t !== "") return t;
|
|
7437
7445
|
let n = e.location?.href;
|
|
7438
|
-
return typeof n == "string" && n !== "" && n !== "about:blank" ? n :
|
|
7439
|
-
},
|
|
7440
|
-
let n = t ===
|
|
7446
|
+
return typeof n == "string" && n !== "" && n !== "about:blank" ? n : Ks;
|
|
7447
|
+
}, Js = (e, t = qs()) => {
|
|
7448
|
+
let n = t === Ks, r;
|
|
7441
7449
|
try {
|
|
7442
7450
|
r = new URL(t).origin;
|
|
7443
7451
|
} catch {
|
|
@@ -7463,28 +7471,28 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7463
7471
|
relativeToBase: !1,
|
|
7464
7472
|
sentinelBase: n
|
|
7465
7473
|
};
|
|
7466
|
-
},
|
|
7474
|
+
}, Ys = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, Xs = (e) => {
|
|
7467
7475
|
let t = [];
|
|
7468
7476
|
if (e == null) return Object.freeze(t);
|
|
7469
7477
|
let n = e;
|
|
7470
7478
|
if (typeof n.forEach == "function" && typeof n.entries == "function") return e.forEach((e, n) => {
|
|
7471
|
-
let r =
|
|
7479
|
+
let r = Ys(n, e);
|
|
7472
7480
|
r && t.push(r);
|
|
7473
7481
|
}), Object.freeze(t);
|
|
7474
7482
|
if (Array.isArray(e)) {
|
|
7475
7483
|
for (let n of e) if (Array.isArray(n) && n.length >= 2) {
|
|
7476
|
-
let e =
|
|
7484
|
+
let e = Ys(String(n[0]), n[1]);
|
|
7477
7485
|
e && t.push(e);
|
|
7478
7486
|
}
|
|
7479
7487
|
return Object.freeze(t);
|
|
7480
7488
|
}
|
|
7481
7489
|
if (typeof e == "object") for (let [n, r] of Object.entries(e)) {
|
|
7482
|
-
let e =
|
|
7490
|
+
let e = Ys(n, Array.isArray(r) ? r.join(", ") : r);
|
|
7483
7491
|
e && t.push(e);
|
|
7484
7492
|
}
|
|
7485
7493
|
return Object.freeze(t);
|
|
7486
|
-
},
|
|
7487
|
-
let t = e.base === void 0 ?
|
|
7494
|
+
}, Zs = (e) => {
|
|
7495
|
+
let t = e.base === void 0 ? Js(e.url) : Js(e.url, e.base), n = {
|
|
7488
7496
|
raw: e.url,
|
|
7489
7497
|
href: t.href,
|
|
7490
7498
|
dispatchUrl: t.sentinelBase || !t.resolved ? e.url : t.href,
|
|
@@ -7493,29 +7501,29 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7493
7501
|
resolved: t.resolved,
|
|
7494
7502
|
relativeToBase: t.relativeToBase,
|
|
7495
7503
|
method: (e.method ?? "GET").toUpperCase(),
|
|
7496
|
-
headers:
|
|
7504
|
+
headers: Xs(e.headers),
|
|
7497
7505
|
bodyKind: e.bodyKind,
|
|
7498
7506
|
..."body" in e ? { body: e.body } : {}
|
|
7499
7507
|
};
|
|
7500
7508
|
return Object.freeze(n);
|
|
7501
|
-
},
|
|
7509
|
+
}, Qs = (e, t) => {
|
|
7502
7510
|
if (!t || t.from === t.to) return e;
|
|
7503
7511
|
let n = !1, r = e.map(([e, r]) => e === "authorization" && r === t.from ? (n = !0, [e, t.to]) : [e, r]);
|
|
7504
7512
|
return n ? Object.freeze(r) : e;
|
|
7505
|
-
},
|
|
7513
|
+
}, $s = (e) => {
|
|
7506
7514
|
let t = {};
|
|
7507
7515
|
for (let [n, r] of e) t[n] = r;
|
|
7508
7516
|
return t;
|
|
7509
|
-
},
|
|
7517
|
+
}, ec = /* @__PURE__ */ new Set([
|
|
7510
7518
|
"GET",
|
|
7511
7519
|
"HEAD",
|
|
7512
7520
|
"OPTIONS"
|
|
7513
|
-
]),
|
|
7521
|
+
]), tc = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, nc = (e) => typeof e == "string" ? e : tc(e) ? e.url : String(e), rc = (e, t) => (t?.method ?? (tc(e) ? e.method : void 0) ?? "GET").toUpperCase(), ic = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", ac = (e) => {
|
|
7514
7522
|
if (typeof e == "string") return e.length;
|
|
7515
7523
|
let t = e;
|
|
7516
7524
|
if (typeof t?.size == "number") return t.size;
|
|
7517
7525
|
if (typeof t?.byteLength == "number") return t.byteLength;
|
|
7518
|
-
},
|
|
7526
|
+
}, oc = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? ec.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), sc = (e, t, n, r, i) => ({
|
|
7519
7527
|
replayable: !1,
|
|
7520
7528
|
bodyKind: e,
|
|
7521
7529
|
reason: t,
|
|
@@ -7523,11 +7531,11 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7523
7531
|
forwardInit: i,
|
|
7524
7532
|
snapshot: r,
|
|
7525
7533
|
replay: () => Promise.reject(/* @__PURE__ */ Error(`This request cannot be replayed: ${t}`))
|
|
7526
|
-
}),
|
|
7534
|
+
}), cc = (e, t) => $s(Qs(e.headers, t?.authorizationSwap)), lc = (e) => {
|
|
7527
7535
|
if (!e || !("headers" in e)) return e;
|
|
7528
7536
|
let { headers: t, ...n } = e;
|
|
7529
7537
|
return n;
|
|
7530
|
-
},
|
|
7538
|
+
}, uc = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : tc(e) ? e.headers : void 0, dc = (e) => {
|
|
7531
7539
|
if (e === null || typeof e == "string") return e;
|
|
7532
7540
|
if (typeof FormData < "u" && e instanceof FormData) {
|
|
7533
7541
|
let t = new FormData();
|
|
@@ -7535,18 +7543,18 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7535
7543
|
return t;
|
|
7536
7544
|
}
|
|
7537
7545
|
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;
|
|
7538
|
-
},
|
|
7539
|
-
let r =
|
|
7546
|
+
}, fc = (e, t, n) => new Request(e, { headers: cc(t, n) }), pc = (e, t, n) => {
|
|
7547
|
+
let r = nc(e), i = rc(e, t), a = uc(e, t), o = (e, t) => Zs({
|
|
7540
7548
|
url: r,
|
|
7541
7549
|
method: i,
|
|
7542
7550
|
headers: a,
|
|
7543
7551
|
bodyKind: e,
|
|
7544
7552
|
...t === void 0 ? {} : { body: t }
|
|
7545
7553
|
});
|
|
7546
|
-
if (
|
|
7554
|
+
if (tc(e)) {
|
|
7547
7555
|
if (e.body === null || e.body === void 0) {
|
|
7548
7556
|
let a = o("none");
|
|
7549
|
-
return
|
|
7557
|
+
return oc(n, {
|
|
7550
7558
|
url: r,
|
|
7551
7559
|
method: i,
|
|
7552
7560
|
bodyKind: "none"
|
|
@@ -7556,20 +7564,20 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7556
7564
|
forwardInput: e,
|
|
7557
7565
|
forwardInit: t,
|
|
7558
7566
|
snapshot: a,
|
|
7559
|
-
replay: (n, r) => n(
|
|
7560
|
-
} :
|
|
7567
|
+
replay: (n, r) => n(fc(e, a, r), lc(t))
|
|
7568
|
+
} : sc("none", "the replay policy refused this request", e, a, t);
|
|
7561
7569
|
}
|
|
7562
7570
|
let a = o("request-clone");
|
|
7563
|
-
if (!
|
|
7571
|
+
if (!oc(n, {
|
|
7564
7572
|
url: r,
|
|
7565
7573
|
method: i,
|
|
7566
7574
|
bodyKind: "request-clone"
|
|
7567
|
-
})) return
|
|
7575
|
+
})) return sc("request-clone", "the replay policy refused this request", e, a, t);
|
|
7568
7576
|
let s;
|
|
7569
7577
|
try {
|
|
7570
7578
|
s = e.clone();
|
|
7571
7579
|
} catch {
|
|
7572
|
-
return
|
|
7580
|
+
return sc("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
|
|
7573
7581
|
}
|
|
7574
7582
|
return {
|
|
7575
7583
|
replayable: !0,
|
|
@@ -7577,17 +7585,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7577
7585
|
forwardInput: e,
|
|
7578
7586
|
forwardInit: t,
|
|
7579
7587
|
snapshot: a,
|
|
7580
|
-
replay: (e, n) => e(
|
|
7588
|
+
replay: (e, n) => e(fc(s, a, n), lc(t))
|
|
7581
7589
|
};
|
|
7582
7590
|
}
|
|
7583
|
-
let s =
|
|
7584
|
-
if (s === "one-shot") return
|
|
7585
|
-
if (!
|
|
7591
|
+
let s = ic(t?.body);
|
|
7592
|
+
if (s === "one-shot") return sc("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
|
|
7593
|
+
if (!oc(n, {
|
|
7586
7594
|
url: r,
|
|
7587
7595
|
method: i,
|
|
7588
7596
|
bodyKind: s
|
|
7589
|
-
},
|
|
7590
|
-
let c = t && "body" in t ?
|
|
7597
|
+
}, ac(t?.body))) return sc(s, "the replay policy refused this request", e, o(s), t);
|
|
7598
|
+
let c = t && "body" in t ? dc(t.body ?? null) : void 0, l = o(s, c);
|
|
7591
7599
|
return {
|
|
7592
7600
|
replayable: !0,
|
|
7593
7601
|
bodyKind: s,
|
|
@@ -7595,21 +7603,21 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7595
7603
|
forwardInit: t,
|
|
7596
7604
|
snapshot: l,
|
|
7597
7605
|
replay: (e, n) => e(l.dispatchUrl, {
|
|
7598
|
-
...
|
|
7606
|
+
...lc(t),
|
|
7599
7607
|
...c === void 0 ? {} : { body: c },
|
|
7600
|
-
headers:
|
|
7608
|
+
headers: cc(l, n),
|
|
7601
7609
|
method: l.method
|
|
7602
7610
|
})
|
|
7603
7611
|
};
|
|
7604
|
-
},
|
|
7605
|
-
if (!
|
|
7612
|
+
}, mc = (e) => typeof e == "object" && !!e, hc = (e) => (t) => {
|
|
7613
|
+
if (!mc(e)) return;
|
|
7606
7614
|
let n = e[t] ?? e[t.toLowerCase()] ?? (typeof e.get == "function" ? e.get(t) : void 0);
|
|
7607
7615
|
return Array.isArray(n) ? n.join(", ") : typeof n == "string" ? n : void 0;
|
|
7608
|
-
},
|
|
7616
|
+
}, gc = (e) => {
|
|
7609
7617
|
let t = e?.url ?? "", n = e?.baseURL;
|
|
7610
7618
|
return !n || /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t) ? t : `${n.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
7611
|
-
},
|
|
7612
|
-
let r =
|
|
7619
|
+
}, _c = (e) => (e?.method ?? "GET").toUpperCase(), vc = (e) => e == null ? "none" : mc(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", yc = (e, t, n) => {
|
|
7620
|
+
let r = $s(Qs(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
|
|
7613
7621
|
return {
|
|
7614
7622
|
...e,
|
|
7615
7623
|
...i ? { baseURL: void 0 } : {},
|
|
@@ -7618,10 +7626,10 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7618
7626
|
headers: r,
|
|
7619
7627
|
..."body" in t ? { data: t.body } : {}
|
|
7620
7628
|
};
|
|
7621
|
-
},
|
|
7622
|
-
let o = t ?? e?.config, s =
|
|
7623
|
-
url:
|
|
7624
|
-
method:
|
|
7629
|
+
}, bc = (e, t, n, r, i, a) => {
|
|
7630
|
+
let o = t ?? e?.config, s = vc(o?.data), c = a ?? Zs({
|
|
7631
|
+
url: gc(o),
|
|
7632
|
+
method: _c(o),
|
|
7625
7633
|
headers: o?.headers,
|
|
7626
7634
|
bodyKind: s,
|
|
7627
7635
|
body: o?.data
|
|
@@ -7629,22 +7637,22 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7629
7637
|
url: c.href,
|
|
7630
7638
|
method: c.method,
|
|
7631
7639
|
bodyKind: s
|
|
7632
|
-
}, u = s !== "one-shot" &&
|
|
7640
|
+
}, u = s !== "one-shot" && oc(i.replay, l);
|
|
7633
7641
|
return {
|
|
7634
7642
|
status: e?.status ?? 0,
|
|
7635
|
-
getHeader:
|
|
7643
|
+
getHeader: hc(e?.headers),
|
|
7636
7644
|
readBody: async () => e?.data,
|
|
7637
7645
|
request: c,
|
|
7638
7646
|
replay: async (e) => {
|
|
7639
|
-
let t = Xe(
|
|
7647
|
+
let t = Xe(yc(o ?? {}, c, e));
|
|
7640
7648
|
try {
|
|
7641
7649
|
let e = await r(t);
|
|
7642
|
-
return
|
|
7650
|
+
return bc(e, e?.config ?? t, e, r, i, c);
|
|
7643
7651
|
} catch (e) {
|
|
7644
|
-
let n =
|
|
7652
|
+
let n = mc(e) ? e : {};
|
|
7645
7653
|
if (!n.response || typeof n.response.status != "number" || Pa(e)) throw e;
|
|
7646
7654
|
return {
|
|
7647
|
-
...
|
|
7655
|
+
...bc(n.response, n.config ?? t, e, r, i, c),
|
|
7648
7656
|
rejected: !0
|
|
7649
7657
|
};
|
|
7650
7658
|
}
|
|
@@ -7658,30 +7666,30 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7658
7666
|
replayUnsupportedReason: s === "one-shot" ? "a streaming request body is consumed by the first send" : "the replay policy refused this request",
|
|
7659
7667
|
signal: o?.signal
|
|
7660
7668
|
};
|
|
7661
|
-
},
|
|
7662
|
-
let r =
|
|
7669
|
+
}, xc = (e, t) => async (n) => {
|
|
7670
|
+
let r = ls(e), i = mc(n) ? n : {}, a = Os(await Ts(bc(i.response, i.config, i.response, t, r), r), n);
|
|
7663
7671
|
if (a.settle === "reject") throw a.error;
|
|
7664
7672
|
return a.value;
|
|
7665
|
-
},
|
|
7666
|
-
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,
|
|
7673
|
+
}, Sc = (e, t, n) => {
|
|
7674
|
+
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, xc(t, i)), o = !1;
|
|
7667
7675
|
return () => {
|
|
7668
7676
|
o || (o = !0, e.interceptors.response.eject(a));
|
|
7669
7677
|
};
|
|
7670
|
-
},
|
|
7678
|
+
}, Cc = (t, n) => {
|
|
7671
7679
|
let r = e.create(t);
|
|
7672
7680
|
return n(r), r;
|
|
7673
|
-
},
|
|
7681
|
+
}, wc = () => {
|
|
7674
7682
|
let e = typeof location > "u" ? void 0 : location.origin;
|
|
7675
7683
|
return e && e !== "null" ? e : void 0;
|
|
7676
|
-
},
|
|
7684
|
+
}, Tc = (e) => {
|
|
7677
7685
|
let t = new URL(e).origin;
|
|
7678
7686
|
if (t === "null") throw Error(`Passflow: "${e}" has no origin a request can be matched against; list http(s) origins only.`);
|
|
7679
7687
|
return t;
|
|
7680
|
-
},
|
|
7681
|
-
let n = (t?.origins ?? []).map(
|
|
7688
|
+
}, Ec = (e, t) => {
|
|
7689
|
+
let n = (t?.origins ?? []).map(Tc);
|
|
7682
7690
|
return (t, r) => {
|
|
7683
7691
|
if (r) return Promise.resolve(void 0);
|
|
7684
|
-
let i =
|
|
7692
|
+
let i = wc(), a;
|
|
7685
7693
|
try {
|
|
7686
7694
|
a = new URL(t, i).origin;
|
|
7687
7695
|
} catch {
|
|
@@ -7689,22 +7697,22 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7689
7697
|
}
|
|
7690
7698
|
return a !== i && !n.includes(a) ? Promise.resolve(void 0) : e();
|
|
7691
7699
|
};
|
|
7692
|
-
},
|
|
7693
|
-
let r =
|
|
7700
|
+
}, Dc = (e) => typeof Request < "u" && e instanceof Request, Oc = (e, t) => new Headers(t?.headers === void 0 ? Dc(e) ? e.headers : void 0 : t.headers), kc = (e, t, n) => {
|
|
7701
|
+
let r = Ec(t, n);
|
|
7694
7702
|
return async (t, n) => {
|
|
7695
|
-
let i =
|
|
7703
|
+
let i = Dc(t) ? t.url : t instanceof URL ? t.href : String(t), a = Oc(t, n), o = await r(i, a.has("authorization"));
|
|
7696
7704
|
return o ? (a.set("authorization", `Bearer ${o}`), e(t, {
|
|
7697
7705
|
...n,
|
|
7698
7706
|
headers: a
|
|
7699
7707
|
})) : e(t, n);
|
|
7700
7708
|
};
|
|
7701
|
-
},
|
|
7709
|
+
}, Ac = (e) => {
|
|
7702
7710
|
let t = e.url ?? "", n = /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
7703
7711
|
return !e.baseURL || n && e.allowAbsoluteUrls !== !1 ? t : t ? `${e.baseURL.replace(/\/?\/$/, "")}/${t.replace(/^\/+/, "")}` : e.baseURL;
|
|
7704
|
-
},
|
|
7705
|
-
let n =
|
|
7712
|
+
}, jc = (e) => e ? typeof e.has == "function" ? e.has("Authorization") : Object.keys(e).some((t) => t.toLowerCase() === "authorization" && e[t] != null) : !1, Mc = (e, t) => {
|
|
7713
|
+
let n = Ec(e, t);
|
|
7706
7714
|
return async (e) => {
|
|
7707
|
-
let t = e.headers, r = await n(
|
|
7715
|
+
let t = e.headers, r = await n(Ac(e), jc(t));
|
|
7708
7716
|
if (!r) return e;
|
|
7709
7717
|
let i = `Bearer ${r}`;
|
|
7710
7718
|
return t && typeof t.set == "function" ? t.set("Authorization", i) : e.headers = {
|
|
@@ -7712,7 +7720,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7712
7720
|
Authorization: i
|
|
7713
7721
|
}, e;
|
|
7714
7722
|
};
|
|
7715
|
-
},
|
|
7723
|
+
}, Nc = 0, Pc = (e, t) => {
|
|
7716
7724
|
let n = t?.signal ?? (typeof e == "object" && e ? e.signal : void 0) ?? void 0;
|
|
7717
7725
|
if (n) return {
|
|
7718
7726
|
get aborted() {
|
|
@@ -7726,34 +7734,34 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7726
7734
|
removeEventListener: (e, t) => n.removeEventListener(e, t)
|
|
7727
7735
|
} : {}
|
|
7728
7736
|
};
|
|
7729
|
-
},
|
|
7737
|
+
}, Fc = (e) => (t) => e.headers?.get(t), Ic = (e, t, n, r, i) => ({
|
|
7730
7738
|
status: e.status,
|
|
7731
|
-
getHeader:
|
|
7739
|
+
getHeader: Fc(e),
|
|
7732
7740
|
readBody: () => e.clone().json(),
|
|
7733
7741
|
request: t.snapshot,
|
|
7734
|
-
replay: async (e) =>
|
|
7742
|
+
replay: async (e) => Ic(await t.replay(n, e), t, n, r, i),
|
|
7735
7743
|
markers: r,
|
|
7736
7744
|
raw: e,
|
|
7737
7745
|
replayable: t.replayable,
|
|
7738
7746
|
replayUnsupportedReason: t.reason,
|
|
7739
7747
|
signal: i,
|
|
7740
7748
|
responseType: e.type
|
|
7741
|
-
}),
|
|
7749
|
+
}), Lc = (e, t) => {
|
|
7742
7750
|
let n = (t, n) => {
|
|
7743
|
-
|
|
7751
|
+
Nc += 1;
|
|
7744
7752
|
try {
|
|
7745
7753
|
return e(t, n);
|
|
7746
7754
|
} finally {
|
|
7747
|
-
--
|
|
7755
|
+
--Nc;
|
|
7748
7756
|
}
|
|
7749
7757
|
};
|
|
7750
7758
|
return async (e, r) => {
|
|
7751
|
-
if (
|
|
7752
|
-
let i =
|
|
7759
|
+
if (Nc > 0) return n(e, r);
|
|
7760
|
+
let i = ls(t), a = pc(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = Ds(await Ts(Ic(o, a, n, {}, Pc(e, r)), i), o, i);
|
|
7753
7761
|
if (s.settle === "reject") throw s.error;
|
|
7754
7762
|
return s.value;
|
|
7755
7763
|
};
|
|
7756
|
-
},
|
|
7764
|
+
}, Rc = new Set(Vo.filter((e) => !e.requiresPrepare).map((e) => e.type)), zc = (e) => {
|
|
7757
7765
|
if (!e || typeof e != "object" || !e.challenge_id || !e.expires_at) throw new $({
|
|
7758
7766
|
kind: "protocol",
|
|
7759
7767
|
message: "The upgrade start response is missing challenge_id or expires_at"
|
|
@@ -7765,17 +7773,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7765
7773
|
webauthn: e.webauthn,
|
|
7766
7774
|
codeSentTo: e.code_sent_to
|
|
7767
7775
|
};
|
|
7768
|
-
},
|
|
7776
|
+
}, Bc = (e) => Pa(e) && !Fa(e), Vc = (e) => ({
|
|
7769
7777
|
async prepare(t, n) {
|
|
7770
|
-
if (!
|
|
7778
|
+
if (!Rc.has(t)) try {
|
|
7771
7779
|
let r = e.relyingPartyId?.();
|
|
7772
|
-
return
|
|
7780
|
+
return zc(await e.startUpgrade({
|
|
7773
7781
|
method: t,
|
|
7774
7782
|
...r ? { relying_party_id: r } : {},
|
|
7775
7783
|
...n?.resend ? { resend: !0 } : {}
|
|
7776
7784
|
}));
|
|
7777
7785
|
} catch (e) {
|
|
7778
|
-
if (
|
|
7786
|
+
if (Bc(e)) throw e;
|
|
7779
7787
|
let t = Va(e, "start");
|
|
7780
7788
|
if (t.kind === "prepare_not_required") return;
|
|
7781
7789
|
throw t;
|
|
@@ -7793,17 +7801,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7793
7801
|
assertion: n
|
|
7794
7802
|
});
|
|
7795
7803
|
} catch (t) {
|
|
7796
|
-
if (
|
|
7804
|
+
if (Bc(t)) throw t;
|
|
7797
7805
|
let n = Va(t, "refresh");
|
|
7798
7806
|
throw n.status === 401 && Ua(n) && e.markSessionInvalid?.(), n;
|
|
7799
7807
|
}
|
|
7800
7808
|
}
|
|
7801
|
-
}),
|
|
7809
|
+
}), Hc = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Uc = (e) => {
|
|
7802
7810
|
let t, n = (e) => e !== void 0 && t === e, r = (r) => {
|
|
7803
7811
|
let i = () => {
|
|
7804
7812
|
if (!n(r())) throw new $({ kind: "session_changed" });
|
|
7805
7813
|
};
|
|
7806
|
-
return
|
|
7814
|
+
return Vc({
|
|
7807
7815
|
...e,
|
|
7808
7816
|
relyingPartyId: () => t?.options.relyingPartyId ?? e.relyingPartyId?.(),
|
|
7809
7817
|
startUpgrade: (t) => (i(), e.startUpgrade(t)),
|
|
@@ -7814,7 +7822,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7814
7822
|
});
|
|
7815
7823
|
}, i = (t, n) => {
|
|
7816
7824
|
let i = {}, a = {
|
|
7817
|
-
controller: new
|
|
7825
|
+
controller: new cs({
|
|
7818
7826
|
transport: r(() => i.current),
|
|
7819
7827
|
prompt: t.prompt,
|
|
7820
7828
|
platform: e.platform,
|
|
@@ -7826,7 +7834,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7826
7834
|
options: t,
|
|
7827
7835
|
scope: {
|
|
7828
7836
|
passflow: e.passflowDomain,
|
|
7829
|
-
backend:
|
|
7837
|
+
backend: Hc(t.backend)
|
|
7830
7838
|
},
|
|
7831
7839
|
generation: n
|
|
7832
7840
|
};
|
|
@@ -7836,14 +7844,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7836
7844
|
s = void 0;
|
|
7837
7845
|
});
|
|
7838
7846
|
let c = (e) => {
|
|
7839
|
-
if (!s ||
|
|
7847
|
+
if (!s || ss(s.challenge, e)) return;
|
|
7840
7848
|
let t = Math.min(o, e.maxAge === void 0 ? o : e.maxAge * 1e3);
|
|
7841
7849
|
if (!(Date.now() - s.at > t)) return s.challenge;
|
|
7842
7850
|
}, l = async (r, i) => {
|
|
7843
7851
|
let o = t;
|
|
7844
7852
|
if (!o) throw new Ga("Step-up verification is not enabled on this Passflow instance");
|
|
7845
7853
|
let l = e.stopRepeatedElevation ? c(r) : void 0;
|
|
7846
|
-
if (l) throw new Wa(
|
|
7854
|
+
if (l) throw new Wa(is(l), is(r), "This requirement was already proved and the server still refused it: sign the user in again");
|
|
7847
7855
|
o.controller.active || (o.pin = e.readSessionPin?.());
|
|
7848
7856
|
let u = await o.controller.elevate(r, i);
|
|
7849
7857
|
if (!n(o)) throw new Ka();
|
|
@@ -7893,9 +7901,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7893
7901
|
let r = [];
|
|
7894
7902
|
if (e.attachInternalSeam) {
|
|
7895
7903
|
let t = e.attachInternalSeam;
|
|
7896
|
-
t((e) =>
|
|
7904
|
+
t((e) => xc(u, e)), r.push(() => t(void 0));
|
|
7897
7905
|
}
|
|
7898
|
-
n.interceptFetch && r.push(ur((e, t, n) =>
|
|
7906
|
+
n.interceptFetch && r.push(ur((e, t, n) => Lc(e, u)(t, n), {
|
|
7899
7907
|
priority: 20,
|
|
7900
7908
|
name: "passflow-upgrade"
|
|
7901
7909
|
})), e.onSessionChange && r.push(e.onSessionChange(() => {
|
|
@@ -7927,8 +7935,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7927
7935
|
enumerable: !0,
|
|
7928
7936
|
value: (t, n) => {
|
|
7929
7937
|
let r = (t) => {
|
|
7930
|
-
let r =
|
|
7931
|
-
return e.readAccessToken ?
|
|
7938
|
+
let r = Lc(t, u);
|
|
7939
|
+
return e.readAccessToken ? kc(r, e.readAccessToken, n) : r;
|
|
7932
7940
|
};
|
|
7933
7941
|
if (t) return r(t);
|
|
7934
7942
|
let i = typeof globalThis > "u" ? void 0 : globalThis;
|
|
@@ -7939,14 +7947,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7939
7947
|
attachAuth: {
|
|
7940
7948
|
enumerable: !0,
|
|
7941
7949
|
value: (t, n) => {
|
|
7942
|
-
let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(
|
|
7950
|
+
let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(Mc(e.readAccessToken, n)), a = Sc(t, u);
|
|
7943
7951
|
return () => {
|
|
7944
7952
|
a(), r && i !== void 0 && r.eject(i);
|
|
7945
7953
|
};
|
|
7946
7954
|
}
|
|
7947
7955
|
}
|
|
7948
7956
|
});
|
|
7949
|
-
},
|
|
7957
|
+
}, Wc, Gc = class {
|
|
7950
7958
|
get origin() {
|
|
7951
7959
|
return this.platform.getCurrentUrl()?.origin ?? "";
|
|
7952
7960
|
}
|
|
@@ -7959,7 +7967,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7959
7967
|
prefix: e.keyStoragePrefix ?? "",
|
|
7960
7968
|
storage: this.platform.storage,
|
|
7961
7969
|
appId: n
|
|
7962
|
-
}), this.deviceService = new he(this.storageManager), this.authApi = new vn(e, this.storageManager, this.deviceService), this.appApi = new dn(e, this.storageManager, this.deviceService), this.userApi = new kn(e, this.storageManager, this.deviceService), this.settingApi = new xn(e, this.storageManager, this.deviceService), this.tenantApi = new Sn(e, this.storageManager, this.deviceService), this.invitationApi = new bn(e, this.storageManager, this.deviceService), this.twoFactorApi = new Dn(e, this.storageManager, this.deviceService), this.upgradeApi = new On(e, this.storageManager, this.deviceService), this.upgradeDomain = et(e.url), this.subscribeStore = new Gr(), this.tokenCacheService = new
|
|
7970
|
+
}), this.deviceService = new he(this.storageManager), this.authApi = new vn(e, this.storageManager, this.deviceService), this.appApi = new dn(e, this.storageManager, this.deviceService), this.userApi = new kn(e, this.storageManager, this.deviceService), this.settingApi = new xn(e, this.storageManager, this.deviceService), this.tenantApi = new Sn(e, this.storageManager, this.deviceService), this.invitationApi = new bn(e, this.storageManager, this.deviceService), this.twoFactorApi = new Dn(e, this.storageManager, this.deviceService), this.upgradeApi = new On(e, this.storageManager, this.deviceService), this.upgradeDomain = et(e.url), this.subscribeStore = new Gr(), this.tokenCacheService = new ko(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? x, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
|
|
7963
7971
|
let i = Ui(e.refreshCoordination, this.platform, e.keyStoragePrefix, { tokenKeys: () => this.storageManager.tokenKeys() });
|
|
7964
7972
|
this.deviceKeyService = e.deviceKey === !0 && !e.tokenExchange?.enabled ? Jn({
|
|
7965
7973
|
dbName: Gn(e.keyStoragePrefix),
|
|
@@ -7990,7 +7998,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7990
7998
|
...e.antiBotWorkerUrl ? { workerUrl: e.antiBotWorkerUrl } : {}
|
|
7991
7999
|
}), this.authApi.setAntiBotHandler((e) => this.antiBot.headerFor(e)), this.riskIds = di({ readSettings: () => this.readAppSettings() }), this.authApi.setRiskIdHandler((e) => this.riskIds.headersFor(e)), this.tokenCacheService.attachRefreshController(this.authService.refresh);
|
|
7992
8000
|
for (let e of this.axiosClients()) e.setRefreshHandler((e) => this.authService.refresh.ensureFresh(e));
|
|
7993
|
-
this.userService = new
|
|
8001
|
+
this.userService = new jo(this.userApi, this.deviceService, this.platform), this.tenantService = new Oo(this.tenantApi, this.scopes, void 0, () => this.storageManager.getToken(N.access_token)), this.tenant = this.tenantService, this.invitationService = new Co(this.invitationApi), this.twoFactorService = new Ao(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Uc({
|
|
7994
8002
|
startUpgrade: (e) => this.upgradeApi.startUpgrade(e),
|
|
7995
8003
|
commitRefresh: async (e, t) => {
|
|
7996
8004
|
await this.authService.refreshToken(e, t);
|
|
@@ -8019,7 +8027,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
8019
8027
|
let e = (await this.getTokens(!0))?.access_token;
|
|
8020
8028
|
return e && !j(M(e)) ? e : void 0;
|
|
8021
8029
|
}
|
|
8022
|
-
}), this.hostedUpgrade =
|
|
8030
|
+
}), this.hostedUpgrade = Uc({
|
|
8023
8031
|
startUpgrade: (e) => this.upgradeApi.startHostedUpgrade(e),
|
|
8024
8032
|
commitRefresh: (e) => this.upgradeApi.commitHostedUpgrade(e),
|
|
8025
8033
|
canCommit: () => ({ ok: !0 }),
|
|
@@ -8056,7 +8064,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
8056
8064
|
return this.upgrade.attachAuth(e, t);
|
|
8057
8065
|
}
|
|
8058
8066
|
createClient(e, t) {
|
|
8059
|
-
return
|
|
8067
|
+
return Cc(e, (e) => this.upgrade.attachAuth(e, t));
|
|
8060
8068
|
}
|
|
8061
8069
|
readAssuranceBar() {
|
|
8062
8070
|
let e = this.storageManager.getToken(N.access_token);
|
|
@@ -8742,7 +8750,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
8742
8750
|
this.twoFactorService.clearMagicLinkSession();
|
|
8743
8751
|
}
|
|
8744
8752
|
};
|
|
8745
|
-
|
|
8746
|
-
export { bt as ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID, m as AGENT_TOOL_HEADER_KEY, v as ANTI_BOT_ACTION, ot as ANTI_BOT_FAILED_ERROR_ID, p as ANTI_BOT_HEADER_KEY, ut as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, lt as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, at as ANTI_BOT_REQUIRED_ERROR_ID, dt as ANTI_BOT_SOLVE_FAILED_ERROR_ID, ct as ANTI_BOT_UNAVAILABLE_ERROR_ID, l as APP_ID_HEADER_KEY, Dt as APP_SECRET_NAMES, u as AUTHORIZATION_HEADER_KEY, dn as AppAPI, vn as AuthAPI, So as AuthService, yn as CLIAuthAPI, S as DEFAULT_GROUP_NAME, x as DEFAULT_SCOPES,
|
|
8753
|
+
Wc = Gc, Wc.version = y;
|
|
8754
|
+
export { bt as ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID, m as AGENT_TOOL_HEADER_KEY, v as ANTI_BOT_ACTION, ot as ANTI_BOT_FAILED_ERROR_ID, p as ANTI_BOT_HEADER_KEY, ut as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, lt as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, at as ANTI_BOT_REQUIRED_ERROR_ID, dt as ANTI_BOT_SOLVE_FAILED_ERROR_ID, ct as ANTI_BOT_UNAVAILABLE_ERROR_ID, l as APP_ID_HEADER_KEY, Dt as APP_SECRET_NAMES, u as AUTHORIZATION_HEADER_KEY, dn as AppAPI, vn as AuthAPI, So as AuthService, yn as CLIAuthAPI, S as DEFAULT_GROUP_NAME, x as DEFAULT_SCOPES, Vo as DEFAULT_UPGRADE_FACTORS, d as DEVICE_ID_HEADER_KEY, h as DEVICE_PROOF_HEADER_KEY, f as DEVICE_TYPE_HEADER_KEY, Yn as DeviceKeyErrorId, ht as ENTERPRISE_CONNECTION_AMBIGUOUS_ERROR_ID, ft as ENTERPRISE_EMAIL_INVALID_ERROR_ID, mt as ENTERPRISE_NO_CONNECTION_ERROR_ID, pt as ENTERPRISE_START_INPUT_ERROR_ID, re as ERROR_MESSAGE_MAX_LENGTH, Zn as FETCH_PRIORITY_OIDC, Qn as FETCH_PRIORITY_UPGRADE, g as FINGERPRINT_EVENT_HEADER_KEY, $n as FetchMiddlewareContractError, Me as INSUFFICIENT_USER_AUTHENTICATION, bn as InvitationAPI, Co as InvitationService, yr as M2MClient, mr as M2MConfigError, H as M2MError, hr as M2MErrorCodes, fr as M2MNetworkError, pr as M2MTokenParseError, gr as M2M_DEFAULTS, Ot as MASKED_SECRET_PREFIX, b as MINIMAL_DEFAULT_SCOPES, L as NativeSignInError, jt as OS, ee as PASSFLOW_CLOUD_URL, it as PASSWORD_CHANGE_REQUIRED_ERROR_ID, w as POPUP_HEIGHT, T as POPUP_POLL_INTERVAL_MS, E as POPUP_TIMEOUT_MS, C as POPUP_WIDTH, Gc as Passflow, Tt as PassflowAddressChangeProofRequiredError, $e as PassflowAdminEndpointPaths, wt as PassflowAntiBotChallengeError, R as PassflowEndpointPaths, z as PassflowError, G as PassflowEvent, U as PassflowOidcError, gt as PassflowPasswordChangeRequiredError, Ct as PassflowRecoveryCodesStepUpRequiredError, Y as PassflowRefreshError, St as PassflowSendLimitError, xt as PassflowSmsQuotaExceededError, ge as PopupClosedError, Et as Providers, Oa as RECOVERABLE_COMMIT_ERROR_IDS, yt as RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID, Wi as REFRESH_AUTH_FAILURE_IDS, J as RefreshErrorId, Qe as RequestMethod, y as SDK_VERSION, nt as SERVICE_UNAVAILABLE_ERROR_ID, rt as SERVICE_UNAVAILABLE_MESSAGE, ka as SESSION_INVALIDATING_COMMIT_ERROR_IDS, kt as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, st as SIGN_IN_REFUSED_ERROR_ID, _ as STYTCH_TELEMETRY_HEADER_KEY, F as SessionState, xn as SettingAPI, te as TOKEN_EXPIRY_BUFFER_SECONDS, vt as TWO_FACTOR_SEND_LIMIT_ERROR_ID, _t as TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID, Sn as TenantAPI, Oo as TenantService, Eo as TenantUserMembership, ko as TokenCacheService, P as TokenDeliveryMode, N as TokenType, Dn as TwoFactorApiClient, Pt as TwoFactorPolicy, Ao as TwoFactorService, Ne as UPGRADE_REQUIRED, D as USERNAME_MAX_LENGTH, ne as USERNAME_MIN_LENGTH, On as UpgradeAPI, Jo as UpgradeCancelledError, ra as UpgradeCommitInterruptedError, cs as UpgradeController, Q as UpgradeErrorIds, Mo as UpgradeFactorError, Wa as UpgradeInsufficientError, Ka as UpgradeSessionChangedError, Yo as UpgradeSignInRequiredError, $ as UpgradeTransportError, Ga as UpgradeUnavailableError, es as UpgradeUnsatisfiableError, kn as UserAPI, jo as UserService, Te as WebAdapter, Va as classifyUpgradeError, Ro as emailOtpFactor, Ho as factorRegistry, dr as fetchRegistryState, Mt as getOSFromDeviceType, Ua as invalidatesSessionOnCommit, tt as isEmailVerificationStep, At as isMaskedSecret, Ha as isRecoverableCommitFailure, ja as isRetryableUpgradeKind, j as isTokenExpired, Rs as isUpgradeCancelled, zs as isUpgradeExhausted, Bs as isUpgradeInsufficient, Ws as isUpgradeSessionChanged, Hs as isUpgradeSignInRequired, Fa as isUpgradeTransportError, Gs as isUpgradeTransportFailure, Us as isUpgradeUnavailable, Vs as isUpgradeUnsatisfiable, Za as isValidEmail, Ya as isValidJWTFormat, Qa as isValidPhoneNumber, $a as isValidUsername, Be as parseChallengeBody, ze as parseChallengeHeader, M as parseToken, We as parseUpgradeChallenge, Io as passkeyFactor, Nt as pathWithParams, In as pushChallengeOf, Fo as recoveryCodesFactor, ur as registerFetchMiddleware, je as requiredAcrLevel, et as resolveUpgradeDomain, Xa as sanitizeErrorMessage, qo as selectFactors, zo as smsOtpFactor, Po as totpFactor, Ee as webAdapter };
|
|
8747
8755
|
|
|
8748
8756
|
//# sourceMappingURL=index.mjs.map
|