In Dan. Chap. 2 The king had a dream - but could not remember it. His fake-wise-men caught a death sentence for not being able to recite the dream; then interpret the dream. Daniel was able to do so, only by the power of the LORD. Vs.22 "HE reveals the deep and secret things: He knows what is in the darkness[minds], - and the light - dwells with HIM."
Some secrets are encouraged: Matt. 6:4-18 deals with alms, and prayer. These should be in private; with a public reward. We either get the reward/accolades from man, or from our Creator!
In Mk.4:22, and Luke 8:17 we see that nothing[no thing] is hidden from our LORD, and all will be made manifest.
Our LORD warns us to be careful of the Enemy's #1 weapon = deception. This is regarding Blind-leaders, False-prophets, Hypocrites[religious].... These folk swear or take public oaths - then take another oath in private; that is Anti-Christ, Anti-people. I. E. Politicians.
Our LORD-Christ-Jesus, will judge the secrets of men[Rom.2:16].