Wray's work as a part of a team of attorneys about five years ago appears to be at odds with the international push by the Justice Department and U.S. allies to allow law enforcement and intelligence agencies to bypass encrypted communications.
Wray himself has been a very public part of that campaign, arguing that finding a way around encryption was key to the fight against terrorism and serious crime.
Only last month, Wray told a cybersecurity conference that internet companies were "increasingly shielding indispensable information about those threats from any form of lawful access through warrant-proof encryption."
Wray's work for Facebook, which occurred when he was employed as a lawyer for law firm King & Spalding, has not been previously reported.
The FBI said Wray could not comment on the case.
"When he was an attorney in private practice, however, the Director represented his clients' interests and advocated on their behalf," the agency said in a statement.
"Like all other lawyers, his duty of loyalty was to his client, and he did not put his personal views ahead of his clients' interests or allow them to affect the legal work he did for clients. Today, as Director of the FBI, his duty is to act in the best interests of the American people," it said.
Alan Rozenshtein, a former U.S. Department of Justice lawyer who now teaches at the University of Minnesota, agreed with that assessment.
"I don’t think it’s anything untoward," he said in a telephone interview. "There are plenty of attorneys who go from industry to government and argue against the very industry they were representing."
He added that it might be a good thing that Wray "is not coming into this cold. He understands the perspective of the private sector.”
The 2015-2016 case that pitted WhatsApp against the government has also not previously been reported and remains shrouded in mystery.
Sparse details about the behind-the-scenes battle were released late Wednesday by Facebook in court filings related to a separate lawsuit against Israeli cyber arms dealer NSO Group.
In that case, being heard in California, Facebook has accused NSO of hacking its users through a now-fixed flaw in WhatsApp. NSO denies wrongdoing in that case.
The newly released documents argue that King & Spalding should not be allowed to represent NSO because the firm's past representation of WhatsApp "necessarily involved the provision and exchange of WhatsApp's highly confidential information."
The documents do not specify what the past representation entailed – saying only that it occurred as WhatsApp was implementing its encryption protections and involved the government. A person familiar with the case said it involved an attempt by the U.S. Department of Justice to pressure WhatsApp over the use of encryption but did not provide further detail.
King & Spalding declined to comment.
In a statement, WhatsApp did not comment specifically on Wray's past position on encryption but said that King & Spalding's past work for WhatsApp poses "serious ethical concerns for their representation of NSO today."