show prompt when stdout is redirected

and close the tty file so we don't leak descriptors
simple command to just print the secret key

this is for integration into third party apps