gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 07/07: worked on rec doc upload


From: gnunet
Subject: [taler-anastasis] 07/07: worked on rec doc upload
Date: Thu, 26 Nov 2020 12:54:14 +0100

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit 3f7c3b80c90fb7722bf65341390e4e08a6cadc12
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Thu Nov 26 12:53:42 2020 +0100

    worked on rec doc upload
---
 src/cli/test_anastasis_reducer_enter_secret.sh |  95 +++++++-
 src/cli/test_reducerEUWWNI.conf                | 301 -------------------------
 src/lib/anastasis_api_backup_redux.c           |  22 +-
 3 files changed, 110 insertions(+), 308 deletions(-)

diff --git a/src/cli/test_anastasis_reducer_enter_secret.sh 
b/src/cli/test_anastasis_reducer_enter_secret.sh
index 61a7dab..1cac54a 100755
--- a/src/cli/test_anastasis_reducer_enter_secret.sh
+++ b/src/cli/test_anastasis_reducer_enter_secret.sh
@@ -21,11 +21,13 @@ function cleanup()
     do
         kill $n 2> /dev/null || true
     done
-    rm -f $TFILE $CONF_1 $CONF_2 $CONF_3 $CONF_4 
+    rm -f $SFILE $TFILE $CONF $CONF_1 $CONF_2 $CONF_3 $CONF_4 
     wait
 }
 
 # Install cleanup handler (except for kill -9)
+WALLET_DB=`mktemp test_reducer_walletXXXXXX`
+CONF=`mktemp test_reducerXXXXXX.conf`
 CONF_1=`mktemp test_reducerXXXXXX_1.conf`
 CONF_2=`mktemp test_reducerXXXXXX_2.conf`
 CONF_3=`mktemp test_reducerXXXXXX_3.conf`
@@ -40,6 +42,18 @@ echo -n "Testing for jq"
 jq -h > /dev/null || exit_skip "jq required"
 echo " FOUND"
 
+echo -n "Testing for taler"
+taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange required"
+taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
+echo " FOUND"
+
+echo -n "Testing for taler-bank-manage"
+taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
+echo " FOUND"
+echo -n "Testing for taler-wallet-cli"
+taler-wallet-cli -v >/dev/null </dev/null || exit_skip " MISSING"
+echo " FOUND"
+
 echo -n "Testing for anastasis-httpd"
 anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
 echo " FOUND"
@@ -47,21 +61,81 @@ echo " FOUND"
 # Name of the Postgres database we will use for the script.
 # Will be dropped, do NOT use anything that might be used
 # elsewhere
-TARGET_DB=anastasischeck
+TALER_DB=talercheck
+ANASTASIS_DB=anastasischeck
+
+# delete existing wallet database
+rm -f $WALLET_DB
 
 # Configuration file will be edited, so we create one
 # from the template.
+cp test_reducer.conf $CONF
 cp test_anastasis_reducer.conf $CONF_1
 cp test_anastasis_reducer_1.conf $CONF_2
 cp test_anastasis_reducer_2.conf $CONF_3
 cp test_anastasis_reducer_3.conf $CONF_4
 
+# Clean up
+DATA_DIR=`taler-config -f -c $CONF -s PATHS -o TALER_HOME`
+rm -rf $DATA_DIR || true
+
 # reset database
-dropdb $TARGET_DB >/dev/null 2>/dev/null || true
-createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
+dropdb $TALER_DB >/dev/null 2>/dev/null || true
+createdb $TALER_DB || exit_skip "Could not create database $TALER_DB"
+dropdb $ANASTASIS_DB >/dev/null 2>/dev/null || true
+createdb $ANASTASIS_DB || exit_skip "Could not create database $ANASTASIS_DB"
+
+# obtain key configuration data
+MASTER_PRIV_FILE=`taler-config -f -c $CONF -s EXCHANGE -o MASTER_PRIV_FILE`
+MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE`
+mkdir -p $MASTER_PRIV_DIR
+gnunet-ecc -g1 $MASTER_PRIV_FILE > /dev/null
+MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE`
+EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL`
+MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT`
+MERCHANT_URL=http://localhost:${MERCHANT_PORT}/
+BANK_PORT=`taler-config -c $CONF -s BANK -o HTTP_PORT`
+BANK_URL=http://localhost:${BANK_PORT}/
+AUDITOR_URL=http://localhost:8083/
+
+# patch configuration
+taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB
+taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
+# FIXME: SQL_DIR not usefull in general
+taler-config -c $CONF -s exchangedb-postgres -o SQL_DIR -V 
${HOME}/.local/share/taler/sql/exchange/
+taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TALER_DB
+# FIXME: SQL_DIR not usefull in general
+taler-config -c $CONF -s auditordb-postgres -o SQL_DIR -V 
${HOME}/.local/share/taler/sql/exchange/
+taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TALER_DB
+taler-config -c $CONF -s merchantdb-postgres -o CONFIG -V postgres:///$TALER_DB
+taler-config -c $CONF -s bank -o database -V postgres:///$TALER_DB
+
+# setup exchange
+echo "Setting up exchange"
+taler-exchange-dbinit -c $CONF
+taler-exchange-wire -c $CONF 2> taler-exchange-wire.log
+taler-exchange-keyup -L INFO -c $CONF -o e2a.dat 2> taler-exchange-keyup.log
+
+# setup auditor
+echo "Setting up auditor"
+taler-auditor-dbinit -c $CONF
+taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL
+taler-auditor-sign -c $CONF -u $AUDITOR_URL -r e2a.dat -o a2e.dat -m 
$MASTER_PUB
+rm -f e2a.dat
+
+# provide auditor's signature to exchange
+ABD=`taler-config -c $CONF -s EXCHANGEDB -o AUDITOR_BASE_DIR -f`
+mkdir -p $ABD
+mv a2e.dat $ABD
 
 # Launch services
 echo "Launching anastasis service"
