Iran is a signatory to the Nuclear Non-Proliferation Treaty (NPT) and has been since 1970. It was cooperating with the International Atomic Energy Agency (IAEA) until a few years ago and allowing intrusive inspections of its nuclear facilities.
In 2015, Iran agreed the Joint Comprehensive Plan of Action (JCPOA) to massively reduce their nuclear programme in exchange for reduced sanctions:
https://en.wikipedia.org/wiki/Joint_Comprehensive_Plan_of_Action
It was Trump that withdrew from that deal in 2018. Since then, Iran has been less cooperative. Similarly, due to the recent attack by Israel, there is now a real possibility Iran will leave the NPT altogether, and no longer be legally obligated to cooperate with any nuclear inspections.
Israel, on the other hand, has never even signed the NPT, does not fully cooperate with IAEA inspections, and pursues a policy of nuclear ambiguity, neither denying nor conforming whether they possess nuclear weapons (but it's widely believed they do, possibly up to 100 or more). Bit hypocritical.
The US officially acknowledged earlier in 2025 (and several times over the years under successive govts) that Iran is not currently pursuing a nuclear bomb. The IAEA also does not believe they are developing one (although Iran's compliance with inspections has dropped since Trump pulled out of the 2015 deal). It's known that Iran has enriched uranium close to weapons-grade, well above that needed for civilian energy generation, but there is no clear evidence they were about to produce a nuclear bomb (or clear statements that, should they develop one, they intend to use it to strike Israel, despite hostile rhetoric towards Israel).
"According to U.S. intelligence assessments, Tehran has the capacity to produce nuclear weapons at some point, but has halted its nuclear weapons program and has not mastered all of the necessary technologies for building such weapons."
https://www.congress.gov/crs-product/IF12106
Israel no doubt has detailed intelligence on Iran that maybe even the US isn't privy to, and claims Iran was weeks/months away from developing a nuclear bomb. But it's not been demonstrated to the international community.
On top of that, Israel attacked preemptively and aside from assassinating key military figures/govt scientists (already a highly controversial action), over 200 people, including mainly innocent Iranian civilians, were killed. I'm not a lawyer, but I suspect that might violate a few international laws.