A deal has been made between the US and China to keep TikTok running in the US, according to US President Donald Trump.

We have a deal on TikTok, I've reached a deal with China, I'm going to speak to President Xi on Friday to confirm everything up, Trump told reporters as he left the White House for a state visit to the UK.

The social media platform, which is run by Chinese company ByteDance, was warned it had to sell its US operations or risk being shut down. However, Trump has continuously delayed the ban since its announcement in January.

The US president said a buyer will be announced soon. CNBC reported the deal would include a mix of current and new investors, to be completed in the next 30 to 45 days. It also confirmed that US tech company Oracle would maintain its existing agreement to host TikTok's servers within the US.

This arrangement had been a crucial requirement for American lawmakers concerned about data privacy and national security issues related to information sharing with China.

A US trade delegation recently stated that it had reached a framework deal with China amid broader trade discussions in Madrid. China acknowledged the agreement, emphasizing that it would not compromise the interests of their companies.

During a press conference, China's cyberspace administration deputy head Wang Jingtao suggested the agreement might include licensing agreements regarding TikTok's algorithm and other intellectual property rights, stating that the Chinese government would legally examine and approve issues related to TikTok, including technology exports.

After initially advocating for a ban of TikTok during his first term, Trump has now shifted his approach to the widely popular video-sharing platform. In January, the US Supreme Court upheld a law mandating a sale of TikTok's US arm to avoid an outright ban, citing concerns over national security.

The US Justice Department has indicated that TikTok's access to user data raises significant national-security threats. Despite this, ByteDance has resisted efforts to sell, asserting that its US operations are separate and do not share information with the Chinese government.

TikTok briefly faced potential blackout earlier in January, but the shutdown was delayed after less than a day. The deadline for a sale has since been extended three times, with the latest extension due to conclude on September 17.