Move PIN dialog code to separate library.