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:
parent
7b632f9ccb
commit
78a99587a4
36 changed files with 184 additions and 229 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue