It was non-trivial to do this, so I put it into a library. Strangely I couldn't directly wrap the ReadPassword function from the golang.org/x/term package, as it wouldn't unblock for some reason.