Module: Elastic::AppSearch::Client::SignedSearchOptions::ClassMethods

Defined in:
lib/elastic/app-search/client.rb

Instance Method Summary collapse

Instance Method Details

#create_signed_search_key(api_key, api_key_name, options = {}) ⇒ String

Build a JWT for authentication

Parameters:

  • api_key (String)

    the API Key to sign the request with

  • api_key_name (String)

    the unique name for the API Key

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

Returns:

  • (String)

    the JWT to use for authentication



56
57
58
59
# File 'lib/elastic/app-search/client.rb', line 56

def create_signed_search_key(api_key, api_key_name, options = {})
  payload = Utils.symbolize_keys(options).merge(:api_key_name => api_key_name)
  JWT.encode(payload, api_key, ALGORITHM)
end