| Total Complexity | 3 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 9 | class UtilsTest extends TestCase |
||
| 10 | { |
||
| 11 | public function testKeypairGeneration() |
||
| 12 | { |
||
| 13 | $keypair = Utils::generateKeypair(); |
||
| 14 | $this->assertEquals(\get_class($keypair), 'ncryptf\Keypair'); |
||
| 15 | $this->assertEquals(32, \strlen($keypair->getPublicKey())); |
||
| 16 | $this->assertEquals(32, \strlen($keypair->getSecretKey())); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function testSigningKeypairGeneration() |
||
| 20 | { |
||
| 21 | $keypair = Utils::generateSigningKeypair(); |
||
| 22 | $this->assertEquals(\get_class($keypair), 'ncryptf\Keypair'); |
||
| 23 | $this->assertEquals(32, \strlen($keypair->getPublicKey())); |
||
| 24 | $this->assertEquals(64, \strlen($keypair->getSecretKey())); |
||
| 25 | } |
||
| 26 | |||
| 27 | public function testZero() |
||
| 28 | { |
||
| 29 | $data = \random_bytes(32); |
||
| 30 | $zero = Utils::zero($data); |
||
| 31 | $this->assertEquals($zero, true); |
||
| 32 | $this->assertEquals($data, null); |
||
| 33 | } |
||
| 35 |