Sha256: d555541b5a6bc5a66ac501b5428a33d5cc7d9596fee5a0cc1b2772a04e8aab40
Contents?: true
Size: 841 Bytes
Versions: 1
Compression:
Stored size: 841 Bytes
Contents
# frozen_string_literal: true require "aws-sdk-kms" require "jwt" require_relative "kms/version" require_relative "kms/hmac_key" module JWT # :nodoc: module KMS def self.client @client ||= Aws::KMS::Client.new end def self.by(key_id:) from_description(KMS.client.describe_key(key_id: key_id)) end def self.from_description(description) case description.key_metadata.key_usage when "GENERATE_VERIFY_MAC" HmacKey.new(key_id: description.key_metadata.key_id, key_spec: description.key_metadata.key_spec) when "SIGN_VERIFY" SignVerifyKey.new(key_id: description.key_metadata.key_id, key_spec: description.key_metadata.key_spec) else raise ArgumentError, "Keys with key_usage #{description.key_metadata.key_usage} not supported" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jwt-kms-0.2.0 | lib/jwt/kms.rb |