class Captchah::Encryptor

Public Class Methods

decrypt(value) click to toggle source
# File lib/captchah/encryptor.rb, line 10
def decrypt(value)
  encryptor.decrypt_and_verify(Base64.strict_decode64(value))
end
encrypt(value) click to toggle source
# File lib/captchah/encryptor.rb, line 6
def encrypt(value)
  Base64.strict_encode64(encryptor.encrypt_and_sign(value))
end

Private Class Methods

encryptor() click to toggle source
# File lib/captchah/encryptor.rb, line 16
def encryptor
  secret =
    Rails.application.secrets.secret_key_base.mb_chars.limit(32).to_s

  ActiveSupport::MessageEncryptor.new(secret)
end