saker.build Documentation TaskDoc JavaDoc Packages
public interface SecretInputReader
Interface for reading a secret character sequence from a given source.

This interface is used to read characters from a given input without explicitly displaying those characters. The purpose of this class is to provide a simplar secret reading mechanism to Console while abstracting away the implementation.

This interface can be used by tasks by requesting it through the task context.

Common implementations of this interface may be backed by the aforementioned console class from System.console(), may be implemented by a password text box in an IDE, or a properties file that contains identifier based associations to secrets.

Methods
public String
readSecret(String titleinfo, String message, String prompt, String secretidentifier)
Reads a secret character sequence from the underlying input.
public abstract String readSecret(String titleinfo, String message, String prompt, String secretidentifier)
Reads a secret character sequence from the underlying input.

Extra information for the user may be provided using the parameters, which will be displayed when the user is prompted for the input. These informations are optional, but are strongly recommended, as they can provide the user information about why the given input is requested.

The provided informations are usually presented in the following way in a console:

 <Title information>
 <A longer explanation about
 why the given input information
 is required by the caller.>
 <The prompt for input:><$cursor>
 
There is no new line after the prompt string.

If the implementation is not backed by a console, the informations may be displayed in dialog using a similar format, or in any other implementation dependent way.

An identifier for the requested secret can be provided in order to accomodate to other secret reading implementation which are not backed by the direct input of the user, but rather an identifier based database. The identifier may be arbitrary, but should be unique.

titleinfoThe title for the request or null if not specified.
messageThe message or explanation for the request or null if not specified.
promptThe prompt string for the request or null if not specified.
secretidentifierThe identifier associated to the prompted secret reading or null if none.
The user entered input or null in case the user didn't provide an answer. (E.g. closed the dialog)