Most of these were written by David. He understood this quite well especially when he was being chased around Judah by Saul, and he had to frequently find hiding places, but he understood that his ultimate hiding place, his ultimate secret place, was God Himself. So he wrote it in the Psalms.