A mattress startup has been accused of illegally mining information about visitors to its website.

Casper, a direct-to-consumer startup, and the NaviStone software company now face a federal class-action lawsuit, CBS News reports.

The lawsuit alleges that New York City resident Brady Cohen saw personal information such as his name and address lifted by NaviStone while browsing on Casper's website for a mattress. The lawsuit alleges that this amounts to 'wiretapping'.

A lawsuit has been filed against the mattress startup called Casper. The lawsuit alleges that the site, with the help of code from software company NaviStone, illegally 'wiretapped' visitors to its website

The lawsuit reads in part: 'A visitor's IP address and other PII is sent to NaviStone in real-time. 'This real-time interception and transmission of visitors' electronic communications begins as soon as the visitor loads casper.com into their web browser.' Pictured is a stock advertisement for the company

Casper uses NaviStone's code, according to the lawsuit.

The code, the lawsuit alleges, enables Casper to gather data on the habits of visitors to its website.

The lawsuit, filed November 28, alleges that both companies have violated the Wiretap Act.

It reads in part: 'A visitor's IP address and other PII is sent to NaviStone in real-time.

'This real-time interception and transmission of visitors' electronic communications begins as soon as the visitor loads casper.com into their web browser.'

Casper, quoted in the suit, called the allegations 'a blatant attempt to cash in on and extort a successful, high-growth startup'.

NaviStone said in a statement to CBS News that it had not heard of the lawsuit.

The statement reads in part: 'We are hopeful that, once that conversation takes place, we can clear up any misunderstandings they may have regarding what NaviStone does - and does not.'