The phone/computer/whatever IS NOT YOUR PROPERTY and ALL THE INFORMATION on it is the property of YOUR EMPLOYER.
So just kindly tell the border agent that one must obtain permission from one's employer before revealing proprietary company information. Pretty much tell them that one has to get permission from one's company's legal department to reveal the unlock code for any company equipment because it's not one's own decision to make to reveal company proprietary information to a third party. That's pretty much standard policy for any company.
However, if it's one personal device, it's definitely it's within one's right to not give the border agents the password, but then it's also the border agent's right to detain you till you do, or till some other agreement is reached. Unless you can contact a lawyer immediately and have the funds to pay one, then without a lawyer helping you out, it's going to be difficult for you to navigate the legal minefield.