Sha256: 12e4bce7d4ac372fadd85c066576b7d4994c1fcbd9093addcd9749f67c576c33

Contents?: true

Size: 939 Bytes

Versions: 3

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true

module JWT
  module JWA
    # Provides backwards compatibility for algorithms
    # @api private
    module Compat
      # @api private
      module ClassMethods
        def from_algorithm(algorithm)
          new(algorithm)
        end

        def sign(algorithm, msg, key)
          Deprecations.warning('Support for calling sign with positional arguments will be removed in future ruby-jwt versions')

          from_algorithm(algorithm).sign(data: msg, signing_key: key)
        end

        def verify(algorithm, key, signing_input, signature)
          Deprecations.warning('Support for calling verify with positional arguments will be removed in future ruby-jwt versions')

          from_algorithm(algorithm).verify(data: signing_input, signature: signature, verification_key: key)
        end
      end

      def self.included(klass)
        klass.extend(ClassMethods)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/jwt-2.10.1/lib/jwt/jwa/compat.rb
jwt-2.10.1 lib/jwt/jwa/compat.rb
jwt-2.10.0 lib/jwt/jwa/compat.rb