isValid method

bool isValid()

Validates the session based on timeout and other security checks.

Implementation

bool isValid() {
  // Check if session has been manually invalidated
  if (isInvalidated()) {
    return false;
  }

  // Check if session has expired
  if (isExpired()) {
    return false;
  }

  // Check if session was created (basic integrity check)
  final createdAt = _session['created_at'];
  if (createdAt == null) {
    return false;
  }

  // Additional validation can be added here
  // e.g., check IP address consistency, user agent, etc.

  return true;
}