Using the domain name has been flawlessly working for 10 to 15 years in tools like Maven, Gradle, Leiningen, SBT, etc. Squatting just doesn’t exist there.
It’s the right solution. (Yes, there are many other bad things about Maven and its ecosystem, but they got this detail right.)
My suggestion to derive some identifier from a different service is just a very watered down approach of that, but in these times in which worse-is-better reigns supreme, one has to adjust the expectations.
Using the domain (or reverse domain) would also avoid a clash between the existing crate names and the “new” namespaced crate names, and it would be fairly easy to flip a switch between them:
Disallow publishing new crates under the global namespace after a cut-off date, except where the new version adds a “redirect-to” property to the new crate location in its Cargo.toml.
This would allow us to automatically migrate/upgrade users of the existing crates to the new namespaced versions when running cargo update.
Then, at a certain point in time it would be disallowed to specify “global” crates as dependencies in the Cargo.toml.
Ownership could either be verified by sending a mail to postmaster@domain-in-questi.on or by placing the public key at a well-known location on the server belonging to the domain, such that a crate would be signed with a private key, and crates.io would verify the validity by checking with the public key on the server.
This would also solve the issue with the question of what happens when domains change hands … the person not owning the domain would not be able to publish crates under that domain anymore. And the new owner would have to publish crates using a new key, making the change of ownership easily displayable on crates.io.