diff --git a/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookRevokeSignature.php b/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookRevokeSignature.php index 849cf79..8e0426e 100644 --- a/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookRevokeSignature.php +++ b/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookRevokeSignature.php @@ -14,7 +14,6 @@ use Socialbox\Objects\ClientRequest; use Socialbox\Objects\PeerAddress; use Socialbox\Objects\RpcRequest; - use Symfony\Component\Uid\Uuid; class AddressBookRevokeSignature extends Method { @@ -43,20 +42,10 @@ throw new MissingRpcArgumentException('signature_uuid'); } - try - { - $signatureUuid = Uuid::fromString($rpcRequest->getParameter('signature_uuid')); - } - catch(InvalidArgumentException $e) - { - throw new InvalidRpcArgumentException('signature_uuid', $e); - } - try { // Check if the contact already exists - $peer = $request->getPeer(); - $contact = ContactManager::getContact($peer, $address); + $contact = ContactManager::getContact($request->getPeer(), $address); } catch (DatabaseOperationException $e) { @@ -70,6 +59,7 @@ try { + $signatureUuid = (string)$rpcRequest->getParameter('signature_uuid'); if(!ContactManager::contactSigningKeyUuidExists($contact, $signatureUuid)) { return $rpcRequest->produceResponse(false); diff --git a/src/Socialbox/Managers/ContactManager.php b/src/Socialbox/Managers/ContactManager.php index e220249..197fe43 100644 --- a/src/Socialbox/Managers/ContactManager.php +++ b/src/Socialbox/Managers/ContactManager.php @@ -7,6 +7,7 @@ use ncc\ThirdParty\Symfony\Uid\UuidV4; use PDO; use PDOException; + use Socialbox\Classes\Cryptography; use Socialbox\Classes\Database; use Socialbox\Classes\Validator; use Socialbox\Enums\Types\ContactRelationshipType; @@ -424,6 +425,15 @@ { $contactUuid = $contactUuid->getUuid(); } + elseif(!Validator::validateUuid($contactUuid)) + { + throw new InvalidArgumentException('The given contact UUID is not a valid UUID V4'); + } + + if(!Validator::validateUuid($signatureUuid)) + { + throw new InvalidArgumentException('The given signature UUID is not a valid UUID V4'); + } try {