+taler-bank-manage-testing $CONF postgres:///$TALER_DB serve &
+taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
+taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
+taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
+taler-auditor-httpd -c $CONF 2> taler-auditor-httpd.log &
+
 anastasis-httpd -c $CONF_1 2> anastasis-httpd_1.log &
 anastasis-httpd -c $CONF_2 2> anastasis-httpd_2.log &
 anastasis-httpd -c $CONF_3 2> anastasis-httpd_3.log &
@@ -73,6 +147,14 @@ do
     echo -n "."
     sleep 0.1
     OK=0
+    # exchange
+    wget http://localhost:8081/ -o /dev/null -O /dev/null >/dev/null || 
continue
+    # merchant
+    wget http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || 
continue
+    # bank
+    wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || 
continue
+    # Auditor
+    wget http://localhost:8083/ -o /dev/null -O /dev/null >/dev/null || 
continue
     # anastasis_01
     wget http://localhost:8086/ -o /dev/null -O /dev/null >/dev/null || 
continue
     # anastasis_02
@@ -90,6 +172,11 @@ then
     exit_skip "Failed to launch anastasis services"
 fi
 
+# Setup merchant
+
+curl -H "Content-Type: application/json" -X POST -d 
'{"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
 
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms"
 : 3600000},"default_pay_delay":{"d_ms": 3600000}}' 
http://localhost:9966/private/instances
+
+
 echo " ANASTASIS SETUP DONE"
 echo " "
 echo " "
