rootstrap/apple_sign_in

View on GitHub
lib/apple_auth/helpers/conditions/iat_condition.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module AppleAuth
  module Conditions
    class IatCondition
      def initialize(jwt)
        @iat = jwt['iat'].to_i
      end

      def validate!
        return true if @iat <= Time.now.to_i

        raise JWTValidationError, 'jwt_iat is greater than now'
      end
    end
  end
end