Made message signing in Cryptography use SHA512 as the message content for... #1
1 changed files with 35 additions and 1 deletions
|
@ -23,7 +23,6 @@
|
||||||
*
|
*
|
||||||
* @param string|PeerAddress $peerAddress The address of the peer to connect to.
|
* @param string|PeerAddress $peerAddress The address of the peer to connect to.
|
||||||
* @param ExportedSession|null $exportedSession Optional. The exported session to use for communication.
|
* @param ExportedSession|null $exportedSession Optional. The exported session to use for communication.
|
||||||
* @param array $options Optional. Additional options to pass to the client.
|
|
||||||
* @throws CryptographyException If the public key is invalid.
|
* @throws CryptographyException If the public key is invalid.
|
||||||
* @throws ResolutionException If the domain cannot be resolved.
|
* @throws ResolutionException If the domain cannot be resolved.
|
||||||
* @throws RpcException If the RPC request fails.
|
* @throws RpcException If the RPC request fails.
|
||||||
|
@ -59,6 +58,19 @@
|
||||||
)->getResponse()->getResult());
|
)->getResponse()->getResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the list of allowed methods, these are the methods that can be called by the client.
|
||||||
|
*
|
||||||
|
* @return array The allowed methods returned from the RPC request.
|
||||||
|
* @throws RpcException Thrown if the RPC request fails.
|
||||||
|
*/
|
||||||
|
public function getAllowedMethods(): array
|
||||||
|
{
|
||||||
|
return $this->sendRequest(
|
||||||
|
new RpcRequest(StandardMethods::GET_ALLOWED_METHODS->value, Utilities::randomCrc32())
|
||||||
|
)->getResponse()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the privacy policy document by sending a remote procedure call request.
|
* Fetches the privacy policy document by sending a remote procedure call request.
|
||||||
*
|
*
|
||||||
|
@ -320,6 +332,28 @@
|
||||||
)->getResponse()->getResult();
|
)->getResponse()->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticates a password by sending a remote procedure call request with an optional hashing operation.
|
||||||
|
*
|
||||||
|
* @param string $password The password to authenticate.
|
||||||
|
* @param bool $hash Indicates whether the password should be hashed using SHA-512 before authentication.
|
||||||
|
* @return bool The result of the password authentication request.
|
||||||
|
* @throws RpcException Thrown if the RPC request fails.
|
||||||
|
*/
|
||||||
|
public function verificationPasswordAuthentication(string $password, bool $hash=true): bool
|
||||||
|
{
|
||||||
|
if($hash)
|
||||||
|
{
|
||||||
|
$password = hash('sha512', $password);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (bool)$this->sendRequest(
|
||||||
|
new RpcRequest(StandardMethods::VERIFICATION_PASSWORD_AUTHENTICATION->value, Utilities::randomCrc32(), [
|
||||||
|
'password' => $password
|
||||||
|
])
|
||||||
|
)->getResponse()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new password for settings with optional hashing.
|
* Sets a new password for settings with optional hashing.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue