Method: Fernet::Token#initialize
- Defined in:
- lib/fernet/token.rb
#initialize(token, opts = {}) ⇒ Token
Internal: initializes a Token object
token - the string representation of this token opts - a has containing
-
secret - the secret, optionally base 64 encoded (required)
-
enforce_ttl - whether to enforce TTL upon validation. Defaults to
value set in Configuration.enforce_ttl -
ttl - number of seconds token is valid, defaults to
Configuration.ttl
27 28 29 30 31 32 33 |
# File 'lib/fernet/token.rb', line 27 def initialize(token, opts = {}) @token = token @secret = Secret.new(opts.fetch(:secret)) @enforce_ttl = opts.fetch(:enforce_ttl) { Configuration.enforce_ttl } @ttl = opts[:ttl] || Configuration.ttl @now = opts[:now] end |