gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: anastasis header created


From: gnunet
Subject: [taler-anastasis] branch master updated: anastasis header created
Date: Sun, 29 Mar 2020 23:45:31 +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 fc6cb9f  anastasis header created
fc6cb9f is described below

commit fc6cb9fa91d65612be56fe1d76f4a9c11f9741be
Author: Dominik Meister <address@hidden>
AuthorDate: Sun Mar 29 23:45:21 2020 +0200

    anastasis header created
---
 src/include/anastasis.h | 407 ++++++++++++++++++++++++++++++++++++++++--------
 src/lib/anastasis.c     | 384 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 722 insertions(+), 69 deletions(-)

diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 5d3c9f4..253b382 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -21,86 +21,361 @@
  * @author Dennis Neufeld
  */
 
+/*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
+*/
+struct ANASTASIS_DecryptionPolicy
+{
+  // subset of methods that must be satisfied for this dp
+  struct ANASTASIS_EscrowMethod *ems;
+
+  unsigned int ems_len;
+
+};
+
+/**
+ * Defines the recovery information (possible policies and version of the 
recovery document)
+ */
+struct ANASTASIS_RecoveryInformation
+{
+
+  struct ANASTASIS_DecryptionPolicy *dps;
+
+  unsigned int dps_len;
 
-/* libanastasis */
-#include <anastasis_crypto_lib.h>
+  unsigned int version;     // actual version obtained
 
+};
+
+/**
+ * Core Secret Callback is opened at the begin of a recovery process, it 
passes back the core secret of
+ * the user after the recovery process is completed.
+ * @param cls handle for the callback
+ * @param secret contains the core secret which is passed to the user
+ * @param secret_size defines the size of the core secret
+ */
 typedef void
-(*ANASTASIS_EscrowProviderInformation*)(void *cls,
-                                        const char *policy,
-                                        const struct TALER_Amount *cost);
+(*ANASTASIS_CoreSecretCallback)(void *cls,
+                                const void *secret,
+                                size_t secret_size);
+
+/**
+ * Challenge struct contains the UUID's needed for the recovery process and a 
reference to
+ * ANASTASIS_Recovery.
+ */
+struct ANASTASIS_Challenge;
 
-struct ANASTASIS_EscrowProviderInspection *
-ANASTASIS_escrow_provider_inspect (const char *base_url,
-                                   ANASTASIS_EscrowProviderInformation cb,
-                                   void *cb_cls);
+/**
+ * The answer feedback defines the callback for an esrow challenge e.g. (wrong 
SMS Pin)
+ *
+ * @param af_cls handle for the callback
+ * @param ec enum with the different possible states like wrong pin, success
+ */
+typedef void
+(*ANASTASIS_AnswerFeedback)(void *af_cls,
+                            enum TALER_ErrorCode ec);
 
+/**
+ * Challenge answer from the user like input SMS pin. Is referenced to a 
challenge and
+ * sends back an AnswerFeedback.
+ *
+ * @param challenge reference to the challenge which is answered
+ * @param answer user input instruction defines which input is needed
+ * @param answer_size size of the user answer
+ * @param af reference to the answerfeedback which is passed back to the user
+ * @param af_cls handle for the challenge answer struct
+ */
 void
-ANASTASIS_escrow_provider_inspect_cancel (struct
-                                          ANASTASIS_EscrowProviderInspection *
-                                          epi);
+ANASTASIS_challenge_answer (struct ANASTASIS_Challenge *challenge,
+                            const void *answer,
+                            size_t answer_size,
+                            ANASTASIS_AnswerFeedback af,
+                            void af_cls);
+
+/**
+ * Defines the instructions for a challenge, what does the user have to do to 
fulfill the challenge.
+ * Also defines the method and other information for the challenge like a link 
for the video indent
+ * or a information to which address an e-mail was sent.
+ *
+ * @param method which method is this challenge (E-Mail, Security Question, 
SMS...)
+ * @param url can be NULL defines the url or mail address used for the 
challenge
+ * @param instructions defines which steps need to be done e.g. ( please look 
for the pin for recovery #1234)
+ */
+struct ANASTASIS_ChallengeInformation
+{
+  const char *method;
+  const char *url;
+  const char *instructions;
+};
 
+/**
+ * Defines a Challenge Callback which is initially sent with the challenge 
run. It gives back the previously
+ * defined Challenge Information and a Status Code, cloud be payment missing.
+ *
+ * @param cls handle for the callback
+ * @param ci reference to the challenge information struct
+ * @param ec enum which defines the different status codes
+ *
+*/
+typedef void
+(*ANASTASIS_ChallengeCallback)(void *cls,
+                               const struct ANASTASIS_ChallengeInformation *ci,
+                               enum TALER_ErrorCode ec); // i.e. payment 
missing
 
+/**
+ * Starts the process for a defined escrow challenge. Has a reference to the 
challenge and opens a
+ * challenge callback which returns the results of the request.
+ *
+ * @param challenge reference to the escrow challenge which is started
+ * @param cc opens a callback for the requested information
+ * @param cc_cls handle for the request
+ */
+void
+ANASTASIS_challenge_run (struct ANASTASIS_Challenge *challenge,
+                         ANASTASIS_ChallengeCallback cc,
+                         void cc_cls)
+
+/**
+ * Defines a Callback for the payment of an escrow challenge. Sends back a 
payment link
+ * and a status code.
+ *
+ * @param cls handle to the request
+ * @param order_url payment url is passed to the user (taler://pay/Foo)
+ * @param ec Status code for the request e.g (truth ID unknown to provider)
+ */
 typedef void
-(*ANASTASIS_PolicyInformation*)(void *cls,
-                                struct ANASTASIS_CRYPTO_Policy *policy);
+(*ANASTASIS_ChallengePaymentCallback)(void *cls,
+                                      const char *order_url,
+                                      enum TALER_ErrorCode ec);
 
+/**
+ * User decides which method is to be used, and wants to pay for the 
authentication
+ * this is only needed if the cost for the authentication is not zero. Opens a 
Challenge Payment Callback
+ * which passes back the payment information.
+ *
+ * @param challenge reference to the escrow challenge which is paid
+ * @param cc opens a ChallengePaymentCallback for the requested information
+ * @param cc_cls handle for the request
+ */
+void
+ANASTASIS_challenge_select_to_pay (struct ANASTASIS_Challenge *challenge,
+                                   ANASTASIS_ChallengePaymentCallback cc,
+                                   void cc_cls)
+
+/**
+* Callback which passes back the recovery document and its possible policies. 
Also passes
+* back the version of the document for the user to check.
+*
+* @param cls closure for the callback
+* @param ri recovery information struct which contains the policies (NULL if 
all provider candidates gave us 404/errors)
+* @param ecs array of error codes, one per provider, EC_NONE-terminated
+*/
+typedef void
+(*ANASTASIS_PolicyCallback)(void *cls,
+                            const struct ANASTASIS_RecoveryInformation *ri,
+                            const enum TALER_ErrorCode ecs[]);
 
-struct ANASTASIS_PolicyFetch *
-ANASTASIS_get_policy (const char *base_url,
-                      const struct ANASTASIS_CRYPTO_UserIdentifier *id,
-                      ANASTASIS_PolicyInformation cb,
-                      void *cb_cls);
+/**
+ * stores provider URIs, identity key material, decrypted recovery document 
(internally!)
+*/
+struct ANASTASIS_Recovery; //
 
