gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: added json and callback


From: gnunet
Subject: [taler-anastasis] branch master updated: added json and callback
Date: Sun, 26 Apr 2020 22:51:29 +0200

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

ds-meister pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 1a3fec2  added json and callback
1a3fec2 is described below

commit 1a3fec2e90daaaa12068ef6ecce15b9f2423cbc5
Author: Dominik Meister <address@hidden>
AuthorDate: Sun Apr 26 22:51:24 2020 +0200

    added json and callback
---
 src/include/anastasis.h | 16 +++------------
 src/lib/anastasis.c     | 54 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 458c947..c8270f6 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -27,16 +27,6 @@
 
 
 /*Download api*/
-/**
- * Defines an opaque handle to select a method
- * Contains the cost of a method (can be zero)
-*/
-struct ANASTASIS_EscrowMethod
-{
-  struct ANASTASIS_Challenge *challenge;
-
-  struct TALER_Amount cost;
-};
 
 /**
  * Defines a Decryption Policy with multiple escrow methods
@@ -67,9 +57,9 @@ struct ANASTASIS_RecoveryInformation
 
   unsigned int dps_len;
 
-  struct ANSTASIS_EscrowMethod *ems;
+  struct ANASTASIS_Challenge *cs;
 
-  unsigned int ems_len;
+  unsigned int cs_len;
 
   unsigned int version;     // actual version obtained
 
@@ -201,7 +191,7 @@ ANASTASIS_challenge_select_to_pay (struct 
ANASTASIS_Challenge *challenge,
 typedef void
 (*ANASTASIS_PolicyCallback)(void *cls,
                             const struct ANASTASIS_RecoveryInformation *ri,
-                            const enum TALER_ErrorCode *ecs[]);
+                            const enum TALER_ErrorCode ec);
 
 /**
  * stores provider URIs, identity key material, decrypted recovery document 
(internally!)
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 22db6f7..884c634 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -131,6 +131,10 @@ struct ANASTASIS_Challenge
    * size of the challenge
    */
   size_t challenge_size;
+  /**
+   * method of the challenge
+   */
+  char *escrow_method;
 };
 
 /**
@@ -378,13 +382,58 @@ ANASTASIS_recovery_begin (const json_t *id_data,
                               "policies", dec_policies,
                               "policies_length", &ri->dps_len,
                               "escrow_methods", esc_methods,
-                              "escrow_methods_length", &ri->ems_len,
+                              "escrow_methods_length", &ri->cs_len,
                               "core_secret", r->enc_core_secret,
                               "core_secret_size", &r->enc_core_secret_size));
 
 
 
-  // FIXME CALLBACK
+
+  struct ANASTASIS_Challenge cs[ri->cs_len];
+  struct ANASTASIS_DecryptionPolicy dps[ri->dps_len];
+
+
+  for (unsigned int i = 0; i < ri->cs_len; i++)
+  {
+    GNUNET_assert (0 ==
+                   json_unpack (json_array_get (esc_methods, i),
+                                "{s:o,"   /* truth uuid */
+                                " s:s,"   /* provider url */
+                                " s:o,"   /* truth key */
+                                " s:o,"   /* truth salt */
+                                " s:s}",   /* escrow method */
+                                "uuid", cs[i].challenge_uuid,
+                                "url", cs[i].url,
+                                "truth_key",cs[i].truth_key,
+                                "salt",cs[i].truth_salt,
+                                "escrow_method", cs[i].escrow_method));
+    cs[i].recovery = r;
+  }
+
+  for (unsigned int j = 0; j < ri->dps_len; j++ )
+  {
+    GNUNET_assert (0 ==
+                   json_unpack (json_array_get (dec_policies, j),
+                                "{s:o,"     /* encrypted master key */
+                                " s:o,"     /* policy uuids  */
+                                " s:i}",    /* policy uuids length */
+                                "master_key",dps[j].emk,
+                                "uuids",dps[j].escrow_uuids,
+                                "uuid_length", dps[j].uuids_length));
+  }
+
+  // SETUP POLICY CALLBACK
+  ri->dps = dps;
+  ri->cs = cs;
+  r->pc = pc;
+  r->pc_cls = pc_cls;
+  if (NULL != r->pc)
+  {
+    r->pc (r->pc_cls,
+           ri,
+           r->http_status);
+    r->pc = NULL;
+  }
   return r;
 }
 
@@ -1114,7 +1163,6 @@ ANASTASIS_secret_share (const json_t *id_data,
                                               &policy_store_cb,
                                               ss->pss[l]);
   }
-
   // Callback handle
   return ss;
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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