Revert "Keyguard rewrite"

This reverts commit ddf84ec73bb94544fe822ebca5f617faa1bda3d6.