No. of Recommendations: 4
Can you just refuse to provide the unlock code (sans court order, which you have to obey)?
Yes - not legal advice, but that's my understanding.
Of course, if you refuse to provide the unlock code, they'll take your phone and try to unlock it on their own. They might not be successful. If you have paid attention to and prioritized securing your phone, even the feds can't always get into a locked phone. But they're almost certainly going to take some amount of time (certainly days, perhaps weeks) to try.
BTW, the court can't order you to provide a PIN (also not legal advice). That's considered a testimonial act - you can't be compelled to reveal the contents of your mind - and is protected by the Fourth Amendment. But they can require you to provide a biometric unlock, like a fingerprint or face scan.