Compare commits

..

No commits in common. "22629f9b30654ef4a30a0f51f2e854aeddab50dc" and "66ed368d7520b5367d6f8ed5ef0173683ecf3247" have entirely different histories.

2 changed files with 1 additions and 53 deletions

View file

@ -1111,7 +1111,7 @@
public function settingsGetSignatures(): array
{
return array_map(fn($signatures) => new Signature($signatures), $this->sendRequest(
new RpcRequest(StandardMethods::SETTINGS_GET_SIGNATURES)
new RpcRequest(StandardMethods::SETTINGS_GET_INFORMATION_FIELDS)
)->getResponse()->getResult());
}

View file

@ -4,11 +4,9 @@
use Helper;
use PHPUnit\Framework\TestCase;
use Socialbox\Classes\Cryptography;
use Socialbox\Classes\OtpCryptography;
use Socialbox\Enums\Flags\SessionFlags;
use Socialbox\Enums\PrivacyState;
use Socialbox\Enums\StandardError;
use Socialbox\Enums\Types\InformationFieldName;
use Socialbox\Exceptions\CryptographyException;
use Socialbox\Exceptions\DatabaseOperationException;
@ -580,54 +578,4 @@
// Verify the OTP
$this->assertTrue($testClient->verificationOtpAuthentication($otp));
}
/**
* @throws RpcException
* @throws DatabaseOperationException
* @throws ResolutionException
* @throws CryptographyException
*/
public function testSettingsAddMultipleSigningKeys(): void
{
$testClient = Helper::generateRandomClient(COFFEE_DOMAIN, prefix: 'deleteRequiredPassword');
$this->assertTrue($testClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe'));
$this->assertTrue($testClient->settingsSetPassword('SecretTestingPassword123'));
$this->assertTrue($testClient->getSessionState()->isAuthenticated());
$signingKeys = [];
for($i = 0; $i < 20; $i++)
{
$signingKeypair = Cryptography::generateSigningKeyPair();
$signatureUuid = $testClient->settingsAddSignature($signingKeypair->getPublicKey());
$this->assertNotNull($signatureUuid);
$signingKeys[$signatureUuid] = $signingKeypair;
}
$this->assertCount(10, $testClient->settingsGetSignatures());
}
/**
* @throws RpcException
* @throws DatabaseOperationException
* @throws ResolutionException
* @throws CryptographyException
*/
public function testSettingsAddExceedingSigningKeys(): void
{
$testClient = Helper::generateRandomClient(COFFEE_DOMAIN, prefix: 'deleteRequiredPassword');
$this->assertTrue($testClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe'));
$this->assertTrue($testClient->settingsSetPassword('SecretTestingPassword123'));
$this->assertTrue($testClient->getSessionState()->isAuthenticated());
$signingKeys = [];
$this->expectException(RpcException::class);
$this->expectExceptionCode(StandardError::FORBIDDEN->value);
for($i = 0; $i < 25; $i++)
{
$signingKeypair = Cryptography::generateSigningKeyPair();
$signatureUuid = $testClient->settingsAddSignature($signingKeypair->getPublicKey());
$this->assertNotNull($signatureUuid);
$signingKeys[$signatureUuid] = $signingKeypair;
}
}
}