src/includes/classes/Core/Utils/Nonce.php
public function create(string $action = null, callable $callback = null): string
    {
        $Nonce = (object) [
            'token'       => $this->c::uuidV4(),
            'action'      => mb_strtolower($action ?? ''),
            'expire_time' => time() + $this::SECONDS_IN_DAY,
            'used'        => false, // Unused on creation.
        ];
        if (isset($callback)) {
            $callback($Nonce);
            return $Nonce->token;
        }
        if ($this->c::isActiveSession()) {
            $_SESSION['_nonce'] = $_SESSION['_nonce'] ?? [];
            $this->c::arrayUnshiftAssoc($_SESSION['_nonce'], $Nonce->token, $Nonce);
            $_SESSION['_nonce'] = array_slice($_SESSION['_nonce'], 0, 64, true);
            return $Nonce->token;
        }
        throw $this->c::issue('No storage handler.');
    }
public function create(string $action = null, callable $callback = null): string
    {
        $Nonce = (object) [
            'token'       => $this->c::uuidV4(),
            'action'      => mb_strtolower($action ?? ''),
            'expire_time' => time() + $this::SECONDS_IN_DAY,
            'used'        => false, // Unused on creation.
        ];
        if (isset($callback)) {
            $callback($Nonce);
            return $Nonce->token;
        }
        if ($this->c::isActiveSession()) {
            $_SESSION['_nonce'] = $_SESSION['_nonce'] ?? [];
            $this->c::arrayUnshiftAssoc($_SESSION['_nonce'], $Nonce->token, $Nonce);
            $_SESSION['_nonce'] = array_slice($_SESSION['_nonce'], 0, 64, true);
            return $Nonce->token;
        }
        throw $this->c::issue('No storage handler.');
    }
Nonce generator.

@since 17xxxx Nonce utils.

@param string|null   $action   Action.
@param callable|null $callback Callback.

@return string New, unique nonce token.
CaSe-insensitive, 32 bytes in length.

@note Callback stores the token for future verification.
If no callback, a `$_SESSION` storage handler is used by default.