I have a function that takes in input like so.
(list (read-string "Key to use for encryption: ")
How can I prevent the inputted string from being saved to minibuffer-history and is there another way to read input that avoids being saved to minibuffer-history?
Have you tried using
read-passwd? It was designed for this kind of "secure" input. https://www.gnu.org/software/emacs/manual/html_node/elisp/Reading-a-Password.html
You could temporarily bind
minibuffer-history to itself:
(let ((minibuffer-history minibuffer-history)) (read-string "Key to use: "))
minibuffer-history is restored to its original value, which will not include whatever
read-string added to it.