Merge pull request #7825 from nextcloud/add-type-hinting-for-ICrypto-decrypt
Adds type hinting for scalar types in ICrypto->decrypt
This commit is contained in:
commit
60f38d37fe
|
@ -108,7 +108,7 @@ class Crypto implements ICrypto {
|
||||||
* @return string plaintext
|
* @return string plaintext
|
||||||
* @throws \Exception If the HMAC does not match
|
* @throws \Exception If the HMAC does not match
|
||||||
*/
|
*/
|
||||||
public function decrypt($authenticatedCiphertext, $password = '') {
|
public function decrypt(string $authenticatedCiphertext, string $password = ''): string {
|
||||||
if($password === '') {
|
if($password === '') {
|
||||||
$password = $this->config->getSystemValue('secret');
|
$password = $this->config->getSystemValue('secret');
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,5 +61,5 @@ interface ICrypto {
|
||||||
* @throws \Exception If the HMAC does not match
|
* @throws \Exception If the HMAC does not match
|
||||||
* @since 8.0.0
|
* @since 8.0.0
|
||||||
*/
|
*/
|
||||||
public function decrypt($authenticatedCiphertext, $password = '');
|
public function decrypt(string $authenticatedCiphertext, string $password = ''): string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -653,14 +653,14 @@ class LostControllerTest extends \Test\TestCase {
|
||||||
public function testIsSetPasswordWithoutTokenFailing() {
|
public function testIsSetPasswordWithoutTokenFailing() {
|
||||||
$this->config->method('getUserValue')
|
$this->config->method('getUserValue')
|
||||||
->with('ValidTokenUser', 'core', 'lostpassword', null)
|
->with('ValidTokenUser', 'core', 'lostpassword', null)
|
||||||
->will($this->returnValue(null));
|
->willReturn('aValidtoken');
|
||||||
$this->userManager->method('get')
|
$this->userManager->method('get')
|
||||||
->with('ValidTokenUser')
|
->with('ValidTokenUser')
|
||||||
->willReturn($this->existingUser);
|
->willReturn($this->existingUser);
|
||||||
|
|
||||||
$this->crypto->method('decrypt')
|
$this->crypto->method('decrypt')
|
||||||
->with(
|
->with(
|
||||||
$this->equalTo(''),
|
$this->equalTo('aValidtoken'),
|
||||||
$this->equalTo('test@example.comSECRET')
|
$this->equalTo('test@example.comSECRET')
|
||||||
)->willThrowException(new \Exception());
|
)->willThrowException(new \Exception());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue