[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: moved json construction to test
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: moved json construction to test cmd |
Date: |
Mon, 13 Apr 2020 09:53:21 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new b6245af moved json construction to test cmd
b6245af is described below
commit b6245af71f3ef8762aa3e8b844a2246ec6639abf
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Apr 13 07:53:16 2020 +0000
moved json construction to test cmd
---
src/include/anastasis_testing_lib.h | 8 +++++
src/lib/test_anastasis_api.c | 55 +++++----------------------------
src/lib/testing_api_cmd_truth_store.c | 57 +++++++++++++++++++++++++++++++++++
src/stasis/test_anastasis_db.c | 18 ++---------
4 files changed, 75 insertions(+), 63 deletions(-)
diff --git a/src/include/anastasis_testing_lib.h
b/src/include/anastasis_testing_lib.h
index 5bdb601..be8d429 100644
--- a/src/include/anastasis_testing_lib.h
+++ b/src/include/anastasis_testing_lib.h
@@ -320,6 +320,14 @@ enum ANASTASIS_TESTING_TruthStoreOption
};
+/**
+ * Creates a sample of truth.
+ *
+ * @return truth in json format
+ */
+json_t
+ANASTASIS_TESTING_get_truth_example ();
+
/**
* Make the "truth store" command.
*
diff --git a/src/lib/test_anastasis_api.c b/src/lib/test_anastasis_api.c
index 0a0605f..a73781d 100644
--- a/src/lib/test_anastasis_api.c
+++ b/src/lib/test_anastasis_api.c
@@ -76,6 +76,11 @@ static struct TALER_TESTING_BankConfiguration bc;
*/
static struct TALER_TESTING_ExchangeConfiguration ec;
+/**
+ * Truth data
+ */
+static json_t truth_data;
+
/**
* Payto URI of the customer (payer).
*/
@@ -234,51 +239,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- json_t *truth_data;
- struct ANASTASIS_CRYPTO_EncryptedKeyShare keyshare_data;
- struct ANASTASIS_CRYPTO_Nonce nonce;
- struct ANASTASIS_CRYPTO_AesTag aes_gcm_tag;
- struct GNUNET_HashCode truth_hash;
- const char *encrypted_truth;
-
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &nonce,
- sizeof (struct ANASTASIS_CRYPTO_Nonce));
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &aes_gcm_tag,
- sizeof (struct ANASTASIS_CRYPTO_AesTag));
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &keyshare_data,
- sizeof (struct
- ANASTASIS_CRYPTO_EncryptedKeyShare));
- GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
- &truth_hash,
- sizeof (struct GNUNET_HashCode));
- encrypted_truth = "Truth test (et)";
-
- truth_data = json_pack ("{s:o," /* keyshare_data */
- " s:s," /* method */
- " s:o," /* nonce */
- " s:o," /* aes_gcm_tag */
- " s:o," /* encrypted_truth */
- " s:s}", /* truth_mime */
- "keyshare_data", GNUNET_JSON_from_data_auto (
- &keyshare_data),
- "method", "Truth test method",
- "nonce", GNUNET_JSON_from_data_auto (&nonce),
- "aes_gcm_tag", GNUNET_JSON_from_data_auto (
- &aes_gcm_tag),
- "encrypted_truth", GNUNET_JSON_from_data (
- encrypted_truth, strlen (encrypted_truth)),
- "truth_mime", "Truth test mime"
- );
- if (NULL == truth_data)
- {
- GNUNET_break (0);
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Truth json before upload: %s\n",
- json_dumps (truth_data, JSON_COMPACT));
+ truth_data = ANASTASIS_TESTING_get_truth_example ();
struct TALER_TESTING_Command truth[] = {
// FIXME: Code for truth handling
@@ -288,8 +249,8 @@ run (void *cls,
NULL,
MHD_HTTP_NO_CONTENT,
ANASTASIS_TESTING_TSO_NONE,
- truth_data,
- sizeof (truth_data)),
+ &truth_data,
+ sizeof (&truth_data)),
TALER_TESTING_cmd_end ()
};
diff --git a/src/lib/testing_api_cmd_truth_store.c
b/src/lib/testing_api_cmd_truth_store.c
index f975d32..3f89242 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -373,6 +373,63 @@ truth_store_traits (void *cls,
index);
}
+/**
+ * Creates a sample of truth.
+ *
+ * @return truth in json format
+ */
+json_t
+ANASTASIS_TESTING_get_truth_example ()
+{
+
+ json_t *truth_data;
+ struct ANASTASIS_CRYPTO_EncryptedKeyShare keyshare_data;
+ struct ANASTASIS_CRYPTO_Nonce nonce;
+ struct ANASTASIS_CRYPTO_AesTag aes_gcm_tag;
+ struct GNUNET_HashCode truth_hash;
+ const char *encrypted_truth;
+
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &nonce,
+ sizeof (struct ANASTASIS_CRYPTO_Nonce));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &aes_gcm_tag,
+ sizeof (struct ANASTASIS_CRYPTO_AesTag));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &keyshare_data,
+ sizeof (struct
+ ANASTASIS_CRYPTO_EncryptedKeyShare));
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &truth_hash,
+ sizeof (struct GNUNET_HashCode));
+ encrypted_truth = "Truth test (et)";
+
+ truth_data = json_pack ("{s:o," /* keyshare_data */
+ " s:s," /* method */
+ " s:o," /* nonce */
+ " s:o," /* aes_gcm_tag */
+ " s:o," /* encrypted_truth */
+ " s:s}", /* truth_mime */
+ "keyshare_data", GNUNET_JSON_from_data_auto (
+ &keyshare_data),
+ "method", "Truth test method",
+ "nonce", GNUNET_JSON_from_data_auto (&nonce),
+ "aes_gcm_tag", GNUNET_JSON_from_data_auto (
+ &aes_gcm_tag),
+ "encrypted_truth", GNUNET_JSON_from_data (
+ encrypted_truth, strlen (encrypted_truth)),
+ "truth_mime", "Truth test mime"
+ );
+ if (NULL == truth_data)
+ {
+ GNUNET_break (0);
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Truth json before upload: %s\n",
+ json_dumps (truth_data, JSON_COMPACT));
+
+ return *truth_data;
+}
/**
* Make the "truth store" command.
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 1f08d1c..c1cdbd5 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -183,7 +183,6 @@ run (void *cls)
}
static uint32_t recversion = 1;
- size_t truthsize;
size_t recoverydatasize;
size_t keysharesize;
const char *str = "AHV123456789";
@@ -224,11 +223,9 @@ run (void *cls)
unsigned char aes_gcm_tag[16];
RND_BLK (&aes_gcm_tag);
- unsigned char *res_aes_gcm_tag;
- uint32_t *res_nonce;
-
post_counter = 2;
mime_type = "Picture";
+ method = "Methode";
TALER_string_to_amount ("EUR:30",&amount);
uuid_t uuid;
uuid_generate (uuid);
@@ -265,7 +262,7 @@ run (void *cls)
sizeof ("encrypted_truth"),
aes_gcm_tag,
&nonce,
- "Methode",
+ method,
rel_time));
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -283,17 +280,6 @@ run (void *cls)
&accountPubP,
&r));
- /* FIXME: do we really get an escrow challenge?
- FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
- plugin->get_escrow_challenge (plugin->cls,
- &uuid,
- &truth,
- &truthsize,
- &res_aes_gcm_tag,
- &res_nonce,
- &res_mime_type,
- &method));*/
-
FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
plugin->get_key_share (plugin->cls,
&uuid,
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: moved json construction to test cmd,
gnunet <=