Module auth/storage/token-init

Authentication Token System Initialization Module

Handles the initial bootstrap process for the authentication token system, ensuring proper loading of existing tokens and coordination between various token-related modules.

Features:

  • One-time initialization of the token management system
  • Automatic loading of persisted tokens during application startup
  • Circular dependency resolution through dynamic imports
  • Automatic token refresh for tokens near expiration
  • Token expiry validation during initialization
  • Automatic refresh scheduling for valid tokens
  • Proper token state synchronization across modules
  • Comprehensive error handling during initialization

This module serves as the bootstrap mechanism for the token system, ensuring that all token-related modules are properly initialized and configured, and that any existing tokens are loaded and validated. It also handles the initial token refresh scheduling based on the loaded token state.

Functions

initTokenStore