Hamas leader Yahya Sinwar and other senior militants were formally charged by the Justice Department as masterminds of the attack.