Class: CyberSource::Utilities::CaptureContext::PublicKeyFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/utilities/capture_context/public_key_fetcher.rb

Overview

PublicKeyFetcher Class

Fetches public keys from CyberSource Flex V2 API for the given key ID (kid) and run environment.

Author:

  • CyberSource

Constant Summary collapse

DEFAULT_TIMEOUT =

Default timeout for HTTP requests (in seconds)

30
HTTP_REQUEST_CONFIG =

HTTP request configuration

{
  headers: {
    'Accept' => 'application/json'
  },
  timeout: DEFAULT_TIMEOUT
}.freeze

Class Method Summary collapse

Class Method Details

.fetch_public_key(kid, run_environment) ⇒ Hash

Fetches the public key for the given key ID (kid) from the specified run environment.

Examples:

Fetch public key

jwk_hash = PublicKeyFetcher.fetch_public_key('test-kid-123', 'apitest.cybersource.com')

Parameters:

  • kid (String)

    The key ID for which to fetch the public key

  • run_environment (String)

    The environment domain (e.g., ‘apitest.cybersource.com’)

Returns:

  • (Hash)

    The raw JWK hash from the API response

Raises:

  • (ArgumentError)

    If required parameters are missing

  • (StandardError)

    For HTTP and network errors



43
44
45
46
# File 'lib/cybersource_rest_client/utilities/capture_context/public_key_fetcher.rb', line 43

def fetch_public_key(kid, run_environment)
  validate_parameters(kid, run_environment)
  fetch_from_api(kid, run_environment)
end