**EDIT:** Discovered my `getPass()` adds backspace characters too; here's one
workaround for that:
proc getPassword(prompt = "Secret: "): string =
stdout.write(prompt)
const backspace_character = char(127) # ASCII code
while result == "" or result[^1] notin ['\r', '\n']:
let entered_char = getch()
# Cant actually implement backspace behaviour (remove char already
printed to stdout), but can at least not add/print for its character
if entered_char != backspace_character:
result.add(entered_char)
stdout.write("*")
stdout.write("\n")
return result.strip()
Run