Skip to content

Instantly share code, notes, and snippets.

@thatmarvin
Created November 25, 2020 03:14
Show Gist options
  • Save thatmarvin/b55e4a1b3bc4435dc1c27f4892a41043 to your computer and use it in GitHub Desktop.
Save thatmarvin/b55e4a1b3bc4435dc1c27f4892a41043 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
"id": "setupMfa",
"initial": "startSetup",
"context": {
"method": "totp",
"totpUrl": "",
"recoveryCodes": "",
"phone": ""
},
"states": {
"startSetup": {
"on": {
"NEXT": "chooseMethod"
}
},
"chooseMethod": {
"on": {
"CHOOSE_TOTP": "registerTotp",
"CHOOSE_SMS": "verifySms"
}
},
"registerTotp": {
"on": {
"NEXT": "verifyTotp",
"PREVIOUS": "chooseMethod"
}
},
"verifyTotp": {
"on": {
"NEXT": "recoveryCodes",
"PREVIOUS": "registerTotp"
}
},
"verifySms": {
"on": {
"NEXT": "recoveryCodes",
"PREVIOUS": "chooseMethod"
}
},
"recoveryCodes": {
"on": {
"NEXT": "completed"
}
},
"completed": {
"type": "final"
}
}
});
@thatmarvin
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment