[keys] Fix critical logic error in keys.js
[keys] Split state.js to fsm.js and help.js