read

abstract suspend fun read(key: String, prompt: AuthenticationPrompt): String?(source)

Shows a biometric prompt and, once the user authenticates, returns the value stored under key. Suspends without blocking the calling thread while the prompt is visible.

Return

the stored value, or null if no entry exists for key. No prompt is shown for a missing entry.

Throws

with Canceled if the user dismissed the prompt, AuthenticationInvalidated if biometric enrollment changed since the entry was written, Unsupported if no strong biometric is available or enrolled, or another reason if the read fails.

if key is blank or contains NUL, CR, or LF.

if the coroutine is cancelled; the prompt is dismissed.