Sha256: be5abaddbbbf442228933f377a10a82702c5e3978324ca8ad8359b763119cbad

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/extension"
require "pakyow/support/message_verifier"

module Pakyow
  class App
    class Connection
      module Behavior
        module Verifier
          extend Support::Extension

          apply_extension do
            after "initialize" do
              if app.config.session.enabled
                session[:verifier_key] ||= Support::MessageVerifier.key
              end
            end
          end

          def verifier
            if app.config.session.enabled
              unless instance_variable_defined?(:@verifier)
                @verifier = Support::MessageVerifier.new(verifier_key)
              end

              @verifier
            else
              nil
            end
          end

          def verifier_key
            if app.config.session.enabled
              session[:verifier_key]
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pakyow-core-1.0.0.rc5 lib/pakyow/app/connection/behavior/verifier.rb
pakyow-core-1.0.0.rc4 lib/pakyow/app/connection/behavior/verifier.rb
pakyow-core-1.0.0.rc3 lib/pakyow/app/connection/behavior/verifier.rb
pakyow-core-1.0.0.rc2 lib/pakyow/app/connection/behavior/verifier.rb