[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: worked on cli assembler 'answer
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: worked on cli assembler 'answer' |
Date: |
Tue, 16 Jun 2020 16:24:25 +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 7c97842 worked on cli assembler 'answer'
7c97842 is described below
commit 7c978423b0b43135c1d12378b0ebefe280279b04
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Jun 16 14:24:18 2020 +0000
worked on cli assembler 'answer'
---
src/cli/anastasis-cli-assembler.c | 49 +++++++++++++++++++++++++++++++++++++--
src/include/anastasis.h | 1 +
src/lib/anastasis.c | 1 +
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/src/cli/anastasis-cli-assembler.c
b/src/cli/anastasis-cli-assembler.c
index ade518e..eff360a 100644
--- a/src/cli/anastasis-cli-assembler.c
+++ b/src/cli/anastasis-cli-assembler.c
@@ -135,34 +135,42 @@ struct RecoverSecretState
* URL of the anastasis backend.
*/
const char *anastasis_url;
+
/**
* Expected status code.
*/
unsigned int http_status_salt;
+
/**
* Expected status code.
*/
unsigned int http_status_policy;
+
/**
* The /policy GET operation handle.
*/
struct ANASTASIS_Recovery *recovery;
+
/**
* Identification data from the user
*/
json_t *id_data;
+
/**
* version of the recovery document
*/
unsigned int version;
+
/**
* Salt to be used to derive the id
*/
struct ANASTASIS_CRYPTO_SaltP *salt;
+
/**
* Recovery information from the lookup
*/
const struct ANASTASIS_RecoveryInformation *ri;
+
/**
* The /salt GET operation handle.
*/
@@ -284,7 +292,7 @@ read_keyboard_command (void *cls)
{
if (0 == uuid_compare (policies[i].escrow_uuids[j],
challenges[k].uuid))
- if (1 != challenges[k].solved)
+ if (1 != *challenges[k].solved)
printf ("truth#%u ", k);
}
}
@@ -311,7 +319,44 @@ read_keyboard_command (void *cls)
buffer,
strlen ("answer")))
{
- // FIXME "answer" logic here
+ char *token_start = &buffer[strlen ("answer ")];
+ char *token = strtok (token_start, " ");
+
+ unsigned int truth_index;
+ if (0 != strncmp ("truth#",
+ token,
+ strlen ("truth#")))
+ {
+ printf ("Wrong argument: %s!\n", token);
+ free (buffer);
+ start_read_keyboard ();
+ return;
+ }
+ truth_index = (int) token[strlen ("truth#")] - 48;
+
+ if (0 == strcmp (challenges[truth_index].method, "question"))
+ token = strtok (NULL, "\"");
+
+ char *challenge_answer = GNUNET_malloc (strlen (token) + 1);
+ GNUNET_strlcpy (challenge_answer,
+ token,
+ strlen (token) + 1);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d challenge answer is %s\n", __FILE__, __LINE__,
+ challenge_answer);
+ struct GNUNET_HashCode hash_answer;
+ GNUNET_CRYPTO_hash (challenge_answer,
+ strlen (challenge_answer),
+ &hash_answer);
+
+ /**
+ ANASTASIS_challenge_answer (ctx,
+ challenges[truth_index].challenge,
+ &hash_answer,
+ sizeof (struct GNUNET_HashCode),
+ challenge_answer_cb,
+ cs);
+ */
start_read_keyboard ();
GNUNET_free (buffer);
buffer = NULL;
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 4ca4e22..f57fde7 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -158,6 +158,7 @@ struct ANASTASIS_ChallengeInformation
const unsigned int *solved;
const uuid_t *uuid;
const char *currency;
+ const struct ANASTASIS_Challenge *challenge;
};
/**
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index aaab198..ade28ba 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -486,6 +486,7 @@ ANASTASIS_get_challenge (struct ANASTASIS_Challenge
*challenge,
ci->url = challenge->url;
ci->instructions = challenge->instructions;
ci->solved = &challenge->solved;
+ ci->challenge = challenge;
challenge->cc (ci,
200);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: worked on cli assembler 'answer',
gnunet <=