Stormy Daniels had sex with Trump, according to lie detector test — but how does the test actually work?

Former adult film star Stormy Daniels passed a polygraph test in which she admitted having unprotected sex with Donald Trump.

On Tuesday, Michael Avenatti, an attorney for Daniels (whose real name is Stephanie Clifford), confirmed to NBC News that he paid $25,000 for the video of his client taking the test on May 19, 2011. Avenatti also tweeted a video screenshot.

Stormy Daniels passed a lie detector test on whether she slept with Donald Trump in 2006. (Photo: Getty Images)

Daniels followed up with a tweet that read, “Technically I didn’t sleep with the POTUS 12 years ago. There was no sleeping (hehe) and he was just a goofy reality TV star. But I digress…People DO care that he lied about it, had me bullied, broke laws to cover it up, etc. And PS…I am NOT going anywhere. xoxoxo.”

“In the opinion of this examiner, Ms. Clifford is truthful about having unprotected vaginal intercourse with Donald Trump in July 2006,” said Ronald Slay of Western Security Consultants, which administered the polygraph, according to the Wall Street Journal.

NBC News also reported that Daniels took the lie detector test at the request of Life & Style magazine, owned by Bauer Publishing. The story never ran; however in January, In Touch Weekly (also owned by Bauer) released the full story titled “Stormy Daniels’ Explosive Full Interview on Donald Trump Affair: “I Can Describe His Junk Perfectly.”

In the story, Daniels alleges that she met Trump during a charity golf tournament event in Lake Tahoe. “So anyway, the sex was nothing crazy,” Daniels told In Touch. “He wasn’t like, chain me to the bed or anything. It was one position. I can definitely describe his junk perfectly if I ever have to. He definitely seemed smitten after that. He was like, ‘I wanna see you again, when can I see you again?’”

She added that the pair did not use protection, a decision that was made “kind of in the moment.”

Earlier in March, NBC News reported that Daniels sued the president on grounds that her “hush agreement” — which included a $130,000 payout — to keep quiet about the affair was invalid because although Trump attorney Michael Cohen signed the document, Trump did not.

The White House has denied the affair, according to CNN.

Slay did not return Yahoo Lifestyle’s request for comment. However, according to Michael Martin, a certified polygraph expert and owner of Global Polygraph Network, Daniels likely agreed to a two-hour polygraph, ranging in cost from $400 to $700, that included a pre-interview determining her mental and physical health.

“You can administer the test for just about any reason, but the most common reason is infidelity,” Martin told Yahoo Lifestyle.

While polygraphs cannot provide indisputable evidence that one is lying, it measures changes in breathing, pulse, blood pressure, and skin gland activity — all physiological signs that a person is undergoing a fight-flight-freeze response.

According to Psychology Today, unlike the “fight or flight” response that occurs when the body’s sympathetic nervous system senses a threat to survival prompting a person to either face the danger or flee, the fight-flight-freeze response is triggered “when the situation confronting you overwhelms your coping capacities and leaves you paralyzed in fear.”

Martin acknowledges that most test takers are nervous; however, polygraphs account for a person’s baseline demeanor, only measuring physiological changes between each question. What’s more, motion sensors distinguish between a person who is caught in a lie and one who has a leg cramp.

After the test is complete, the computer calculates a score based on an algorithm. In Daniels’s case, according to NBC News, there was a “more than 99 percent probability” that she was telling the truth about the unprotected sex.

According to Spencer Coursen, a threat management expert and founder of the Coursen Security Group, polygraphs can be a useful tool. But “they’re not the magic box television makes them out to be,” he told Yahoo Lifestyle. “Detectives like to use them in a criminal investigation because the reading of the machine is inadmissible, but what the person says may provide additional clues to aid in their efforts.”

Coursen adds, “There is no evidence that a particular physiological reaction is unique to deception. An honest person may be nervous when answering truthfully and a dishonest person may be cool as a cucumber.”

Read more from Yahoo Lifestyle: 

Follow us on Instagram, Facebook, and Twitter for nonstop inspiration delivered fresh to your feed, every day.