Is there a security app I can download so I can keep another device from being able to see my iPhone messages and documents when they are connected to my wifi
If you mean that when your iPhone does network, eavesdroppers on the line can, say, eavesdrop, then that's a "welcome to the Internet" situation.
When an Internet-capable device (e.g. your iPhone) talks to other systems on the Internet (e.g. Web servers), then nothing in particular protects the traffic from prying eyes of people who manage to have access to one of the links used to transfer the bytes back and forth. In particular, people with computers connected to the same WiFi access point as you (assuming that the first link from your device to the rest of the world is WiFi) are in ideal place to see everything.
An important point is that this WiFi is not the only weak link in the chain; it just is what your prankster friends or suspicious spouse will primarily use for eavesdropping.
The only known solution for that is to use end-to-end protection, commonly known as "SSL", "TLS" or "HTTPS". When you connect to a Web site with an
The HTTPS-everywhere browser extension will automatically use SSL if the target server supports it, even if you did not ask for it. However, that extension is for Firefox and Chrome, not Safari (the normal iPhone Web browser). It seems that there is a Chrome version for iPhone and iPad. In any case, what HTTPS-everywhere does automatically can also be done manually, by making sure that the URL is in
Privacy is another matter. SSL will prevent eavesdropper from seeing what you send or receive, but they may still make a good guess as to the identity of the target site (the server name part of the target site is not protected by SSL). If you want to improve your privacy, Tor might help, but iPhones don't seem to be officially supported (there is some support for Android, though). Note that Tor does not replace SSL; Tor uses SSL (in several layers) and may, as a by-product, offer confidentiality against local attackers (people on the same WiFi network as you), but if the target server does not use SSL then your data will be sent unprotected at some point on the Internet.