Refactor AddressBookTrustSignature and ContactManager to improve UUID and peer address validation
https://github.com/nosial/Socialbox-PHP/issues/35
This commit is contained in:
parent
8cd3b381cf
commit
81b3dcf3ea
3 changed files with 33 additions and 28 deletions
|
@ -77,6 +77,15 @@
|
|||
{
|
||||
$contactAddress = $contactAddress->getAddress();
|
||||
}
|
||||
elseif(!Validator::validatePeerAddress($contactAddress))
|
||||
{
|
||||
throw new InvalidArgumentException('The given contact address is not a valid peer address');
|
||||
}
|
||||
|
||||
if(!Validator::validateUuid($peerUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
$uuid = UuidV4::v4()->toRfc4122();
|
||||
|
||||
|
@ -136,6 +145,15 @@
|
|||
{
|
||||
$contactAddress = $contactAddress->getAddress();
|
||||
}
|
||||
elseif(!Validator::validatePeerAddress($contactAddress))
|
||||
{
|
||||
throw new InvalidArgumentException('The given contact address is not a valid peer address');
|
||||
}
|
||||
|
||||
if(!Validator::validateUuid($peerUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -376,6 +394,10 @@
|
|||
{
|
||||
$contactUuid = $contactUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($contactUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given contact UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -473,6 +495,10 @@
|
|||
{
|
||||
$contactUuid = $contactUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($contactUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given contact UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -573,6 +599,10 @@
|
|||
{
|
||||
$contactUuid = $contactUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($contactUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given contact UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue