selectChallenge method
Future<SXTuple1<IGChallengeVerification> >
selectChallenge(
- IGChallengeChoice choice, {
- IGChallengeVerification? replay,
选择认证
Implementation
Future<SXTuple1<IGChallengeVerification>> selectChallenge(
IGChallengeChoice choice,
{IGChallengeVerification? replay}) async {
_checkChallengelock();
int choiceInt = 0;
switch (choice) {
case IGChallengeChoice.Phone:
choiceInt = 0;
break;
case IGChallengeChoice.Email:
choiceInt = 1;
break;
case IGChallengeChoice.ThisWasMe:
choiceInt = 0;
break;
case IGChallengeChoice.Uncaught:
assert(false);
choiceInt = 0;
break;
}
var apiPath = _account?.state.challengeLock?.apiPath;
final body = {
"_csrftoken": _csrftoken,
"_uuid": _deviceId,
"device_id": _deviceId,
"choice": "$choiceInt",
// "_uid": "__logged_out_998288.664296"
};
bool directory = false;
if (replay != null) {
apiPath = "/challenge/replay/${replay.userId}/${replay.nonce}";
body["phone_number"] = null;
directory = true;
}
return (await _apiNet.postSignedJson(apiPath, body,
directory: directory, action: IGAPIAction.AuthChallengeSelect))
.tuple1();
}