When Hamas and Fatah split in 2007, both of them claimed to be the legitimate government of the Palestinian Authority.
Most of the world recognized Fatah's claims that they formed a new government for the PA, even though its creation violated the Palestinian constitution.
But Hamas maintained its own claim to be the legitimate government, and it has never relinquished that claim, even though it too is not the government under the Palestinian constitution. Which means that Hamas duplicated all of the governmental ministries of the Ramallah-based Palestinian Authority, at least on paper.
Including a Foreign Ministry.
The Hamas Foreign Ministry page doesn't mention Hamas - it claims to be the Palestinian Foreign Ministry.
It is a strange site. It occasionally issues statements, such as the most recent one from October 27 condemning cartoons that hurt Muslim feelings. It held a Zoom session on mediation techniques in early October.
But nowhere does it say who the actual Hamas foreign minister is, or the names of anyone who works at the ministry, or even its address. Press releases are simply signed "Ministry of Foreign Affairs, Gaza, Palestine."
Even Iran doesn't recognizes this ministry as having any legitimacy, as the Palestinian "embassy" in Tehran is run by the PLO (at least as of 2016.)
Between the PA and Hamas, the Palestinians have two illegitimate governments.