The US has held negotiations with Hamas, the White House has confirmed.