Enhance validation in EncryptionAcceptChannel and SocialClient for UUIDs and public encryption keys
https://github.com/nosial/Socialbox-PHP/issues/14
This commit is contained in:
parent
43b62ee1c9
commit
ba99c62e6a
2 changed files with 15 additions and 19 deletions
|
@ -7,6 +7,7 @@
|
|||
use InvalidArgumentException;
|
||||
use Socialbox\Classes\Cryptography;
|
||||
use Socialbox\Classes\RpcClient;
|
||||
use Socialbox\Classes\Validator;
|
||||
use Socialbox\Enums\PrivacyState;
|
||||
use Socialbox\Enums\StandardMethods;
|
||||
use Socialbox\Enums\Status\SignatureVerificationStatus;
|
||||
|
@ -537,6 +538,20 @@
|
|||
{
|
||||
$identifiedAs = $identifiedAs->getAddress();
|
||||
}
|
||||
elseif(is_string($identifiedAs) && !Validator::validatePeerAddress($identifiedAs))
|
||||
{
|
||||
throw new InvalidArgumentException('Invalid Peer Address');
|
||||
}
|
||||
|
||||
if(!Validator::validateUuid($channelUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('Invalid Channel UUID V4');
|
||||
}
|
||||
|
||||
if(!Cryptography::validatePublicEncryptionKey($publicEncryptionKey))
|
||||
{
|
||||
throw new InvalidArgumentException('Invalid Public Encryption Key');
|
||||
}
|
||||
|
||||
return $this->sendRequest(
|
||||
new RpcRequest(StandardMethods::ENCRYPTION_ACCEPT_CHANNEL, parameters: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue