RecaptchaClient

interface RecaptchaClient


A client that enables Android Apps to trigger reCAPTCHA Enterprise.

Summary

Public functions

suspend Result<String>
execute(recaptchaAction: RecaptchaAction)

Executes reCAPTCHA Enterprise on a user action.

suspend Result<String>
execute(recaptchaAction: RecaptchaAction, timeout: Long)

Executes reCAPTCHA Enterprise on a user action.

Public functions

execute

suspend fun execute(recaptchaAction: RecaptchaAction): Result<String>

Executes reCAPTCHA Enterprise on a user action.

This method will throw a timeout exception after 5 seconds.

Parameters
recaptchaAction: RecaptchaAction

The user action to protect.

Returns
Result<String>

A Result encapsulating a reCAPTCHA Enterprise token.

execute

suspend fun execute(
    recaptchaAction: RecaptchaAction,
    timeout: Long = DEFAULT_TIMEOUT_EXECUTE
): Result<String>

Executes reCAPTCHA Enterprise on a user action.

It is suggested the usage of 10 seconds for the timeout. The minimum value is 5 seconds.

Parameters
recaptchaAction: RecaptchaAction

The user action to protect.

timeout: Long = DEFAULT_TIMEOUT_EXECUTE

Maximum amount of time of execute() call in milliseconds.

Returns
Result<String>

A Result encapsulating a reCAPTCHA Enterprise token.