diff --git a/src/cli/test_reducerEUWWNI.conf b/src/cli/test_reducerEUWWNI.conf
deleted file mode 100644
index ca7a6e9..0000000
--- a/src/cli/test_reducerEUWWNI.conf
+++ /dev/null
@@ -1,301 +0,0 @@
-# This file is in the public domain.
-#
-[PATHS]
-# Persistent data storage for the testcase
-TALER_TEST_HOME = test_anastasis_api_home/
-
-# Persistent data storage
-TALER_DATA_HOME = $TALER_TEST_HOME/.local/share/taler/
-
-# Configuration files
-TALER_CONFIG_HOME = $TALER_TEST_HOME/.config/taler/
-
-# Cached data, no big deal if lost
-TALER_CACHE_HOME = $TALER_TEST_HOME/.cache/taler/
-
-[taler]
-# What currency do we use?
-#currency = EUR
-currency = TESTKUDOS
-#CURRENCY_ROUND_UNIT = EUR:0.01
-#CURRENCY_ROUND_UNIT = TESTKUDOS:0.01
-
-[bank]
-HTTP_PORT = 8082
-#BASE_URL = https://bank.test.taler.net/
-
-##########################################
-# Configuration for Anastasis #
-##########################################
-
-[anastasis]
-PORT = 8086
-
-DB = postgres
-
-# Base URL of anastasis.
-# BASE_URL = http://localhost:8086/
-
-# Where does our payment backend run?  Must match PORT under [merchant]
-PAYMENT_BACKEND_URL = http://localhost:8080/
-
-# Annual fee we charge.
-#ANNUAL_FEE = EUR:4.99
-ANNUAL_FEE = TESTKUDOS:4.99
-#ANNUAL_FEE = EUR:0
-
-# Cost of authentication by question
-#QUESTION_COST = EUR:0
-QUESTION_COST = TESTKUDOS:0
-
-# Upload limit
-UPLOAD_LIMIT_MB = 1
-
-SUPPORTED_METHODS = question
-
-# Insurance
-INSURANCE = TESTKUDOS:1.0
-
-# This specifies which database the postgres backend uses.
-[anastasisdb-postgres]
-CONFIG = postgres:///anastasischeck
-
-##########################################
-# Configuration for the merchant backend #
-##########################################
-
-[test]
-INSTANCES = default tor
-
-[merchant]
-
-# Which port do we run the backend on? (HTTP server)
-PORT = 8080
-
-# How quickly do we want the exchange to send us our money?
-# Used only if the frontend does not specify a value.
-WIRE_TRANSFER_DELAY = 0 s
-
-# Which plugin (backend) do we use for the DB.
-DB = postgres
-
-# Default choice for maximum wire fee.
-DEFAULT_MAX_WIRE_FEE = TESTKUDOS:0.10
-
-# Default choice for maximum deposit fee.
-DEFAULT_MAX_DEPOSIT_FEE = TESTKUDOS:0.10
-
-
-# This specifies which database the postgres backend uses.
-[merchantdb-postgres]
-CONFIG = postgres:///talercheck
-
-# Different instances operated by this merchant:
-[instance-default]
-KEYFILE = ${TALER_CONFIG_HOME}/merchant/default.priv
-NAME = Kudos Inc.
-
-# Account of the MERCHANT
-[merchant-account-merchant]
-# What is the merchant's bank account?
-PAYTO_URI = "payto://x-taler-bank/localhost:8082/3"
-
-# This is the *salted* response we give out for /contract requests.
-# File is generated on first use, no need for merchants to generate
-# the salt!
-WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/account-3.json
-
-# Accept payments to this account in instance-default
-HONOR_default = YES
-
-# Advertise in new contracts of instance-default
-ACTIVE_default = YES
-
-# Sections starting with "exchange-" specify trusted exchanges
-# (by the merchant)
-[merchant-exchange-default]
-#MASTER_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG
-#EXCHANGE_BASE_URL = http://localhost:8081/
-MASTER_KEY = DY95EXAHQ2BKM2WK9YHZHYG1R7PPMMJPY14FNGP662DAKE35AKQG
-EXCHANGE_BASE_URL = https://exchange.test.taler.net/
-#CURRENCY = EUR
-CURRENCY = TESTKUDOS
-
-
-
-# only fixes skips.
-[auditor]
-BASE_URL = http://the.auditor/
-#BASE_URL = https://auditor.test.taler.net/
-#AUDITOR_KEY = DSDASDXAMDAARMNAD53ZA4AFAHA2QADAMAHHASWDAWXN84SDAA11
-# If currency does not match [TALER] section, the auditor
-# will be ignored!
-CURRENCY = TESTKUDOS
-
-# Auditors must be in sections "auditor-", the rest of the section
-# name could be anything.
-[auditor-ezb]
-# Informal name of the auditor. Just for the user.
-NAME = European Central Bank
-
-# URL of the auditor (especially for in the future, when the
-# auditor offers an automated issue reporting system).
-# Not really used today.
-URL = http://taler.ezb.eu/
-
-# This is the important bit: the signing key of the auditor.
-PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60
-
-# Which currency is this auditor trusted for?
-CURRENCY = TESTKUDOS
-
-
-###################################################
-# Configuration for the exchange for the testcase #
-###################################################
-
-[exchange_keys]
-
-# how long is one signkey valid?
-signkey_duration = 4 weeks
-
-# how long are the signatures with the signkey valid?
-legal_duration = 2 years
-
-# how long do we generate denomination and signing keys
-# ahead of time?
-lookahead_sign = 32 weeks 1 day
-
-# how long do we provide to clients denomination and signing keys
-# ahead of time?
-lookahead_provide = 4 weeks 1 day
-
-
-[exchange]
-# How to access our database
-DB = postgres
-
-# HTTP port the exchange listens to
-#PORT = 8081
-
-# Our public key
-MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG
-
-# Base URL of the exchange.
-BASE_URL = "http://localhost:8081/";
-#BASE_URL = https://exchange.test.taler.net/
-
-
-##############################################################
-## Added following lines because they were complaint in log ##
-# START
-
-# Where do we store the private keys the exchange needs at
-# runtime? (Denomination and signing keys are then stored
-# in respective subdirectories.)
-KEYDIR = ${TALER_DATA_HOME}/exchange/live-keys/
-
-# Directory where the exchange expects to find revocation
-# certificates (and where taler-exchange-keyup will write them).
-REVOCATION_DIR = ${TALER_DATA_HOME}/exchange/revocations/
-
-# Network configuration for the normal API/service HTTP server
-# serve via tcp socket (on PORT)
-SERVE = tcp
-
-# END
-##############################################################
-
-
-[exchangedb-postgres]
-CONFIG = "postgres:///talercheck"
-
-[auditordb-postgres]
-CONFIG = "postgres:///talercheck"
-
-# Account of the EXCHANGE
-[exchange-account-exchange]
-# What is the exchange's bank account (with the "Taler Bank" demo system)?
-PAYTO_URI = "payto://x-taler-bank/localhost:8082/2"
-
-# This is the response we give out for the /wire request.  It provides
-# wallets with the bank information for transfers to the exchange.
-WIRE_RESPONSE = ${TALER_CONFIG_HOME}/exchange/account-2.json
-
-WIRE_GATEWAY_URL = "http://localhost:8082/2/";
-WIRE_GATEWAY_AUTH_METHOD = NONE
-
-ENABLE_DEBIT = YES
-ENABLE_CREDIT = YES
-
-
-# wire fees
-[fees-x-taler-bank]
-
-# Fees for the foreseeable future...
-# If you see this after 2018, update to match the next 10 years...
-WIRE-FEE-2018 = TESTKUDOS:0.01
-WIRE-FEE-2019 = TESTKUDOS:0.01
-WIRE-FEE-2020 = TESTKUDOS:0.01
-WIRE-FEE-2021 = TESTKUDOS:0.01
-WIRE-FEE-2022 = TESTKUDOS:0.01
-WIRE-FEE-2023 = TESTKUDOS:0.01
-WIRE-FEE-2024 = TESTKUDOS:0.01
-WIRE-FEE-2025 = TESTKUDOS:0.01
-WIRE-FEE-2026 = TESTKUDOS:0.01
-WIRE-FEE-2027 = TESTKUDOS:0.01
-CLOSING-FEE-2018 = TESTKUDOS:0.01
-CLOSING-FEE-2019 = TESTKUDOS:0.01
-CLOSING-FEE-2020 = TESTKUDOS:0.01
-CLOSING-FEE-2021 = TESTKUDOS:0.01
-CLOSING-FEE-2022 = TESTKUDOS:0.01
-CLOSING-FEE-2023 = TESTKUDOS:0.01
-CLOSING-FEE-2024 = TESTKUDOS:0.01
-CLOSING-FEE-2025 = TESTKUDOS:0.01
-CLOSING-FEE-2026 = TESTKUDOS:0.01
-CLOSING-FEE-2027 = TESTKUDOS:0.01
-
-
-[coin_eur_ct_1]
-value = TESTKUDOS:0.01
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.00
-fee_deposit = TESTKUDOS:0.00
-fee_refresh = TESTKUDOS:0.01
-fee_refund = TESTKUDOS:0.01
-rsa_keysize = 1024
-
-[coin_eur_ct_10]
-value = TESTKUDOS:0.10
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-rsa_keysize = 1024
-
-[coin_eur_1]
-value = TESTKUDOS:1
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-rsa_keysize = 1024
-
-[coin_eur_5]
-value = TESTKUDOS:5
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = TESTKUDOS:0.01
-fee_deposit = TESTKUDOS:0.01
-fee_refresh = TESTKUDOS:0.03
-fee_refund = TESTKUDOS:0.01
-rsa_keysize = 1024
diff --git a/src/lib/anastasis_api_backup_redux.c 
b/src/lib/anastasis_api_backup_redux.c
index 82d9b10..a57deca 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -1365,10 +1365,21 @@ secret_share_result_cb (void *cls,
                  ANASTASIS_backup_state_to_string (
                    ANASTASIS_BACKUP_STATE_BACKUP_FINISHED));
     }
-
+    if (http_status == sss->http_status)
+    {
+      sss->cb (sss->cb_cls,
+               ANASTASIS_EC_NONE,
+               sss->state);
+      return;
+    }
+    json_t *error = json_pack ("{s:I, s:s}",
+                               "code",
+                               (json_int_t) ec,
+                               "hint",
+                               "Unexpected response code!");
     sss->cb (sss->cb_cls,
-             ANASTASIS_EC_NONE,
-             sss->state);
+             ANASTASIS_EC_INVALID,  // FIXME: ERROR CODE
+             error);
     return;
   }
   GNUNET_break (0);
@@ -1394,6 +1405,11 @@ upload_rec_documents (json_t *state,
     initialize_policies (state);
   }
   struct SecretShareState *sss = GNUNET_new (struct SecretShareState);
+
+  sss->cb = cb;
+  sss->cb_cls = cb_cls;
+  sss->http_status = MHD_HTTP_NO_CONTENT;
+
   GNUNET_assert (NULL !=
                  (sss->id_data = json_object_get (state,
                                                   "identity_attributes")));

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]