class Toktok::Configuration

Constants

SecretKeyMissingError

Error raised when an algorithm is given but the secret_key is missing.

Attributes

algorithm[R]
lifetime[R]
secret_key[R]

Public Class Methods

new(algorithm: nil, lifetime: nil, secret_key: nil) click to toggle source
# File lib/toktok/configuration.rb, line 8
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
end