Sha256: f3a8e9fc5039269e9c66a2bd3e76ef7b7b398538eb36bc609ea8b65f24cb8fc6
Contents?: true
Size: 711 Bytes
Versions: 27
Compression:
Stored size: 711 Bytes
Contents
module Avo module Services class EncryptionService class << self def encrypt(...) new(...).encrypt end def decrypt(...) new(...).decrypt end end def initialize(message:, purpose:, **kwargs) @message = message @purpose = purpose @crypt = ActiveSupport::MessageEncryptor.new(encryption_key, **kwargs) end def encrypt @crypt.encrypt_and_sign(@message, purpose: @purpose) end def decrypt @crypt.decrypt_and_verify(@message, purpose: @purpose) end private def encryption_key Rails.application.secret_key_base[0..31] end end end end
Version data entries
27 entries across 27 versions & 1 rubygems