Sha256: d7f237813789a24192f4fb6b1b2db735810432cb83faa9a3c4dbaf3d7f705844
Contents?: true
Size: 762 Bytes
Versions: 1
Compression:
Stored size: 762 Bytes
Contents
# frozen_string_literal: true module JWT module KMS # :nodoc: class Key def self.by(key_id:) new(key_id: key_id) end include JWT::JWA::SigningAlgorithm def initialize(key_id:) @key_id = key_id @alg = "HS256" end def header(*) { "alg" => "HS256" } end def sign(data:, **) client.generate_mac(key_id: key_id, mac_algorithm: "HMAC_SHA_256", message: data).mac end def verify(data:, signature:, **) client.verify_mac(key_id: key_id, mac_algorithm: "HMAC_SHA_256", message: data, mac: signature).mac_valid end private attr_reader :key_id def client @client = Aws::KMS::Client.new end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jwt-kms-0.1.0 | lib/jwt/kms/key.rb |