There are two types of CDIs, as in: AC-powered CDIs, and DC-powered DCIs. In each of these, an AC voltage (provided through an inverter on a DC-powered CDI) is stepped up, rectified, and used to charge a capacitor. A pickup coil senses a timing lump on the rotor, triggering a thyristor (Silicon-Controlled Rectifier, or SCR), discharging the capacitor across the primary windings of the ignition coil, resulting in a spark from the ignition coil secondary windings.
Magneto IGNITIONS are 'nother thing entirely (as described in the links provided), to the best of my knowledge and belief. No CDI is involved in a magneto ignition system.
“You better put down that gun. You got two ways to go, put it down or use it. Even if you tie me, you’re gonna be dead.” "John Russell" (Paul Newman), Hombre