requestPassphrase

suspend fun PromptModel.requestPassphrase(title: String, subtitle: String, passphraseConstraints: PassphraseConstraints, passphraseEvaluator: suspend (enteredPassphrase: String) -> PassphraseEvaluation?): String

Prompts user for authentication through a passphrase.

If passphraseEvaluator is not null, it is called every time the user inputs a passphrase with the user input as a parameter. It should return PassphraseEvaluation.OK to indicate the passphrase is correct otherwise PassphraseEvaluation.TryAgain with optional number of remaining attempts, or PassphraseEvaluation.TooManyAttempts.

To dismiss the prompt programmatically, cancel the job the coroutine was launched in.

To obtain title and subtitle back-end code generally should create a Reason object and use PromptModel.toHumanReadable to convert it to human-readable form. This gives application code a chance to customize user-facing messages.

Return

the passphrase entered by the user.

Parameters

title

the title for the passphrase prompt.

subtitle

the subtitle for the passphrase prompt.

passphraseConstraints

the PassphraseConstraints for the passphrase.

passphraseEvaluator

an optional function to evaluate the passphrase and give the user feedback.

Throws

if user dismissed passphrase prompt dialog.

if coroutineContext does not have PromptModel.

if the UI layer hasn't bound any UI for PromptModel.