changed trusted domain check to a separate method, added salt null check