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.h323
1 files changed, 49 insertions, 274 deletions
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index c21cde5..e88b7e0 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -517,258 +517,6 @@ ANASTASIS_policy_store_cancel (
/**
- * Operational status.
- */
-enum ANASTASIS_KeyShareDownloadStatus
-{
- /**
- * We got the encrypted key share.
- */
- ANASTASIS_KSD_SUCCESS = 0,
-
- /**
- * Payment is needed to proceed with the recovery.
- */
- ANASTASIS_KSD_PAYMENT_REQUIRED,
-
- /**
- * The provided answer was wrong or missing. Instructions for
- * getting a good answer may be provided.
- */
- ANASTASIS_KSD_INVALID_ANSWER,
-
- /**
- * To answer the challenge, the client should be redirected to
- * the given URL.
- */
- ANASTASIS_KSD_REDIRECT_FOR_AUTHENTICATION,
-
- /**
- * The provider had an error.
- */
- ANASTASIS_KSD_SERVER_ERROR,
-
- /**
- * The provider claims we made an error.
- */
- ANASTASIS_KSD_CLIENT_FAILURE,
-
- /**
- * The provider does not know this truth.
- */
- ANASTASIS_KSD_TRUTH_UNKNOWN,
-
- /**
- * Too many attempts to solve the challenge were made in a short
- * time. Try again later.
- */
- ANASTASIS_KSD_RATE_LIMIT_EXCEEDED,
-
- /**
- * The user did not satisfy the (external)
- * authentication check until the request timeout
- * was reached. The client should try again later.
- */
- ANASTASIS_KSD_AUTHENTICATION_TIMEOUT,
-
- /**
- * The plugin provided external challenge instructions
- * that should be followed. They are method-specific.
- */
- ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS
-
-};
-
-
-/**
- * Detailed results from the successful download.
- */
-struct ANASTASIS_KeyShareDownloadDetails
-{
-
- /**
- * Operational status.
- */
- enum ANASTASIS_KeyShareDownloadStatus status;
-
- /**
- * Anastasis URL that returned the @e status.
- */
- const char *server_url;
-
- /**
- * Details depending on @e 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).
- */
- 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.
- */
- const char *content_type;
-
- /**
- * Number of bytes in @e body.
- */
- size_t body_size;
-
- } open_challenge;
-
- /**
- * URL with instructions for the user to satisfy the challenge, if
- * @e status is #ANASTASIS_KSD_REDIRECT_FOR_AUTHENTICATION.
- */
- const char *redirect_url;
-
- /**
- * Response with instructions for how to pay, if
- * @e status is #ANASTASIS_KSD_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.
- */
- struct ANASTASIS_PaymentSecretP payment_secret;
-
- } payment_required;
-
-
- 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;
-
- } rate_limit_exceeded;
-
-
- /**
- * 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
- {
-
- /**
- * HTTP status returned by the server.
- */
- unsigned int http_status;
-
- /**
- * Taler-specific error code.
- */
- enum TALER_ErrorCode ec;
-
- } server_failure;
-
- /**
- * External challenge instructions, if @e status is
- * #ANASTASIS_KSD_EXTERNAL_CHALLENGE_INSTRUCTIONS.
- */
- const json_t *external_challenge;
-
- } details;
-};
-
-
-/**
- * Handle for a GET /truth operation.
- */
-struct ANASTASIS_KeyShareLookupOperation;
-
-
-/**
- * Callback to process a GET /truth request
- *
- * @param cls closure
- * @param http_status HTTP status code for this request
- * @param kdd details about the key share
- */
-typedef void
-(*ANASTASIS_KeyShareLookupCallback) (
- void *cls,
- const struct ANASTASIS_KeyShareDownloadDetails *kdd);
-
-
-/**
- * Does a GET /truth.
- *
- * @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 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,
- void *cb_cls);
-
-
-/**
- * Cancel a GET /truth request.
- *
- * @param kslo cancel the key share lookup operation
- */
-void
-ANASTASIS_keyshare_lookup_cancel (
- struct ANASTASIS_KeyShareLookupOperation *kslo);
-
-
-/**
* Handle for a POST /truth operation.
*/
struct ANASTASIS_TruthStoreOperation;
@@ -836,6 +584,12 @@ enum ANASTASIS_ChallengeDetailType
{
/**
+ * A challenge TAN was written to a file.
+ * The name of the file is provided.
+ */
+ ANASTASIS_CS_FILE_WRITTEN,
+
+ /**
* A challenge TAN was sent to the customer.
* A hint may be provided as to the address used.
*/
@@ -851,6 +605,42 @@ enum ANASTASIS_ChallengeDetailType
/**
+ * 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
+{
+
+ /**
+ * Answer code expected.
+ */
+ uint64_t answer_code;
+
+ /**
+ * How much should be sent.
+ */
+ struct TALER_Amount amount;
+
+ /**
+ * IBAN where to send the funds.
+ */
+ const char *target_iban;
+
+ /**
+ * Name of the business receiving the funds.
+ */
+ const char *target_business_name;
+
+ /**
+ * Wire transfer subject to use.
+ */
+ const char *wire_transfer_subject;
+
+};
+
+
+/**
* Information returned for a POST /truth/$TID/challenge request.
*/
struct ANASTASIS_TruthChallengeDetails
@@ -894,6 +684,12 @@ struct ANASTASIS_TruthChallengeDetails
{
/**
+ * 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.
@@ -907,28 +703,7 @@ struct ANASTASIS_TruthChallengeDetails
* as a hint as to which bank account to send
* the funds from.
*/
- struct
- {
-
- /**
- * How much should be sent.
- */
- struct TALER_Amount amount;
-
- /**
- * payto:// URI with the target account number.
- */
- const char *target_payto;
-
- /**
- * Human-readable hint about which sender bank
- * account must be used.
- */
- const char *sender_hint;
-
- // FIXME: more? Wire transfer subject?
-
- } wire_funds;
+ struct ANASTASIS_WireFundsDetails wire_funds;
} details;