Deprecate TaintedString (#15423)

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
This commit is contained in:
Juan Carlos 2021-01-15 23:56:38 -03:00 • committed by GitHub
commit 78a99587a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 184 additions and 229 deletions

View file

@ -771,7 +771,7 @@ proc getch*(): char =
when defined(windows):
from unicode import toUTF8, Rune, runeLenAt
proc readPasswordFromStdin*(prompt: string, password: var TaintedString):
proc readPasswordFromStdin*(prompt: string, password: var string):
bool {.tags: [ReadIOEffect, WriteIOEffect].} =
## Reads a `password` from stdin without printing it. `password` must not
## be ``nil``! Returns ``false`` if the end of the file has been reached,
@ -797,7 +797,7 @@ when defined(windows):
else:
import termios
proc readPasswordFromStdin*(prompt: string, password: var TaintedString):
proc readPasswordFromStdin*(prompt: string, password: var string):
bool {.tags: [ReadIOEffect, WriteIOEffect].} =
password.string.setLen(0)
let fd = stdin.getFileHandle()
@ -811,9 +811,9 @@ else:
stdout.write "\n"
discard fd.tcSetAttr(TCSADRAIN, old.addr)
proc readPasswordFromStdin*(prompt = "password: "): TaintedString =
proc readPasswordFromStdin*(prompt = "password: "): string =
## Reads a password from stdin without printing it.
result = TaintedString("")
result = ""
discard readPasswordFromStdin(prompt, result)