Sha256: f046103b8cd694121a67cb110407e9aa4a320da7bed7d8e3a153cfbaa1975c90

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require 'singleton'
module Legacy::Fernet
  class Configuration
    include Singleton

    # Whether to enforce a message TTL
    # (true or false)
    attr_accessor :enforce_ttl

    # How long messages are considered valid to the verifier
    # (an integer in seconds)
    attr_accessor :ttl

    # Whether to encrypt the payload
    # (true or false)
    attr_accessor :encrypt

    def self.run
      self.instance.enforce_ttl = true
      self.instance.ttl         = 60
      self.instance.encrypt     = true
      yield self.instance if block_given?
    end

    class << self
      def method_missing(method)
        if self.instance.respond_to?(method)
          self.instance.send(method)
        else
          super
        end
      end

      def respond_to?(method)
        self.instance.respond_to?(method) || super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
legacy-fernet-1.6.1 lib/fernet/configuration.rb