diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-27 23:00:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-27 23:00:06 +0200 |
commit | 442226045ced8412589155501dbd77ef841d5069 (patch) | |
tree | 27954dd21d9ba0e068db22a1401a5add3956e936 | |
parent | d104a3c8c3fafe6dd9bb56cae91fae60c651ff80 (diff) | |
download | anastasis-442226045ced8412589155501dbd77ef841d5069.tar.gz anastasis-442226045ced8412589155501dbd77ef841d5069.tar.bz2 anastasis-442226045ced8412589155501dbd77ef841d5069.zip |
if we had a challenge code before, submit it again
-rw-r--r-- | src/reducer/anastasis_api_recovery_redux.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c index 684b877..897a6dd 100644 --- a/src/reducer/anastasis_api_recovery_redux.c +++ b/src/reducer/anastasis_api_recovery_redux.c @@ -1697,12 +1697,33 @@ select_challenge_cb (void *cls, return; } /* trigger challenge */ - ret = ANASTASIS_challenge_start (ci, - psp, - timeout, - NULL, /* no answer */ - &answer_feedback_cb, - sctx); + { + json_t *c = find_challenge_in_cs (sctx->state, + &cd->uuid); + json_t *pin = json_object_get (c, + "answer-pin"); + + if (NULL != pin) + { + uint64_t ianswer = json_integer_value (pin); + + ret = ANASTASIS_challenge_answer2 (ci, + psp, + timeout, + ianswer, + &answer_feedback_cb, + sctx); + } + else + { + ret = ANASTASIS_challenge_start (ci, + psp, + timeout, + NULL, /* no answer */ + &answer_feedback_cb, + sctx); + } + } if (GNUNET_OK != ret) { ANASTASIS_redux_fail_ (sctx->cb, |