Module: SwiftypeAppSearch::Client::SignedSearchOptions::ClassMethods

Defined in:
lib/swiftype-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



47
48
49
50
# File 'lib/swiftype-app-search/client.rb', line 47

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