It is narrated from Abu Salih Dhakwan (may Allah have mercy on him): "A man said to the Prophet (peace and blessings be upon him): 'I do a good deed and keep it hidden; then, when it becomes known (that is, when people come to know of it), it pleases me.' He (peace and blessings be upon him) said: 'Allah Almighty writes for you two rewards: the reward of the hidden deed and the reward of the open one.'"
Imam Musaddad recorded it as mursal with a sahih (authentic) chain.