secure firebase state machines