@passflow/core 0.21.0 → 0.21.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/dist/index.d.cts CHANGED
@@ -3432,6 +3432,15 @@ export declare class TokenCacheService {
3432
3432
  * construction. Without it, `getTokensWithRefresh()` returns the cache and sends nothing.
3433
3433
  */
3434
3434
  attachRefreshController(controller: Pick<RefreshController, 'refresh' | 'busy'> | undefined): void;
3435
+ /**
3436
+ * Starts the expiry check. `Passflow.subscribe()` calls it on every subscribe, so it must be
3437
+ * safe to repeat:
3438
+ * - A filled cache wins over storage. The cache only moves forward (the refresh controller
3439
+ * and its fence own every later change), while storage can still hold an older pair of the
3440
+ * same session (a held tab). Reading storage here would move the cache back.
3441
+ * - `TokenCacheExpired{isExpired:true}` fires only when the expired state changes, not on
3442
+ * every call.
3443
+ */
3435
3444
  initialize(): void;
3436
3445
  startTokenCheck(): void;
3437
3446
  private setupLifecycleListeners;
package/dist/index.d.ts CHANGED
@@ -3432,6 +3432,15 @@ export declare class TokenCacheService {
3432
3432
  * construction. Without it, `getTokensWithRefresh()` returns the cache and sends nothing.
3433
3433
  */
3434
3434
  attachRefreshController(controller: Pick<RefreshController, 'refresh' | 'busy'> | undefined): void;
3435
+ /**
3436
+ * Starts the expiry check. `Passflow.subscribe()` calls it on every subscribe, so it must be
3437
+ * safe to repeat:
3438
+ * - A filled cache wins over storage. The cache only moves forward (the refresh controller
3439
+ * and its fence own every later change), while storage can still hold an older pair of the
3440
+ * same session (a held tab). Reading storage here would move the cache back.
3441
+ * - `TokenCacheExpired{isExpired:true}` fires only when the expired state changes, not on
3442
+ * every call.
3443
+ */
3435
3444
  initialize(): void;
3436
3445
  startTokenCheck(): void;
3437
3446
  private setupLifecycleListeners;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import e from "axios";
2
2
  import { startAuthentication as t, startRegistration as n } from "@simplewebauthn/browser";
3
3
  // package.json
4
- var r = "0.21.0", i = "X-Passflow-Clientid", a = "Authorization", o = "X-Passflow-DeviceId", s = "X-Passflow-DeviceType", c = r, l = [
4
+ var r = "0.21.1", i = "X-Passflow-Clientid", a = "Authorization", o = "X-Passflow-DeviceId", s = "X-Passflow-DeviceType", c = r, l = [
5
5
  "id",
6
6
  "offline",
7
7
  "openid"
@@ -4397,13 +4397,13 @@ var _r = "passflow_2fa_pkce", vr = 3e5, yr = class {
4397
4397
  }
4398
4398
  initialize() {
4399
4399
  try {
4400
- let e = this.storageManager.getTokens();
4401
- if (!e) return;
4402
- if (!e.access_token) {
4403
- this.setTokensCache(e), this.startTokenCheck();
4400
+ let e = this.tokensCache, t = e ?? this.storageManager.getTokens();
4401
+ if (!t) return;
4402
+ if (!t.access_token) {
4403
+ e || this.setTokensCache(t), this.startTokenCheck();
4404
4404
  return;
4405
4405
  }
4406
- k(A(e.access_token)) ? (this.tokenExpiredFlag = !0, this.stopTokenCheck(), this.subscribeStore.notify(Z.TokenCacheExpired, { isExpired: !0 })) : (this.setTokensCache(e), this.startTokenCheck());
4406
+ k(A(t.access_token)) ? (this.stopTokenCheck(), this.tokenExpiredFlag || (this.tokenExpiredFlag = !0, this.subscribeStore.notify(Z.TokenCacheExpired, { isExpired: !0 }))) : (e || this.setTokensCache(t), this.startTokenCheck());
4407
4407
  } catch (e) {
4408
4408
  let t = {
4409
4409
  operation: "tokens.load",