I am trying to help someone to repent from a sin. I was actually involved in that sin myself earlier and have repented alhamdulillah, but I have not told him any of this since in I know I cannot reveal my sins. Is it permissible to say to him "I know someone who did ... and then he did ... and was able to repent", while you are actually speaking about yourself and giving private details on your own life, in order to encourage him on how to stop sinning, as his situation is similar? Does it make a difference if you are speaking to him anonymously online?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
You have indeed done well in concealing your sin, for this is what you are obliged to do for the Hadeeth: “Avoid these filthy things which Allah has forbidden, but if someone commits any of them, he should conceal himself with the screen of Allah and repent to Allah.” [Al-Hakim – who graded it as Saheeh (authentic) and adh-Dhahabi agreed with him]
You also did well in seeking to help your Muslim brother to repent, for this is among the acts of cooperation in righteousness, piety, and counseling among Muslims.
There is nothing wrong with you saying ‘I know someone who did this’ while you mean yourself by it, and there is no difference in ruling between talking to him directly or via the Internet.
Allah knows best.
You can search for fatwa through many choices