The Justice Department has indicted former FBI Director James Comey over a social media post prosecutors say implied a threat against the president, setting up a legal battle likely to test First Amendment protections.