At a US port of entry citizens and non-citizens alike have no 4th or 5th Amendment rights. So things like laptops, smartphones, and USB flash drives are subject to search as a condition of entry to the country. A demand of passwords to devices and social media appears to be in line with existing law.