refreshSession method

Future<DSSession> refreshSession(
  1. String userId, {
  2. Duration? newDuration,
})

Refreshes an existing session

Implementation

Future<DSSession> refreshSession(String userId,
    {Duration? newDuration}) async {
  final existing = _activeSessions[userId];
  if (existing == null) {
    throw SessionNotFoundException('No session found for user: $userId');
  }

  return await createSession(
    userId: userId,
    deviceId: existing.deviceId,
    maxAge: newDuration ?? const Duration(hours: 24),
  );
}