The Iranian government has been warned any attempt on Donald Trump's life would be seen as an act of war, a US official says.