. */ namespace SP\Domain\User\Ports; use SP\Domain\Auth\Dtos\UserLoginDto; use SP\Domain\Common\Services\ServiceException; use SP\Domain\User\Dtos\UserDataDto; use SP\Domain\User\Dtos\UserMasterPassDto; /** * Class UserPassService * * @package SP\Domain\User\Services */ interface UserMasterPassService { /** * Update the current user's master password with the previous user's login password * * @throws ServiceException */ public function updateFromOldPass( string $oldUserPass, UserLoginDto $userLoginDto, UserDataDto $userDataDto ): UserMasterPassDto; /** * Load the user's master password * * @throws ServiceException */ public function load( UserLoginDto $userLoginDto, UserDataDto $userDataDto, ?string $userPass = null ): UserMasterPassDto; /** * Update the user's master pass on log in. * It requires the user's login data to build a secure key to store the master password * * @param string $userMasterPass * @param UserLoginDto $userLoginDto * @param int $userId * @return UserMasterPassDto * @throws ServiceException */ public function updateOnLogin(string $userMasterPass, UserLoginDto $userLoginDto, int $userId): UserMasterPassDto; /** * Update the user's master password in the database * * @param string $masterPass * @param string $userLogin * @param string $userPass * @return UserMasterPassDto * @throws ServiceException */ public function create(string $masterPass, string $userLogin, string $userPass): UserMasterPassDto; }