aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/User/Backend/IPasswordHashBackend.php
blob: 2525b4e45ea5733d9a192c883827ca3086b65d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCP\User\Backend;

use InvalidArgumentException;

/**
 * @since 30.0.0
 */
interface IPasswordHashBackend {
	/**
	 * @return ?string the password hash hashed by `\OCP\Security\IHasher::hash()`
	 * @since 30.0.0
	 */
	public function getPasswordHash(string $userId): ?string;

	/**
	 * @param string $passwordHash the password hash hashed by `\OCP\Security\IHasher::hash()`
	 * @throws InvalidArgumentException when `$passwordHash` is not a valid hash
	 * @since 30.0.0
	 */
	public function setPasswordHash(string $userId, string $passwordHash): bool;
}