Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
Showing only changes of commit 603ee57511 - Show all commits

View file

@ -11,11 +11,29 @@
/** /**
* Thrown when a required parameter is missing * Thrown when a required parameter is missing
* *
* @param string $parameterName The name of the parameter that is missing * @param string|null $parameterName The name of the parameter that is missing
* @param string|Throwable|null $reason The reason why the parameter is invalid can be a string or an exception or null * @param string|Throwable|null $reason The reason why the parameter is invalid can be a string or an exception or null
*/ */
public function __construct(string $parameterName, null|string|Throwable $reason=null) public function __construct(string|null $parameterName, null|string|Throwable $reason=null)
{ {
if($parameterName === null)
{
if($reason instanceof InvalidArgumentException)
{
parent::__construct(sprintf('Invalid parameter: %s', $reason->getMessage()), StandardError::RPC_INVALID_ARGUMENTS, $reason);
return;
}
if(is_string($reason))
{
parent::__construct(sprintf('Invalid parameter: %s', $reason), StandardError::RPC_INVALID_ARGUMENTS);
return;
}
parent::__construct('Invalid parameter', StandardError::RPC_INVALID_ARGUMENTS);
return;
}
if(is_null($reason)) if(is_null($reason))
{ {
parent::__construct(sprintf('Invalid parameter %s', $parameterName), StandardError::RPC_INVALID_ARGUMENTS); parent::__construct(sprintf('Invalid parameter %s', $parameterName), StandardError::RPC_INVALID_ARGUMENTS);