nextcloud/tests/lib/Session/CryptoSessionHandlerTest.php
Christoph Wurst aee7a7daac
fixup! fix(session): Make session encryption more robust
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-08-28 10:13:43 +02:00

33 lines
763 B
PHP

<?php
declare(strict_types=1);
/*
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OC\Tests\Session;
use OC\Session\CryptoSessionHandler;
use Test\TestCase;
/**
* @covers \OC\Session\CryptoSessionHandler
*/
class CryptoSessionHandlerTest extends TestCase {
public function testParseIdWithPassphrase(): void {
[$sessionId, $passphrase] = CryptoSessionHandler::parseId('abc|def');
self::assertEquals('abc', $sessionId);
self::assertEquals('def', $passphrase);
}
public function testParseIdWithoutPassphrase(): void {
[$sessionId, $passphrase] = CryptoSessionHandler::parseId('abc');
self::assertEquals('abc', $sessionId);
self::assertNull($passphrase);
}
}