gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: -update reducer documentation t


From: gnunet
Subject: [taler-anastasis] branch master updated: -update reducer documentation to new plan (yet to be implemented)
Date: Thu, 20 Jan 2022 16:28:54 +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 e73d2b4  -update reducer documentation to new plan (yet to be 
implemented)
e73d2b4 is described below

commit e73d2b49559e3dbb34b002fdd5325fc0212c4408
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jan 20 16:28:52 2022 +0100

    -update reducer documentation to new plan (yet to be implemented)
---
 doc/sphinx/anastasis_reducer_recovery.drawio |   2 +-
 doc/sphinx/anastasis_reducer_recovery.png    | Bin 52610 -> 51922 bytes
 doc/sphinx/anastasis_reducer_recovery.svg    |   3 +-
 doc/sphinx/reducer.rst                       |  82 +++++++++++++++++----------
 src/reducer/anastasis_api_recovery_redux.c   |  19 +++++++
 5 files changed, 73 insertions(+), 33 deletions(-)

diff --git a/doc/sphinx/anastasis_reducer_recovery.drawio 
b/doc/sphinx/anastasis_reducer_recovery.drawio
index ac1f617..4ffb43e 100644
--- a/doc/sphinx/anastasis_reducer_recovery.drawio
+++ b/doc/sphinx/anastasis_reducer_recovery.drawio
@@ -1 +1 @@
-<mxfile host="app.diagrams.net" modified="2021-07-14T14:05:15.539Z" agent="5.0 
(X11)" etag="RgsPOgrkZ7CacnVb-4wQ" version="14.8.6" type="device"><diagram 
id="PpkpfZO7TL7CUlFfbbxv" 
name="Seite-1">7Vxbd6o4FP41PupKwv2xWnuZ6Win2k49Ly6qVDlF8SC29fz6CTUISQBRgmLX6UOXBEhgZ+8v376EmtSafV575mL6jzu2nBoC48+adFlDSIcQ/w8a1psGGcqbholnjzdNMGro2b8t0ghI68oeW0vqQt91Hd9e0I0jdz63Rj7VZnqe+0Ff9uo69KgLc2JxDb2R6fCt/9ljf0paoWpEJ24sezIlQ+tI25yYmeHF5E2WU3PsfsSapHZNanmu629+zT5blhPILpTL5r6rlLPbB/OsuZ/nhtf1r8797YXSN1+lY
 [...]
\ No newline at end of file
+<mxfile host="app.diagrams.net" modified="2022-01-20T15:16:50.498Z" agent="5.0 
(X11)" etag="8Qk7PxXMA2Ox2VhIvYvE" version="16.4.3" type="device"><diagram 
id="PpkpfZO7TL7CUlFfbbxv" 
name="Seite-1">7Vxbe6I4GP41XupDwvmyWnvY7Wq32m6dGx+qVJmiOIhtnV+/oQYhCWCUoNhnejEjIQf4Dm++U6jJrdnntW8tpv94Y9utQWn8WZMvaxACBUrov7BlvWnRZdww8Z0x7hQ39JzfNm6Muq2csb0kOgae5wbOgmwcefO5PQqINsv3vQ+y26vnkqsurInNNPRGlsu2/ueMgyluBZoZ37ixnckUL21AfXNjZkWd8Zssp9bY+0g0ye2a3PI9L9j8mn22bDckXkSXzbirjLvbB/PtecAz4HX9q3N/e6H2rVd52FkCw
 [...]
\ No newline at end of file
diff --git a/doc/sphinx/anastasis_reducer_recovery.png 
b/doc/sphinx/anastasis_reducer_recovery.png
index b08c763..2c0c33c 100644
Binary files a/doc/sphinx/anastasis_reducer_recovery.png and 
b/doc/sphinx/anastasis_reducer_recovery.png differ
diff --git a/doc/sphinx/anastasis_reducer_recovery.svg 
b/doc/sphinx/anastasis_reducer_recovery.svg
index 7020498..fc20336 100644
--- a/doc/sphinx/anastasis_reducer_recovery.svg
+++ b/doc/sphinx/anastasis_reducer_recovery.svg
@@ -1,3 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Do not edit this file with editors other than diagrams.net -->
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
-<svg xmlns="http://www.w3.org/2000/svg"; style="background-color: rgb(255, 255, 
255);" xmlns:xlink="http://www.w3.org/1999/xlink"; version="1.1" width="1076px" 
height="398px" viewBox="-0.5 -0.5 1076 398" content="&lt;mxfile 
host=&quot;app.diagrams.net&quot; modified=&quot;2021-07-14T14:05:44.086Z&quot; 
agent=&quot;5.0 (X11)&quot; etag=&quot;heBcjQYLP05MJ4nWahSj&quot; 
version=&quot;14.8.6&quot; type=&quot;device&quot;&gt;&lt;diagram 
id=&quot;PpkpfZO7TL7CUlFfbbxv&quot; name=&quot;Seite-1&quo [...]
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg"; style="background-color: rgb(255, 255, 
255);" xmlns:xlink="http://www.w3.org/1999/xlink"; version="1.1" width="1076px" 
height="398px" viewBox="-0.5 -0.5 1076 398" content="&lt;mxfile 
host=&quot;app.diagrams.net&quot; modified=&quot;2022-01-20T15:17:03.380Z&quot; 
agent=&quot;5.0 (X11)&quot; etag=&quot;ddZmVuAcNf0rTgyu1oTB&quot; 
version=&quot;16.4.3&quot; type=&quot;device&quot;&gt;&lt;diagram 
id=&quot;PpkpfZO7TL7CUlFfbbxv&quot; name=&quot;Seite-1&quo [...]
\ No newline at end of file
diff --git a/doc/sphinx/reducer.rst b/doc/sphinx/reducer.rst
index 589ee63..0ab7f2e 100644
--- a/doc/sphinx/reducer.rst
+++ b/doc/sphinx/reducer.rst
@@ -1,6 +1,6 @@
 ..
   This file is part of Anastasis
-  Copyright (C) 2019-2021 Anastasis SARL
+  Copyright (C) 2019-2022 Anastasis SARL
 
   Anastasis is free software; you can redistribute it and/or modify it under 
the
   terms of the GNU Affero General Public License as published by the Free 
Software
@@ -499,7 +499,8 @@ If contacting the provider failed, the information returned 
is:
 
 **add_provider**:
 
-This operation can be performed in state ``USER_ATTRIBUTES_COLLECTING``.  It
+This operation can be performed in states ``USER_ATTRIBUTES_COLLECTING``
+and ``SECRET_SELECTING``.  It
 adds one or more Anastasis providers to the list of providers the reducer
 should henceforth consider.  Note that removing providers is not possible at
 this time.
@@ -513,8 +514,8 @@ use. For example:
 
     {
       "http://localhost:8088/"; : { "disabled" : false },
-      "http://localhost:8089/"; : { "disabled" : false }
-      "http://localhost:8090/"; : { "disabled" : true },
+      "http://localhost:8089/"; : { "disabled" : false },
+      "http://localhost:8090/"; : { "disabled" : true }
     }
 
 Note that existing providers will remain in the state they were in.  The 
following is an
@@ -1293,11 +1294,52 @@ the backup process.  Example arguments would thus be:
       }
     }
 
-However, in contrast to the backup process, the reducer will attempt to
-retrieve the latest recovery document from all known providers for the
-selected currency given the above inputs.  If a recovery document was found
-by any provider, the reducer will attempt to load it and transition to
-a state where the user can choose which challenges to satisfy:
+Afterwards, the reducer transitions into the ``SECRET_SELECTING`` state:
+
+.. code-block:: json
+
+    {
+      "recovery_state": "SECRET_SELECTING",
+      "identity_attributes": {
+        "full_name": "Max Musterman",
+        "social_security_number": "123456789",
+        "birthdate": "2000-01-01",
+        "birthplace": "Earth"
+      }
+    }
+
+Here, it is again possible to add providers (see above under
+``USER_ATTRIBUTES_COLLECTING``).  Typically, the special policy
+discovery process (outside of the state machine) is expected to be
+run in this state.  The discovery process will use the state
+(and in particular the identity attributes and the list of
+active providers) to discover a set of possible recovery documents
+with their respective provider URLs, policy version and identity
+attribute mask. An identity attribute mask is a bitmask that
+describes which of the optional attributes from the identity
+attributes should be omitted to recover this backup.  Once the
+user has selected a backup providing this triplet, it is possible
+to proceed.
+
+**next**:
+
+Using the ``next`` transition in the ``SECRET_SELECTING`` state,
+it is possible to trigger the download and decryption of a recovery
+policy document. Here, the arguments specify which provider, version
+and mask should be used to download the document:
+
+.. code-block:: json
+
+    {
+      "provider_url": "https://localhost:8088/";,
+      "version": 0,
+      "mask": 0
+    }
+
+The reducer will attempt to retrieve the specified recovery document
+from that provider.  If a recovery document was found, the reducer
+will attempt to load it and transition to a state where the user can
+choose which challenges to satisfy:
 
 .. code-block:: json
 
@@ -1386,28 +1428,6 @@ However, in general it should be sufficient to display 
the slightly
 more generic Taler error code that is returned with the new state.
 
 
-**change_version:**
-
-Even if a recovery document was found, it is possible that the user
-intended to recover a different version, or recover a backup where
-the recovery document is stored at a different provider. Thus, the
-reducer allows the user to explicitly switch to a different provider
-or recovery document version using the ``change_version`` transition,
-which takes a provider URL and policy version as arguments:
-
-.. code-block:: json
-
-    {
-      "provider_url": "https://localhost:8080/";,
-      "version": 2
-    }
-
-Note that using a version of 0 implies fetching "the latest version".  The
-resulting states are the same as those of the ``enter_user_attributes``
-transition, except that the recovery document version is not necessarily the
-latest available version at the provider.
-
-
 **select_challenge:**
 
 Selecting a challenge takes different, depending on the state of the payment.
diff --git a/src/reducer/anastasis_api_recovery_redux.c 
b/src/reducer/anastasis_api_recovery_redux.c
index 088ff7e..ccef1e2 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -2291,6 +2291,12 @@ struct RecoverSecretState
    */
   unsigned int version;
 
+  /**
+   * Mask to apply to optional attributes when fetching the
+   * recovery document.
+   */
+  json_int_t mask;
+
   /**
    * Number of provider /config operations in @e ba_head that
    * are still awaiting completion.
@@ -2301,6 +2307,11 @@ struct RecoverSecretState
    * Is @e version set?
    */
   bool have_version;
+
+  /**
+   * Is @e mask set?
+   */
+  bool have_mask;
 };
 
 
@@ -2878,6 +2889,7 @@ ANASTASIS_REDUX_recovery_challenge_begin_ (json_t *state,
                                            void *cb_cls)
 {
   json_t *version;
+  json_t *mask;
   json_t *providers;
   const json_t *attributes;
   struct RecoverSecretState *rss;
@@ -2916,6 +2928,13 @@ ANASTASIS_REDUX_recovery_challenge_begin_ (json_t *state,
     rss->version = (unsigned int) json_integer_value (version);
     rss->have_version = true;
   }
+  mask = json_object_get (arguments,
+                          "mask");
+  if (NULL != mask)
+  {
+    rss->mask = (unsigned int) json_integer_value (mask);
+    rss->have_mask = true;
+  }
   rss->state = json_incref (state);
   rss->cb = cb;
   rss->cb_cls = cb_cls;

-- 
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]