From 78c5a22c15d20a392a8718146bb666086c1c094a Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 7 Mar 2025 15:01:48 -0500 Subject: [PATCH] Cast channel and message UUIDs to string in EncryptionChannelAcknowledgeMessage https://github.com/nosial/Socialbox-PHP/issues/14 --- .../EncryptionChannelAcknowledgeMessage.php | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/Socialbox/Classes/StandardMethods/EncryptionChannel/EncryptionChannelAcknowledgeMessage.php b/src/Socialbox/Classes/StandardMethods/EncryptionChannel/EncryptionChannelAcknowledgeMessage.php index 66c9194..6cbc068 100644 --- a/src/Socialbox/Classes/StandardMethods/EncryptionChannel/EncryptionChannelAcknowledgeMessage.php +++ b/src/Socialbox/Classes/StandardMethods/EncryptionChannel/EncryptionChannelAcknowledgeMessage.php @@ -5,12 +5,10 @@ use Exception; use Socialbox\Abstracts\Method; use Socialbox\Classes\Logger; - use Socialbox\Classes\Validator; use Socialbox\Enums\StandardError; use Socialbox\Enums\Status\EncryptionChannelStatus; use Socialbox\Exceptions\DatabaseOperationException; use Socialbox\Exceptions\RpcException; - use Socialbox\Exceptions\Standard\InvalidRpcArgumentException; use Socialbox\Exceptions\Standard\MissingRpcArgumentException; use Socialbox\Exceptions\Standard\StandardRpcException; use Socialbox\Interfaces\SerializableInterface; @@ -32,23 +30,11 @@ { throw new MissingRpcArgumentException('channel_uuid'); } - elseif(!Validator::validateUuid($rpcRequest->getParameter('channel_uuid'))) - { - throw new InvalidRpcArgumentException('channel_uuid', 'The given channel uuid is not a valid UUID V4'); - } if(!$rpcRequest->containsParameter('message_uuid')) { throw new MissingRpcArgumentException('message_uuid'); } - elseif(!is_string($rpcRequest->getParameter('message_uuid'))) - { - throw new InvalidRpcArgumentException('message_uuid', 'Must be type string'); - } - elseif(!Validator::validateUuid($rpcRequest->getParameter('message_uuid'))) - { - throw new InvalidRpcArgumentException('message_uuid', 'Invalid message UUID V4'); - } try { @@ -177,7 +163,7 @@ } EncryptionChannelManager::acknowledgeMessage( - $rpcRequest->getParameter('channel_uuid'), $rpcRequest->getParameter('message_uuid') + (string)$rpcRequest->getParameter('channel_uuid'), (string)$rpcRequest->getParameter('message_uuid') ); } catch(DatabaseOperationException $e) @@ -191,8 +177,8 @@ { $rpcClient = Socialbox::getExternalSession($message->getOwner($encryptionChannel)->getDomain()); $rpcClient->encryptionChannelAcknowledgeMessage( - channelUuid: $rpcRequest->getParameter('channel_uuid'), - messageUuid: $rpcRequest->getParameter('message_uuid'), + channelUuid: (string)$rpcRequest->getParameter('channel_uuid'), + messageUuid: (string)$rpcRequest->getParameter('message_uuid'), identifiedAs: $requestingPeer->getAddress() ); }