summaryrefslogtreecommitdiff
path: root/src/include/anastasis_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/anastasis_service.h')
-rw-r--r--src/include/anastasis_service.h716
1 files changed, 503 insertions, 213 deletions
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index bec89d1..2f30a8b 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -1,16 +1,16 @@
/*
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
+ terms of the GNU 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 Lesser General Public License for more details.
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with
+ You should have received a copy of the GNU General Public License along with
Anastasis; see the file COPYING.LIB. If not, see <http://www.gnu.org/licenses/>
*/
/**
@@ -51,56 +51,82 @@ struct ANASTASIS_AuthorizationMethodConfig
*/
struct ANASTASIS_Config
{
- /**
- * Protocol version supported by the server.
- */
- const char *version;
/**
- * Business name of the anastasis provider.
+ * HTTP status returned.
*/
- const char *business_name;
+ unsigned int http_status;
/**
- * Currency used for payments by the server.
+ * Taler-specific error code, #TALER_EC_NONE on success.
*/
- const char *currency;
+ enum TALER_ErrorCode ec;
/**
- * Array of authorization methods supported by the server.
+ * Full response in JSON, if provided.
*/
- const struct ANASTASIS_AuthorizationMethodConfig *methods;
+ const json_t *response;
/**
- * Length of the @e methods array.
+ * Details depending on @e http_status.
*/
- unsigned int methods_length;
+ union
+ {
- /**
- * Maximum size of an upload in megabytes.
- */
- uint32_t storage_limit_in_megabytes;
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
- /**
- * Annual fee for an account / policy upload.
- */
- struct TALER_Amount annual_fee;
+ /**
+ * Protocol version supported by the server.
+ */
+ const char *version;
- /**
- * Fee for a truth upload.
- */
- struct TALER_Amount truth_upload_fee;
+ /**
+ * Business name of the anastasis provider.
+ */
+ const char *business_name;
- /**
- * Maximum legal liability for data loss covered by the
- * provider.
- */
- struct TALER_Amount liability_limit;
+ /**
+ * Array of authorization methods supported by the server.
+ */
+ const struct ANASTASIS_AuthorizationMethodConfig *methods;
- /**
- * Server salt.
- */
- struct ANASTASIS_CRYPTO_ProviderSaltP salt;
+ /**
+ * Length of the @e methods array.
+ */
+ unsigned int methods_length;
+
+ /**
+ * Maximum size of an upload in megabytes.
+ */
+ uint32_t storage_limit_in_megabytes;
+
+ /**
+ * Annual fee for an account / policy upload.
+ */
+ struct TALER_Amount annual_fee;
+
+ /**
+ * Fee for a truth upload.
+ */
+ struct TALER_Amount truth_upload_fee;
+
+ /**
+ * Maximum legal liability for data loss covered by the
+ * provider.
+ */
+ struct TALER_Amount liability_limit;
+
+ /**
+ * Provider salt.
+ */
+ struct ANASTASIS_CRYPTO_ProviderSaltP provider_salt;
+ } ok;
+
+ } details;
};
@@ -112,12 +138,10 @@ struct ANASTASIS_Config
* the server provided an acceptable response.
*
* @param cls closure
- * @param http_status the HTTP status
* @param acfg configuration obtained, NULL if we could not parse it
*/
typedef void
(*ANASTASIS_ConfigCallback)(void *cls,
- unsigned int http_status,
const struct ANASTASIS_Config *acfg);
@@ -156,34 +180,181 @@ ANASTASIS_config_cancel (struct ANASTASIS_ConfigOperation *co);
/**
- * Detailed results from the successful download.
+ * Detailed meta data result.
*/
-struct ANASTASIS_DownloadDetails
+struct ANASTASIS_MetaDataEntry
{
+
+ /**
+ * Timestamp of the backup at the server.
+ */
+ struct GNUNET_TIME_Timestamp server_time;
+
/**
- * Signature (already verified).
+ * The encrypted meta data we downloaded.
*/
- struct ANASTASIS_AccountSignatureP sig;
+ const void *meta_data;
/**
- * Hash over @e policy and @e policy_size.
+ * Number of bytes in @e meta_data.
*/
- struct GNUNET_HashCode curr_policy_hash;
+ size_t meta_data_size;
/**
- * The backup we downloaded.
+ * Policy version this @e meta_data is for.
*/
- const void *policy;
+ uint32_t version;
+};
+
+
+/**
+ * Detailed results for meta data download.
+ */
+struct ANASTASIS_MetaDownloadDetails
+{
/**
- * Number of bytes in @e backup.
+ * HTTP status returned.
*/
- size_t policy_size;
+ unsigned int http_status;
/**
- * Policy version returned by the service.
+ * Taler-specific error code, #TALER_EC_NONE on success.
*/
- uint32_t version;
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Full response in JSON, if provided.
+ */
+ const json_t *response;
+
+ /**
+ * Details depending on @e http_status.
+ */
+ union
+ {
+
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Version-sorted array of meta data we downloaded.
+ */
+ const struct ANASTASIS_MetaDataEntry *metas;
+
+ /**
+ * Number of entries in @e metas.
+ */
+ size_t metas_length;
+
+ } ok;
+
+ } details;
+};
+
+
+/**
+ * Callback to process a GET /policy/$POL/meta request
+ *
+ * @param cls closure
+ * @param dd the response details
+ */
+typedef void
+(*ANASTASIS_PolicyMetaLookupCallback) (
+ void *cls,
+ const struct ANASTASIS_MetaDownloadDetails *dd);
+
+
+/**
+ * Does a GET /policy/$POL/meta.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param anastasis_pub public key of the user's account
+ * @param max_version maximum version number to fetch
+ * @param cb callback which will work the response gotten from the backend
+ * @param cb_cls closure to pass to the callback
+ * @return handle for this operation, NULL upon errors
+ */
+struct ANASTASIS_PolicyMetaLookupOperation *
+ANASTASIS_policy_meta_lookup (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
+ uint32_t max_version,
+ ANASTASIS_PolicyMetaLookupCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a GET /policy/$POL/meta request.
+ *
+ * @param plo cancel the policy lookup operation
+ */
+void
+ANASTASIS_policy_meta_lookup_cancel (
+ struct ANASTASIS_PolicyMetaLookupOperation *plo);
+
+
+/**
+ * Detailed results from the successful download.
+ */
+struct ANASTASIS_DownloadDetails
+{
+
+ /**
+ * HTTP status returned.
+ */
+ unsigned int http_status;
+
+ /**
+ * Taler-specific error code, #TALER_EC_NONE on success.
+ */
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Details depending on @e http_status.
+ */
+ union
+ {
+
+ /**
+ * Details on #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * Signature (already verified).
+ */
+ struct ANASTASIS_AccountSignatureP sig;
+
+ /**
+ * Hash over @e policy and @e policy_size.
+ */
+ struct GNUNET_HashCode curr_policy_hash;
+
+ /**
+ * The backup we downloaded.
+ */
+ const void *policy;
+
+ /**
+ * Number of bytes in @e backup.
+ */
+ size_t policy_size;
+
+ /**
+ * Policy version returned by the service.
+ */
+ uint32_t version;
+ } ok;
+
+ } details;
+
};
@@ -197,13 +368,10 @@ struct ANASTASIS_PolicyLookupOperation;
* Callback to process a GET /policy request
*
* @param cls closure
- * @param http_status HTTP status code for this request
- * @param ec anastasis-specific error code
- * @param obj the response body
+ * @param dd the response details
*/
typedef void
(*ANASTASIS_PolicyLookupCallback) (void *cls,
- unsigned int http_status,
const struct ANASTASIS_DownloadDetails *dd);
@@ -337,7 +505,7 @@ struct ANASTASIS_UploadDetails
* At what time is the provider set to forget this
* policy (because the account expires)?
*/
- struct GNUNET_TIME_Absolute policy_expiration;
+ struct GNUNET_TIME_Timestamp policy_expiration;
/**
* Version number of the resulting policy.
@@ -371,8 +539,7 @@ struct ANASTASIS_UploadDetails
* Callback to process a POST /policy request
*
* @param cls closure
- * @param http_status HTTP status code for this request
- * @param obj the decoded response body
+ * @param up the decoded response body
*/
typedef void
(*ANASTASIS_PolicyStoreCallback) (void *cls,
@@ -387,6 +554,8 @@ typedef void
* @param anastasis_priv private key of the user's account
* @param recovery_data policy data to be stored
* @param recovery_data_size number of bytes in @a recovery_data
+ * @param recovery_meta_data policy meta data to be stored
+ * @param recovery_meta_data_size number of bytes in @a recovery_meta_data
* @param payment_years_requested for how many years would the client like the service to store the truth?
* @param payment_secret payment identifier of last payment
* @param payment_timeout how long to wait for the payment, use
@@ -402,6 +571,8 @@ ANASTASIS_policy_store (
const struct ANASTASIS_CRYPTO_AccountPrivateKeyP *anastasis_priv,
const void *recovery_data,
size_t recovery_data_size,
+ const void *recovery_meta_data,
+ size_t recovery_meta_data_size,
uint32_t payment_years_requested,
const struct ANASTASIS_PaymentSecretP *payment_secret,
struct GNUNET_TIME_Relative payment_timeout,
@@ -423,299 +594,418 @@ ANASTASIS_policy_store_cancel (
/**
- * Operational status.
+ * Handle for a POST /truth operation.
+ */
+struct ANASTASIS_TruthStoreOperation;
+
+
+/**
+ * Callback to process a POST /truth request
+ *
+ * @param cls closure
+ * @param obj the response body
+ */
+typedef void
+(*ANASTASIS_TruthStoreCallback) (void *cls,
+ const struct ANASTASIS_UploadDetails *up);
+
+
+/**
+ * Store Truth, does a POST /truth/$UUID
+ *
+ * @param ctx the CURL context used to connect to the backend
+ * @param backend_url backend's base URL, including final "/"
+ * @param uuid unique identfication of the Truth Upload
+ * @param type type of the authorization method
+ * @param encrypted_keyshare key material to return to the client upon authorization
+ * @param truth_mime mime type of @e encrypted_truth (after decryption)
+ * @param encrypted_truth_size number of bytes in @e encrypted_truth
+ * @param encrypted_truth contains the @a type-specific authorization data
+ * @param payment_years_requested for how many years would the client like the service to store the truth?
+ * @param payment_timeout how long to wait for the payment, use
+ * #GNUNET_TIME_UNIT_ZERO to let the server pick
+ * @param cb callback processing the response from /truth
+ * @param cb_cls closure for cb
+ * @return handle for the operation
+ */
+struct ANASTASIS_TruthStoreOperation *
+ANASTASIS_truth_store (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid,
+ const char *type,
+ const struct ANASTASIS_CRYPTO_EncryptedKeyShareP *encrypted_keyshare,
+ const char *truth_mime,
+ size_t encrypted_truth_size,
+ const void *encrypted_truth,
+ uint32_t payment_years_requested,
+ struct GNUNET_TIME_Relative payment_timeout,
+ ANASTASIS_TruthStoreCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a POST /truth request.
+ *
+ * @param tso the truth store operation
+ */
+void
+ANASTASIS_truth_store_cancel (
+ struct ANASTASIS_TruthStoreOperation *tso);
+
+
+/**
+ * Possible ways how to proceed with a challenge.
*/
-enum ANASTASIS_KeyShareDownloadStatus
+enum ANASTASIS_ChallengeDetailType
{
- /**
- * We got the encrypted key share.
- */
- ANASTASIS_KSD_SUCCESS = 0,
/**
- * Payment is needed to proceed with the recovery.
+ * A challenge TAN was written to a file.
+ * The name of the file is provided.
*/
- ANASTASIS_KSD_PAYMENT_REQUIRED,
+ ANASTASIS_CS_FILE_WRITTEN,
/**
- * The provided answer was wrong or missing. Instructions for
- * getting a good answer may be provided.
+ * A challenge TAN was sent to the customer.
+ * A hint may be provided as to the address used.
*/
- ANASTASIS_KSD_INVALID_ANSWER,
+ ANASTASIS_CS_TAN_SENT,
/**
- * To answer the challenge, the client should be redirected to
- * the given URL.
+ * A challenge TAN was already recently sent to the customer.
+ * A hint may be provided as to the address used.
*/
- ANASTASIS_KSD_REDIRECT_FOR_AUTHENTICATION,
+ ANASTASIS_CS_TAN_ALREADY_SENT,
/**
- * The provider had an error.
+ * The customer should wire funds to the bank
+ * account address provided.
*/
- ANASTASIS_KSD_SERVER_ERROR,
+ ANASTASIS_CS_WIRE_FUNDS
+
+};
+
+
+/**
+ * This structure contains information about where to wire the funds
+ * to authenticate as well as a hint as to which bank account to send
+ * the funds from.
+ */
+struct ANASTASIS_WireFundsDetails
+{
/**
- * The provider claims we made an error.
+ * Answer code expected.
*/
- ANASTASIS_KSD_CLIENT_FAILURE,
+ uint64_t answer_code;
/**
- * The provider does not know this truth.
+ * How much should be sent.
*/
- ANASTASIS_KSD_TRUTH_UNKNOWN,
+ struct TALER_Amount amount;
/**
- * Too many attempts to solve the challenge were made in a short
- * time. Try again later.
+ * IBAN where to send the funds.
*/
- ANASTASIS_KSD_RATE_LIMIT_EXCEEDED,
+ const char *target_iban;
/**
- * The user did not satisfy the (external)
- * authentication check until the request timeout
- * was reached. The client should try again later.
+ * Name of the business receiving the funds.
*/
- ANASTASIS_KSD_AUTHENTICATION_TIMEOUT,
+ const char *target_business_name;
/**
- * The plugin provided external challenge instructions
- * that should be followed. They are method-specific.
+ * Wire transfer subject to use.
*/
- ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS
+ const char *wire_transfer_subject;
};
/**
- * Detailed results from the successful download.
+ * Information returned for a POST /truth/$TID/challenge request.
*/
-struct ANASTASIS_KeyShareDownloadDetails
+struct ANASTASIS_TruthChallengeDetails
{
+ /**
+ * HTTP status returned by the server.
+ */
+ unsigned int http_status;
/**
- * Operational status.
+ * Taler-specific error code, #TALER_EC_NONE on success.
*/
- enum ANASTASIS_KeyShareDownloadStatus status;
+ enum TALER_ErrorCode ec;
/**
- * Anastasis URL that returned the @e status.
+ * Full response in JSON, if provided.
*/
- const char *server_url;
+ const json_t *response;
/**
- * Details depending on @e status.
+ * Details depending on @e http_status.
*/
union
{
/**
- * The encrypted key share (if @e status is #ANASTASIS_KSD_SUCCESS).
- */
- struct ANASTASIS_CRYPTO_EncryptedKeyShareP eks;
-
- /**
- * Response if the challenge still needs to be answered, and the
- * instructions are provided inline (no redirection).
+ * Information for @e http_status of #MHD_HTTP_OK.
*/
struct
{
-
- /**
- * HTTP status returned by the server. #MHD_HTTP_ALREADY_REPORTED
- * if the server did already send the challenge to the user,
- * #MHD_HTTP_FORBIDDEN if the answer was wrong (or missing).
- */
- unsigned int http_status;
-
- /**
- * Response with server-side reply containing instructions for the user
- */
- const char *body;
-
/**
- * Content-type: mime type of @e body, NULL if server did not provide any.
+ * Meta-state about how the challenge was
+ * initiated and what is to be done next.
*/
- const char *content_type;
+ enum ANASTASIS_ChallengeDetailType cs;
/**
- * Number of bytes in @e body.
+ * Details depending on @e cs.
*/
- size_t body_size;
-
- } open_challenge;
+ union
+ {
+
+ /**
+ * If @e cs is #ANASTASIS_CS_FILE_WRITTEN, this
+ * is the filename with the challenge code.
+ */
+ const char *challenge_filename;
+
+ /**
+ * If @e cs is #ANASTASIS_CS_TAN_SENT, this
+ * is human-readable information as to where
+ * the TAN was sent.
+ */
+ const char *tan_address_hint;
+
+ /**
+ * If @e cs is #ANASTASIS_CS_WIRE_FUNDS, this
+ * structure contains information about where
+ * to wire the funds to authenticate as well
+ * as a hint as to which bank account to send
+ * the funds from.
+ */
+ struct ANASTASIS_WireFundsDetails wire_funds;
+
+ } details;
- /**
- * URL with instructions for the user to satisfy the challenge, if
- * @e status is #ANASTASIS_KSD_REDIRECT_FOR_AUTHENTICATION.
- */
- const char *redirect_url;
+ } success;
/**
- * Response with instructions for how to pay, if
- * @e status is #ANASTASIS_KSD_PAYMENT_REQUIRED.
+ * Information returne if @e http_status is #MHD_HTTP_PAYMENT_REQUIRED
*/
struct
{
-
- /**
- * "taler://pay" URL with details how to pay for the challenge.
- */
- const char *taler_pay_uri;
-
/**
- * The order ID from @e taler_pay_uri.
+ * A taler://pay/-URI with a request to pay the annual fee for
+ * the service. Returned if @e us is #ANASTASIS_US_PAYMENT_REQUIRED.
*/
- struct ANASTASIS_PaymentSecretP payment_secret;
-
- } payment_required;
-
-
- /**
- * Response with details about a server-side failure, if
- * @e status is #ANASTASIS_KSD_SERVER_ERROR,
- * #ANASTASIS_KSD_CLIENT_FAILURE or #ANASTASIS_KSD_TRUTH_UNKNOWN.
- */
- struct
- {
+ const char *payment_request;
/**
- * HTTP status returned by the server.
+ * The payment secret (aka order ID) extracted from the @e payment_request.
*/
- unsigned int http_status;
+ struct ANASTASIS_PaymentSecretP ps;
/**
- * Taler-specific error code.
+ * Data extracted from the payto:// URI.
*/
- enum TALER_ErrorCode ec;
-
- } server_failure;
+ const struct TALER_MERCHANT_PayUriData *pd;
- /**
- * External challenge instructions, if @e status is
- * #ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS.
- */
- const json_t *external_challenge;
+ } payment_required;
} details;
+
};
/**
- * Handle for a GET /truth operation.
+ * Handle for a POST /truth/$TID/challenge operation.
*/
-struct ANASTASIS_KeyShareLookupOperation;
+struct ANASTASIS_TruthChallengeOperation;
/**
- * Callback to process a GET /truth request
+ * Callback to process a POST /truth/$TID/challenge response.
*
* @param cls closure
- * @param http_status HTTP status code for this request
- * @param kdd details about the key share
+ * @param tcd details about the key share
*/
typedef void
-(*ANASTASIS_KeyShareLookupCallback) (
+(*ANASTASIS_TruthChallengeCallback) (
void *cls,
- const struct ANASTASIS_KeyShareDownloadDetails *kdd);
+ const struct ANASTASIS_TruthChallengeDetails *tcd);
/**
- * Does a GET /truth.
+ * Makes a POST /truth/$TID/challenge request.
*
* @param ctx execution context
* @param backend_url base URL of the merchant backend
* @param truth_uuid identification of the Truth
* @param truth_key Key used to Decrypt the Truth on the Server
* @param payment_secret secret from the previously done payment NULL to trigger payment
- * @param timeout how long to wait for the payment, use
- * #GNUNET_TIME_UNIT_ZERO to let the server pick
- * @param hashed_answer hashed answer to the challenge
* @param cb callback which will work the response gotten from the backend
* @param cb_cls closure to pass to the callback
* @return handle for this operation, NULL upon errors
*/
-struct ANASTASIS_KeyShareLookupOperation *
-ANASTASIS_keyshare_lookup (
+struct ANASTASIS_TruthChallengeOperation *
+ANASTASIS_truth_challenge (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key,
const struct ANASTASIS_PaymentSecretP *payment_secret,
- struct GNUNET_TIME_Relative timeout,
- const struct GNUNET_HashCode *hashed_answer,
- ANASTASIS_KeyShareLookupCallback cb,
+ ANASTASIS_TruthChallengeCallback cb,
void *cb_cls);
/**
- * Cancel a GET /truth request.
+ * Cancel a POST /truth/$TID/challenge request.
*
- * @param kslo cancel the key share lookup operation
+ * @param[in] tco operation to cancel
*/
void
-ANASTASIS_keyshare_lookup_cancel (
- struct ANASTASIS_KeyShareLookupOperation *kslo);
+ANASTASIS_truth_challenge_cancel (
+ struct ANASTASIS_TruthChallengeOperation *tco);
/**
- * Handle for a POST /truth operation.
+ * Information returned for a POST /truth/$TID/solve request.
*/
-struct ANASTASIS_TruthStoreOperation;
+struct ANASTASIS_TruthSolveReply
+{
+
+ /**
+ * HTTP status returned by the server.
+ */
+ unsigned int http_status;
+
+ /**
+ * Taler-specific error code, #TALER_EC_NONE on success.
+ */
+ enum TALER_ErrorCode ec;
+
+ /**
+ * Details depending on @e http_status.
+ */
+ union
+ {
+
+ /**
+ * Information returned if @e http_status is #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * The encrypted key share.
+ */
+ struct ANASTASIS_CRYPTO_EncryptedKeyShareP eks;
+
+ } success;
+
+ /**
+ * Information returne if @e http_status is #MHD_HTTP_PAYMENT_REQUIRED
+ */
+ struct
+ {
+ /**
+ * A taler://pay/-URI with a request to pay the annual fee for
+ * the service. Returned if @e us is #ANASTASIS_US_PAYMENT_REQUIRED.
+ */
+ const char *payment_request;
+
+ /**
+ * The payment secret (aka order ID) extracted from the @e payment_request.
+ */
+ struct ANASTASIS_PaymentSecretP ps;
+
+ /**
+ * Data extracted from the payto:// URI.
+ */
+ const struct TALER_MERCHANT_PayUriData *pd;
+
+ } payment_required;
+
+ /**
+ * Information returne if @e http_status is #MHD_HTTP_TOO_MANY_REQUESTS.
+ */
+ struct
+ {
+
+ /**
+ * How many requests are allowed at most per @e request_frequency?
+ */
+ uint32_t request_limit;
+
+ /**
+ * Frequency at which requests are allowed / new challenges are
+ * created.
+ */
+ struct GNUNET_TIME_Relative request_frequency;
+ } too_many_requests;
+
+ } details;
+
+};
/**
- * Callback to process a POST /truth request
+ * Handle for a POST /truth/$TID/solve operation.
+ */
+struct ANASTASIS_TruthSolveOperation;
+
+
+/**
+ * Callback to process a POST /truth/$TID/solve response.
*
* @param cls closure
- * @param obj the response body
+ * @param kdd details about the key share
*/
typedef void
-(*ANASTASIS_TruthStoreCallback) (void *cls,
- const struct ANASTASIS_UploadDetails *up);
+(*ANASTASIS_TruthSolveCallback) (
+ void *cls,
+ const struct ANASTASIS_TruthSolveReply *trs);
/**
- * Store Truth, does a POST /truth/$UUID
+ * Makes a POST /truth/$TID/solve request.
*
- * @param ctx the CURL context used to connect to the backend
- * @param backend_url backend's base URL, including final "/"
- * @param uuid unique identfication of the Truth Upload
- * @param type type of the authorization method
- * @param encrypted_keyshare key material to return to the client upon authorization
- * @param truth_mime mime type of @e encrypted_truth (after decryption)
- * @param encrypted_truth_size number of bytes in @e encrypted_truth
- * @param encrypted_truth contains the @a type-specific authorization data
- * @param payment_years_requested for how many years would the client like the service to store the truth?
- * @param payment_timeout how long to wait for the payment, use
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param truth_uuid identification of the Truth
+ * @param truth_key Key used to Decrypt the Truth on the Server
+ * @param payment_secret secret from the previously done payment NULL to trigger payment
+ * @param timeout how long to wait for the payment, use
* #GNUNET_TIME_UNIT_ZERO to let the server pick
- * @param cb callback processing the response from /truth
- * @param cb_cls closure for cb
- * @return handle for the operation
+ * @param hashed_answer hashed answer to the challenge
+ * @param cb callback which will work the response gotten from the backend
+ * @param cb_cls closure to pass to the callback
+ * @return handle for this operation, NULL upon errors
*/
-struct ANASTASIS_TruthStoreOperation *
-ANASTASIS_truth_store (
+struct ANASTASIS_TruthSolveOperation *
+ANASTASIS_truth_solve (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid,
- const char *type,
- const struct ANASTASIS_CRYPTO_EncryptedKeyShareP *encrypted_keyshare,
- const char *truth_mime,
- size_t encrypted_truth_size,
- const void *encrypted_truth,
- uint32_t payment_years_requested,
- struct GNUNET_TIME_Relative payment_timeout,
- ANASTASIS_TruthStoreCallback cb,
+ const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid,
+ const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key,
+ const struct ANASTASIS_PaymentSecretP *payment_secret,
+ struct GNUNET_TIME_Relative timeout,
+ const struct GNUNET_HashCode *hashed_answer,
+ ANASTASIS_TruthSolveCallback cb,
void *cb_cls);
/**
- * Cancel a POST /truth request.
+ * Cancel a POST /truth/$TID/solve request.
*
- * @param tso the truth store operation
+ * @param[in] tso handle of the operation to cancel
*/
void
-ANASTASIS_truth_store_cancel (
- struct ANASTASIS_TruthStoreOperation *tso);
+ANASTASIS_truth_solve_cancel (
+ struct ANASTASIS_TruthSolveOperation *tso);
#endif /* _ANASTASIS_SERVICE_H */