Created with <3 with dartpad.dev.
Created
June 5, 2023 23:02
-
-
Save dnys1/af9c5044e25631da2e6626d9939c0b7e to your computer and use it in GitHub Desktop.
bustling-aurora-9307
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum MfaType { sms, totp } | |
T _useCurrent<T>(T value) => value; | |
Future<void> setMfaPreferences({ | |
Set<MfaType> Function(Set<MfaType>) enabled = _useCurrent, | |
MfaType? Function(MfaType?) preferred = _useCurrent, | |
}) async { | |
// TODO | |
} | |
Future<void> main() async { | |
// To enable SMS MFA without affecting other settings. | |
await setMfaPreferences( | |
enabled: (enabled) => enabled..add(MfaType.sms), | |
); | |
// To disable SMS MFA without affecting other settings. | |
await setMfaPreferences( | |
enabled: (enabled) => enabled..remove(MfaType.sms), | |
); | |
// To make SMS MFA the only method, overriding previous values. | |
await setMfaPreferences( | |
enabled: (_) => {MfaType.sms}, | |
preferred: (_) => null, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment