A long-awaited deal to secure TikTok's future in the United States is taking shape, with new investors poised to join existing shareholders of parent company ByteDance and Oracle set to maintain its role as TikTok's U.S. cloud provider, according to people familiar with the negotiations.

The framework agreement, which Treasury Secretary Scott Bessent confirmed was reached in Madrid after talks with Chinese officials, is expected to close within 30 to 45 days. "Where this thing is capitalized and how large it is remains to be seen," CNBC's David Faber said Tuesday on Squawk on the Street, adding that the agreement is likely to involve "relatively small" checks and is not expected to result in a publicly traded company.

President Donald Trump is scheduled to speak with Chinese President Xi Jinping on Friday to finalize the deal, which both sides have sought for months. "We have a group of very big companies that want to buy it," Trump told reporters, noting that "the kids wanted it so badly. I had parents calling me up ... they say, if I don't get it done, they're in big trouble with their kids."

Oracle, co-founded by billionaire Larry Ellison, has been considered a key player since 2020, when the Trump administration first floated the idea of forcing ByteDance to divest TikTok's U.S. operations. Oracle declined to comment Tuesday, as did TikTok and potential investor Silver Lake.

The deal comes against the backdrop of a 2024 law requiring ByteDance to divest its U.S. TikTok assets or face a nationwide ban - a measure upheld unanimously by the Supreme Court. Trump has repeatedly extended enforcement deadlines since taking office, with the most recent extension set to expire Wednesday.

Chinese officials signaled Tuesday that they would defend national interests but "fully respect the will of enterprises and supports them in conducting business negotiations on an equal footing in accordance with market principles," according to a statement from the Chinese Embassy in Washington.

TikTok has faced years of scrutiny over fears that Beijing could access U.S. user data or manipulate its recommendation algorithm. Lawmakers from both parties have argued that divestiture is the only way to protect national security, while TikTok has denied any Chinese government control.

Oracle's cloud-hosting arrangement, first implemented as part of TikTok's "Project Texas" data-security initiative, is expected to remain a central piece of the agreement. Under the plan, U.S. TikTok user data will continue to be routed through Oracle's Texas-based servers, a move designed to reassure regulators and lawmakers.

Trump has expressed mixed feelings about the platform, once trying to ban it but more recently crediting TikTok with helping him gain support among younger voters in the 2024 election. "We may let it die, or we may, I don't know," Trump said Monday. "Up to China. It doesn't matter too much. I'd like to do it for the kids. They like it."