Jane Manchun Wong, a computer science student at the UMass Dartmouth, discovered the feature when looking inside of the Android application package (APK) for Twitter.
APKs, which are how the Android operating system installs mobile apps, often contain code for unlaunched features and code in the most recent release suggests an encryption feature is being tested.
DMs on Twitter are currently transmitted in plain text, which mean that they are visible to everyone who has access to them on Twitter’s network.
By introducing end-to-end encryption, the messages would be completely unintelligible to Twitter or anyone else who does not possess the decryption keys.
Ms Wong explained to Sky News how she discovered the feature. She said: “In layman’s term (hopefully), I alter the settings of their app’s hidden feature tests on my phone.
“They usually do tests like that to get feedback before rolling it out globally. Kinda like study groups.”
The ability to send secret and safe messages could protect users from malicious parties with access to Twitter’s network.
It is not yet clear whether the feature would be available for desktop Twitter users, or if it would only be used in the app.
Ms Wong said she doubted Twitter would make encrypted DMs available on desktop: “It would be too much work to implement that securely.”
In a screenshot she shared with Sky News, the feature for a secret conversation appears to present users with their keys in a similar fashion to messaging apps WhatsApp and Signal, both of which use the Signal encryption protocol.
“It sure looks similar to what we see on WhatsApp. But as long as Twitter hasn’t officially confirmed it yet, it’s still up to speculation on whether it trials the Signal protocol,” said Ms Wong.
In the last week of April, Twitter posted its second consecutive quarterly profit as it added more users and reaped the benefit of streaming video.
As regulators criticise both social media companies and the widespread availability of encryption for the challenges they allegedly present to public safety, Twitter’s decision to roll-out secret messaging may invite more criticism.
The company did not immediately respond to a request for comment.