summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-21 11:41:16 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-21 11:41:16 +0100
commit37d1d112520f0b42c3e50d262ea139f25d093fbc (patch)
treef2f4abcbbe7444f25ed26ecf05affddbe7943b6c
parentd8ef0458721116c268af7a5fc69f7f7ac3b14385 (diff)
downloadanastasis-37d1d112520f0b42c3e50d262ea139f25d093fbc.tar.gz
anastasis-37d1d112520f0b42c3e50d262ea139f25d093fbc.tar.bz2
anastasis-37d1d112520f0b42c3e50d262ea139f25d093fbc.zip
add discussion about need for another transition
-rw-r--r--doc/sphinx/reducer.rst23
-rwxr-xr-xsrc/cli/test_anastasis_reducer_recovery_no_pay.sh1
-rw-r--r--src/reducer/anastasis_api_recovery_redux.c37
3 files changed, 33 insertions, 28 deletions
diff --git a/doc/sphinx/reducer.rst b/doc/sphinx/reducer.rst
index cc696a9..5a92d9d 100644
--- a/doc/sphinx/reducer.rst
+++ b/doc/sphinx/reducer.rst
@@ -1369,14 +1369,12 @@ choose which challenges to satisfy:
{
"uuid": "MW2R3RCBZPHNC78AW8AKWRCHF9KV3Y82EN62T831ZP54S3K5599G",
"uuid-display": "MW2R3RC",
- "cost": "TESTKUDOS:0",
"type": "question",
"instructions": "q1"
},
{
"uuid": "TXYKGE1SJZHJ4M2FKSV1P2RZVNTHZFB9E3A79QE956D3SCAWXPK0",
"uuid-display": "TXYKGE",
- "cost": "TESTKUDOS:0",
"type": "email",
"instructions": "e-mail address m?il@f*.bar"
},
@@ -1415,8 +1413,6 @@ four mandatory fields:
send to the user. Allows the user to
distinguish different PIN/TANs should say the same phone number be
used for SMS-authentication with different providers.
- - **cost**: This is the amount the Anastasis provider will charge
- to allow the user to pass the challenge.
- **type**: This is the type of the challenge, as a string.
- **instructions**: Contains additional important hints for the user
to allow the user to satisfy the challenge. It typically includes
@@ -1447,6 +1443,25 @@ However, in general it should be sufficient to display the slightly
more generic Taler error code that is returned with the new state.
+**FIXME: add new transition: sync_providers**
+
+The downloaded policy may include secrets from providers for which
+we do not (yet) have the cost structure or even the salt. So here
+a client/UI should have _again_ the opportunity to explicitly request
+providers to be downloaded to fill in missing cost(s) and salts.
+
+As providers may fail to respond, this action may need to be called
+repeatedly ("sync" button in the UI?). Once all providers are in
+'sync', that button should be hidden/obscured. Alternatively, we
+may want to enable long-polling on this one => no button!
+
+Furthermore, we likely need an additional *error* case in case a
+challenge is selected for which the provider details are unknown
+(invalid input!), and the UI should somehow disable buttons for
+challenges for which the provider details are unknown.
+
+
+
**select_challenge:**
Selecting a challenge takes different, depending on the state of the payment.
diff --git a/src/cli/test_anastasis_reducer_recovery_no_pay.sh b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
index 10f6968..a80b030 100755
--- a/src/cli/test_anastasis_reducer_recovery_no_pay.sh
+++ b/src/cli/test_anastasis_reducer_recovery_no_pay.sh
@@ -220,6 +220,7 @@ anastasis-reducer -a '{"provider_url" : "http://localhost:8086/" }' add_provider
echo " OK"
echo -n "Selecting secret to recover"
+bash
anastasis-reducer -a '{"version": 0, "mask": 0, "provider_url" : "http://localhost:8086/" }' next < $R1FILE > $R2FILE
STATE=`jq -r -e .recovery_state < $R2FILE`
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c
index b93b5e6..791ed9f 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -2036,6 +2036,10 @@ lookup_cost (const json_t *state,
const json_t *methods;
*ec = TALER_EC_NONE;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Looking up cost for provider `%s' and method `%s'\n",
+ provider_url,
+ type);
providers = json_object_get (state,
"authentication_providers");
if (NULL == providers)
@@ -2056,9 +2060,15 @@ lookup_cost (const json_t *state,
json_integer_value (json_object_get (provider,
"http_status")))
{
- *ec = json_integer_value (json_object_get (provider,
- "error_code"));
- return GNUNET_SYSERR;
+ json_t *eco;
+
+ eco = json_object_get (provider,
+ "error_code");
+ if (NULL != eco)
+ *ec = json_integer_value (eco);
+ else
+ *ec = TALER_EC_ANASTASIS_REDUCER_PROVIDER_INVALID_CONFIG;
+ return GNUNET_NO;
}
methods = json_object_get (provider,
"methods");
@@ -2172,30 +2182,9 @@ policy_lookup_cb (void *cls,
enum TALER_ErrorCode ec;
cd = ANASTASIS_challenge_get_details (c);
- ret = lookup_cost (pd->state,
- cd->provider_url,
- cd->type,
- &cost,
- &ec);
- if (GNUNET_SYSERR == ret)
- {
- json_decref (challenges);
- json_decref (policies);
- ANASTASIS_redux_fail_ (pd->cb,
- pd->cb_cls,
- ec,
- "failed to 'lookup_cost'");
- free_pd (pd);
- return;
- }
-
cj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("uuid",
&cd->uuid),
- TALER_JSON_pack_amount ("cost",
- (GNUNET_NO == ret)
- ? NULL
- : &cost),
GNUNET_JSON_pack_string ("type",
cd->type),
GNUNET_JSON_pack_string ("uuid-display",