How do I use getpass?

help?> Base.SecretBuffer
Base.SecretBuffer()

An IOBuffer-like object where the contents will be securely wiped when garbage collected.

It is considered best practice to wipe the buffer using Base.shred!(::SecretBuffer) as soon as the secure data are no longer required. When initializing with existing data, the SecretBuffer! method is highly recommended to securely zero the passed argument. Avoid initializing with and converting to Strings as they are unable to be securely zeroed.

You can read from it like any IO object - just avoid putting it into a string (i.e. no simple read). Most methods and packages dealing with passwords (hashing etc.) I’ve seen can handle IO directly, so you should be able to pass it directly to them.

Interestingly in both 0.7/1.0, Base. has to be prepended for both getpass and SecretBuffer to get the doc to show up. Might be best to report an issue about that.

1 Like