No system is truly secure when you need the unencrypted version.
I keep my password in environment variables, but you can still poke in /proc to get it back.
All you can do is minimize the time you have it present. Delete as soon as you dont need it anymore.
The only secure way to use swap (which can hold your unencrypted data) is to fully encrypt your system. All of it.
I remember Snowden in an interview put a blanket on top of his head to type in his password to open his laptop. As pin needle camera's exist. Or good microphones, that can actually (with multiple microphones) deduce which key was pressed by it's sound (concentrate on, for example, the spacebar; you will hear that it is different sounding, just like the shift. Press qpqpqp Can you hear the difference? So might microphones).The video display actually leaks the image too (in a CCC they showed how, with a cheap laptop, they could read the screen using the leaked radiowave signal coming from the laptop)
I like keepassXC, it write the password in combinations with capslock randomly going on/off.
for that eavesdropping thing: DDG: rfi tempest
Kind of reminds me of the movie "The Darkest Hour", where this guy had a faraday cage with his electronics inside.