Class: TokenWithIv
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- TokenWithIv
- Defined in:
- app/models/token_with_iv.rb
Overview
rubocop: todo Gitlab/NamespacedClass
Constant Summary
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary collapse
- .find_by_hashed_token(value) ⇒ Object
- .find_by_plaintext_token(value) ⇒ Object
- .find_nonce_by_hashed_token(value) ⇒ Object
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Class Method Details
.find_by_hashed_token(value) ⇒ Object
9 10 11 |
# File 'app/models/token_with_iv.rb', line 9 def self.find_by_hashed_token(value) find_by(hashed_token: ::Digest::SHA256.digest(value)) end |
.find_by_plaintext_token(value) ⇒ Object
13 14 15 |
# File 'app/models/token_with_iv.rb', line 13 def self.find_by_plaintext_token(value) find_by(hashed_plaintext_token: ::Digest::SHA256.digest(value)) end |
.find_nonce_by_hashed_token(value) ⇒ Object
17 18 19 20 21 22 |
# File 'app/models/token_with_iv.rb', line 17 def self.find_nonce_by_hashed_token(value) return unless table_exists? token_record = find_by_hashed_token(value) token_record&.iv end |