If you have secrets anywhere near your live stream, it's not a question if "if" you will leak them but "when." Don't put yourself in that situation.
Work _hard_ to keep yourself out of that situation.
I’d assume you’re not coding on a production system so your secrets shouldn’t be too hard to revoke, cycle them after your stream and any time you leak them.
I generate my secrets once, send them off to the secrets service, and then my service queries that service. I never see the secrets with my own eyes.
I've not come across what you describe
Let's say I live streamed implementing Stripe. There's no way to avoid not showing my test API keys if I'm going to show the end to end process of setting everything up. The best I could do is to roll the keys before I start the stream but this degrades the quality of the stream since it's not from scratch.
Of course those keys and anything else that's sensitive would be sitting in an .env file, and I'd also have an .env.example file showing how it's set up without anything sensitive being in there (I do this already in my pre-recorded videos). Even going as far as preventing the real .env file coming up when I fuzzy open files so I don't open it by accident and the contents of that file being ignored from multi-file searches.
If you revealed a Stripe key only to change it 1 minute afterwards, you still need a process to change it in secret, which goes back to my original reply of setting up a dedicated "secret" scene so you can modify things in private.
You are making the choice to live stream. It is always possible to avoid live streaming. Always.
- Not only I have seen secrets revealed on stream, like passwords and tokens and such... I have seen people working with databases full of personally identifiable information, and you could see names, phone numbers, e-mails and addresses on stream. There are irresponsible people out here.
- I have seen people doxxing themselves by showing their git identity, or some popup window with some licensing information such as "Registered to: John Doe", or when the autocomplete suggestions on their browser search bar shows "[Facebook favicon] John Doe".
As you can see, there are many, many ways to leak your identity on stream. If you want to have a discrete online presence, try to do all your work on a dedicated VM, or take measures such as using a dedicated browser for your stream related activities, a separate git identity, hide splash screens, and pay attention to detail at how things look before you go live.
There are benefits to streaming. It somehow makes you productive, because you don't want to look bad in front of your audience.
Plus, there are smart people on Twitch. A lot of lurkers that do not stream have an impressive amount of knowledge.
Money-wise, it's not worth it. The category that has the most programmers, "Science & Technology", has only 2,000 viewers at a time on a good day. That is very little compared to other categories. If you want to make money, publishing YouTube videos may be way more profitable than Twitch.
That's really the critical bit. It's one thing to show your face on camera. It's another to show your name and address. The latter bits are regularly used to, e.g., SWAT streamers. Let's just say that streamers are all too familiar with legal trusts.
Though with keyboard camera they probably should be more careful in which scenes show that if any of those secrets are typed rather than say copy/pasted.
-1 -if gaming on a FPS, enemies might use your Twitch stream to find you. 30 seconds delay allows you to actually use counter-measures and employ disinformation tactics on your stream
-2 -if showing something, chat should be secondary, not primary. You're not on a live AMA, for that use Youtube LIVE (or chaturbate if that's your thing, I don't judge)
-3 -as said above, to give you time to react to your own mistakes
-4 -post processing for additional effects/reasons. Making a loop allows you to cut into mid-stream in some cases. This is an advanced use though, I only know of one twitcher that uses this
Many, many streamers expressly DO want to live chat with viewers. As a viewer, I don't like streamers that don't interact with chat. I may as well as watch a youtube video at that point. As a streamer, the entire point for me is to interact with people. If all I wanted to do was showcase something, I'd make youtube videos...
There are other methods one can use to avoid i.e. stream sniping besides having a long latency.
"You're not on a live AMA"
Twitch literally has a "Just Chatting" category. That said, there's nothing wrong with a streamer taking a break from the game to just chat for a bit. If you don't like that, instead of telling people how they should act, why not find a different streamer or use a different platform?
When I set up OBS, I overlayed a full screen image that says I'm showing something secret which had nothing but a small webcam feed in the bottom right so folks could still see me but not my desktop. It was assigned to a global hotkey toggle of course.