I want to note that you can call actual C functions from D without much extra effort.
Here’s a program that calls getpass: https://glot.io/snippets/fqf04b6wg2
I forgot to edit my comment to add that, for some reason, it doesn’t seem work on macOS. But if that’s not a problem for you, then I’m happy I could help.
Edit: I just read the code, and it seems like you found out about that before I could warn you. :)