A service to manage Azure-specific storage operations.

Hierarchy (view full)

Constructors

Properties

config: WebCoreConfig<"azure">

The configuration for the web core.

credentialKeys: string[] = ...

The list of keys used to store credentials in the storage.

prefix: string = 'lemon'
storage: Storage = ...

Methods

  • Calculates the token expiration timestamp with built-in safety buffer. Uses a priority-based approach: server expiration first, then JWT expiration, finally fallback duration. Automatically applies a 5-minute safety buffer to prevent token expiry during requests.

    Parameters

    • Optional serverExpiration: string

      ISO string or date string from server response

    • Optional jwtToken: string

      JWT token string to extract expiration from

    Returns number

    Unix timestamp (milliseconds) when the token should be considered expired

  • Extracts the issued time from a JWT token for token lifecycle tracking. Used to calculate token age and determine refresh timing based on token lifetime.

    Parameters

    • Optional jwtToken: string

      JWT token string to extract issued time from

    Returns string | number

    Unix timestamp in milliseconds if found, empty string if not available or on error

  • Safely decodes a JWT token and extracts its payload. Provides error-safe JWT parsing without throwing exceptions on malformed tokens.

    Parameters

    • jwt: string

      JWT token string to decode

    Returns JwtPayload

    Decoded JWT payload object, or null if decoding fails