Class: Mach::Nonce
- Inherits:
-
Object
- Object
- Mach::Nonce
- Defined in:
- lib/mach/nonce.rb
Class Method Summary collapse
- .exists?(credential_id, nonce_value) ⇒ Boolean
- .for(timestamp) ⇒ Object
- .persist(credential_id, nonce_value, timestamp) ⇒ Object
Class Method Details
.exists?(credential_id, nonce_value) ⇒ Boolean
12 13 14 |
# File 'lib/mach/nonce.rb', line 12 def exists?(credential_id, nonce_value) Mach.configuration.data_store.find_nonce_by(credential_id, nonce_value) end |
.for(timestamp) ⇒ Object
7 8 9 10 |
# File 'lib/mach/nonce.rb', line 7 def for() #17 byte string to make sure we don't get any padding after base64 Base64.urlsafe_encode64("#{SecureRandom.random_bytes(17)}#{}") end |
.persist(credential_id, nonce_value, timestamp) ⇒ Object
16 17 18 19 |
# File 'lib/mach/nonce.rb', line 16 def persist(credential_id, nonce_value, ) expires_in = Mach.configuration.stale_request_window Mach.configuration.data_store.add_nonce(credential_id, nonce_value, expires_in) end |