Wavefront sensing by phase retrieval implies extraction of the Fourier transform of a complex signal based on observation of the modulus of the signal. Only the image intensity from a system's focal plane array is required to estimate the phase aberrations. These estimates are used to derive control signals to align (or to maintain alignment of) the optical system. The concept can be used in both a predetection and postdetection mode. In the former, the control system labors to keep the optics in a diffraction-limited mode all the time. In the latter, the control system induces a phase or wavelength diversity that allows successive images to be restored to nearly diffraction-limited quality by postprocessing of the image. This second mode is particularly interesting because it will reduce the design effort for both the optical system and the control system. How the phase or wavelength diversity is achieved is not clear at this time. If the method has utility, it provides an interesting challenge to designers of optical devices. In this paper we describe the mathematics of the technique and show some computer simulations which involve both point sources and extended objects.