+/**
+* Starts the recovery process by opening callbacks for the coresecret and a 
policy callback. A list of
+* providers is checked for policies and passed back to the client.
+*
+* @param id_data contains the users identity, (user account on providers)
+* @param version defines the version which will be downloaded NULL for latest 
version
+* @param anastasis_provider_url_candidates NULL terminated list of possible 
provider urls
+* @param pc opens the policy call back which holds the downloaded version and 
the policies
+* @param pc_cls closure for callback
+* @param csc core secret callback is opened, with this the core secert is 
passed to the client after the authentication
+* @param csc_cls handle for the callback
+*/
+struct ANASTASIS_Recovery *
+ANASTASIS_recovery_begin (const json_t *id_data,
+                          unsigned int version,
+                          const char *anastasis_provider_url_candidates[],
+                          ANASTASIS_PolicyCallback pc,
+                          void *pc_cls,
+                          ANASTASIS_CoreSecretCallback csc,
+                          void *csc_cls);
+/**
+* Cancels the recovery process
+* @param r handle to the recovery struct
+*/
 void
-ANASTASIS_get_policy_cancel (struct ANASTASIS_PolicyFetch *pf);
+ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r);
 
-struct ANASTASIS_RecoveryDocumentUpload;
 
+/* Upload api
+----------------------------------------------------------------- */
 
+/**
+* Truth Upload struct
+*/
+struct ANASTASIS_TruthUpload;
+
+/**
+* provider_url + UUID
+*/
+struct ANASTASIS_Truth;
+
+/**
+* Initiates a callback for the payment of the truth upload
+*
+* @param cls closure for callback
+* @param taler_pay_url payment link for the transaction (taler://pay/Foo)
+* @param ec status code of the request
+*/
 typedef void
