protected function generateUniqueId() : string
{
$unique = '';
$query = 'SELECT count(*) FROM airship_users WHERE uniqueid = ?';
do {
if (!empty($unique)) {
// This will probably never be executed. It will be a nice easter egg if it ever does.
$state = State::instance();
$state->logger->log(LogLevel::ALERT, "A unique user ID collision occurred. This should never happen. (There are 2^192 possible values," . "which has approximately a 50% chance of a single collision occurring after 2^96 users," . "and the database can only hold 2^64). This means you're either extremely lucky or your CSPRNG " . "is broken. We hope it's luck. Airship is clever enough to try again and not fail " . "(so don't worry), but we wanted to make sure you were aware.", ['colliding_random_id' => $unique]);
}
$unique = \Airship\uniqueId();
} while ($this->db->exists($query, $unique));
return $unique;
}