Refactor ContactManager to add validation for peer address and UUID input

https://github.com/nosial/Socialbox-PHP/issues/31
This commit is contained in:
netkas 2025-03-12 00:31:32 -04:00
parent 0bc51a9917
commit 86050e2201
Signed by: netkas
GPG key ID: 4D8629441B76E4CC

View file

@ -191,6 +191,15 @@
{ {
$contactAddress = $contactAddress->getAddress(); $contactAddress = $contactAddress->getAddress();
} }
elseif(!Validator::validatePeerAddress($contactAddress))
{
throw new InvalidArgumentException('The given contact address is invalid');
}
if(!Validator::validateUuid($peerUuid))
{
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
}
try try
{ {