Sha256: 06f4c55f187b22f614caea91d8a86dc5c21ba54397691c595813ea87fe711702

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

module JWT
  module JWA
    class Wrapper
      include SigningAlgorithm

      def initialize(algorithm)
        @algorithm = algorithm
      end

      def alg
        return @algorithm.alg if @algorithm.respond_to?(:alg)

        super
      end

      def valid_alg?(alg_to_check)
        return @algorithm.valid_alg?(alg_to_check) if @algorithm.respond_to?(:valid_alg?)

        super
      end

      def header(*args, **kwargs)
        return @algorithm.header(*args, **kwargs) if @algorithm.respond_to?(:header)

        super
      end

      def sign(*args, **kwargs)
        return @algorithm.sign(*args, **kwargs) if @algorithm.respond_to?(:sign)

        super
      end

      def verify(*args, **kwargs)
        return @algorithm.verify(*args, **kwargs) if @algorithm.respond_to?(:verify)

        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jwt-2.9.3 lib/jwt/jwa/wrapper.rb
jwt-2.9.2 lib/jwt/jwa/wrapper.rb
jwt-2.9.1 lib/jwt/jwa/wrapper.rb
jwt-2.9.0 lib/jwt/jwa/wrapper.rb