lib/toktok/configuration.rb in toktok-0.1.0 vs lib/toktok/configuration.rb in toktok-0.2.0

- old
+ new

@@ -1,12 +1,14 @@ module Toktok class Configuration - attr_reader :algorithm, :secret_key + attr_reader :algorithm, :lifetime, :secret_key + # Error raised when an algorithm is given but the secret_key is missing. SecretKeyMissingError = Class.new(StandardError) - def initialize(algorithm: nil, secret_key: nil) + def initialize(algorithm: nil, lifetime: nil, secret_key: nil) @algorithm = algorithm || 'HS256' + @lifetime = lifetime @secret_key = secret_key if algorithm != 'none' && (secret_key || '') == '' raise SecretKeyMissingError, "Toktok: The algorithm #{algorithm} requires you to setup a 'secret_key'" end