class Spree::Encryptor

Spree::Encryptor is a thin wrapper around ActiveSupport::MessageEncryptor.

Public Class Methods

new(key) click to toggle source

@param key [String] the 256 bits signature key

# File lib/spree/encryptor.rb, line 7
def initialize(key)
  @crypt = ActiveSupport::MessageEncryptor.new(key)
end

Public Instance Methods

decrypt(encrypted_value) click to toggle source

Decrypt an encrypted value @param encrypted_value [String] the value to decrypt @return [String] the decrypted value

# File lib/spree/encryptor.rb, line 21
def decrypt(encrypted_value)
  @crypt.decrypt_and_verify(encrypted_value)
end
encrypt(value) click to toggle source

Encrypt a value @param value [String] the value to encrypt @return [String] the encrypted value

# File lib/spree/encryptor.rb, line 14
def encrypt(value)
  @crypt.encrypt_and_sign(value)
end