Skip to content

Api should catch encryption exception

Return JSON style response rather than throwing an exception.

Sentry Issue: ENGINE-1W

Exception: Could not decrypt private key
  File "/Core/Messenger/Encryption/OpenSSL.php", line 113, in Minds\Core\Messenger\Encryption\OpenSSL::unlockPrivateKey
    throw new \Exception('Could not decrypt private key');
  File "/Core/Messenger/Keystore.php", line 56, in Minds\Core\Messenger\Keystore::unlockPrivateKey
    self::$tmpPrivateKey = $this->handler->unlockPrivateKey($this->getPrivateKey(), $password, $new_password);
  File "/Controllers/api/v2/messenger/keys.php", line 91, in Minds\Controllers\api\v2\messenger\keys::post
    $keystore->unlockPrivateKey($_POST['password'], $unlockPassword);
  File "/Api/Factory.php", line 90, in Minds\Api\Factory::build
    return $handler->$method($pages);
  File "/Controllers/api/api.php", line 81, in Minds\Controllers\api\api::post
    return Factory::build($pages, $this->request, $this->response);
...
(2 additional frame(s) were not displayed)
Edited by Ben