Made message signing in Cryptography use SHA512 as the message content for... #1
1 changed files with 12 additions and 12 deletions
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
namespace Socialbox\Classes\StandardMethods\Core;
|
namespace Socialbox\Classes\StandardMethods\Core;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Socialbox\Abstracts\Method;
|
use Socialbox\Abstracts\Method;
|
||||||
use Socialbox\Enums\ReservedUsernames;
|
use Socialbox\Enums\ReservedUsernames;
|
||||||
use Socialbox\Enums\StandardError;
|
use Socialbox\Enums\StandardError;
|
||||||
|
use Socialbox\Exceptions\DatabaseOperationException;
|
||||||
use Socialbox\Exceptions\Standard\MissingRpcArgumentException;
|
use Socialbox\Exceptions\Standard\MissingRpcArgumentException;
|
||||||
use Socialbox\Exceptions\Standard\StandardRpcException;
|
use Socialbox\Exceptions\Standard\StandardRpcException;
|
||||||
use Socialbox\Interfaces\SerializableInterface;
|
use Socialbox\Interfaces\SerializableInterface;
|
||||||
|
@ -40,20 +40,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if host is making the request & the identifier is not empty
|
// Check if host is making the request & the identifier is not empty
|
||||||
|
try
|
||||||
|
{
|
||||||
$identifyAs = null;
|
$identifyAs = null;
|
||||||
if($request->getPeer()->getUsername() == ReservedUsernames::HOST && $request->getIdentifyAs() != null)
|
if ($request->getPeer()->getUsername() == ReservedUsernames::HOST && $request->getIdentifyAs() != null)
|
||||||
{
|
{
|
||||||
$identifyAs = $request->getIdentifyAs();
|
$identifyAs = $request->getIdentifyAs();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (DatabaseOperationException $e)
|
||||||
|
{
|
||||||
|
throw new StandardRpcException('Failed to retrieve peer information', StandardError::INTERNAL_SERVER_ERROR, $e);
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve the peer using the server's peer resolver, this will resolve both internal peers and external peers
|
// Resolve the peer using the server's peer resolver, this will resolve both internal peers and external peers
|
||||||
try
|
|
||||||
{
|
|
||||||
return $rpcRequest->produceResponse(Socialbox::resolvePeer($peerAddress, $identifyAs));
|
return $rpcRequest->produceResponse(Socialbox::resolvePeer($peerAddress, $identifyAs));
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
throw new StandardRpcException(sprintf('There was an error while trying to resolve the peer %s: %s', $peerAddress, $e->getMessage()), StandardError::RESOLUTION_FAILED, $e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue