module Hello::RailsActiveRecord::Credential

Public Instance Methods

first_error_message() click to toggle source

CUSTOM METHODS

# File lib/hello/rails_active_record/credential.rb, line 26
def first_error_message
  errors.messages.values.flatten.first if errors.any?
end
reset_verifying_token!() click to toggle source
# File lib/hello/rails_active_record/credential.rb, line 37
def reset_verifying_token!
  uuid, digest = simple_encryptor.pair
  update!(verifying_token_digest: digest, verifying_token_digested_at: 1.second.ago)
  uuid
end
verifying_token_is?(unencrypted_token) click to toggle source

verifying token

# File lib/hello/rails_active_record/credential.rb, line 32
def verifying_token_is?(unencrypted_token)
  digest = simple_encryptor.encrypt(unencrypted_token)
  verifying_token_digest == digest
end

Protected Instance Methods

complex_encryptor() click to toggle source
# File lib/hello/rails_active_record/credential.rb, line 45
def complex_encryptor
  Hello::Encryptors::Complex.instance
end
simple_encryptor() click to toggle source
# File lib/hello/rails_active_record/credential.rb, line 49
def simple_encryptor
  Hello::Encryptors::Simple.instance
end