A method for unique phase retrieval of ultrafast optical fields