requestPassphrase

suspend fun PromptModel.requestPassphrase(reason: Reason, 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.

Return

the passphrase entered by the user.

Parameters

reason

a Reason describing why passphrase authentication is needed.

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.