Class: AppIdentity::Versions::TimestampNonce
- Defined in:
- lib/app_identity/versions.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#check_nonce!(nonce, config) ⇒ Object
:nodoc:.
-
#generate_nonce ⇒ Object
:nodoc:.
-
#nonce_type ⇒ Object
:nodoc:.
Methods inherited from Base
defined, inherited, #inspect, instance, #make_digest
Instance Method Details
#check_nonce!(nonce, config) ⇒ Object
:nodoc:
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/app_identity/versions.rb', line 77 def check_nonce!(nonce, config) # :nodoc: super(nonce, config) = (nonce) config ||= default_config fuzz = config[:fuzz] || config["fuzz"] || 600 diff = (Time.now.utc - ).abs.to_i raise AppIdentity::Error, "nonce is invalid" unless diff <= fuzz end |
#generate_nonce ⇒ Object
:nodoc:
73 74 75 |
# File 'lib/app_identity/versions.rb', line 73 def generate_nonce # :nodoc: Time.now.utc.strftime("%Y%m%dT%H%M%S.%6NZ") end |
#nonce_type ⇒ Object
:nodoc:
69 70 71 |
# File 'lib/app_identity/versions.rb', line 69 def nonce_type # :nodoc: :timestamp end |