Sha256: 05a02f40acc5376bac17f5d0f59a0399195a24180d0330e8d09ab5f039bb773f

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

require "aws-sdk-kms"
require "jwt"

require_relative "kms/version"
require_relative "kms/hmac_key"
require_relative "kms/sign_verify_key"

module JWT
  # :nodoc:
  module Aws
    # :nodoc:
    module KMS
      def self.client
        @client ||= ::Aws::KMS::Client.new
      end

      def self.for(algorithm:)
        if HmacKey::MAPPINGS.key?(algorithm)
          HmacKey
        elsif SignVerifyKey::MAPPINGS.key?(algorithm)
          SignVerifyKey
        else
          raise ArgumentError, "Algorithm #{algorithm} not supported"
        end.new(algorithm: algorithm)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jwt-aws-kms-1.0.0 lib/jwt/aws/kms.rb
jwt-aws-kms-0.6.0 lib/jwt/aws/kms.rb