fold
Returns onSuccess of the value or onFailure of the error; exactly one of them runs. The usual way to turn a result into your own type:
passkeys.signIn(options).fold(
onSuccess = { AuthResult.SignedIn(api.finishSignIn(it.json)) },
onFailure = { if (it.isUserCancellation) AuthResult.Idle else AuthResult.Error(it) },
)Content copied to clipboard