-(*ANASTASIS_RecoverUploadResult)(void *cls,
-                                 ...);
-
-// last_etag can be NULL (if not known)
-struct ANASTASIS_RecoveryDocumentUpload *
-ANASTASIS_escrow_provider_recovery_document_upload (const char *base_url,
-                                                    const struct
-                                                    
ANASTASIS_CRYPTO_UserIdentifier
-                                                    *id,
-                                                    const struct
-                                                    GNUNET_HashCode *last_etag,
-                                                    const struct
-                                                    
ANASTASIS_CRYPTO_RecoveryDocument
-                                                    *p,
-                                                    
ANASTASIS_RecoverUploadResult
-                                                    cb,
-                                                    void *cb_cls);
-
-// ... cancel
-
-
-struct ANASTASIS_Handle;
-
-// In the C code:
-// {
-//   json_t *policy_document;
-//   unsigned int escrow_methods_length;
-//   struct ANASTASIS_CRYPTO_EscrowMethod *escrow_methods;
-// };
-
-
-int
-ANASTASIS_add_escrow_method (struct ANASTASIS_Handle *h,
-                             const char *provider_url,
-                             const char *method,
-                             const void *challenge,
-                             size_t challenge_size,
-                             const void *truth,
-                             size_t truth_size,
-                             struct ANASTASIS_CRYPTO_EscrowUuid *uuid);
-
-
-int
-ANASTASIS_remove_escrow_method (struct ANASTASIS_Handle *h,
-                                const struct ANASTASIS_CRYPTO_EscrowUuid 
*uuid);
+(ANASTASIS_TruthPaymentCallback)(void *cls,
+                                 const char *taler_pay_url,
+                                 enum TALER_ErrorCode ec);
+
+/**
+* Upload information
+* caller MUST free 't' using ANASTASIS_truth_free()
+*
+* @param cls closure for callback
+* @param t Truth object (contains provider url and uuid)
+*/
+typedef void
+(ANASTASIS_TruthCallback)(void *cls,
+                          struct ANASTASIS_Truth *t);
+/**
+* Uploads a truth object onto a escrow provider
+*
+* @param id_data user provided authentication for generation of the truth 
encryption
+* @param method defines the method of the challenge (secure question, sms, 
email)
+* @param instructions depending on method! usually only for security 
question/answer!
+* @param mime_type format of the challenge
+* @param data contains the keyshare for this truth
+* @param data_size size of the data
+* @param tpc opens a truth payment callback to pay the upload
+* @param tpc_cls closure for the payment callback
+* @param tc opens the truth callback which contains the status of the upload
+* @param tc_cls closure for the callback
+*/
+struct ANASTASIS_TruthUpload *
+ANASTASIS_truth_upload (const json_t *id_data,
+                        const char *provider_url,
+                        const char *method,
+                        const char *instructions,
+                        const char *mime_type,
+                        const void *data,
+                        size_t data_size,
+                        ANASTASIS_TruthPaymentCallback tpc,
+                        void *tpc_cls,
+                        ANASTASIS_TruthCallback tc,
+                        void *tc_cls);
+
+/**
+* Cancels a upload process
+* @param tu handle for the upload
+*/
+void
+ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload *tu);
+
+/**
+* Free's the truth object which was allocated
+* @param t object to clean up
+*/
+void
+ANASTASIS_truth_free (struct ANASTASIS_Truth *t)
+
+
+/**
+* Policy object to upload
+*/
+struct ANASTASIS_Policy;
+
+/**
+* Creates a policy with a set of trutht's
+* Creates the policy key with the different key shares from the truths and 
encrypts the escrow master key.
+* @param truths array of truths which are stored on different providers
+* @param truths_len amount of truths in this policy
+*/
+struct ANASTASIS_Policy *
+ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
+                         unsigned int truths_len);
+
+/**
+* Destroys a policy object
+* @param p handle for the policy to destroy
+*/
+void
+ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p);
+
+/**
+* Callback for a policy upload process.
+*
+* @param cls closure for callback
+* @param current_etag sends back the etag of the upload (used to prevent 
redundant uploads)
+* @param ec status code of the request
+*/
+typedef void
+(ANASTASIS_ShareResultCallback)(void *cls,
+                                const struct GNUNET_HashCode *current_etag,
+                                enum TALER_ErrorCode ec);
+/**
+* Callback for a payment process for uploading a policy
+*
+* @param cls closure for the callback
+* @param taler_pay_url url for the payment (taler://pay/Foo)
+* @param ec status of the request
+*/
+typedef void
+(ANASTASIS_SharePaymentCallback)(void *cls,
+                                 const char *taler_pay_url,
+                                 enum TALER_ErrorCode ec);
+
+/**
+* Defines a recovery document upload process (recovery document consists of 
multiple policies)
+*/
+struct ANASTASIS_SecretShare;
+
+/**
+* Creates a recovery document with the created policies.
+*
+* @param id_data used to create a account identifier on the escrow provider
+* @param last_etag NULL on 'first' use, otherwise 'current_etag' from previous 
ShareResultCallback
+* @param policies list of policies which are included in this recovery document
+* @param policies_length amount of policies in the document
+* @param spc payment callback is opened to pay the upload
+* @param spc_cls closure for the payment callback
+* @param src callback for the upload process
+* @param src_cls closure for the upload callback
+* @param core_secret input of the user which is secured by anastasis e.g. 
(wallet private key)
+* @param core_secret_size size of the core secret
+*/
+struct ANASTASIS_SecretShare *
+ANASTASIS_secret_share (const json_t *id_data,
+                        const struct GNUNET_HashCode *last_etag,
+                        struct ANASTASIS_Policy *policies[],
+                        unsigned int policies_len,
+                        ANASTASIS SharePaymentCallback spc,
+                        void *spc_cls,
+                        ANASTASIS ShareResultCallback src,
+                        void *src_cls,
+                        const void *core_secret,
+                        size_t core_secret_size);
+
+/**
+* Cancels a secret share request
+* @param ss handle to the request
+*/
+void
+ANASTASIS_secret_share_cancel (struct ANASTASIS_SecretShare *ss);
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index ec8bd5c..872bbfb 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1,4 +1,382 @@
-/*struct ANASTASIS_Policy *
-ANASTASIS_policy_create ()
+/*
+  This file is part of Anastasis
+  Copyright (C) 2020 Taler Systems SA
+
+  Anastasis is free software; you can redistribute it and/or modify it under 
the
+  terms of the GNU Lesser General Public License as published by the Free 
Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @brief anastasis client api
+ * @author Christian Grothoff
+ * @author Dominik Meister
+ * @author Dennis Neufeld
+ */
+
+#include "anastasis.h"
+
+/*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
+*/
+struct ANASTASIS_DecryptionPolicy
+{
+  // subset of methods that must be satisfied for this dp
+  struct ANASTASIS_EscrowMethod *ems;
+
+  unsigned int ems_len;
+
+};
+
+/**
+ * Defines the recovery information (possible policies and version of the 
recovery document)
+ */
+struct ANASTASIS_RecoveryInformation
+{
+
+  struct ANASTASIS_DecryptionPolicy *dps;
+
+  unsigned int dps_len;
+
+  unsigned int version;     // actual version obtained
+
+};
+
+/**
+ * Core Secret Callback is opened at the begin of a recovery process, it 
passes back the core secret of
+ * the user after the recovery process is completed.
+ * @param cls handle for the callback
+ * @param secret contains the core secret which is passed to the user
+ * @param secret_size defines the size of the core secret
+ */
+typedef void
+(*ANASTASIS_CoreSecretCallback)(void *cls,
+                                const void *secret,
+                                size_t secret_size);
+
+/**
+ * Challenge struct contains the UUID's needed for the recovery process and a 
reference to
+ * ANASTASIS_Recovery.
+ */
+struct ANASTASIS_Challenge;
+
+/**
+ * The answer feedback defines the callback for an esrow challenge e.g. (wrong 
SMS Pin)
+ *
+ * @param af_cls handle for the callback
+ * @param ec enum with the different possible states like wrong pin, success
+ */
+typedef void
+(*ANASTASIS_AnswerFeedback)(void *af_cls,
+                            enum TALER_ErrorCode ec);
+
+/**
+ * Challenge answer from the user like input SMS pin. Is referenced to a 
challenge and
+ * sends back an AnswerFeedback.
+ *
+ * @param challenge reference to the challenge which is answered
+ * @param answer user input instruction defines which input is needed
+ * @param answer_size size of the user answer
+ * @param af reference to the answerfeedback which is passed back to the user
+ * @param af_cls handle for the challenge answer struct
+ */
+void
+ANASTASIS_challenge_answer (struct ANASTASIS_Challenge *challenge,
+                            const void *answer,
+                            size_t answer_size,
+                            ANASTASIS_AnswerFeedback af,
+                            void af_cls);
+
+/**
+ * Defines the instructions for a challenge, what does the user have to do to 
fulfill the challenge.
+ * Also defines the method and other information for the challenge like a link 
for the video indent
+ * or a information to which address an e-mail was sent.
+ *
+ * @param method which method is this challenge (E-Mail, Security Question, 
SMS...)
+ * @param url can be NULL defines the url or mail address used for the 
challenge
+ * @param instructions defines which steps need to be done e.g. ( please look 
for the pin for recovery #1234)
+ */
+struct ANASTASIS_ChallengeInformation
+{
+  const char *method;
+  const char *url;
+  const char *instructions;
+};
+
+/**
+ * Defines a Challenge Callback which is initially sent with the challenge 
run. It gives back the previously
+ * defined Challenge Information and a Status Code, cloud be payment missing.
+ *
+ * @param cls handle for the callback
+ * @param ci reference to the challenge information struct
+ * @param ec enum which defines the different status codes
+ *
+*/
+typedef void
+(*ANASTASIS_ChallengeCallback)(void *cls,
+                               const struct ANASTASIS_ChallengeInformation *ci,
+                               enum TALER_ErrorCode ec); // i.e. payment 
missing
+
+/**
+ * Starts the process for a defined escrow challenge. Has a reference to the 
challenge and opens a
+ * challenge callback which returns the results of the request.
+ *
+ * @param challenge reference to the escrow challenge which is started
+ * @param cc opens a callback for the requested information
+ * @param cc_cls handle for the request
+ */
+void
+ANASTASIS_challenge_run (struct ANASTASIS_Challenge *challenge,
+                         ANASTASIS_ChallengeCallback cc,
+                         void cc_cls)
+
+/**
+ * Defines a Callback for the payment of an escrow challenge. Sends back a 
payment link
+ * and a status code.
+ *
+ * @param cls handle to the request
+ * @param order_url payment url is passed to the user (taler://pay/Foo)
+ * @param ec Status code for the request e.g (truth ID unknown to provider)
+ */
+typedef void
+(*ANASTASIS_ChallengePaymentCallback)(void *cls,
+                                      const char *order_url,
+                                      enum TALER_ErrorCode ec);
+
+/**
+ * User decides which method is to be used, and wants to pay for the 
authentication
+ * this is only needed if the cost for the authentication is not zero. Opens a 
Challenge Payment Callback
+ * which passes back the payment information.
+ *
+ * @param challenge reference to the escrow challenge which is paid
+ * @param cc opens a ChallengePaymentCallback for the requested information
+ * @param cc_cls handle for the request
+ */
+void
+ANASTASIS_challenge_select_to_pay (struct ANASTASIS_Challenge *challenge,
+                                   ANASTASIS_ChallengePaymentCallback cc,
+                                   void cc_cls)
+
+/**
+* Callback which passes back the recovery document and its possible policies. 
Also passes
+* back the version of the document for the user to check.
+*
+* @param cls closure for the callback
+* @param ri recovery information struct which contains the policies (NULL if 
all provider candidates gave us 404/errors)
+* @param ecs array of error codes, one per provider, EC_NONE-terminated
+*/
+typedef void
+(*ANASTASIS_PolicyCallback)(void *cls,
+                            const struct ANASTASIS_RecoveryInformation *ri,
+                            const enum TALER_ErrorCode ecs[]);
+
+/**
+ * stores provider URIs, identity key material, decrypted recovery document 
(internally!)
+*/
+struct ANASTASIS_Recovery; //
+
+/**
+* Starts the recovery process by opening callbacks for the coresecret and a 
policy callback. A list of
+* providers is checked for policies and passed back to the client.
+*
+* @param id_data contains the users identity, (user account on providers)
+* @param version defines the version which will be downloaded NULL for latest 
version
+* @param anastasis_provider_url_candidates NULL terminated list of possible 
provider urls
+* @param pc opens the policy call back which holds the downloaded version and 
the policies
+* @param pc_cls closure for callback
+* @param csc core secret callback is opened, with this the core secert is 
passed to the client after the authentication
+* @param csc_cls handle for the callback
+*/
+struct ANASTASIS_Recovery *
+ANASTASIS_recovery_begin (const json_t *id_data,
+                          unsigned int version,
+                          const char *anastasis_provider_url_candidates[],
+                          ANASTASIS_PolicyCallback pc,
+                          void *pc_cls,
+                          ANASTASIS_CoreSecretCallback csc,
+                          void *csc_cls);
+/**
+* Cancels the recovery process
+* @param r handle to the recovery struct
+*/
+void
+ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r);
+
+
+/* Upload api
+----------------------------------------------------------------- */
+
+/**
+* Truth Upload struct
+*/
+struct ANASTASIS_TruthUpload;
+
+/**
+* provider_url + UUID
+*/
+struct ANASTASIS_Truth;
+
+/**
+* Initiates a callback for the payment of the truth upload
+*
+* @param cls closure for callback
+* @param taler_pay_url payment link for the transaction (taler://pay/Foo)
+* @param ec status code of the request
+*/
+typedef void
+(ANASTASIS_TruthPaymentCallback)(void *cls,
+                                 const char *taler_pay_url,
+                                 enum TALER_ErrorCode ec);
+
+/**
+* Upload information
+* caller MUST free 't' using ANASTASIS_truth_free()
+*
+* @param cls closure for callback
+* @param t Truth object (contains provider url and uuid)
+*/
+typedef void
+(ANASTASIS_TruthCallback)(void *cls,
+                          struct ANASTASIS_Truth *t);
+/**
+* Uploads a truth object onto a escrow provider
+*
+* @param id_data user provided authentication for generation of the truth 
encryption
+* @param method defines the method of the challenge (secure question, sms, 
email)
+* @param instructions depending on method! usually only for security 
question/answer!
+* @param mime_type format of the challenge
+* @param data contains the keyshare for this truth
+* @param data_size size of the data
+* @param tpc opens a truth payment callback to pay the upload
+* @param tpc_cls closure for the payment callback
+* @param tc opens the truth callback which contains the status of the upload
+* @param tc_cls closure for the callback
+*/
+struct ANASTASIS_TruthUpload *
+ANASTASIS_truth_upload (const json_t *id_data,
+                        const char *provider_url,
+                        const char *method,
+                        const char *instructions,
+                        const char *mime_type,
+                        const void *data,
+                        size_t data_size,
+                        ANASTASIS_TruthPaymentCallback tpc,
+                        void *tpc_cls,
+                        ANASTASIS_TruthCallback tc,
+                        void *tc_cls);
+
+/**
+* Cancels a upload process
+* @param tu handle for the upload
+*/
+void
+ANASTASIS_truth_upload_cancel (struct ANASTASIS_TruthUpload *tu);
+
+/**
+* Free's the truth object which was allocated
+* @param t object to clean up
+*/
+void
+ANASTASIS_truth_free (struct ANASTASIS_Truth *t)
+
+
+/**
+* Policy object to upload
+*/
+struct ANASTASIS_Policy;
+
+/**
+* Creates a policy with a set of trutht's
+* Creates the policy key with the different key shares from the truths and 
encrypts the escrow master key.
+* @param truths array of truths which are stored on different providers
+* @param truths_len amount of truths in this policy
+*/
+struct ANASTASIS_Policy *
+ANASTASIS_policy_create (struct ANASTASIS_Truth *truths[],
+                         unsigned int truths_len);
+
+/**
+* Destroys a policy object
+* @param p handle for the policy to destroy
+*/
+void
+ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p);
+
+/**
+* Callback for a policy upload process.
+*
+* @param cls closure for callback
+* @param current_etag sends back the etag of the upload (used to prevent 
redundant uploads)
+* @param ec status code of the request
+*/
+typedef void
+(ANASTASIS_ShareResultCallback)(void *cls,
+                                const struct GNUNET_HashCode *current_etag,
+                                enum TALER_ErrorCode ec);
+/**
+* Callback for a payment process for uploading a policy
+*
+* @param cls closure for the callback
+* @param taler_pay_url url for the payment (taler://pay/Foo)
+* @param ec status of the request
+*/
+typedef void
+(ANASTASIS_SharePaymentCallback)(void *cls,
+                                 const char *taler_pay_url,
+                                 enum TALER_ErrorCode ec);
+
+/**
+* Defines a recovery document upload process (recovery document consists of 
multiple policies)
+*/
+struct ANASTASIS_SecretShare;
+
+/**
+* Creates a recovery document with the created policies.
+*
+* @param id_data used to create a account identifier on the escrow provider
+* @param last_etag NULL on 'first' use, otherwise 'current_etag' from previous 
ShareResultCallback
+* @param policies list of policies which are included in this recovery document
+* @param policies_length amount of policies in the document
+* @param spc payment callback is opened to pay the upload
+* @param spc_cls closure for the payment callback
+* @param src callback for the upload process
+* @param src_cls closure for the upload callback
+* @param core_secret input of the user which is secured by anastasis e.g. 
(wallet private key)
+* @param core_secret_size size of the core secret
+*/
+struct ANASTASIS_SecretShare *
+ANASTASIS_secret_share (const json_t *id_data,
+                        const struct GNUNET_HashCode *last_etag,
+                        struct ANASTASIS_Policy *policies[],
+                        unsigned int policies_len,
+                        ANASTASIS SharePaymentCallback spc,
+                        void *spc_cls,
+                        ANASTASIS ShareResultCallback src,
+                        void *src_cls,
+                        const void *core_secret,
+                        size_t core_secret_size);
+
+/**
+* Cancels a secret share request
+* @param ss handle to the request
+*/
+void
+ANASTASIS_secret_share_cancel (struct ANASTASIS_SecretShare *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]