@passflow/core 0.35.0 → 0.35.2
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 +74 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -27
- package/dist/index.d.ts +31 -27
- package/dist/index.mjs +300 -278
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var i = "__passflowAntiBot", a = (e, t) => {
|
|
|
11
11
|
if (typeof e != "object" || !e) return;
|
|
12
12
|
let t = e[i];
|
|
13
13
|
return typeof t == "object" && t ? t : void 0;
|
|
14
|
-
}, s = "0.35.
|
|
14
|
+
}, s = "0.35.2", c = "X-Passflow-Clientid", l = "Authorization", u = "X-Passflow-DeviceId", d = "X-Passflow-DeviceType", f = "X-Passflow-Anti-Bot", p = "X-Passflow-Agent-Tool", m = "passflow_auth", h = s, g = [
|
|
15
15
|
"id",
|
|
16
16
|
"offline",
|
|
17
17
|
"openid"
|
|
@@ -113,7 +113,13 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
113
113
|
return e.Unknown = "unknown", e.Valid = "valid", e.Invalid = "invalid", e;
|
|
114
114
|
}({}), ce = class {
|
|
115
115
|
constructor(e) {
|
|
116
|
-
this.storageManager = e, this.mode = "json_body", this.sessionState = "unknown", this.isInitializedFlag = !1, this.
|
|
116
|
+
this.storageManager = e, this.mode = "json_body", this.sessionState = "unknown", this.isInitializedFlag = !1, this.SESSION_STATE_KEY = "passflow_session_state", this.loadPersistedMode(), this.loadPersistedSessionState();
|
|
117
|
+
}
|
|
118
|
+
sessionStateKey() {
|
|
119
|
+
return this.storageManager.appKey(this.SESSION_STATE_KEY);
|
|
120
|
+
}
|
|
121
|
+
reload() {
|
|
122
|
+
this.mode = "json_body", this.isInitializedFlag = !1, this.sessionState = "unknown", this.loadPersistedMode(), this.loadPersistedSessionState();
|
|
117
123
|
}
|
|
118
124
|
setMode(e) {
|
|
119
125
|
this.mode = e, this.isInitializedFlag = !0, this.persistMode();
|
|
@@ -157,48 +163,54 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
157
163
|
getSessionState() {
|
|
158
164
|
return this.sessionState;
|
|
159
165
|
}
|
|
160
|
-
reset(
|
|
161
|
-
this.mode = "json_body", this.sessionState = "unknown", this.isInitializedFlag = !1,
|
|
166
|
+
reset() {
|
|
167
|
+
this.mode = "json_body", this.sessionState = "unknown", this.isInitializedFlag = !1, this.clearPersistedSessionState(), this.storageManager.clearDeliveryMode();
|
|
162
168
|
}
|
|
163
169
|
loadPersistedMode() {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
e && Object.values(N).includes(e) && (this.mode = e, this.isInitializedFlag = !0);
|
|
167
|
-
} catch {}
|
|
170
|
+
let e = this.storageManager.getDeliveryMode();
|
|
171
|
+
e && (this.mode = e, this.isInitializedFlag = !0);
|
|
168
172
|
}
|
|
169
173
|
loadPersistedSessionState() {
|
|
170
174
|
try {
|
|
171
|
-
let e = this.storageManager.storage.getItem(this.
|
|
175
|
+
let e = this.storageManager.storage.getItem(this.sessionStateKey());
|
|
172
176
|
e && Object.values(se).includes(e) && (this.sessionState = e);
|
|
173
177
|
} catch {}
|
|
174
178
|
}
|
|
175
179
|
persistMode() {
|
|
176
|
-
|
|
177
|
-
this.storageManager.storage.setItem(this.DELIVERY_MODE_KEY, this.mode);
|
|
178
|
-
} catch {}
|
|
180
|
+
this.storageManager.setDeliveryMode(this.mode);
|
|
179
181
|
}
|
|
180
182
|
persistSessionState() {
|
|
181
183
|
try {
|
|
182
|
-
this.storageManager.storage.setItem(this.
|
|
183
|
-
} catch {}
|
|
184
|
-
}
|
|
185
|
-
clearPersistedMode() {
|
|
186
|
-
try {
|
|
187
|
-
this.storageManager.storage.removeItem(this.DELIVERY_MODE_KEY);
|
|
184
|
+
this.storageManager.storage.setItem(this.sessionStateKey(), this.sessionState);
|
|
188
185
|
} catch {}
|
|
189
186
|
}
|
|
190
187
|
clearPersistedSessionState() {
|
|
191
188
|
try {
|
|
192
|
-
this.storageManager.storage.removeItem(this.
|
|
189
|
+
this.storageManager.storage.removeItem(this.sessionStateKey());
|
|
193
190
|
} catch {}
|
|
194
191
|
}
|
|
195
192
|
}, P = "tokens_scopes", F = "passflowDeviceId", I = "passflowInvitationToken", le = "passflowPreviousRedirectUrl", ue = class {
|
|
196
193
|
constructor({ storage: e, prefix: t, appId: n } = {}) {
|
|
197
|
-
this.keyStoragePrefix = "", this.STORAGE_PREFIX = "passflow_", this.
|
|
194
|
+
this.keyStoragePrefix = "", this.STORAGE_PREFIX = "passflow_", this.storage = e ?? localStorage, this.keyStoragePrefix = t ? `${t}_` : "", this.scopes = `${this.keyStoragePrefix}${P}`, this.deviceId = `${this.keyStoragePrefix}${F}`, this.invitationToken = `${this.keyStoragePrefix}${I}`, this.previousRedirectUrl = `${this.keyStoragePrefix}${le}`, this.appId = n || void 0;
|
|
198
195
|
}
|
|
199
196
|
setAppId(e) {
|
|
200
197
|
this.appId = e || void 0;
|
|
201
198
|
}
|
|
199
|
+
getAppId() {
|
|
200
|
+
return this.appId;
|
|
201
|
+
}
|
|
202
|
+
appKey(e) {
|
|
203
|
+
return this.appId ? `${e}:${this.appId}` : e;
|
|
204
|
+
}
|
|
205
|
+
idTokenKey() {
|
|
206
|
+
return this.appKey(`${this.STORAGE_PREFIX}id_token`);
|
|
207
|
+
}
|
|
208
|
+
csrfTokenKey() {
|
|
209
|
+
return this.appKey(`${this.STORAGE_PREFIX}csrf_token`);
|
|
210
|
+
}
|
|
211
|
+
deliveryModeKey() {
|
|
212
|
+
return this.appKey(`${this.STORAGE_PREFIX}delivery_mode`);
|
|
213
|
+
}
|
|
202
214
|
ownToken(e) {
|
|
203
215
|
if (!e) return;
|
|
204
216
|
if (!this.appId) return e;
|
|
@@ -227,7 +239,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
227
239
|
this.getKeyForTokenType(M.access_token),
|
|
228
240
|
this.getKeyForTokenType(M.refresh_token),
|
|
229
241
|
this.getKeyForTokenType(M.id_token),
|
|
230
|
-
this.
|
|
242
|
+
this.idTokenKey()
|
|
231
243
|
];
|
|
232
244
|
}
|
|
233
245
|
holdsOtherAppToken(e) {
|
|
@@ -245,7 +257,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
245
257
|
}
|
|
246
258
|
saveTokens(e, t, n) {
|
|
247
259
|
let { id_token: r, access_token: i, refresh_token: a, scopes: o } = e;
|
|
248
|
-
if (t === N.Cookie || t === N.BFF) r && this.storage.setItem(this.
|
|
260
|
+
if (t === N.Cookie || t === N.BFF) r && this.storage.setItem(this.idTokenKey(), r);
|
|
249
261
|
else {
|
|
250
262
|
if (n?.replace && i) {
|
|
251
263
|
let e = this.holdsOnlyOtherAppSession();
|
|
@@ -260,7 +272,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
260
272
|
getTokens() {
|
|
261
273
|
let e = this.getDeliveryMode();
|
|
262
274
|
if (e === N.Cookie || e === N.BFF) {
|
|
263
|
-
let e = this.readToken(this.
|
|
275
|
+
let e = this.readToken(this.idTokenKey());
|
|
264
276
|
return e ? { id_token: e } : void 0;
|
|
265
277
|
}
|
|
266
278
|
let t = this.readToken(this.getKeyForTokenType(M.access_token));
|
|
@@ -278,7 +290,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
278
290
|
return !!this.readToken(this.getKeyForTokenType(M.access_token));
|
|
279
291
|
}
|
|
280
292
|
hasCookieModeIdToken() {
|
|
281
|
-
return !!this.readToken(this.
|
|
293
|
+
return !!this.readToken(this.idTokenKey());
|
|
282
294
|
}
|
|
283
295
|
deleteToken(e) {
|
|
284
296
|
let t = this.getKeyForTokenType(e);
|
|
@@ -287,7 +299,7 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
287
299
|
deleteTokens() {
|
|
288
300
|
let e = this.holdsOnlyOtherAppSession();
|
|
289
301
|
for (let e of this.tokenValueKeys()) this.removeOwnToken(e);
|
|
290
|
-
e ||
|
|
302
|
+
e || this.removePrefixed(this.scopes, P), this.clearDeliveryMode(), this.clearCsrfToken(), this.appId && this.getHostedSignIn() === void 0 && this.storage.getItem(this.hostedSignInKey()) || this.storage.removeItem(this.hostedSignInKey());
|
|
291
303
|
}
|
|
292
304
|
setHostedSignIn(e) {
|
|
293
305
|
this.storage.setItem(this.hostedSignInKey(), JSON.stringify({
|
|
@@ -335,55 +347,52 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
335
347
|
}
|
|
336
348
|
setDeliveryMode(e) {
|
|
337
349
|
try {
|
|
338
|
-
this.storage.setItem(this.
|
|
350
|
+
this.storage.setItem(this.deliveryModeKey(), e);
|
|
339
351
|
} catch {}
|
|
340
352
|
}
|
|
341
353
|
getDeliveryMode() {
|
|
342
354
|
try {
|
|
343
|
-
let e = this.storage.getItem(this.
|
|
355
|
+
let e = this.storage.getItem(this.deliveryModeKey());
|
|
344
356
|
if (e && Object.values(N).includes(e)) return e;
|
|
345
357
|
} catch {}
|
|
346
358
|
}
|
|
347
359
|
clearDeliveryMode() {
|
|
348
360
|
try {
|
|
349
|
-
this.storage.removeItem(this.
|
|
361
|
+
this.storage.removeItem(this.deliveryModeKey());
|
|
350
362
|
} catch {}
|
|
351
363
|
}
|
|
352
364
|
getIdToken() {
|
|
353
365
|
try {
|
|
354
|
-
return this.readToken(this.
|
|
366
|
+
return this.readToken(this.idTokenKey());
|
|
355
367
|
} catch {
|
|
356
368
|
return;
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
371
|
setIdToken(e) {
|
|
360
372
|
try {
|
|
361
|
-
this.storage.setItem(this.
|
|
373
|
+
this.storage.setItem(this.idTokenKey(), e);
|
|
362
374
|
} catch {}
|
|
363
375
|
}
|
|
364
376
|
clearIdToken() {
|
|
365
377
|
try {
|
|
366
|
-
this.removeOwnToken(this.
|
|
378
|
+
this.removeOwnToken(this.idTokenKey());
|
|
367
379
|
} catch {}
|
|
368
380
|
}
|
|
369
381
|
getCsrfToken() {
|
|
370
382
|
try {
|
|
371
|
-
return this.storage.getItem(this.
|
|
383
|
+
return this.storage.getItem(this.csrfTokenKey()) ?? void 0;
|
|
372
384
|
} catch {
|
|
373
385
|
return;
|
|
374
386
|
}
|
|
375
387
|
}
|
|
376
388
|
setCsrfToken(e) {
|
|
377
389
|
try {
|
|
378
|
-
this.storage.setItem(this.
|
|
390
|
+
this.storage.setItem(this.csrfTokenKey(), e);
|
|
379
391
|
} catch {}
|
|
380
392
|
}
|
|
381
393
|
clearCsrfToken() {
|
|
382
|
-
this.holdsOnlyOtherAppSession() || this.removeCsrfToken();
|
|
383
|
-
}
|
|
384
|
-
removeCsrfToken() {
|
|
385
394
|
try {
|
|
386
|
-
this.storage.removeItem(this.
|
|
395
|
+
this.storage.removeItem(this.csrfTokenKey());
|
|
387
396
|
} catch {}
|
|
388
397
|
}
|
|
389
398
|
tokenKeys() {
|
|
@@ -392,9 +401,9 @@ var M = /* @__PURE__ */ function(e) {
|
|
|
392
401
|
this.getKeyForTokenType(M.access_token),
|
|
393
402
|
this.getKeyForTokenType(M.refresh_token),
|
|
394
403
|
this.scopes,
|
|
395
|
-
this.
|
|
396
|
-
this.
|
|
397
|
-
this.
|
|
404
|
+
this.idTokenKey(),
|
|
405
|
+
this.csrfTokenKey(),
|
|
406
|
+
this.deliveryModeKey()
|
|
398
407
|
];
|
|
399
408
|
}
|
|
400
409
|
getKeyForTokenType(e) {
|
|
@@ -904,7 +913,7 @@ var ot = /* @__PURE__ */ function(e) {
|
|
|
904
913
|
return this.send(Re.DELETE, e, t);
|
|
905
914
|
}
|
|
906
915
|
setAppId(e) {
|
|
907
|
-
this.appId = e, this.defaultHeaders = {
|
|
916
|
+
this.appId = e, this.tokenDeliveryManager.reload(), this.defaultHeaders = {
|
|
908
917
|
...this.defaultHeaders,
|
|
909
918
|
[c]: e
|
|
910
919
|
}, this.instance.defaults.headers[c] = e;
|
|
@@ -4054,7 +4063,18 @@ function Gi(e) {
|
|
|
4054
4063
|
return t.length > 64 || !/^[A-Z0-9-]+$/.test(t) || t.replace(/-/g, "") === "" ? null : t;
|
|
4055
4064
|
}
|
|
4056
4065
|
// lib/services/auth-service.ts
|
|
4057
|
-
var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow_pwless_pending", Xi = 3e3, Zi = "passflow_federated_pkce", Qi = 6e5, $i = "AppId is required for federated auth"
|
|
4066
|
+
var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow_pwless_pending", Xi = 3e3, Zi = "passflow_federated_pkce", Qi = 6e5, $i = "AppId is required for federated auth";
|
|
4067
|
+
function ea(e) {
|
|
4068
|
+
let t;
|
|
4069
|
+
try {
|
|
4070
|
+
t = new URL(e).protocol;
|
|
4071
|
+
} catch {
|
|
4072
|
+
t = void 0;
|
|
4073
|
+
}
|
|
4074
|
+
if (t !== "https:" && t !== "http:") throw Error("The federated start returned an address that is not http or https");
|
|
4075
|
+
return e;
|
|
4076
|
+
}
|
|
4077
|
+
var ta = 10, na = "The sign-in answered with a PKCE code, but its verifier is gone", ra = (e, t) => new Promise((n, r) => {
|
|
4058
4078
|
if (t?.aborted) {
|
|
4059
4079
|
r(t.reason);
|
|
4060
4080
|
return;
|
|
@@ -4065,21 +4085,21 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4065
4085
|
t?.removeEventListener("abort", i), n();
|
|
4066
4086
|
}, e);
|
|
4067
4087
|
t?.addEventListener("abort", i, { once: !0 });
|
|
4068
|
-
}),
|
|
4088
|
+
}), ia = (e) => {
|
|
4069
4089
|
if (!e) return;
|
|
4070
4090
|
let t = new URLSearchParams(e.search).get("token");
|
|
4071
4091
|
if (t) return t;
|
|
4072
4092
|
let n = e.hash.indexOf("?");
|
|
4073
4093
|
return n < 0 ? void 0 : new URLSearchParams(e.hash.slice(n + 1)).get("token") ?? void 0;
|
|
4074
|
-
},
|
|
4094
|
+
}, aa = (e) => {
|
|
4075
4095
|
if (e) try {
|
|
4076
4096
|
return j(e).email;
|
|
4077
4097
|
} catch {
|
|
4078
4098
|
return;
|
|
4079
4099
|
}
|
|
4080
|
-
},
|
|
4100
|
+
}, oa = class {
|
|
4081
4101
|
constructor(e, t, n, r, i, a, o, s, c, l, u, d = R, f, p = { coordination: jr() }, m) {
|
|
4082
|
-
this.authApi = e, this.deviceService = t, this.storageManager = n, this.subscribeStore = r, this.tokenCacheService = i, this.scopes = a, this.createTenantForNewUser = o, this.url = s, this.sessionCallbacks = c, this.appId = l, this.platform = d, this.readPkceEnabled = f, this.readAppSettings = m, this.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ce(n),
|
|
4102
|
+
this.authApi = e, this.deviceService = t, this.storageManager = n, this.subscribeStore = r, this.tokenCacheService = i, this.scopes = a, this.createTenantForNewUser = o, this.url = s, this.sessionCallbacks = c, this.appId = l, this.platform = d, this.readPkceEnabled = f, this.readAppSettings = m, this.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ce(n), this.setBffModeIfConfigured(), this.refresh = fi({
|
|
4083
4103
|
emit: this.createRefreshEmit(),
|
|
4084
4104
|
storage: n,
|
|
4085
4105
|
cache: i,
|
|
@@ -4091,7 +4111,10 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4091
4111
|
}), this.initializeSession();
|
|
4092
4112
|
}
|
|
4093
4113
|
setAppId(e) {
|
|
4094
|
-
this.appId = e;
|
|
4114
|
+
this.appId = e, this.tokenDeliveryManager.reload(), this.setBffModeIfConfigured();
|
|
4115
|
+
}
|
|
4116
|
+
setBffModeIfConfigured() {
|
|
4117
|
+
this.tokenExchangeConfig?.enabled && this.tokenDeliveryManager.setMode(N.BFF);
|
|
4095
4118
|
}
|
|
4096
4119
|
async isSimpleModeApp() {
|
|
4097
4120
|
try {
|
|
@@ -4117,7 +4140,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4117
4140
|
if (!this.tokenDeliveryManager.isCookieMode()) return !1;
|
|
4118
4141
|
try {
|
|
4119
4142
|
let e = await this.authApi.validateSession();
|
|
4120
|
-
return e
|
|
4143
|
+
return e?.id ? (this.tokenDeliveryManager.setSessionValid(), this.subscribeStore.notify(G.SessionRestored, e), !0) : (this.tokenDeliveryManager.setSessionInvalid(), !1);
|
|
4121
4144
|
} catch {
|
|
4122
4145
|
return this.tokenDeliveryManager.setSessionInvalid(), !1;
|
|
4123
4146
|
}
|
|
@@ -4160,7 +4183,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4160
4183
|
rememberEmailChallenge(e, t) {
|
|
4161
4184
|
this.emailChallenges.delete(e), this.emailChallenges.set(e, t);
|
|
4162
4185
|
for (let e of this.emailChallenges.keys()) {
|
|
4163
|
-
if (this.emailChallenges.size <=
|
|
4186
|
+
if (this.emailChallenges.size <= ta) break;
|
|
4164
4187
|
this.emailChallenges.delete(e);
|
|
4165
4188
|
}
|
|
4166
4189
|
}
|
|
@@ -4247,7 +4270,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4247
4270
|
}
|
|
4248
4271
|
async completePkceSignIn(e) {
|
|
4249
4272
|
let t = this.readPendingPkce();
|
|
4250
|
-
if (!t) throw Error(
|
|
4273
|
+
if (!t) throw Error(na);
|
|
4251
4274
|
let n = await this.authApi.pkceExchange(e, t.verifier);
|
|
4252
4275
|
return await this.processAuthResponse(n, t.scopes ?? this.scopes), n;
|
|
4253
4276
|
}
|
|
@@ -4420,7 +4443,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4420
4443
|
if (i = !0, this.handlePendingSecondFactor(n, r?.email, r && { verifier: r.verifier }, r?.scopes)) return this.forgetPendingPasswordless(), n;
|
|
4421
4444
|
let a = n;
|
|
4422
4445
|
if (n.code) {
|
|
4423
|
-
if (!r) throw Error(
|
|
4446
|
+
if (!r) throw Error(na);
|
|
4424
4447
|
if (a = await this.authApi.pkceExchange(n.code, r.verifier), this.handlePendingSecondFactor(a)) return this.forgetPendingPasswordless(), {
|
|
4425
4448
|
...a,
|
|
4426
4449
|
redirect_url: n.redirect_url ?? ""
|
|
@@ -4452,11 +4475,11 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4452
4475
|
let n = t?.signal;
|
|
4453
4476
|
try {
|
|
4454
4477
|
let t = this.readPendingPasswordless();
|
|
4455
|
-
if (t?.challengeId !== e) throw Error(
|
|
4478
|
+
if (t?.challengeId !== e) throw Error(na);
|
|
4456
4479
|
for (;;) {
|
|
4457
4480
|
if (n?.aborted) throw n.reason;
|
|
4458
4481
|
if (Date.now() >= t.expiresAt) return this.forgetPendingPasswordless(), { status: "expired" };
|
|
4459
|
-
if (this.readPendingPasswordless()?.challengeId !== e) throw Error(
|
|
4482
|
+
if (this.readPendingPasswordless()?.challengeId !== e) throw Error(na);
|
|
4460
4483
|
let r;
|
|
4461
4484
|
try {
|
|
4462
4485
|
r = await this.authApi.passwordlessStatus({
|
|
@@ -4474,7 +4497,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4474
4497
|
status: "signed-in",
|
|
4475
4498
|
tokens: { redirect_url: r.redirect_url }
|
|
4476
4499
|
};
|
|
4477
|
-
await
|
|
4500
|
+
await ra(Xi, n);
|
|
4478
4501
|
}
|
|
4479
4502
|
} catch (e) {
|
|
4480
4503
|
if (n?.aborted && e === n.reason) throw e;
|
|
@@ -4543,14 +4566,14 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4543
4566
|
let t = this.emailChallenges.get(e.challenge_id), n = t?.email;
|
|
4544
4567
|
try {
|
|
4545
4568
|
let r = t?.pkce === !1 ? void 0 : this.readPendingPkce();
|
|
4546
|
-
if (t?.pkce && !r) throw Error(
|
|
4569
|
+
if (t?.pkce && !r) throw Error(na);
|
|
4547
4570
|
let i = await this.authApi.validateEmailCode(e);
|
|
4548
4571
|
this.emailChallenges.delete(e.challenge_id);
|
|
4549
4572
|
let a = r?.scopes ?? t?.scopes ?? this.scopes;
|
|
4550
4573
|
if (this.handleEmailVerificationStep(i, t?.operation ?? "sign-in", n, r, a) || this.handlePendingSecondFactor(i, n, r, a)) return i;
|
|
4551
4574
|
let o = i;
|
|
4552
4575
|
if (i.code) {
|
|
4553
|
-
if (!r) throw Error(
|
|
4576
|
+
if (!r) throw Error(na);
|
|
4554
4577
|
if (o = await this.authApi.pkceExchange(i.code, r.verifier), this.handlePendingSecondFactor(o, n)) return o;
|
|
4555
4578
|
}
|
|
4556
4579
|
let s = i.redirect_url ? {
|
|
@@ -4607,8 +4630,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4607
4630
|
} catch {}
|
|
4608
4631
|
}
|
|
4609
4632
|
clearLocalSession() {
|
|
4610
|
-
|
|
4611
|
-
this.storageManager.deleteTokens(), this.storageManager.clearIdToken(), this.storageManager.clearCsrfToken(), this.tokenDeliveryManager.reset(e), this.tokenCacheService.setTokensCache(void 0), this.tokenCacheService.stopTokenCheck?.();
|
|
4633
|
+
this.storageManager.deleteTokens(), this.tokenDeliveryManager.reset(), this.tokenCacheService.setTokensCache(void 0), this.tokenCacheService.stopTokenCheck?.();
|
|
4612
4634
|
}
|
|
4613
4635
|
readSessionPin() {
|
|
4614
4636
|
try {
|
|
@@ -4753,10 +4775,10 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4753
4775
|
}
|
|
4754
4776
|
async resetPassword(e, t, n) {
|
|
4755
4777
|
this.subscribeStore.notify(G.SignInStart, {});
|
|
4756
|
-
let r = n ??
|
|
4778
|
+
let r = n ?? ia(this.platform.getCurrentUrl()), i = t ?? this.scopes;
|
|
4757
4779
|
try {
|
|
4758
4780
|
let t = await this.startPkce(), n = t ? await this.authApi.resetPassword(e, i, r, t.challenge) : await this.authApi.resetPassword(e, i, r);
|
|
4759
|
-
if (this.handleEmailVerificationStep(n, "reset-password",
|
|
4781
|
+
if (this.handleEmailVerificationStep(n, "reset-password", aa(r), t, i) || this.handlePendingSecondFactor(n, void 0, t, i)) return n;
|
|
4760
4782
|
let a = await this.exchangeCode(n, t);
|
|
4761
4783
|
if (this.handlePendingSecondFactor(a)) return a;
|
|
4762
4784
|
let o = n.redirect_url ? {
|
|
@@ -4889,7 +4911,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4889
4911
|
} : {}
|
|
4890
4912
|
};
|
|
4891
4913
|
return {
|
|
4892
|
-
url: await this.usesFederatedPost(t) ? (await this.authApi.federatedStart(e.provider, this.federatedStartBody(a, n), t)).auth_url : this.createFederatedAuthUrl(a),
|
|
4914
|
+
url: await this.usesFederatedPost(t) ? ea((await this.authApi.federatedStart(e.provider, this.federatedStartBody(a, n), t)).auth_url) : this.createFederatedAuthUrl(a),
|
|
4893
4915
|
pkce: i
|
|
4894
4916
|
};
|
|
4895
4917
|
})(), o, s = (e) => {
|
|
@@ -4952,7 +4974,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
4952
4974
|
code_challenge: i.challenge,
|
|
4953
4975
|
code_challenge_method: "S256"
|
|
4954
4976
|
} : {}
|
|
4955
|
-
}, o = await this.usesFederatedPost(t) ? (await this.authApi.federatedStart(e.provider, this.federatedStartBody(a, n), t)).auth_url : this.createFederatedAuthUrl(a);
|
|
4977
|
+
}, o = await this.usesFederatedPost(t) ? ea((await this.authApi.federatedStart(e.provider, this.federatedStartBody(a, n), t)).auth_url) : this.createFederatedAuthUrl(a);
|
|
4956
4978
|
i ? this.rememberFederatedSlot(i.verifier, n) : this.forgetFederatedSlot(), this.platform.navigateTo(o);
|
|
4957
4979
|
}).catch((e) => this.reportFederatedRedirectFailure(e));
|
|
4958
4980
|
}
|
|
@@ -5142,7 +5164,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5142
5164
|
return;
|
|
5143
5165
|
}
|
|
5144
5166
|
}
|
|
5145
|
-
},
|
|
5167
|
+
}, sa = class {
|
|
5146
5168
|
constructor(e) {
|
|
5147
5169
|
this.invitationApi = e;
|
|
5148
5170
|
}
|
|
@@ -5161,7 +5183,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5161
5183
|
getInvitationLink(e) {
|
|
5162
5184
|
return this.invitationApi.getInvitationLink(e);
|
|
5163
5185
|
}
|
|
5164
|
-
},
|
|
5186
|
+
}, ca = class {
|
|
5165
5187
|
constructor(e) {
|
|
5166
5188
|
this.data = this.normalize(e);
|
|
5167
5189
|
}
|
|
@@ -5218,7 +5240,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5218
5240
|
getData() {
|
|
5219
5241
|
return this.data;
|
|
5220
5242
|
}
|
|
5221
|
-
},
|
|
5243
|
+
}, la = class {
|
|
5222
5244
|
constructor(e, t, n) {
|
|
5223
5245
|
this.tenantApi = e, this.scopes = t, this.logger = n || Pr();
|
|
5224
5246
|
}
|
|
@@ -5256,7 +5278,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5256
5278
|
}
|
|
5257
5279
|
async getTenantUserMembership(e) {
|
|
5258
5280
|
try {
|
|
5259
|
-
return new
|
|
5281
|
+
return new ca(await this.tenantApi.getTenantDetails(e));
|
|
5260
5282
|
} catch (t) {
|
|
5261
5283
|
this.handlePassflowError(t, `Get tenant user membership failed for tenant ID ${e}`);
|
|
5262
5284
|
}
|
|
@@ -5401,7 +5423,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5401
5423
|
this.handlePassflowError(r, `Invalidate invite by email failed for tenant ID ${e}, group ID ${t}, email ${n}`);
|
|
5402
5424
|
}
|
|
5403
5425
|
}
|
|
5404
|
-
},
|
|
5426
|
+
}, ua = class {
|
|
5405
5427
|
constructor(e, t, n, r = R) {
|
|
5406
5428
|
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();
|
|
5407
5429
|
}
|
|
@@ -5481,7 +5503,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5481
5503
|
isExpired() {
|
|
5482
5504
|
return this.tokensCache ? this.tokensCache.access_token ? A(j(this.tokensCache.access_token)) : !1 : !0;
|
|
5483
5505
|
}
|
|
5484
|
-
},
|
|
5506
|
+
}, da = class {
|
|
5485
5507
|
constructor(e, t, n) {
|
|
5486
5508
|
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) => {
|
|
5487
5509
|
if (e === G.TwoFactorRequired) {
|
|
@@ -5812,7 +5834,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5812
5834
|
this.emitErrorAndThrow(e, "2fa.trusted-devices.revoke", "Revoke trusted device");
|
|
5813
5835
|
}
|
|
5814
5836
|
}
|
|
5815
|
-
},
|
|
5837
|
+
}, fa = class {
|
|
5816
5838
|
constructor(e, t, n = R) {
|
|
5817
5839
|
this.userAPI = e, this.deviceService = t, this.platform = n;
|
|
5818
5840
|
}
|
|
@@ -5848,77 +5870,77 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5848
5870
|
signOutOtherSessions() {
|
|
5849
5871
|
return this.userAPI.revokeOtherUserSessions();
|
|
5850
5872
|
}
|
|
5851
|
-
},
|
|
5873
|
+
}, pa = class extends Error {
|
|
5852
5874
|
constructor(e, t, n = !1) {
|
|
5853
5875
|
super(t), this.name = "UpgradeFactorError", this.factor = e, this.cancelled = n;
|
|
5854
5876
|
}
|
|
5855
|
-
},
|
|
5877
|
+
}, ma = (e, t) => {
|
|
5856
5878
|
let n = t?.trim();
|
|
5857
|
-
if (!n) throw new
|
|
5879
|
+
if (!n) throw new pa(e, "A verification code is required");
|
|
5858
5880
|
return n;
|
|
5859
|
-
},
|
|
5881
|
+
}, ha = {
|
|
5860
5882
|
type: "totp",
|
|
5861
5883
|
requiresPrepare: !1,
|
|
5862
5884
|
input: "code",
|
|
5863
|
-
assert: async ({ code: e }) => ({ code:
|
|
5864
|
-
},
|
|
5885
|
+
assert: async ({ code: e }) => ({ code: ma("totp", e) })
|
|
5886
|
+
}, ga = {
|
|
5865
5887
|
type: "recovery_codes",
|
|
5866
5888
|
requiresPrepare: !1,
|
|
5867
5889
|
input: "code",
|
|
5868
|
-
assert: async ({ code: e }) => ({ code:
|
|
5869
|
-
},
|
|
5890
|
+
assert: async ({ code: e }) => ({ code: ma("recovery_codes", e) })
|
|
5891
|
+
}, _a = {
|
|
5870
5892
|
type: "passkey",
|
|
5871
5893
|
requiresPrepare: !0,
|
|
5872
5894
|
input: "none",
|
|
5873
5895
|
assert: async ({ prepared: e, platform: t }) => {
|
|
5874
|
-
if (!e?.webauthn) throw new
|
|
5896
|
+
if (!e?.webauthn) throw new pa("passkey", "The upgrade challenge carried no WebAuthn options");
|
|
5875
5897
|
let n = t.passkeys;
|
|
5876
|
-
if (!n) throw new
|
|
5898
|
+
if (!n) throw new pa("passkey", "This platform does not support passkeys");
|
|
5877
5899
|
let r;
|
|
5878
5900
|
try {
|
|
5879
5901
|
r = await n.startAuthentication(e.webauthn);
|
|
5880
5902
|
} catch (e) {
|
|
5881
|
-
throw new
|
|
5903
|
+
throw new pa("passkey", e?.message || "Passkey verification was cancelled", !0);
|
|
5882
5904
|
}
|
|
5883
|
-
if (!r) throw new
|
|
5905
|
+
if (!r) throw new pa("passkey", "Passkey verification was cancelled", !0);
|
|
5884
5906
|
return {
|
|
5885
5907
|
challenge_id: e.challengeId,
|
|
5886
5908
|
credential: r
|
|
5887
5909
|
};
|
|
5888
5910
|
}
|
|
5889
|
-
},
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
]),
|
|
5911
|
+
}, va = Object.freeze([
|
|
5912
|
+
ha,
|
|
5913
|
+
_a,
|
|
5914
|
+
ga
|
|
5915
|
+
]), ya = (e = va) => new Map(e.map((e) => [e.type, e])), ba = 3, xa = {
|
|
5894
5916
|
totp: 0,
|
|
5895
5917
|
passkey: 1,
|
|
5896
5918
|
email_otp: 2,
|
|
5897
5919
|
sms_otp: 3,
|
|
5898
5920
|
recovery_codes: 9
|
|
5899
|
-
},
|
|
5900
|
-
let n =
|
|
5921
|
+
}, Sa = (e) => e.requiredLevel ?? _e(e.acrValues), Ca = (e, t) => {
|
|
5922
|
+
let n = xa[e.type] ?? 5, r = t !== void 0 && t >= ba, i = e.type === "passkey";
|
|
5901
5923
|
return (r && !i ? 100 : 0) + n;
|
|
5902
|
-
},
|
|
5924
|
+
}, wa = (e, t) => {
|
|
5903
5925
|
if (t.availableFactors) return t.availableFactors.flatMap((t) => e.find((e) => e.type === t) ?? []);
|
|
5904
|
-
let n =
|
|
5905
|
-
return [...e].sort((e, t) =>
|
|
5906
|
-
},
|
|
5926
|
+
let n = Sa(t);
|
|
5927
|
+
return [...e].sort((e, t) => Ca(e, n) - Ca(t, n));
|
|
5928
|
+
}, Ta = class extends Error {
|
|
5907
5929
|
constructor(e) {
|
|
5908
5930
|
super("Upgrade authentication was cancelled"), this.code = "upgrade_cancelled", this.name = "UpgradeCancelledError", e !== void 0 && (this.cause = e);
|
|
5909
5931
|
}
|
|
5910
|
-
},
|
|
5932
|
+
}, Ea = class extends Error {
|
|
5911
5933
|
constructor(e = "Only a fresh sign-in can meet this challenge") {
|
|
5912
5934
|
super(e), this.code = "upgrade_sign_in_required", this.name = "UpgradeSignInRequiredError";
|
|
5913
5935
|
}
|
|
5914
|
-
},
|
|
5915
|
-
if (
|
|
5916
|
-
if (
|
|
5917
|
-
},
|
|
5936
|
+
}, Da = (e) => e?.signInRequired === !0 || e?.signInRequired === void 0 && e?.availableFactors?.length === 0, Oa = (e) => e?.signInRequired === !1 && e.availableFactors?.length === 0, ka = "This account has no factor that reaches the required level (it may need a device-bound passkey)", Aa = (e) => {
|
|
5937
|
+
if (Da(e)) return new Ea();
|
|
5938
|
+
if (Oa(e)) return new ja(ka);
|
|
5939
|
+
}, ja = class extends Error {
|
|
5918
5940
|
constructor(e = "No available authentication factor can satisfy this challenge") {
|
|
5919
5941
|
super(e), this.code = "upgrade_unsatisfiable", this.name = "UpgradeUnsatisfiableError";
|
|
5920
5942
|
}
|
|
5921
|
-
},
|
|
5943
|
+
}, Ma = 4, Na = 3e4, Pa = () => {
|
|
5922
5944
|
let e = () => void 0, t = () => void 0;
|
|
5923
5945
|
return {
|
|
5924
5946
|
promise: new Promise((n, r) => {
|
|
@@ -5927,12 +5949,12 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5927
5949
|
resolve: e,
|
|
5928
5950
|
reject: t
|
|
5929
5951
|
};
|
|
5930
|
-
},
|
|
5952
|
+
}, Fa = (e) => ({
|
|
5931
5953
|
acrValues: e.acrValues,
|
|
5932
5954
|
level: e.requiredLevel,
|
|
5933
5955
|
maxAge: e.maxAge
|
|
5934
|
-
}),
|
|
5935
|
-
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 } =
|
|
5956
|
+
}), Ia = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, La = (e, t) => {
|
|
5957
|
+
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 } = Ra(t, e) && !Ra(e, t) || !t.availableFactors ? e : t;
|
|
5936
5958
|
return {
|
|
5937
5959
|
acrValues: r,
|
|
5938
5960
|
requiredLevel: n,
|
|
@@ -5942,12 +5964,12 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5942
5964
|
...o ? { availableFactors: o } : {},
|
|
5943
5965
|
...s === void 0 ? {} : { signInRequired: s }
|
|
5944
5966
|
};
|
|
5945
|
-
},
|
|
5967
|
+
}, Ra = (e, t) => {
|
|
5946
5968
|
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);
|
|
5947
5969
|
return n || r;
|
|
5948
|
-
},
|
|
5970
|
+
}, za = class {
|
|
5949
5971
|
constructor(e) {
|
|
5950
|
-
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 ??
|
|
5972
|
+
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 ?? va, this.registry = ya(this.available), this.maxAttempts = e.maxAttempts ?? Ma, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? Na;
|
|
5951
5973
|
}
|
|
5952
5974
|
get currentState() {
|
|
5953
5975
|
return this.state;
|
|
@@ -5967,9 +5989,9 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5967
5989
|
}
|
|
5968
5990
|
register(e, t) {
|
|
5969
5991
|
let n = t.kind === "imperative" && t.requested !== void 0, r = {
|
|
5970
|
-
demanded: t.kind === "imperative" && t.requested ? t.requested :
|
|
5992
|
+
demanded: t.kind === "imperative" && t.requested ? t.requested : Fa(e),
|
|
5971
5993
|
statedBar: n,
|
|
5972
|
-
settlement:
|
|
5994
|
+
settlement: Pa(),
|
|
5973
5995
|
reported: !1,
|
|
5974
5996
|
entry: {
|
|
5975
5997
|
...t,
|
|
@@ -5985,15 +6007,15 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
5985
6007
|
this.requirement = e;
|
|
5986
6008
|
return;
|
|
5987
6009
|
}
|
|
5988
|
-
let n =
|
|
5989
|
-
this.requirement =
|
|
6010
|
+
let n = Ra(t, e);
|
|
6011
|
+
this.requirement = La(t, e), Aa(this.requirement) ? this.state === "collecting" && this.selected === null && (this.openPrompt?.onClosed?.(), this.closeOpenPrompt?.()) : n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
|
|
5990
6012
|
challenge: this.requirement,
|
|
5991
6013
|
factors: this.offeredFactors()
|
|
5992
6014
|
});
|
|
5993
6015
|
}
|
|
5994
6016
|
offeredFactors() {
|
|
5995
6017
|
let e = this.available.filter((e) => !this.pruned.has(e.type)), t = this.requirement;
|
|
5996
|
-
return t ?
|
|
6018
|
+
return t ? wa(e, t) : e;
|
|
5997
6019
|
}
|
|
5998
6020
|
receiveReport(e, t) {
|
|
5999
6021
|
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());
|
|
@@ -6028,7 +6050,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6028
6050
|
}
|
|
6029
6051
|
release(e, t) {
|
|
6030
6052
|
if (e.entry.kind === "imperative") {
|
|
6031
|
-
if (e.statedBar && !
|
|
6053
|
+
if (e.statedBar && !Ia(t, e.demanded)) {
|
|
6032
6054
|
this.receiveReport(e, {
|
|
6033
6055
|
outcome: "insufficient",
|
|
6034
6056
|
obtained: t,
|
|
@@ -6103,7 +6125,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6103
6125
|
async prove() {
|
|
6104
6126
|
let e;
|
|
6105
6127
|
for (let t = 0; t < this.maxAttempts; t++) {
|
|
6106
|
-
let t =
|
|
6128
|
+
let t = Aa(this.requirement);
|
|
6107
6129
|
if (t) return {
|
|
6108
6130
|
status: "failed",
|
|
6109
6131
|
reason: t
|
|
@@ -6111,7 +6133,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6111
6133
|
let n = this.offeredFactors();
|
|
6112
6134
|
if (n.length === 0) return {
|
|
6113
6135
|
status: "failed",
|
|
6114
|
-
reason: new
|
|
6136
|
+
reason: new ja()
|
|
6115
6137
|
};
|
|
6116
6138
|
let r = this.requirement, i;
|
|
6117
6139
|
try {
|
|
@@ -6119,29 +6141,29 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6119
6141
|
} catch (e) {
|
|
6120
6142
|
return {
|
|
6121
6143
|
status: "failed",
|
|
6122
|
-
reason: new
|
|
6144
|
+
reason: new Ta(e)
|
|
6123
6145
|
};
|
|
6124
6146
|
}
|
|
6125
|
-
let a =
|
|
6147
|
+
let a = Aa(this.requirement);
|
|
6126
6148
|
if (a) return {
|
|
6127
6149
|
status: "failed",
|
|
6128
6150
|
reason: a
|
|
6129
6151
|
};
|
|
6130
6152
|
if (i.type === "cancel") return {
|
|
6131
6153
|
status: "failed",
|
|
6132
|
-
reason: new
|
|
6154
|
+
reason: new Ta()
|
|
6133
6155
|
};
|
|
6134
6156
|
let o = this.registry.get(i.factor);
|
|
6135
|
-
if (!o) e = new
|
|
6157
|
+
if (!o) e = new ja(`Unknown authentication factor: ${i.factor}`), this.state = "collecting", this.selected = null;
|
|
6136
6158
|
else try {
|
|
6137
6159
|
return await this.proveAndCommit(o, i.code), {
|
|
6138
6160
|
status: "proven",
|
|
6139
|
-
obtained: this.readObtainedBar?.() ??
|
|
6161
|
+
obtained: this.readObtainedBar?.() ?? Fa(this.rankedRequirement ?? r)
|
|
6140
6162
|
};
|
|
6141
6163
|
} catch (t) {
|
|
6142
|
-
if (t instanceof
|
|
6164
|
+
if (t instanceof pa && t.cancelled) return {
|
|
6143
6165
|
status: "failed",
|
|
6144
|
-
reason: new
|
|
6166
|
+
reason: new Ta()
|
|
6145
6167
|
};
|
|
6146
6168
|
let n = this.classifyProofFailure(t);
|
|
6147
6169
|
if (n) return {
|
|
@@ -6198,28 +6220,28 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6198
6220
|
});
|
|
6199
6221
|
await this.transport.commit(e.type, r);
|
|
6200
6222
|
}
|
|
6201
|
-
},
|
|
6223
|
+
}, Ba = (e) => typeof e == "function" ? e() : e, Va = (e) => {
|
|
6202
6224
|
try {
|
|
6203
6225
|
return new URL(e);
|
|
6204
6226
|
} catch {
|
|
6205
6227
|
return;
|
|
6206
6228
|
}
|
|
6207
|
-
},
|
|
6229
|
+
}, Ha = (e, t) => {
|
|
6208
6230
|
if (!t || t === "/") return !0;
|
|
6209
6231
|
let n = t.replace(/\/+$/, "");
|
|
6210
6232
|
return e === n || e.startsWith(`${n}/`);
|
|
6211
|
-
},
|
|
6233
|
+
}, Ua = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && Ha(e.pathname, t.pathPrefix), Wa = (e, t) => {
|
|
6212
6234
|
for (let n of t) {
|
|
6213
6235
|
if (n === "") continue;
|
|
6214
6236
|
if (n.startsWith("/")) {
|
|
6215
|
-
if (e.relativeToBase &&
|
|
6237
|
+
if (e.relativeToBase && Ha(e.pathname, n)) return !0;
|
|
6216
6238
|
continue;
|
|
6217
6239
|
}
|
|
6218
|
-
let t =
|
|
6219
|
-
if (t && e.origin !== void 0 && e.origin === t.origin &&
|
|
6240
|
+
let t = Va(n) ?? Va(`https://${n}`);
|
|
6241
|
+
if (t && e.origin !== void 0 && e.origin === t.origin && Ha(e.pathname, t.pathname)) return !0;
|
|
6220
6242
|
}
|
|
6221
6243
|
return !1;
|
|
6222
|
-
},
|
|
6244
|
+
}, Ga = (e, t, n) => Ua(e, t.passflow) || Wa(e, t.backend) ? !n || n(e.href) !== !1 : !1, Ka = (e) => {
|
|
6223
6245
|
let t = e.detail, n = t?.message ?? `[passflow] upgrade challenge not actioned: ${e.reason}`;
|
|
6224
6246
|
console.warn(n, {
|
|
6225
6247
|
status: e.status,
|
|
@@ -6227,8 +6249,8 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6227
6249
|
reason: e.reason,
|
|
6228
6250
|
detail: t
|
|
6229
6251
|
});
|
|
6230
|
-
},
|
|
6231
|
-
let n = t.onUpgradeDiagnostic ??
|
|
6252
|
+
}, qa = (e, t) => {
|
|
6253
|
+
let n = t.onUpgradeDiagnostic ?? Ka;
|
|
6232
6254
|
return (t, r) => {
|
|
6233
6255
|
n({
|
|
6234
6256
|
status: e.status,
|
|
@@ -6240,8 +6262,8 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6240
6262
|
}
|
|
6241
6263
|
});
|
|
6242
6264
|
};
|
|
6243
|
-
},
|
|
6244
|
-
let r = n.onUpgradeDiagnostic ??
|
|
6265
|
+
}, Ja = (e, t, n) => {
|
|
6266
|
+
let r = n.onUpgradeDiagnostic ?? Ka;
|
|
6245
6267
|
for (let n of e) r({
|
|
6246
6268
|
...n,
|
|
6247
6269
|
url: t.request.href,
|
|
@@ -6250,8 +6272,8 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6250
6272
|
...n.detail ?? {}
|
|
6251
6273
|
}
|
|
6252
6274
|
});
|
|
6253
|
-
},
|
|
6254
|
-
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n &&
|
|
6275
|
+
}, Ya = /\bjson\b/i, Xa = async (e, t) => {
|
|
6276
|
+
let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && Ya.test(r), a;
|
|
6255
6277
|
if (i) try {
|
|
6256
6278
|
a = await e.readBody();
|
|
6257
6279
|
} catch {
|
|
@@ -6265,10 +6287,10 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6265
6287
|
status: e.status,
|
|
6266
6288
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
6267
6289
|
}, { requireChallengeChannel: t.requireChallengeChannel });
|
|
6268
|
-
},
|
|
6290
|
+
}, Za = (e) => ke({
|
|
6269
6291
|
status: e.status,
|
|
6270
6292
|
getHeader: (t) => e.getHeader(t) ?? void 0
|
|
6271
|
-
}, { requireChallengeChannel: "header" }).challenge,
|
|
6293
|
+
}, { requireChallengeChannel: "header" }).challenge, Qa = (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.`, $a = (e, t) => e instanceof Ta ? { kind: "cancelled" } : e instanceof Ea ? { kind: "sign-in-required" } : e instanceof ja ? {
|
|
6272
6294
|
kind: "unsatisfiable",
|
|
6273
6295
|
error: e
|
|
6274
6296
|
} : e instanceof Fi ? { kind: "unavailable" } : e instanceof Ii ? { kind: "session-changed" } : e instanceof Pi ? {
|
|
@@ -6287,26 +6309,26 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6287
6309
|
kind: "transport-failure",
|
|
6288
6310
|
retryable: !1,
|
|
6289
6311
|
error: e instanceof Error ? e : Error(String(e))
|
|
6290
|
-
},
|
|
6312
|
+
}, eo = async (e, t, n, r) => {
|
|
6291
6313
|
if (e.status !== 401 && e.status !== 403) return {
|
|
6292
6314
|
kind: "replayed",
|
|
6293
6315
|
response: e
|
|
6294
6316
|
};
|
|
6295
|
-
let { challenge: i, diagnostics: a } = await
|
|
6296
|
-
if (
|
|
6317
|
+
let { challenge: i, diagnostics: a } = await Xa(e, t);
|
|
6318
|
+
if (Ja(a, e, t), !i) return {
|
|
6297
6319
|
kind: "replayed",
|
|
6298
6320
|
response: e
|
|
6299
6321
|
};
|
|
6300
|
-
if (
|
|
6322
|
+
if (Da(i)) return {
|
|
6301
6323
|
kind: "sign-in-required",
|
|
6302
6324
|
response: e
|
|
6303
6325
|
};
|
|
6304
|
-
if (
|
|
6326
|
+
if (Oa(i)) return {
|
|
6305
6327
|
kind: "unsatisfiable",
|
|
6306
|
-
error:
|
|
6328
|
+
error: Aa(i),
|
|
6307
6329
|
response: e
|
|
6308
6330
|
};
|
|
6309
|
-
let o =
|
|
6331
|
+
let o = Fa(i);
|
|
6310
6332
|
return r("elevated-insufficient", {
|
|
6311
6333
|
obtained: n,
|
|
6312
6334
|
required: o
|
|
@@ -6316,7 +6338,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6316
6338
|
required: o,
|
|
6317
6339
|
response: e
|
|
6318
6340
|
};
|
|
6319
|
-
},
|
|
6341
|
+
}, to = async (e, t) => {
|
|
6320
6342
|
if (!t) return {
|
|
6321
6343
|
aborted: !1,
|
|
6322
6344
|
value: await e
|
|
@@ -6343,14 +6365,14 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6343
6365
|
} finally {
|
|
6344
6366
|
n && t.removeEventListener?.("abort", n);
|
|
6345
6367
|
}
|
|
6346
|
-
},
|
|
6368
|
+
}, no = async (e, t) => {
|
|
6347
6369
|
if (e.status !== 401 && e.status !== 403 || e.markers.upgradeTransaction) return { kind: "not-a-challenge" };
|
|
6348
|
-
let n =
|
|
6370
|
+
let n = qa(e, t);
|
|
6349
6371
|
if (e.markers.replayed) {
|
|
6350
|
-
if (!
|
|
6351
|
-
let { challenge: r, diagnostics: i } = await
|
|
6352
|
-
if (
|
|
6353
|
-
let a = t.readObtainedBar?.() ?? {}, o =
|
|
6372
|
+
if (!Ga(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
|
|
6373
|
+
let { challenge: r, diagnostics: i } = await Xa(e, t);
|
|
6374
|
+
if (Ja(i, e, t), !r) return { kind: "not-a-challenge" };
|
|
6375
|
+
let a = t.readObtainedBar?.() ?? {}, o = Fa(r);
|
|
6354
6376
|
return n("elevated-insufficient", {
|
|
6355
6377
|
obtained: a,
|
|
6356
6378
|
required: o
|
|
@@ -6361,12 +6383,12 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6361
6383
|
response: e
|
|
6362
6384
|
};
|
|
6363
6385
|
}
|
|
6364
|
-
if (!
|
|
6386
|
+
if (!Ga(e.request, t.scope, t.shouldIntercept)) return Za(e) ? (n("challenge-out-of-scope", {
|
|
6365
6387
|
header: e.getHeader("www-authenticate") ?? void 0,
|
|
6366
|
-
message:
|
|
6388
|
+
message: Qa(e.request.href, t.scope)
|
|
6367
6389
|
}), { kind: "out-of-scope" }) : { kind: "not-a-challenge" };
|
|
6368
|
-
let { challenge: r, diagnostics: i } = await
|
|
6369
|
-
if (
|
|
6390
|
+
let { challenge: r, diagnostics: i } = await Xa(e, t);
|
|
6391
|
+
if (Ja(i, e, t), !r) {
|
|
6370
6392
|
let r = e.getHeader("www-authenticate");
|
|
6371
6393
|
return t.requireChallengeChannel !== "header" && n("no-channel", {
|
|
6372
6394
|
...r ? { header: r } : {},
|
|
@@ -6380,9 +6402,9 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6380
6402
|
method: e.request.method
|
|
6381
6403
|
}, s, c;
|
|
6382
6404
|
try {
|
|
6383
|
-
s = Promise.resolve(t.elevate(r, o)), c = await
|
|
6405
|
+
s = Promise.resolve(t.elevate(r, o)), c = await to(s, e.signal);
|
|
6384
6406
|
} catch (e) {
|
|
6385
|
-
return
|
|
6407
|
+
return $a(e, void 0);
|
|
6386
6408
|
}
|
|
6387
6409
|
if (c.aborted) return s?.then((e) => e?.waiter.report({ outcome: "failed" }), () => {}), {
|
|
6388
6410
|
kind: "aborted",
|
|
@@ -6393,7 +6415,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6393
6415
|
kind: "aborted",
|
|
6394
6416
|
reason: e.signal.reason
|
|
6395
6417
|
};
|
|
6396
|
-
let u = l?.obtained ?? t.readObtainedBar?.() ??
|
|
6418
|
+
let u = l?.obtained ?? t.readObtainedBar?.() ?? Fa(r), d = t.authorizationSwap?.(), f = d ? {
|
|
6397
6419
|
from: a?.from ?? d.from,
|
|
6398
6420
|
to: d.to
|
|
6399
6421
|
} : void 0;
|
|
@@ -6420,7 +6442,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6420
6442
|
};
|
|
6421
6443
|
throw t;
|
|
6422
6444
|
}
|
|
6423
|
-
let m = await
|
|
6445
|
+
let m = await eo(p, t, u, n);
|
|
6424
6446
|
return m.kind === "insufficient" ? l?.waiter.report({
|
|
6425
6447
|
outcome: "insufficient",
|
|
6426
6448
|
obtained: m.obtained,
|
|
@@ -6429,11 +6451,11 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6429
6451
|
outcome: "replayed",
|
|
6430
6452
|
obtained: u
|
|
6431
6453
|
}), m;
|
|
6432
|
-
},
|
|
6454
|
+
}, ro = (e) => {
|
|
6433
6455
|
switch (e.kind) {
|
|
6434
|
-
case "cancelled": return new
|
|
6435
|
-
case "unsatisfiable": return e.error ?? new
|
|
6436
|
-
case "sign-in-required": return new
|
|
6456
|
+
case "cancelled": return new Ta();
|
|
6457
|
+
case "unsatisfiable": return e.error ?? new ja();
|
|
6458
|
+
case "sign-in-required": return new Ea();
|
|
6437
6459
|
case "unavailable": return new Fi();
|
|
6438
6460
|
case "session-changed": return new Ii();
|
|
6439
6461
|
case "insufficient": return new Pi(e.obtained, e.required);
|
|
@@ -6441,7 +6463,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6441
6463
|
case "transport-failure": return e.error;
|
|
6442
6464
|
default: return;
|
|
6443
6465
|
}
|
|
6444
|
-
},
|
|
6466
|
+
}, io = (e, t, n) => {
|
|
6445
6467
|
switch (e.kind) {
|
|
6446
6468
|
case "replayed": return {
|
|
6447
6469
|
settle: "resolve",
|
|
@@ -6459,26 +6481,26 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6459
6481
|
};
|
|
6460
6482
|
case "cancelled": return n.onCancel === "reject" ? {
|
|
6461
6483
|
settle: "reject",
|
|
6462
|
-
error: new
|
|
6484
|
+
error: new Ta()
|
|
6463
6485
|
} : {
|
|
6464
6486
|
settle: "resolve",
|
|
6465
|
-
value:
|
|
6487
|
+
value: ho(t, e)
|
|
6466
6488
|
};
|
|
6467
6489
|
case "unsatisfiable":
|
|
6468
6490
|
case "sign-in-required": return {
|
|
6469
6491
|
settle: "resolve",
|
|
6470
|
-
value:
|
|
6492
|
+
value: ho(e.response?.raw ?? t, e)
|
|
6471
6493
|
};
|
|
6472
6494
|
case "insufficient": return {
|
|
6473
6495
|
settle: "resolve",
|
|
6474
|
-
value:
|
|
6496
|
+
value: ho(e.response?.raw ?? t, e)
|
|
6475
6497
|
};
|
|
6476
6498
|
default: return {
|
|
6477
6499
|
settle: "resolve",
|
|
6478
|
-
value:
|
|
6500
|
+
value: ho(t, e)
|
|
6479
6501
|
};
|
|
6480
6502
|
}
|
|
6481
|
-
},
|
|
6503
|
+
}, ao = (e, t) => {
|
|
6482
6504
|
switch (e.kind) {
|
|
6483
6505
|
case "replayed": return e.response.rejected ? {
|
|
6484
6506
|
settle: "reject",
|
|
@@ -6493,42 +6515,42 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6493
6515
|
};
|
|
6494
6516
|
default: return {
|
|
6495
6517
|
settle: "reject",
|
|
6496
|
-
error:
|
|
6518
|
+
error: ro(e) ?? t
|
|
6497
6519
|
};
|
|
6498
6520
|
}
|
|
6499
|
-
},
|
|
6521
|
+
}, oo = /* @__PURE__ */ new WeakSet(), so = /* @__PURE__ */ new WeakSet(), co = /* @__PURE__ */ new WeakSet(), lo = /* @__PURE__ */ new WeakSet(), uo = /* @__PURE__ */ new WeakSet(), fo = /* @__PURE__ */ new WeakSet(), po = /* @__PURE__ */ new WeakSet(), mo = /* @__PURE__ */ new WeakSet(), ho = (e, t) => {
|
|
6500
6522
|
switch (t.kind) {
|
|
6501
6523
|
case "cancelled":
|
|
6502
|
-
|
|
6524
|
+
oo.add(e);
|
|
6503
6525
|
break;
|
|
6504
6526
|
case "exhausted":
|
|
6505
|
-
|
|
6527
|
+
so.add(e);
|
|
6506
6528
|
break;
|
|
6507
6529
|
case "insufficient":
|
|
6508
|
-
|
|
6530
|
+
co.add(e);
|
|
6509
6531
|
break;
|
|
6510
6532
|
case "unsatisfiable":
|
|
6511
|
-
|
|
6533
|
+
lo.add(e);
|
|
6512
6534
|
break;
|
|
6513
6535
|
case "sign-in-required":
|
|
6514
|
-
|
|
6536
|
+
uo.add(e);
|
|
6515
6537
|
break;
|
|
6516
6538
|
case "unavailable":
|
|
6517
|
-
|
|
6539
|
+
fo.add(e);
|
|
6518
6540
|
break;
|
|
6519
6541
|
case "session-changed":
|
|
6520
|
-
|
|
6542
|
+
po.add(e);
|
|
6521
6543
|
break;
|
|
6522
|
-
case "transport-failure":
|
|
6544
|
+
case "transport-failure": mo.add(e);
|
|
6523
6545
|
}
|
|
6524
6546
|
return e;
|
|
6525
|
-
},
|
|
6547
|
+
}, go = (e) => oo.has(e), _o = (e) => so.has(e), vo = (e) => co.has(e), yo = (e) => lo.has(e), bo = (e) => uo.has(e), xo = (e) => fo.has(e), So = (e) => po.has(e), Co = (e) => mo.has(e), wo = "https://passflow-relative.invalid", To = () => {
|
|
6526
6548
|
let e = globalThis, t = e.document?.baseURI;
|
|
6527
6549
|
if (typeof t == "string" && t !== "") return t;
|
|
6528
6550
|
let n = e.location?.href;
|
|
6529
|
-
return typeof n == "string" && n !== "" && n !== "about:blank" ? n :
|
|
6530
|
-
},
|
|
6531
|
-
let n = t ===
|
|
6551
|
+
return typeof n == "string" && n !== "" && n !== "about:blank" ? n : wo;
|
|
6552
|
+
}, Eo = (e, t = To()) => {
|
|
6553
|
+
let n = t === wo, r;
|
|
6532
6554
|
try {
|
|
6533
6555
|
r = new URL(t).origin;
|
|
6534
6556
|
} catch {
|
|
@@ -6554,28 +6576,28 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6554
6576
|
relativeToBase: !1,
|
|
6555
6577
|
sentinelBase: n
|
|
6556
6578
|
};
|
|
6557
|
-
},
|
|
6579
|
+
}, Do = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, Oo = (e) => {
|
|
6558
6580
|
let t = [];
|
|
6559
6581
|
if (e == null) return Object.freeze(t);
|
|
6560
6582
|
let n = e;
|
|
6561
6583
|
if (typeof n.forEach == "function" && typeof n.entries == "function") return e.forEach((e, n) => {
|
|
6562
|
-
let r =
|
|
6584
|
+
let r = Do(n, e);
|
|
6563
6585
|
r && t.push(r);
|
|
6564
6586
|
}), Object.freeze(t);
|
|
6565
6587
|
if (Array.isArray(e)) {
|
|
6566
6588
|
for (let n of e) if (Array.isArray(n) && n.length >= 2) {
|
|
6567
|
-
let e =
|
|
6589
|
+
let e = Do(String(n[0]), n[1]);
|
|
6568
6590
|
e && t.push(e);
|
|
6569
6591
|
}
|
|
6570
6592
|
return Object.freeze(t);
|
|
6571
6593
|
}
|
|
6572
6594
|
if (typeof e == "object") for (let [n, r] of Object.entries(e)) {
|
|
6573
|
-
let e =
|
|
6595
|
+
let e = Do(n, Array.isArray(r) ? r.join(", ") : r);
|
|
6574
6596
|
e && t.push(e);
|
|
6575
6597
|
}
|
|
6576
6598
|
return Object.freeze(t);
|
|
6577
|
-
},
|
|
6578
|
-
let t = e.base === void 0 ?
|
|
6599
|
+
}, ko = (e) => {
|
|
6600
|
+
let t = e.base === void 0 ? Eo(e.url) : Eo(e.url, e.base), n = {
|
|
6579
6601
|
raw: e.url,
|
|
6580
6602
|
href: t.href,
|
|
6581
6603
|
dispatchUrl: t.sentinelBase || !t.resolved ? e.url : t.href,
|
|
@@ -6584,29 +6606,29 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6584
6606
|
resolved: t.resolved,
|
|
6585
6607
|
relativeToBase: t.relativeToBase,
|
|
6586
6608
|
method: (e.method ?? "GET").toUpperCase(),
|
|
6587
|
-
headers:
|
|
6609
|
+
headers: Oo(e.headers),
|
|
6588
6610
|
bodyKind: e.bodyKind,
|
|
6589
6611
|
..."body" in e ? { body: e.body } : {}
|
|
6590
6612
|
};
|
|
6591
6613
|
return Object.freeze(n);
|
|
6592
|
-
},
|
|
6614
|
+
}, Ao = (e, t) => {
|
|
6593
6615
|
if (!t || t.from === t.to) return e;
|
|
6594
6616
|
let n = !1, r = e.map(([e, r]) => e === "authorization" && r === t.from ? (n = !0, [e, t.to]) : [e, r]);
|
|
6595
6617
|
return n ? Object.freeze(r) : e;
|
|
6596
|
-
},
|
|
6618
|
+
}, jo = (e) => {
|
|
6597
6619
|
let t = {};
|
|
6598
6620
|
for (let [n, r] of e) t[n] = r;
|
|
6599
6621
|
return t;
|
|
6600
|
-
},
|
|
6622
|
+
}, Mo = /* @__PURE__ */ new Set([
|
|
6601
6623
|
"GET",
|
|
6602
6624
|
"HEAD",
|
|
6603
6625
|
"OPTIONS"
|
|
6604
|
-
]),
|
|
6626
|
+
]), No = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, Po = (e) => typeof e == "string" ? e : No(e) ? e.url : String(e), Fo = (e, t) => (t?.method ?? (No(e) ? e.method : void 0) ?? "GET").toUpperCase(), Io = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", Lo = (e) => {
|
|
6605
6627
|
if (typeof e == "string") return e.length;
|
|
6606
6628
|
let t = e;
|
|
6607
6629
|
if (typeof t?.size == "number") return t.size;
|
|
6608
6630
|
if (typeof t?.byteLength == "number") return t.byteLength;
|
|
6609
|
-
},
|
|
6631
|
+
}, Ro = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? Mo.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), zo = (e, t, n, r, i) => ({
|
|
6610
6632
|
replayable: !1,
|
|
6611
6633
|
bodyKind: e,
|
|
6612
6634
|
reason: t,
|
|
@@ -6614,11 +6636,11 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6614
6636
|
forwardInit: i,
|
|
6615
6637
|
snapshot: r,
|
|
6616
6638
|
replay: () => Promise.reject(/* @__PURE__ */ Error(`This request cannot be replayed: ${t}`))
|
|
6617
|
-
}),
|
|
6639
|
+
}), Bo = (e, t) => jo(Ao(e.headers, t?.authorizationSwap)), Vo = (e) => {
|
|
6618
6640
|
if (!e || !("headers" in e)) return e;
|
|
6619
6641
|
let { headers: t, ...n } = e;
|
|
6620
6642
|
return n;
|
|
6621
|
-
},
|
|
6643
|
+
}, Ho = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : No(e) ? e.headers : void 0, Uo = (e) => {
|
|
6622
6644
|
if (e === null || typeof e == "string") return e;
|
|
6623
6645
|
if (typeof FormData < "u" && e instanceof FormData) {
|
|
6624
6646
|
let t = new FormData();
|
|
@@ -6626,18 +6648,18 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6626
6648
|
return t;
|
|
6627
6649
|
}
|
|
6628
6650
|
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;
|
|
6629
|
-
},
|
|
6630
|
-
let r =
|
|
6651
|
+
}, Wo = (e, t, n) => new Request(e, { headers: Bo(t, n) }), Go = (e, t, n) => {
|
|
6652
|
+
let r = Po(e), i = Fo(e, t), a = Ho(e, t), o = (e, t) => ko({
|
|
6631
6653
|
url: r,
|
|
6632
6654
|
method: i,
|
|
6633
6655
|
headers: a,
|
|
6634
6656
|
bodyKind: e,
|
|
6635
6657
|
...t === void 0 ? {} : { body: t }
|
|
6636
6658
|
});
|
|
6637
|
-
if (
|
|
6659
|
+
if (No(e)) {
|
|
6638
6660
|
if (e.body === null || e.body === void 0) {
|
|
6639
6661
|
let a = o("none");
|
|
6640
|
-
return
|
|
6662
|
+
return Ro(n, {
|
|
6641
6663
|
url: r,
|
|
6642
6664
|
method: i,
|
|
6643
6665
|
bodyKind: "none"
|
|
@@ -6647,20 +6669,20 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6647
6669
|
forwardInput: e,
|
|
6648
6670
|
forwardInit: t,
|
|
6649
6671
|
snapshot: a,
|
|
6650
|
-
replay: (n, r) => n(
|
|
6651
|
-
} :
|
|
6672
|
+
replay: (n, r) => n(Wo(e, a, r), Vo(t))
|
|
6673
|
+
} : zo("none", "the replay policy refused this request", e, a, t);
|
|
6652
6674
|
}
|
|
6653
6675
|
let a = o("request-clone");
|
|
6654
|
-
if (!
|
|
6676
|
+
if (!Ro(n, {
|
|
6655
6677
|
url: r,
|
|
6656
6678
|
method: i,
|
|
6657
6679
|
bodyKind: "request-clone"
|
|
6658
|
-
})) return
|
|
6680
|
+
})) return zo("request-clone", "the replay policy refused this request", e, a, t);
|
|
6659
6681
|
let s;
|
|
6660
6682
|
try {
|
|
6661
6683
|
s = e.clone();
|
|
6662
6684
|
} catch {
|
|
6663
|
-
return
|
|
6685
|
+
return zo("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
|
|
6664
6686
|
}
|
|
6665
6687
|
return {
|
|
6666
6688
|
replayable: !0,
|
|
@@ -6668,17 +6690,17 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6668
6690
|
forwardInput: e,
|
|
6669
6691
|
forwardInit: t,
|
|
6670
6692
|
snapshot: a,
|
|
6671
|
-
replay: (e, n) => e(
|
|
6693
|
+
replay: (e, n) => e(Wo(s, a, n), Vo(t))
|
|
6672
6694
|
};
|
|
6673
6695
|
}
|
|
6674
|
-
let s =
|
|
6675
|
-
if (s === "one-shot") return
|
|
6676
|
-
if (!
|
|
6696
|
+
let s = Io(t?.body);
|
|
6697
|
+
if (s === "one-shot") return zo("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
|
|
6698
|
+
if (!Ro(n, {
|
|
6677
6699
|
url: r,
|
|
6678
6700
|
method: i,
|
|
6679
6701
|
bodyKind: s
|
|
6680
|
-
},
|
|
6681
|
-
let c = t && "body" in t ?
|
|
6702
|
+
}, Lo(t?.body))) return zo(s, "the replay policy refused this request", e, o(s), t);
|
|
6703
|
+
let c = t && "body" in t ? Uo(t.body ?? null) : void 0, l = o(s, c);
|
|
6682
6704
|
return {
|
|
6683
6705
|
replayable: !0,
|
|
6684
6706
|
bodyKind: s,
|
|
@@ -6686,21 +6708,21 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6686
6708
|
forwardInit: t,
|
|
6687
6709
|
snapshot: l,
|
|
6688
6710
|
replay: (e, n) => e(l.dispatchUrl, {
|
|
6689
|
-
...
|
|
6711
|
+
...Vo(t),
|
|
6690
6712
|
...c === void 0 ? {} : { body: c },
|
|
6691
|
-
headers:
|
|
6713
|
+
headers: Bo(l, n),
|
|
6692
6714
|
method: l.method
|
|
6693
6715
|
})
|
|
6694
6716
|
};
|
|
6695
|
-
},
|
|
6696
|
-
if (!
|
|
6717
|
+
}, Ko = (e) => typeof e == "object" && !!e, qo = (e) => (t) => {
|
|
6718
|
+
if (!Ko(e)) return;
|
|
6697
6719
|
let n = e[t] ?? e[t.toLowerCase()] ?? (typeof e.get == "function" ? e.get(t) : void 0);
|
|
6698
6720
|
return Array.isArray(n) ? n.join(", ") : typeof n == "string" ? n : void 0;
|
|
6699
|
-
},
|
|
6721
|
+
}, Jo = (e) => {
|
|
6700
6722
|
let t = e?.url ?? "", n = e?.baseURL;
|
|
6701
6723
|
return !n || /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t) ? t : `${n.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
6702
|
-
},
|
|
6703
|
-
let r = Ao(
|
|
6724
|
+
}, Yo = (e) => (e?.method ?? "GET").toUpperCase(), Xo = (e) => e == null ? "none" : Ko(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", Zo = (e, t, n) => {
|
|
6725
|
+
let r = jo(Ao(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
|
|
6704
6726
|
return {
|
|
6705
6727
|
...e,
|
|
6706
6728
|
...i ? { baseURL: void 0 } : {},
|
|
@@ -6709,10 +6731,10 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6709
6731
|
headers: r,
|
|
6710
6732
|
..."body" in t ? { data: t.body } : {}
|
|
6711
6733
|
};
|
|
6712
|
-
},
|
|
6713
|
-
let o = t ?? e?.config, s =
|
|
6714
|
-
url:
|
|
6715
|
-
method:
|
|
6734
|
+
}, Qo = (e, t, n, r, i, a) => {
|
|
6735
|
+
let o = t ?? e?.config, s = Xo(o?.data), c = a ?? ko({
|
|
6736
|
+
url: Jo(o),
|
|
6737
|
+
method: Yo(o),
|
|
6716
6738
|
headers: o?.headers,
|
|
6717
6739
|
bodyKind: s,
|
|
6718
6740
|
body: o?.data
|
|
@@ -6720,22 +6742,22 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6720
6742
|
url: c.href,
|
|
6721
6743
|
method: c.method,
|
|
6722
6744
|
bodyKind: s
|
|
6723
|
-
}, u = s !== "one-shot" &&
|
|
6745
|
+
}, u = s !== "one-shot" && Ro(i.replay, l);
|
|
6724
6746
|
return {
|
|
6725
6747
|
status: e?.status ?? 0,
|
|
6726
|
-
getHeader:
|
|
6748
|
+
getHeader: qo(e?.headers),
|
|
6727
6749
|
readBody: async () => e?.data,
|
|
6728
6750
|
request: c,
|
|
6729
6751
|
replay: async (e) => {
|
|
6730
|
-
let t = Ie(
|
|
6752
|
+
let t = Ie(Zo(o ?? {}, c, e));
|
|
6731
6753
|
try {
|
|
6732
6754
|
let e = await r(t);
|
|
6733
|
-
return
|
|
6755
|
+
return Qo(e, e?.config ?? t, e, r, i, c);
|
|
6734
6756
|
} catch (e) {
|
|
6735
|
-
let n =
|
|
6757
|
+
let n = Ko(e) ? e : {};
|
|
6736
6758
|
if (!n.response || typeof n.response.status != "number" || wi(e)) throw e;
|
|
6737
6759
|
return {
|
|
6738
|
-
...
|
|
6760
|
+
...Qo(n.response, n.config ?? t, e, r, i, c),
|
|
6739
6761
|
rejected: !0
|
|
6740
6762
|
};
|
|
6741
6763
|
}
|
|
@@ -6749,30 +6771,30 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6749
6771
|
replayUnsupportedReason: s === "one-shot" ? "a streaming request body is consumed by the first send" : "the replay policy refused this request",
|
|
6750
6772
|
signal: o?.signal
|
|
6751
6773
|
};
|
|
6752
|
-
},
|
|
6753
|
-
let r =
|
|
6774
|
+
}, $o = (e, t) => async (n) => {
|
|
6775
|
+
let r = Ba(e), i = Ko(n) ? n : {}, a = ao(await no(Qo(i.response, i.config, i.response, t, r), r), n);
|
|
6754
6776
|
if (a.settle === "reject") throw a.error;
|
|
6755
6777
|
return a.value;
|
|
6756
|
-
},
|
|
6757
|
-
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,
|
|
6778
|
+
}, es = (e, t, n) => {
|
|
6779
|
+
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, $o(t, i)), o = !1;
|
|
6758
6780
|
return () => {
|
|
6759
6781
|
o || (o = !0, e.interceptors.response.eject(a));
|
|
6760
6782
|
};
|
|
6761
|
-
},
|
|
6783
|
+
}, ts = (t, n) => {
|
|
6762
6784
|
let r = e.create(t);
|
|
6763
6785
|
return n(r), r;
|
|
6764
|
-
},
|
|
6786
|
+
}, ns = () => {
|
|
6765
6787
|
let e = typeof location > "u" ? void 0 : location.origin;
|
|
6766
6788
|
return e && e !== "null" ? e : void 0;
|
|
6767
|
-
},
|
|
6789
|
+
}, rs = (e) => {
|
|
6768
6790
|
let t = new URL(e).origin;
|
|
6769
6791
|
if (t === "null") throw Error(`Passflow: "${e}" has no origin a request can be matched against; list http(s) origins only.`);
|
|
6770
6792
|
return t;
|
|
6771
|
-
},
|
|
6772
|
-
let n = (t?.origins ?? []).map(
|
|
6793
|
+
}, is = (e, t) => {
|
|
6794
|
+
let n = (t?.origins ?? []).map(rs);
|
|
6773
6795
|
return (t, r) => {
|
|
6774
6796
|
if (r) return Promise.resolve(void 0);
|
|
6775
|
-
let i =
|
|
6797
|
+
let i = ns(), a;
|
|
6776
6798
|
try {
|
|
6777
6799
|
a = new URL(t, i).origin;
|
|
6778
6800
|
} catch {
|
|
@@ -6780,22 +6802,22 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6780
6802
|
}
|
|
6781
6803
|
return a !== i && !n.includes(a) ? Promise.resolve(void 0) : e();
|
|
6782
6804
|
};
|
|
6783
|
-
},
|
|
6784
|
-
let r =
|
|
6805
|
+
}, as = (e) => typeof Request < "u" && e instanceof Request, os = (e, t) => new Headers(t?.headers === void 0 ? as(e) ? e.headers : void 0 : t.headers), ss = (e, t, n) => {
|
|
6806
|
+
let r = is(t, n);
|
|
6785
6807
|
return async (t, n) => {
|
|
6786
|
-
let i =
|
|
6808
|
+
let i = as(t) ? t.url : t instanceof URL ? t.href : String(t), a = os(t, n), o = await r(i, a.has("authorization"));
|
|
6787
6809
|
return o ? (a.set("authorization", `Bearer ${o}`), e(t, {
|
|
6788
6810
|
...n,
|
|
6789
6811
|
headers: a
|
|
6790
6812
|
})) : e(t, n);
|
|
6791
6813
|
};
|
|
6792
|
-
},
|
|
6814
|
+
}, cs = (e) => {
|
|
6793
6815
|
let t = e.url ?? "", n = /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
6794
6816
|
return !e.baseURL || n && e.allowAbsoluteUrls !== !1 ? t : t ? `${e.baseURL.replace(/\/?\/$/, "")}/${t.replace(/^\/+/, "")}` : e.baseURL;
|
|
6795
|
-
},
|
|
6796
|
-
let n =
|
|
6817
|
+
}, ls = (e) => e ? typeof e.has == "function" ? e.has("Authorization") : Object.keys(e).some((t) => t.toLowerCase() === "authorization" && e[t] != null) : !1, us = (e, t) => {
|
|
6818
|
+
let n = is(e, t);
|
|
6797
6819
|
return async (e) => {
|
|
6798
|
-
let t = e.headers, r = await n(
|
|
6820
|
+
let t = e.headers, r = await n(cs(e), ls(t));
|
|
6799
6821
|
if (!r) return e;
|
|
6800
6822
|
let i = `Bearer ${r}`;
|
|
6801
6823
|
return t && typeof t.set == "function" ? t.set("Authorization", i) : e.headers = {
|
|
@@ -6803,7 +6825,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6803
6825
|
Authorization: i
|
|
6804
6826
|
}, e;
|
|
6805
6827
|
};
|
|
6806
|
-
},
|
|
6828
|
+
}, ds = 0, fs = (e, t) => {
|
|
6807
6829
|
let n = t?.signal ?? (typeof e == "object" && e ? e.signal : void 0) ?? void 0;
|
|
6808
6830
|
if (n) return {
|
|
6809
6831
|
get aborted() {
|
|
@@ -6817,34 +6839,34 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6817
6839
|
removeEventListener: (e, t) => n.removeEventListener(e, t)
|
|
6818
6840
|
} : {}
|
|
6819
6841
|
};
|
|
6820
|
-
},
|
|
6842
|
+
}, ps = (e) => (t) => e.headers?.get(t), ms = (e, t, n, r, i) => ({
|
|
6821
6843
|
status: e.status,
|
|
6822
|
-
getHeader:
|
|
6844
|
+
getHeader: ps(e),
|
|
6823
6845
|
readBody: () => e.clone().json(),
|
|
6824
6846
|
request: t.snapshot,
|
|
6825
|
-
replay: async (e) =>
|
|
6847
|
+
replay: async (e) => ms(await t.replay(n, e), t, n, r, i),
|
|
6826
6848
|
markers: r,
|
|
6827
6849
|
raw: e,
|
|
6828
6850
|
replayable: t.replayable,
|
|
6829
6851
|
replayUnsupportedReason: t.reason,
|
|
6830
6852
|
signal: i,
|
|
6831
6853
|
responseType: e.type
|
|
6832
|
-
}),
|
|
6854
|
+
}), hs = (e, t) => {
|
|
6833
6855
|
let n = (t, n) => {
|
|
6834
|
-
|
|
6856
|
+
ds += 1;
|
|
6835
6857
|
try {
|
|
6836
6858
|
return e(t, n);
|
|
6837
6859
|
} finally {
|
|
6838
|
-
--
|
|
6860
|
+
--ds;
|
|
6839
6861
|
}
|
|
6840
6862
|
};
|
|
6841
6863
|
return async (e, r) => {
|
|
6842
|
-
if (
|
|
6843
|
-
let i =
|
|
6864
|
+
if (ds > 0) return n(e, r);
|
|
6865
|
+
let i = Ba(t), a = Go(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = io(await no(ms(o, a, n, {}, fs(e, r)), i), o, i);
|
|
6844
6866
|
if (s.settle === "reject") throw s.error;
|
|
6845
6867
|
return s.value;
|
|
6846
6868
|
};
|
|
6847
|
-
},
|
|
6869
|
+
}, gs = new Set(va.filter((e) => !e.requiresPrepare).map((e) => e.type)), _s = (e) => {
|
|
6848
6870
|
if (!e || typeof e != "object" || !e.challenge_id || !e.expires_at) throw new $({
|
|
6849
6871
|
kind: "protocol",
|
|
6850
6872
|
message: "The upgrade start response is missing challenge_id or expires_at"
|
|
@@ -6856,16 +6878,16 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6856
6878
|
webauthn: e.webauthn,
|
|
6857
6879
|
codeSentTo: e.code_sent_to
|
|
6858
6880
|
};
|
|
6859
|
-
},
|
|
6881
|
+
}, vs = (e) => wi(e) && !Ti(e), ys = (e) => ({
|
|
6860
6882
|
async prepare(t) {
|
|
6861
|
-
if (!
|
|
6883
|
+
if (!gs.has(t)) try {
|
|
6862
6884
|
let n = e.relyingPartyId?.();
|
|
6863
|
-
return
|
|
6885
|
+
return _s(await e.startUpgrade(n ? {
|
|
6864
6886
|
method: t,
|
|
6865
6887
|
relying_party_id: n
|
|
6866
6888
|
} : { method: t }));
|
|
6867
6889
|
} catch (e) {
|
|
6868
|
-
if (
|
|
6890
|
+
if (vs(e)) throw e;
|
|
6869
6891
|
let t = ji(e, "start");
|
|
6870
6892
|
if (t.kind === "prepare_not_required") return;
|
|
6871
6893
|
throw t;
|
|
@@ -6883,17 +6905,17 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6883
6905
|
assertion: n
|
|
6884
6906
|
});
|
|
6885
6907
|
} catch (t) {
|
|
6886
|
-
if (
|
|
6908
|
+
if (vs(t)) throw t;
|
|
6887
6909
|
let n = ji(t, "refresh");
|
|
6888
6910
|
throw n.status === 401 && Ni(n) && e.markSessionInvalid?.(), n;
|
|
6889
6911
|
}
|
|
6890
6912
|
}
|
|
6891
|
-
}),
|
|
6913
|
+
}), bs = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), xs = (e) => {
|
|
6892
6914
|
let t, n = (e) => e !== void 0 && t === e, r = (r) => {
|
|
6893
6915
|
let i = () => {
|
|
6894
6916
|
if (!n(r())) throw new $({ kind: "session_changed" });
|
|
6895
6917
|
};
|
|
6896
|
-
return
|
|
6918
|
+
return ys({
|
|
6897
6919
|
...e,
|
|
6898
6920
|
relyingPartyId: () => t?.options.relyingPartyId ?? e.relyingPartyId?.(),
|
|
6899
6921
|
startUpgrade: (t) => (i(), e.startUpgrade(t)),
|
|
@@ -6904,7 +6926,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6904
6926
|
});
|
|
6905
6927
|
}, i = (t, n) => {
|
|
6906
6928
|
let i = {}, a = {
|
|
6907
|
-
controller: new
|
|
6929
|
+
controller: new za({
|
|
6908
6930
|
transport: r(() => i.current),
|
|
6909
6931
|
prompt: t.prompt,
|
|
6910
6932
|
platform: e.platform,
|
|
@@ -6916,7 +6938,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6916
6938
|
options: t,
|
|
6917
6939
|
scope: {
|
|
6918
6940
|
passflow: e.passflowDomain,
|
|
6919
|
-
backend:
|
|
6941
|
+
backend: bs(t.backend)
|
|
6920
6942
|
},
|
|
6921
6943
|
generation: n
|
|
6922
6944
|
};
|
|
@@ -6926,14 +6948,14 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6926
6948
|
s = void 0;
|
|
6927
6949
|
});
|
|
6928
6950
|
let c = (e) => {
|
|
6929
|
-
if (!s ||
|
|
6951
|
+
if (!s || Ra(s.challenge, e)) return;
|
|
6930
6952
|
let t = Math.min(o, e.maxAge === void 0 ? o : e.maxAge * 1e3);
|
|
6931
6953
|
if (!(Date.now() - s.at > t)) return s.challenge;
|
|
6932
6954
|
}, l = async (r, i) => {
|
|
6933
6955
|
let o = t;
|
|
6934
6956
|
if (!o) throw new Fi("Step-up verification is not enabled on this Passflow instance");
|
|
6935
6957
|
let l = e.stopRepeatedElevation ? c(r) : void 0;
|
|
6936
|
-
if (l) throw new Pi(
|
|
6958
|
+
if (l) throw new Pi(Fa(l), Fa(r), "This requirement was already proved and the server still refused it: sign the user in again");
|
|
6937
6959
|
o.controller.active || (o.pin = e.readSessionPin?.());
|
|
6938
6960
|
let u = await o.controller.elevate(r, i);
|
|
6939
6961
|
if (!n(o)) throw new Ii();
|
|
@@ -6983,9 +7005,9 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
6983
7005
|
let r = [];
|
|
6984
7006
|
if (e.attachInternalSeam) {
|
|
6985
7007
|
let t = e.attachInternalSeam;
|
|
6986
|
-
t((e) =>
|
|
7008
|
+
t((e) => $o(u, e)), r.push(() => t(void 0));
|
|
6987
7009
|
}
|
|
6988
|
-
n.interceptFetch && r.push(nn((e, t, n) =>
|
|
7010
|
+
n.interceptFetch && r.push(nn((e, t, n) => hs(e, u)(t, n), {
|
|
6989
7011
|
priority: 20,
|
|
6990
7012
|
name: "passflow-upgrade"
|
|
6991
7013
|
})), e.onSessionChange && r.push(e.onSessionChange(() => {
|
|
@@ -7017,8 +7039,8 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7017
7039
|
enumerable: !0,
|
|
7018
7040
|
value: (t, n) => {
|
|
7019
7041
|
let r = (t) => {
|
|
7020
|
-
let r =
|
|
7021
|
-
return e.readAccessToken ?
|
|
7042
|
+
let r = hs(t, u);
|
|
7043
|
+
return e.readAccessToken ? ss(r, e.readAccessToken, n) : r;
|
|
7022
7044
|
};
|
|
7023
7045
|
if (t) return r(t);
|
|
7024
7046
|
let i = typeof globalThis > "u" ? void 0 : globalThis;
|
|
@@ -7029,14 +7051,14 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7029
7051
|
attachAuth: {
|
|
7030
7052
|
enumerable: !0,
|
|
7031
7053
|
value: (t, n) => {
|
|
7032
|
-
let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(
|
|
7054
|
+
let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(us(e.readAccessToken, n)), a = es(t, u);
|
|
7033
7055
|
return () => {
|
|
7034
7056
|
a(), r && i !== void 0 && r.eject(i);
|
|
7035
7057
|
};
|
|
7036
7058
|
}
|
|
7037
7059
|
}
|
|
7038
7060
|
});
|
|
7039
|
-
},
|
|
7061
|
+
}, Ss, Cs = class {
|
|
7040
7062
|
get origin() {
|
|
7041
7063
|
return this.platform.getCurrentUrl()?.origin ?? "";
|
|
7042
7064
|
}
|
|
@@ -7049,9 +7071,9 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7049
7071
|
prefix: e.keyStoragePrefix ?? "",
|
|
7050
7072
|
storage: this.platform.storage,
|
|
7051
7073
|
appId: n
|
|
7052
|
-
}), this.deviceService = new de(this.storageManager), this.authApi = new jt(e, this.storageManager, this.deviceService), this.appApi = new wt(e, this.storageManager, this.deviceService), this.userApi = new Ht(e, this.storageManager, this.deviceService), this.settingApi = new Pt(e, this.storageManager, this.deviceService), this.tenantApi = new Ft(e, this.storageManager, this.deviceService), this.invitationApi = new Nt(e, this.storageManager, this.deviceService), this.twoFactorApi = new Bt(e, this.storageManager, this.deviceService), this.upgradeApi = new Vt(e, this.storageManager, this.deviceService), this.upgradeDomain = Be(e.url), this.subscribeStore = new Rn(), this.tokenCacheService = new
|
|
7074
|
+
}), this.deviceService = new de(this.storageManager), this.authApi = new jt(e, this.storageManager, this.deviceService), this.appApi = new wt(e, this.storageManager, this.deviceService), this.userApi = new Ht(e, this.storageManager, this.deviceService), this.settingApi = new Pt(e, this.storageManager, this.deviceService), this.tenantApi = new Ft(e, this.storageManager, this.deviceService), this.invitationApi = new Nt(e, this.storageManager, this.deviceService), this.twoFactorApi = new Bt(e, this.storageManager, this.deviceService), this.upgradeApi = new Vt(e, this.storageManager, this.deviceService), this.upgradeDomain = Be(e.url), this.subscribeStore = new Rn(), this.tokenCacheService = new ua(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? _, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
|
|
7053
7075
|
let i = Mr(e.refreshCoordination, this.platform, e.keyStoragePrefix, { tokenKeys: () => this.storageManager.tokenKeys() });
|
|
7054
|
-
this.authService = new
|
|
7076
|
+
this.authService = new oa(this.authApi, this.deviceService, this.storageManager, this.subscribeStore, this.tokenCacheService, this.scopes, this.createTenantForNewUser, this.url, {
|
|
7055
7077
|
createSession: async (e) => {
|
|
7056
7078
|
await this.createSessionCallback?.(e);
|
|
7057
7079
|
},
|
|
@@ -7071,7 +7093,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7071
7093
|
...e.antiBotWorkerUrl ? { workerUrl: e.antiBotWorkerUrl } : {}
|
|
7072
7094
|
}), this.authApi.setAntiBotHandler((e) => this.antiBot.headerFor(e)), this.tokenCacheService.attachRefreshController(this.authService.refresh);
|
|
7073
7095
|
for (let e of this.axiosClients()) e.setRefreshHandler((e) => this.authService.refresh.ensureFresh(e));
|
|
7074
|
-
this.userService = new
|
|
7096
|
+
this.userService = new fa(this.userApi, this.deviceService, this.platform), this.tenantService = new la(this.tenantApi, this.scopes), this.tenant = this.tenantService, this.invitationService = new sa(this.invitationApi), this.twoFactorService = new da(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = xs({
|
|
7075
7097
|
startUpgrade: (e) => this.upgradeApi.startUpgrade(e),
|
|
7076
7098
|
commitRefresh: async (e, t) => {
|
|
7077
7099
|
await this.authService.refreshToken(e, t);
|
|
@@ -7100,7 +7122,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7100
7122
|
let e = (await this.getTokens(!0))?.access_token;
|
|
7101
7123
|
return e && !A(j(e)) ? e : void 0;
|
|
7102
7124
|
}
|
|
7103
|
-
}), this.hostedUpgrade =
|
|
7125
|
+
}), this.hostedUpgrade = xs({
|
|
7104
7126
|
startUpgrade: (e) => this.upgradeApi.startHostedUpgrade(e),
|
|
7105
7127
|
commitRefresh: (e) => this.upgradeApi.commitHostedUpgrade(e),
|
|
7106
7128
|
canCommit: () => ({ ok: !0 }),
|
|
@@ -7137,7 +7159,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7137
7159
|
return this.upgrade.attachAuth(e, t);
|
|
7138
7160
|
}
|
|
7139
7161
|
createClient(e, t) {
|
|
7140
|
-
return
|
|
7162
|
+
return ts(e, (e) => this.upgrade.attachAuth(e, t));
|
|
7141
7163
|
}
|
|
7142
7164
|
readAssuranceBar() {
|
|
7143
7165
|
let e = this.storageManager.getToken(M.access_token);
|
|
@@ -7750,7 +7772,7 @@ var Ki = (e) => e ? [e] : [], qi = "passflow_2fa_pkce", Ji = 3e5, Yi = "passflow
|
|
|
7750
7772
|
this.twoFactorService.clearMagicLinkSession();
|
|
7751
7773
|
}
|
|
7752
7774
|
};
|
|
7753
|
-
|
|
7754
|
-
export { p as AGENT_TOOL_HEADER_KEY, m as ANTI_BOT_ACTION, Ke as ANTI_BOT_FAILED_ERROR_ID, f as ANTI_BOT_HEADER_KEY, Ye as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, Je as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, Ge as ANTI_BOT_REQUIRED_ERROR_ID, Xe as ANTI_BOT_SOLVE_FAILED_ERROR_ID, qe as ANTI_BOT_UNAVAILABLE_ERROR_ID, c as APP_ID_HEADER_KEY, $e as APP_SECRET_NAMES, l as AUTHORIZATION_HEADER_KEY, wt as AppAPI, jt as AuthAPI,
|
|
7775
|
+
Ss = Cs, Ss.version = h;
|
|
7776
|
+
export { p as AGENT_TOOL_HEADER_KEY, m as ANTI_BOT_ACTION, Ke as ANTI_BOT_FAILED_ERROR_ID, f as ANTI_BOT_HEADER_KEY, Ye as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, Je as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, Ge as ANTI_BOT_REQUIRED_ERROR_ID, Xe as ANTI_BOT_SOLVE_FAILED_ERROR_ID, qe as ANTI_BOT_UNAVAILABLE_ERROR_ID, c as APP_ID_HEADER_KEY, $e as APP_SECRET_NAMES, l as AUTHORIZATION_HEADER_KEY, wt as AppAPI, jt as AuthAPI, oa as AuthService, Mt as CLIAuthAPI, y as DEFAULT_GROUP_NAME, _ as DEFAULT_SCOPES, va as DEFAULT_UPGRADE_FACTORS, u as DEVICE_ID_HEADER_KEY, d as DEVICE_TYPE_HEADER_KEY, E as ERROR_MESSAGE_MAX_LENGTH, Ut as FETCH_PRIORITY_OIDC, Wt as FETCH_PRIORITY_UPGRADE, Gt as FetchMiddlewareContractError, ve as INSUFFICIENT_USER_AUTHENTICATION, Nt as InvitationAPI, sa as InvitationService, fn as M2MClient, sn as M2MConfigError, H as M2MError, cn as M2MErrorCodes, an as M2MNetworkError, on as M2MTokenParseError, ln as M2M_DEFAULTS, et as MASKED_SECRET_PREFIX, g as MINIMAL_DEFAULT_SCOPES, rt as OS, v as PASSFLOW_CLOUD_URL, We as PASSWORD_CHANGE_REQUIRED_ERROR_ID, x as POPUP_HEIGHT, ee as POPUP_POLL_INTERVAL_MS, S as POPUP_TIMEOUT_MS, b as POPUP_WIDTH, Cs as Passflow, ze as PassflowAdminEndpointPaths, z as PassflowEndpointPaths, B as PassflowError, G as PassflowEvent, U as PassflowOidcError, Ze as PassflowPasswordChangeRequiredError, Y as PassflowRefreshError, fe as PopupClosedError, Qe as Providers, vi as RECOVERABLE_COMMIT_ERROR_IDS, Fr as REFRESH_AUTH_FAILURE_IDS, J as RefreshErrorId, Re as RequestMethod, h as SDK_VERSION, He as SERVICE_UNAVAILABLE_ERROR_ID, Ue as SERVICE_UNAVAILABLE_MESSAGE, yi as SESSION_INVALIDATING_COMMIT_ERROR_IDS, tt as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, se as SessionState, Pt as SettingAPI, C as TOKEN_EXPIRY_BUFFER_SECONDS, Ft as TenantAPI, la as TenantService, ca as TenantUserMembership, ua as TokenCacheService, N as TokenDeliveryMode, M as TokenType, Bt as TwoFactorApiClient, ot as TwoFactorPolicy, da as TwoFactorService, ye as UPGRADE_REQUIRED, T as USERNAME_MAX_LENGTH, w as USERNAME_MIN_LENGTH, Vt as UpgradeAPI, Ta as UpgradeCancelledError, qr as UpgradeCommitInterruptedError, za as UpgradeController, Q as UpgradeErrorIds, pa as UpgradeFactorError, Pi as UpgradeInsufficientError, Ii as UpgradeSessionChangedError, Ea as UpgradeSignInRequiredError, $ as UpgradeTransportError, Fi as UpgradeUnavailableError, ja as UpgradeUnsatisfiableError, Ht as UserAPI, fa as UserService, L as WebAdapter, ji as classifyUpgradeError, ya as factorRegistry, rn as fetchRegistryState, it as getOSFromDeviceType, Ni as invalidatesSessionOnCommit, Ve as isEmailVerificationStep, nt as isMaskedSecret, Mi as isRecoverableCommitFailure, xi as isRetryableUpgradeKind, A as isTokenExpired, go as isUpgradeCancelled, _o as isUpgradeExhausted, vo as isUpgradeInsufficient, So as isUpgradeSessionChanged, bo as isUpgradeSignInRequired, Ti as isUpgradeTransportError, Co as isUpgradeTransportFailure, xo as isUpgradeUnavailable, yo as isUpgradeUnsatisfiable, Vi as isValidEmail, zi as isValidJWTFormat, Hi as isValidPhoneNumber, Ui as isValidUsername, Ee as parseChallengeBody, Te as parseChallengeHeader, j as parseToken, Ae as parseUpgradeChallenge, _a as passkeyFactor, at as pathWithParams, ga as recoveryCodesFactor, nn as registerFetchMiddleware, _e as requiredAcrLevel, Be as resolveUpgradeDomain, Bi as sanitizeErrorMessage, wa as selectFactors, ha as totpFactor, R as webAdapter };
|
|
7755
7777
|
|
|
7756
7778
|
//# sourceMappingURL=index.mjs.map
|