Class: StandardId::CodeChallenge
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- StandardId::CodeChallenge
- Defined in:
- app/models/standard_id/code_challenge.rb
Constant Summary collapse
- REALMS =
%w[authentication verification].freeze
- CHANNELS =
%w[email sms].freeze
Instance Method Summary collapse
Instance Method Details
#active? ⇒ Boolean
26 27 28 |
# File 'app/models/standard_id/code_challenge.rb', line 26 def active? !expired? && !used? end |
#expired? ⇒ Boolean
18 19 20 |
# File 'app/models/standard_id/code_challenge.rb', line 18 def expired? expires_at <= Time.current end |
#use! ⇒ Object
30 31 32 |
# File 'app/models/standard_id/code_challenge.rb', line 30 def use! update!(used_at: Time.current) end |
#used? ⇒ Boolean
22 23 24 |
# File 'app/models/standard_id/code_challenge.rb', line 22 def used? used_at.present? end |