refreshSession method

Future<void> refreshSession(
  1. String userId
)

Updates session timestamp

Implementation

Future<void> refreshSession(String userId) async {
  try {
    final sessionData = await getSession(userId);
    if (sessionData != null) {
      sessionData['timestamp'] = DateTime.now().toIso8601String();

      final file = File('$_sessionDir/$_sessionFile');
      await file.writeAsString(json.encode(sessionData));

      print('Cognito session refreshed for user: $userId');
    }
  } catch (e) {
    print('Failed to refresh session: $e');
    throw DSAuthError('Failed to refresh session');
  }
}