refreshSession method
POST /v1/sessions/refresh; userToken re-verifies a renewed host JWT.
Implementation
@override
Future<KletsoSession> refreshSession(
KletsoSession current, {
String? userToken,
}) async {
await _latency();
final old = _sessions[current.token];
if (old == null) throw const KletsoAuthException('unknown session token');
old.expired = true;
final fresh = _Session(
id: old.id,
token: 'kst_${_id('tok')}',
endUserId: old.endUserId,
anonymous: old.anonymous,
context: old.context,
);
_sessions[fresh.token] = fresh;
_expired = false;
return KletsoSession(
id: fresh.id,
token: fresh.token,
expiresAt: _now().add(const Duration(hours: 1)),
);
}