Hamas hails UN conference declaration on two-state solution, says resistance to occupation ‘legitimate right’