Sha256: 26999148c37bc160464f3d5e77763d122f702d7935c7a7aa544c9831ee865c2d

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require_relative 'error'

module JWT
  # @deprecated This class is deprecated and will be removed in the next major version of ruby-jwt.
  class Verify
    DEFAULTS = { leeway: 0 }.freeze
    METHODS = %w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub verify_required_claims].freeze

    private_constant(:DEFAULTS, :METHODS)
    class << self
      METHODS.each do |method_name|
        define_method(method_name) do |payload, options|
          new(payload, options).send(method_name)
        end
      end

      # @deprecated This method is deprecated and will be removed in the next major version of ruby-jwt.
      def verify_claims(payload, options)
        Deprecations.warning('The ::JWT::Verify.verify_claims method is deprecated and will be removed in the next major version of ruby-jwt')
        ::JWT::Claims.verify!(payload, options)
        true
      end
    end

    # @deprecated This class is deprecated and will be removed in the next major version of ruby-jwt.
    def initialize(payload, options)
      Deprecations.warning('The ::JWT::Verify class is deprecated and will be removed in the next major version of ruby-jwt')
      @payload = payload
      @options = DEFAULTS.merge(options)
    end

    METHODS.each do |method_name|
      define_method(method_name) do
        ::JWT::Claims.verify!(@payload, @options.merge(method_name => true))
      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/verify.rb
jwt-2.10.1 lib/jwt/verify.rb
jwt-2.10.0 lib/jwt/verify.rb