Nanoporous membranes with electrochemically switchable, chemically stabilized ionic selectivity.