Magnetic sensors based on topological insulators