Not a lawer, but the ACLU has a page on this:

Short FAQ:

https://www.aclu.org/know-your-rights/what-do-when-encounter...

Dedicated article:

https://www.aclu.org/news/privacy-technology/can-border-agen...

Thank you. This is excellent guidance.

from [1]:

> Refusal to do so might lead to delay, additional questioning, and/or officers seizing your device for further inspection.

Then, there's no point in denying device search?

[1]: https://www.aclu.org/know-your-rights/what-do-when-encounter...