IPasswordHashBackend.php 726 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\User\Backend;
  8. use InvalidArgumentException;
  9. /**
  10. * @since 30.0.0
  11. */
  12. interface IPasswordHashBackend {
  13. /**
  14. * @return ?string the password hash hashed by `\OCP\Security\IHasher::hash()`
  15. * @since 30.0.0
  16. */
  17. public function getPasswordHash(string $userId): ?string;
  18. /**
  19. * @param string $passwordHash the password hash hashed by `\OCP\Security\IHasher::hash()`
  20. * @throws InvalidArgumentException when `$passwordHash` is not a valid hash
  21. * @since 30.0.0
  22. */
  23. public function setPasswordHash(string $userId, string $passwordHash): bool;
  24. }