Compare commits
No commits in common. "22629f9b30654ef4a30a0f51f2e854aeddab50dc" and "66ed368d7520b5367d6f8ed5ef0173683ecf3247" have entirely different histories.
22629f9b30
...
66ed368d75
2 changed files with 1 additions and 53 deletions
|
@ -1111,7 +1111,7 @@
|
||||||
public function settingsGetSignatures(): array
|
public function settingsGetSignatures(): array
|
||||||
{
|
{
|
||||||
return array_map(fn($signatures) => new Signature($signatures), $this->sendRequest(
|
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());
|
)->getResponse()->getResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
|
|
||||||
use Helper;
|
use Helper;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Socialbox\Classes\Cryptography;
|
|
||||||
use Socialbox\Classes\OtpCryptography;
|
use Socialbox\Classes\OtpCryptography;
|
||||||
use Socialbox\Enums\Flags\SessionFlags;
|
use Socialbox\Enums\Flags\SessionFlags;
|
||||||
use Socialbox\Enums\PrivacyState;
|
use Socialbox\Enums\PrivacyState;
|
||||||
use Socialbox\Enums\StandardError;
|
|
||||||
use Socialbox\Enums\Types\InformationFieldName;
|
use Socialbox\Enums\Types\InformationFieldName;
|
||||||
use Socialbox\Exceptions\CryptographyException;
|
use Socialbox\Exceptions\CryptographyException;
|
||||||
use Socialbox\Exceptions\DatabaseOperationException;
|
use Socialbox\Exceptions\DatabaseOperationException;
|
||||||
|
@ -580,54 +578,4 @@
|
||||||
// Verify the OTP
|
// Verify the OTP
|
||||||
$this->assertTrue($testClient->verificationOtpAuthentication($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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue