public function encodeResponse($response)
 {
     $serialized = json_encode($response, true);
     $encrypter = new \Encryption\Encrypter($this->encryptionKey);
     $response = $encrypter->encode($serialized);
     return $response;
 }
 public function encodeRequest($requestData)
 {
     if (empty($this->encryptionKey)) {
         throw new \Exception('encryption key not specified.');
     }
     $serialized_request = json_encode($requestData, true);
     $encrypter = new \Encryption\Encrypter($this->encryptionKey);
     $encoded = $encrypter->encode($serialized_request);
     return $encoded;
 }