. */ namespace SP\Domain\User; use Defuse\Crypto\Exception\CryptoException; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\DataModel\UserLoginData; use SP\Domain\User\Services\UserPassResponse; use SP\Infrastructure\Common\Repositories\NoSuchItemException; /** * Class UserPassService * * @package SP\Domain\User\Services */ interface UserPassServiceInterface { /** * Actualizar la clave maestra con la clave anterior del usuario * * @throws SPException * @throws CryptoException */ public function updateMasterPassFromOldPass(string $oldUserPass, UserLoginData $userLoginData): UserPassResponse; /** * Comprueba la clave maestra del usuario. * * @throws SPException */ public function loadUserMPass(UserLoginData $userLoginData, ?string $userPass = null): UserPassResponse; /** * Obtener una clave de cifrado basada en la clave del usuario y un salt. * * @return string con la clave de cifrado */ public function makeKeyForUser(string $userLogin, string $userPass): string; /** * Actualizar la clave maestra del usuario al realizar login * * @throws SPException * @throws CryptoException * @throws SPException */ public function updateMasterPassOnLogin(string $userMPass, UserLoginData $userLoginData): UserPassResponse; /** * Actualizar la clave maestra del usuario en la BBDD. * * @throws CryptoException * @throws SPException */ public function createMasterPass(string $masterPass, string $userLogin, string $userPass): UserPassResponse; /** * @throws ConstraintException * @throws QueryException * @throws NoSuchItemException */ public function migrateUserPassById(int $id, string $userPass): void; }