isExpired method
bool
isExpired(
{ - int leeway = 0,
})
Implementation
bool isExpired({int leeway = 0}){
int? exp = claims["exp"];
int? iat = claims["iat"];
int todayTime = DateTime.now().millisecondsSinceEpoch;
logNUI("NUIAuthToken", "exp: $exp, iat: $iat, todayTime: $todayTime");
int futureToday = todayTime + leeway * 1000;
int pastToday = todayTime - leeway * 1000;
bool expValid = exp == null || pastToday <= exp*1000;
bool iatValid = iat == null || futureToday >= iat*1000;
return !expValid || !iatValid;
}