Praise be to Allah.
It is not permissible for a Muslim who pays attention to matters of trust and hates betrayal to record the words of a speaker without his permission or without his knowledge, no matter what the type of speech, whether it is religious or worldly, such as fatwas, scientific discussions, financial matters, and so on.
It is proven in the hadith of Jaabir ibn ‘Abdillah al-Ansaari (may Allah be pleased with him) that the Prophet (blessings and peace of Allah be upon him) said: “If one man speaks to another and looks around (to make sure no one is listening), then that is a trust (amaanah).” Narrated by Ahmad, Abu Dawood and at-Tirmidhi.
What is meant by his looking around is that it is clear from the actions of the speaker that he is being cautious, by looking around, right and left, to make sure that no one can hear what he is saying. Thus what your companion says to you is a trust for the listener, that he has entrusted him with. If he tells someone else about it, then he has gone against the command of Allah, as he has disclosed the trust to people who are not entitled to receive it, and thus he becomes a wrongdoer. What he should do is conceal it, because when the person who told it to him looked around, that was like a gesture telling him not to tell anyone else. They said: This is a very concise expression, yet full of meaning, because the word translated here as looked around is very concise, and is encouraging us to observe good etiquette when mixing with people, to treat people well, to conceal secrets and maintain friendships, and it is a warning against spreading malicious gossip that could lead to resentment, as is quite clear.