A bill that would force a sale of TikTok by its Chinese owner, ByteDance — or ban it outright — was passed by the Senate on Tuesday and is expected to be signed quickly into law by President Biden.

Now the process is likely to get even more complicated.

Congress passed the measure citing national security concerns because of TikTok’s Chinese ties. Both lawmakers and security experts have said there are risks that the Chinese government could lean on ByteDance for access to sensitive data belonging to its 170 million U.S. users or to spread propaganda.

The proposed law would allow TikTok to continue to operate in the United States if ByteDance sold it within 270 days, or about nine months, a time frame that the president could extend to a year.

The measure is likely to face legal challenges, as well as possible resistance from Beijing, which could block the sale or export of the technology. It’s also unclear who has the resources to buy TikTok, since it will carry a hefty price tag.

The issue could take months or even years to settle, during which the app would probably continue to function for U.S. consumers.

“It’s going to be a royal mess,” said Anupam Chander, a visiting scholar at the Institute for Rebooting Social Media at Harvard and an expert on the global regulation of new technologies.