Added the ability to trust signing keys & resolve signing keys for peers, minor improvements and added new standard error "CONFLICT"
This commit is contained in:
parent
4e22a8bacd
commit
330e7f876b
14 changed files with 427 additions and 42 deletions
|
@ -7,6 +7,7 @@
|
|||
use Socialbox\Abstracts\Method;
|
||||
use Socialbox\Classes\Configuration;
|
||||
use Socialbox\Enums\StandardError;
|
||||
use Socialbox\Exceptions\Standard\MissingRpcArgumentException;
|
||||
use Socialbox\Exceptions\Standard\StandardRpcException;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Managers\SigningKeysManager;
|
||||
|
@ -22,7 +23,7 @@
|
|||
{
|
||||
if(!$rpcRequest->containsParameter('public_key'))
|
||||
{
|
||||
return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, "Missing 'public_key' parameter");
|
||||
throw new MissingRpcArgumentException('public_key');
|
||||
}
|
||||
|
||||
$expires = null;
|
||||
|
@ -31,6 +32,11 @@
|
|||
$expires = (int)$rpcRequest->getParameter('expires');
|
||||
}
|
||||
|
||||
if(!$rpcRequest->containsParameter('name'))
|
||||
{
|
||||
throw new MissingRpcArgumentException('name');
|
||||
}
|
||||
|
||||
$name = null;
|
||||
if($rpcRequest->containsParameter('name') && $rpcRequest->getParameter('name') !== null)
|
||||
{
|
||||
|
@ -46,7 +52,7 @@
|
|||
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'The maximum number of signing keys has been reached');
|
||||
}
|
||||
|
||||
$uuid = SigningKeysManager::addSigningKey($peerUuid, $rpcRequest->getParameter('public_key'), $expires, $name);
|
||||
$uuid = SigningKeysManager::addSigningKey($peerUuid, $rpcRequest->getParameter('public_key'), $name, $expires);
|
||||
}
|
||||
catch(InvalidArgumentException $e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue