sorbet/rbi/gems/recaptcha@5.17.0.rbi
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `recaptcha` gem.
# Please instead update this file by running `bin/tapioca gem recaptcha`.
# source://recaptcha//lib/recaptcha/configuration.rb#3
module Recaptcha
class << self
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#125
def action_valid?(action, expected_action); end
# source://recaptcha//lib/recaptcha.rb#170
def api_verification_enterprise(query_params, body, project_id, timeout: T.unsafe(nil)); end
# source://recaptcha//lib/recaptcha.rb#155
def api_verification_free(verify_hash, timeout: T.unsafe(nil), json: T.unsafe(nil)); end
# Gives access to the current Configuration.
#
# source://recaptcha//lib/recaptcha.rb#25
def configuration; end
# Allows easy setting of multiple configuration options. See Configuration
# for all available options.
# --
# The temp assignment is only used to get a nicer rdoc. Feel free to remove
# this hack.
# ++
#
# @yield [config]
#
# source://recaptcha//lib/recaptcha.rb#35
def configure; end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#115
def hostname_valid?(hostname, validation); end
# source://recaptcha//lib/recaptcha.rb#140
def http_client_for(uri:, timeout: T.unsafe(nil)); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#57
def invalid_response?(resp); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#132
def score_above_threshold?(score, minimum_score); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#136
def score_below_threshold?(score, maximum_score); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha.rb#53
def skip_env?(env); end
# source://recaptcha//lib/recaptcha.rb#61
def verify_via_api_call(response, options); end
# source://recaptcha//lib/recaptcha.rb#69
def verify_via_api_call_enterprise(response, options); end
# source://recaptcha//lib/recaptcha.rb#96
def verify_via_api_call_free(response, options); end
# source://recaptcha//lib/recaptcha.rb#40
def with_configuration(config); end
end
end
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#4
module Recaptcha::Adapters; end
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#5
module Recaptcha::Adapters::ControllerMethods
private
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#67
def recaptcha_error(model, attribute, message); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#75
def recaptcha_flash_supported?; end
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#63
def recaptcha_reply; end
# Extracts response token from params. params['g-recaptcha-response-data'] for recaptcha_v3 or
# params['g-recaptcha-response'] for recaptcha_tags and invisible_recaptcha_tags and should
# either be a string or a hash with the action name(s) as keys. If it is a hash, then `action`
# is used as the key.
#
# @return [String] A response token if one was passed in the params; otherwise, `''`
#
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#84
def recaptcha_response_token(action = T.unsafe(nil)); end
# Your private API can be specified in the +options+ hash or preferably
# using the Configuration.
#
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#10
def verify_recaptcha(options = T.unsafe(nil)); end
# source://recaptcha//lib/recaptcha/adapters/controller_methods.rb#59
def verify_recaptcha!(options = T.unsafe(nil)); end
end
# source://recaptcha//lib/recaptcha/adapters/view_methods.rb#5
module Recaptcha::Adapters::ViewMethods
# Renders a reCAPTCHA v2 [Invisible reCAPTCHA](https://developers.google.com/recaptcha/docs/invisible)
#
# source://recaptcha//lib/recaptcha/adapters/view_methods.rb#21
def invisible_recaptcha_tags(options = T.unsafe(nil)); end
# Renders a reCAPTCHA [v2 Checkbox](https://developers.google.com/recaptcha/docs/display) widget
#
# source://recaptcha//lib/recaptcha/adapters/view_methods.rb#16
def recaptcha_tags(options = T.unsafe(nil)); end
# Renders a [reCAPTCHA v3](https://developers.google.com/recaptcha/docs/v3) script and (by
# default) a hidden input to submit the response token. You can also call the functions
# directly if you prefer. You can use
# `Recaptcha::Helpers.recaptcha_v3_execute_function_name(action)` to get the name of the
# function to call.
#
# source://recaptcha//lib/recaptcha/adapters/view_methods.rb#11
def recaptcha_v3(options = T.unsafe(nil)); end
end
# This class enables detailed configuration of the recaptcha services.
#
# By calling
#
# Recaptcha.configuration # => instance of Recaptcha::Configuration
#
# or
# Recaptcha.configure do |config|
# config # => instance of Recaptcha::Configuration
# end
#
# you are able to perform configuration updates.
#
# Your are able to customize all attributes listed below. All values have
# sensitive default and will very likely not need to be changed.
#
# Please note that the site and secret key for the reCAPTCHA API Access
# have no useful default value. The keys may be set via the Shell enviroment
# or using this configuration. Settings within this configuration always take
# precedence.
#
# Setting the keys with this Configuration
#
# Recaptcha.configure do |config|
# config.site_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
# config.secret_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
# end
#
# source://recaptcha//lib/recaptcha/configuration.rb#32
class Recaptcha::Configuration
# @return [Configuration] a new instance of Configuration
#
# source://recaptcha//lib/recaptcha/configuration.rb#44
def initialize; end
# source://recaptcha//lib/recaptcha/configuration.rb#78
def api_server_url; end
# Sets the attribute api_server_url
#
# @param value the value to set the attribute api_server_url to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#42
def api_server_url=(_arg0); end
# Returns the value of attribute default_env.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def default_env; end
# Sets the attribute default_env
#
# @param value the value to set the attribute default_env to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def default_env=(_arg0); end
# Returns the value of attribute enterprise.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise; end
# Sets the attribute enterprise
#
# @param value the value to set the attribute enterprise to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise=(_arg0); end
# Returns the value of attribute enterprise_api_key.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise_api_key; end
# source://recaptcha//lib/recaptcha/configuration.rb#70
def enterprise_api_key!; end
# Sets the attribute enterprise_api_key
#
# @param value the value to set the attribute enterprise_api_key to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise_api_key=(_arg0); end
# Returns the value of attribute enterprise_project_id.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise_project_id; end
# source://recaptcha//lib/recaptcha/configuration.rb#74
def enterprise_project_id!; end
# Sets the attribute enterprise_project_id
#
# @param value the value to set the attribute enterprise_project_id to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def enterprise_project_id=(_arg0); end
# Returns the value of attribute handle_timeouts_gracefully.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def handle_timeouts_gracefully; end
# Sets the attribute handle_timeouts_gracefully
#
# @param value the value to set the attribute handle_timeouts_gracefully to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def handle_timeouts_gracefully=(_arg0); end
# Returns the value of attribute hostname.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def hostname; end
# Sets the attribute hostname
#
# @param value the value to set the attribute hostname to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def hostname=(_arg0); end
# Returns the value of attribute proxy.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def proxy; end
# Sets the attribute proxy
#
# @param value the value to set the attribute proxy to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def proxy=(_arg0); end
# Returns the value of attribute response_limit.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def response_limit; end
# Sets the attribute response_limit
#
# @param value the value to set the attribute response_limit to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def response_limit=(_arg0); end
# Returns the value of attribute secret_key.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def secret_key; end
# source://recaptcha//lib/recaptcha/configuration.rb#62
def secret_key!; end
# Sets the attribute secret_key
#
# @param value the value to set the attribute secret_key to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def secret_key=(_arg0); end
# Returns the value of attribute site_key.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def site_key; end
# source://recaptcha//lib/recaptcha/configuration.rb#66
def site_key!; end
# Sets the attribute site_key
#
# @param value the value to set the attribute site_key to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def site_key=(_arg0); end
# Returns the value of attribute skip_verify_env.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def skip_verify_env; end
# Sets the attribute skip_verify_env
#
# @param value the value to set the attribute skip_verify_env to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#40
def skip_verify_env=(_arg0); end
# source://recaptcha//lib/recaptcha/configuration.rb#82
def verify_url; end
# Sets the attribute verify_url
#
# @param value the value to set the attribute verify_url to.
#
# source://recaptcha//lib/recaptcha/configuration.rb#42
def verify_url=(_arg0); end
end
# source://recaptcha//lib/recaptcha/configuration.rb#33
Recaptcha::Configuration::DEFAULTS = T.let(T.unsafe(nil), Hash)
# source://recaptcha//lib/recaptcha.rb#16
Recaptcha::DEFAULT_TIMEOUT = T.let(T.unsafe(nil), Integer)
# source://recaptcha//lib/recaptcha/helpers.rb#4
module Recaptcha::Helpers
class << self
# source://recaptcha//lib/recaptcha/helpers.rb#91
def invisible_recaptcha_tags(custom); end
# source://recaptcha//lib/recaptcha/helpers.rb#303
def recaptcha_execute_method_name; end
# source://recaptcha//lib/recaptcha/helpers.rb#307
def recaptcha_ready_method_name; end
# source://recaptcha//lib/recaptcha/helpers.rb#48
def recaptcha_tags(options); end
# source://recaptcha//lib/recaptcha/helpers.rb#10
def recaptcha_v3(options = T.unsafe(nil)); end
# Returns the name of an async JavaScript function that executes the reCAPTCHA code.
#
# source://recaptcha//lib/recaptcha/helpers.rb#265
def recaptcha_v3_async_execute_function_name(action); end
# source://recaptcha//lib/recaptcha/helpers.rb#269
def recaptcha_v3_default_callback_name(action); end
# Returns the name of the JavaScript function that actually executes the
# reCAPTCHA code (calls `grecaptcha.execute` or
# `grecaptcha.enterprise.execute`). You can call it again later to reset it.
#
# source://recaptcha//lib/recaptcha/helpers.rb#260
def recaptcha_v3_execute_function_name(action); end
# source://recaptcha//lib/recaptcha/helpers.rb#110
def to_error_message(key); end
# source://recaptcha//lib/recaptcha/helpers.rb#116
def to_message(key, default); end
private
# source://recaptcha//lib/recaptcha/helpers.rb#125
def components(options); end
# Returns a dasherized string that is safe for use as an HTML ID
# dasherize_action('my/action') => 'my-action'
#
# source://recaptcha//lib/recaptcha/helpers.rb#326
def dasherize_action(action); end
# v2
#
# source://recaptcha//lib/recaptcha/helpers.rb#275
def default_callback(options = T.unsafe(nil)); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha/helpers.rb#311
def default_callback_required?(options); end
# source://recaptcha//lib/recaptcha/helpers.rb#334
def element_check_condition(options); end
# source://recaptcha//lib/recaptcha/helpers.rb#330
def hash_to_query(hash); end
# source://recaptcha//lib/recaptcha/helpers.rb#240
def recaptcha_v3_define_default_callback(callback, options); end
# Returns true if we should be adding the default callback.
# That is, if the given callback name is the default callback name (for the given action) and we
# are not skipping inline scripts for any reason.
#
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha/helpers.rb#252
def recaptcha_v3_define_default_callback?(callback, action, options); end
# Renders a script that calls `grecaptcha.execute` or
# `grecaptcha.enterprise.execute` for the given `site_key` and `action` and
# calls the `callback` with the resulting response token.
#
# source://recaptcha//lib/recaptcha/helpers.rb#182
def recaptcha_v3_inline_script(site_key, action, callback, id, options = T.unsafe(nil)); end
# @return [Boolean]
#
# source://recaptcha//lib/recaptcha/helpers.rb#234
def recaptcha_v3_inline_script?(options); end
# source://recaptcha//lib/recaptcha/helpers.rb#216
def recaptcha_v3_onload_script(site_key, action, callback, id, options = T.unsafe(nil)); end
# Returns a camelized string that is safe for use in a JavaScript variable/function name.
# sanitize_action_for_js('my/action') => 'MyAction'
#
# source://recaptcha//lib/recaptcha/helpers.rb#320
def sanitize_action_for_js(action); end
end
end
# source://recaptcha//lib/recaptcha/helpers.rb#5
Recaptcha::Helpers::DEFAULT_ERRORS = T.let(T.unsafe(nil), Hash)
# source://recaptcha//lib/recaptcha/railtie.rb#4
class Recaptcha::Railtie < ::Rails::Railtie
class << self
protected
# source://recaptcha//lib/recaptcha/railtie.rb#24
def add(pattern); end
# source://recaptcha//lib/recaptcha/railtie.rb#29
def pattern_from(args); end
end
end
# source://recaptcha//lib/recaptcha.rb#18
class Recaptcha::RecaptchaError < ::StandardError; end
# source://recaptcha//lib/recaptcha.rb#21
class Recaptcha::VerifyError < ::Recaptcha::RecaptchaError; end