class Rack::Session::Encryptor

def decrypt(base64_data)

def decrypt(base64_data)
  data = Base64.urlsafe_decode64(base64_data)
  signature = data.slice!(-32..-1)
  verify_authenticity! data, signature
  # The version is reserved for future
  _version = data.slice!(0, 1)
  message_secret = data.slice!(0, 32)
  cipher_iv = data.slice!(0, 16)
  cipher = new_cipher
  cipher.decrypt
  set_cipher_key(cipher, cipher_secret_from_message_secret(message_secret))
  cipher.iv = cipher_iv
  data = cipher.update(data) << cipher.final
  deserialized_message data
rescue ArgumentError
  raise InvalidSignature, 'Message invalid'
end