The nuclear bombing of Japan was not a pre-emptive strike. Pearl Harbor was a thing.
> Are you suggesting that during a declaration of war it becomes legal?
While there are some prohibitions in treaties in force or what is accepted as customary international law on conduct during War (though fewer at the time of the atomic bombing than now!), yes, the consequence of a legal state of war -- whether initiated by declaration or an external attack -- generally is that fighting war by any but such prohibited means is legal. Those making the case that particular conduct is not legal would need to identify the source of the prohibition.
> Currently under international law that would not be legal unless agreed upon by the security council.
Well, the UN Charter postdates the atomic bombing, but even if it didn't it does not prevent the use of force against an aggressor once war has started (though someone had to violate the charter to start the war.) See, particularly, Article 51 of the Charter.