It’s not a legal process. It doesn’t involve courts.
You arrive at a border, show proof of citizenship, and they let you in.
It doesn’t even have to be a passport. It could be a state issued drivers license.
And if they don’t like the look of you, or your proof of citizenship, and decide detain and deport you - what recourse do you have?