In an answer to another question, Chris Page said that Terminal can detect when the terminal parameters are in a state that is likely to be for password entry. For example, the terminal may be in cooked mode with character echo turned off.
How does Terminal detect this? Is there an API where you can subscribe to changes to the terminal parameters? Does Terminal poll? Is a special character sent to the terminal when the terminal parameters change?