Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
Showing only changes of commit 4856dacb9d - Show all commits

View file

@ -6,6 +6,8 @@
use Socialbox\Abstracts\Method;
use Socialbox\Enums\StandardError;
use Socialbox\Exceptions\DatabaseOperationException;
use Socialbox\Exceptions\Standard\InvalidRpcArgumentException;
use Socialbox\Exceptions\Standard\MissingRpcArgumentException;
use Socialbox\Exceptions\Standard\StandardException;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Managers\ContactManager;
@ -16,13 +18,16 @@
class AddressBookDeleteContact extends Method
{
/**
* Deletes a contact from the authenticated peer's address book, returns True if the contact was deleted
* false if the contact does not exist.
*
* @inheritDoc
*/
public static function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface
{
if(!$rpcRequest->containsParameter('peer'))
{
return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Missing required peer parameter');
throw new MissingRpcArgumentException('peer');
}
try
@ -31,7 +36,7 @@
}
catch(InvalidArgumentException $e)
{
throw new StandardException('Invalid peer address', StandardError::RPC_INVALID_ARGUMENTS, $e);
throw new InvalidRpcArgumentException('peer', $e->getMessage());
}
try
@ -40,7 +45,7 @@
$peer = $request->getPeer();
if(!ContactManager::isContact($peer, $address))
{
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Contact does not exist');
return $rpcRequest->produceResponse(false);
}
// Create the contact