gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: implement change_version transi


From: gnunet
Subject: [taler-anastasis] branch master updated: implement change_version transition
Date: Fri, 19 Mar 2021 23:03:40 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new b36737e  implement change_version transition
b36737e is described below

commit b36737e72bcd77b182ffab635567e1b096e844be
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Mar 19 22:46:09 2021 +0100

    implement change_version transition
---
 src/reducer/anastasis_api_recovery_redux.c | 65 ++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/src/reducer/anastasis_api_recovery_redux.c 
b/src/reducer/anastasis_api_recovery_redux.c
index e272cf1..1c76f3b 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -1425,6 +1425,66 @@ back_challenge_solving (json_t *state,
 }
 
 
+/**
+ * The user wants us to change the policy version. Download another version.
+ *
+ * @param[in] state we are in
+ * @param arguments our arguments with the solution
+ * @param cb functiont o call with the new state
+ * @param cb_cls closure for @a cb
+ * @return handle to cancel challenge selection step
+ */
+static struct ANASTASIS_ReduxAction *
+change_version (json_t *state,
+                const json_t *arguments,
+                ANASTASIS_ActionCallback cb,
+                void *cb_cls)
+{
+  uint64_t version;
+  struct GNUNET_JSON_Specification spec[] = {
+    GNUNET_JSON_spec_uint64 ("version",
+                             &version),
+    GNUNET_JSON_spec_end ()
+  };
+  json_t *args;
+  struct ANASTASIS_ReduxAction *ra;
+
+  if (GNUNET_OK !=
+      GNUNET_JSON_parse (arguments,
+                         spec,
+                         NULL, NULL))
+  {
+    GNUNET_break (0);
+    ANASTASIS_redux_fail_ (cb,
+                           cb_cls,
+                           TALER_EC_ANASTASIS_REDUCER_INPUT_INVALID,
+                           "'version' invalid");
+    return NULL;
+  }
+  args = json_pack ("{s:I, s:O}",
+                    "version",
+                    (json_int_t) version,
+                    "identity_attributes",
+                    json_object_get (state,
+                                     "identity_attributes"));
+  if (NULL == args)
+  {
+    GNUNET_break (0);
+    ANASTASIS_redux_fail_ (cb,
+                           cb_cls,
+                           TALER_EC_ANASTASIS_REDUCER_STATE_INVALID,
+                           NULL);
+    return NULL;
+  }
+  ra = ANASTASIS_REDUX_recovery_challenge_begin_ (state,
+                                                  args,
+                                                  cb,
+                                                  cb_cls);
+  json_decref (args);
+  return ra;
+}
+
+
 /**
  * Signature of callback function that implements a state transition.
  *
@@ -1470,6 +1530,11 @@ ANASTASIS_recovery_action_ (json_t *state,
       "select_challenge",
       &select_challenge
     },
+    {
+      ANASTASIS_RECOVERY_STATE_CHALLENGE_SELECTING,
+      "change_version",
+      &change_version
+    },
     {
       ANASTASIS_RECOVERY_STATE_CHALLENGE_SELECTING,
       "back",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]