renaming mint->exchange
This commit is contained in:
parent
e406833eab
commit
b5cba32510
48
README
48
README
@ -6,7 +6,7 @@ What is Taler?
|
||||
|
||||
Taler is an electronic payment system providing the ability to pay
|
||||
anonymously using digital cash. Taler consists of a network protocol
|
||||
definition (using a RESTful API over HTTP), a Mint (which creates
|
||||
definition (using a RESTful API over HTTP), a Exchange (which creates
|
||||
digital coins), a Wallet (which allows customers to manage, store and
|
||||
spend digital coins), and a Merchant website which allows customers to
|
||||
spend their digital coins. Naturally, each Merchant is different, but
|
||||
@ -19,7 +19,7 @@ is free software and a GNU package (http://www.gnu.org/).
|
||||
|
||||
This is not even a release yet, but some raw development prototype
|
||||
that does not work yet. This package also only includes the Taler
|
||||
mint, not the other components of the system.
|
||||
exchange, not the other components of the system.
|
||||
|
||||
Documentation about Taler can be found at http://taler.net/.
|
||||
|
||||
@ -27,7 +27,7 @@ Documentation about Taler can be found at http://taler.net/.
|
||||
Dependencies:
|
||||
=============
|
||||
|
||||
These are the direct dependencies for running a Taler mint:
|
||||
These are the direct dependencies for running a Taler exchange:
|
||||
|
||||
- GNUnet >= 0.10.2
|
||||
- GNU libmicrohttpd >= 0.9.38
|
||||
@ -48,50 +48,50 @@ src/util/
|
||||
src/pq/
|
||||
-- Postgres-specific utility functions
|
||||
|
||||
src/mintdb/
|
||||
-- Mint database backend (with DB-specific plugins)
|
||||
src/exchangedb/
|
||||
-- Exchange database backend (with DB-specific plugins)
|
||||
|
||||
src/mint/
|
||||
-- taler mint server
|
||||
src/exchange/
|
||||
-- taler exchange server
|
||||
|
||||
src/mint-tools/
|
||||
-- taler mint helper programs
|
||||
src/exchange-tools/
|
||||
-- taler exchange helper programs
|
||||
|
||||
src/mint-lib/
|
||||
-- libtalermint: C API to issue HTTP requests to mint
|
||||
src/exchange-lib/
|
||||
-- libtalerexchange: C API to issue HTTP requests to exchange
|
||||
|
||||
|
||||
Getting Started
|
||||
==============
|
||||
|
||||
The following steps illustrate how to set up a mint HTTP server.
|
||||
They take as a stub for configuring the mint the content of 'contrib/mint-template/config/'.
|
||||
The following steps illustrate how to set up a exchange HTTP server.
|
||||
They take as a stub for configuring the exchange the content of 'contrib/exchange-template/config/'.
|
||||
|
||||
1) Create a 'test/' directory and copy the stubs in it:
|
||||
|
||||
mkdir -p test/config/
|
||||
cp mint/contrib/mint-template/config/* test/config/
|
||||
cp exchange/contrib/exchange-template/config/* test/config/
|
||||
cd test/
|
||||
|
||||
2) Create the mint's master with the tool 'gnunet-ecc':
|
||||
2) Create the exchange's master with the tool 'gnunet-ecc':
|
||||
|
||||
gnunet-ecc -g1 master.priv
|
||||
|
||||
3) Edit config/mint-common.conf by replacing the right value on the line with the
|
||||
3) Edit config/exchange-common.conf by replacing the right value on the line with the
|
||||
MASTER_PUBLIC_KEY entry with the fresh generated (ASCII version of) master.priv.
|
||||
This ASCII version is obtained by issuing:
|
||||
|
||||
gnunet-ecc -p master.priv
|
||||
|
||||
4) Generate other mint related keys ('denomination' and 'signing' keys), by issuing:
|
||||
4) Generate other exchange related keys ('denomination' and 'signing' keys), by issuing:
|
||||
|
||||
taler-mint-keyup -d `pwd` -m master.priv
|
||||
taler-exchange-keyup -d `pwd` -m master.priv
|
||||
|
||||
5) Check with:
|
||||
|
||||
taler-mint-keycheck -d `pwd`
|
||||
taler-exchange-keycheck -d `pwd`
|
||||
|
||||
6) A mint needs a database to operate, so the following instructions relate to
|
||||
6) A exchange needs a database to operate, so the following instructions relate to
|
||||
how to set up PostgreSQL. On debian, the two packages needed are:
|
||||
|
||||
* postgresql
|
||||
@ -99,8 +99,8 @@ how to set up PostgreSQL. On debian, the two packages needed are:
|
||||
|
||||
For other operating systems, please refer to the relevant documentation.
|
||||
|
||||
In this settlement, the mint wll use a database called 'talercheck' and will
|
||||
run under the username through which 'taler-mint-httpd' is launched. Thus assuming
|
||||
In this settlement, the exchange wll use a database called 'talercheck' and will
|
||||
run under the username through which 'taler-exchange-httpd' is launched. Thus assuming
|
||||
that this user is 'demo', we need to create a 'demo' role for postgresql and make
|
||||
him the owner of 'talercheck' database.
|
||||
|
||||
@ -117,7 +117,7 @@ CREATE DATABASE talercheck OWNER demo;
|
||||
# quit with CTRL-D
|
||||
|
||||
7) If any previous step has been successful, it is now possbile to start up the
|
||||
mint web server (by default it will listen on port 4241); issue:
|
||||
exchange web server (by default it will listen on port 4241); issue:
|
||||
|
||||
|
||||
taler-mint-httpd -d `pwd` # assuming we did not move outside of the 'test' directory
|
||||
taler-exchange-httpd -d `pwd` # assuming we did not move outside of the 'test' directory
|
||||
|
10
configure.ac
10
configure.ac
@ -17,7 +17,7 @@
|
||||
#
|
||||
#
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([taler-mint], [0.0.0], [taler-bug@gnunet.org])
|
||||
AC_INIT([taler-exchange], [0.0.0], [taler-bug@gnunet.org])
|
||||
AC_CONFIG_SRCDIR([src/util/json.c])
|
||||
AC_CONFIG_HEADERS([taler_config.h])
|
||||
# support for non-recursive builds
|
||||
@ -359,9 +359,9 @@ AC_CONFIG_FILES([Makefile
|
||||
src/pq/Makefile
|
||||
src/bank-lib/Makefile
|
||||
src/wire/Makefile
|
||||
src/mintdb/Makefile
|
||||
src/mint/Makefile
|
||||
src/mint-tools/Makefile
|
||||
src/mint-lib/Makefile
|
||||
src/exchangedb/Makefile
|
||||
src/exchange/Makefile
|
||||
src/exchange-tools/Makefile
|
||||
src/exchange-lib/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
2
contrib/coverage.sh
Executable file → Normal file
2
contrib/coverage.sh
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Run from 'taler-mint/' top-level directory to generate
|
||||
# Run from 'taler-exchange/' top-level directory to generate
|
||||
# code coverage data.
|
||||
TOP=`pwd`
|
||||
mkdir -p doc/coverage/
|
||||
|
1
contrib/exchange-template/README
Normal file
1
contrib/exchange-template/README
Normal file
@ -0,0 +1 @@
|
||||
This directory is a template for the exchange directory.
|
@ -1,15 +1,15 @@
|
||||
[mint]
|
||||
# Currency supported by the mint (can only be one)
|
||||
[exchange]
|
||||
# Currency supported by the exchange (can only be one)
|
||||
CURRENCY = EUR
|
||||
|
||||
# Wire format supported by the mint, case-insensitive.
|
||||
# Wire format supported by the exchange, case-insensitive.
|
||||
# Examples for formats include 'test' for testing and 'sepa' (for EU IBAN).
|
||||
WIREFORMAT = SEPA
|
||||
|
||||
# HTTP port the mint listens to
|
||||
# HTTP port the exchange listens to
|
||||
PORT = 4241
|
||||
|
||||
# Master public key used to sign the mint's various keys
|
||||
# Master public key used to sign the exchange's various keys
|
||||
MASTER_PUBLIC_KEY = NEGTF62MNGVPZNW19V7S3CRS9D7K04MAHDGX3N6WY2NXREN26J80
|
||||
|
||||
# How to access our database
|
||||
@ -17,12 +17,12 @@ DB = postgres
|
||||
|
||||
TESTRUN = YES
|
||||
|
||||
[mintdb-postgres]
|
||||
[exchangedb-postgres]
|
||||
|
||||
DB_CONN_STR = "postgres:///talercheck"
|
||||
|
||||
[mint-wire-sepa]
|
||||
[exchange-wire-sepa]
|
||||
SEPA_RESPONSE_FILE = "sepa.json"
|
||||
|
||||
[mint-wire-test]
|
||||
[exchange-wire-test]
|
||||
REDIRECT_URL = "http://test/"
|
@ -1,4 +1,4 @@
|
||||
[mint_keys]
|
||||
[exchange_keys]
|
||||
|
||||
# how long is one signkey valid?
|
||||
signkey_duration = 4 weeks
|
@ -1 +0,0 @@
|
||||
This directory is a template for the mint directory.
|
@ -4,11 +4,11 @@ SUBDIRS = . doxygen
|
||||
|
||||
man_MANS = \
|
||||
taler-auditor-sign.1 \
|
||||
taler-mint-dbinit.1 \
|
||||
taler-mint-httpd.1 \
|
||||
taler-mint-keyup.1 \
|
||||
taler-mint-keycheck.1 \
|
||||
taler-mint-reservemod.1 \
|
||||
taler-exchange-dbinit.1 \
|
||||
taler-exchange-httpd.1 \
|
||||
taler-exchange-keyup.1 \
|
||||
taler-exchange-keycheck.1 \
|
||||
taler-exchange-reservemod.1 \
|
||||
taler.conf.5
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
@ -14,10 +14,10 @@ Naming conventions:
|
||||
SHOULD NOT be included from outside of their own directory
|
||||
+ end in "_lib" for "simple" libraries
|
||||
+ end in "_plugin" for plugins
|
||||
+ end in "_service" for libraries accessing a service, i.e. the mint
|
||||
+ end in "_service" for libraries accessing a service, i.e. the exchange
|
||||
|
||||
* binaries:
|
||||
+ taler-mint-xxx: mint programs
|
||||
+ taler-exchange-xxx: exchange programs
|
||||
+ taler-merchant-xxx: merchant programs (demos)
|
||||
+ taler-wallet-xxx: wallet programs
|
||||
+ plugins should be libtaler_plugin_xxx_yyy.so: plugin yyy for API xxx
|
||||
@ -25,16 +25,16 @@ Naming conventions:
|
||||
|
||||
* logging
|
||||
+ tools use their full name in GNUNET_log_setup
|
||||
(i.e. 'taler-mint-keyup') and log using plain 'GNUNET_log'.
|
||||
(i.e. 'taler-exchange-keyup') and log using plain 'GNUNET_log'.
|
||||
+ pure libraries (without associated service) use 'GNUNET_log_from'
|
||||
with the component set to their library name (without lib or '.so'),
|
||||
which should also be their directory name (i.e. 'util')
|
||||
+ plugin libraries (without associated service) use 'GNUNET_log_from'
|
||||
with the component set to their type and plugin name (without lib or '.so'),
|
||||
which should also be their directory name (i.e. 'mintdb-postgres')
|
||||
which should also be their directory name (i.e. 'exchangedb-postgres')
|
||||
+ libraries with associated service) use 'GNUNET_log_from'
|
||||
with the name of the service, which should also be their
|
||||
directory name (i.e. 'mint')
|
||||
directory name (i.e. 'exchange')
|
||||
|
||||
* configuration
|
||||
+ same rules as for GNUnet
|
||||
@ -44,7 +44,7 @@ Naming conventions:
|
||||
MUST match the subdirectory of src/ in which the symbol is defined
|
||||
+ from libtalerutil start just with TALER_, without subsystemname
|
||||
+ if scope is ONE binary and symbols are not in a shared library,
|
||||
use binary-specific prefix (such as TMH = taler-mint-httpd) for
|
||||
use binary-specific prefix (such as TMH = taler-exchange-httpd) for
|
||||
globals, possibly followed by the subsystem (TMH_DB_xxx).
|
||||
|
||||
* structs:
|
||||
|
@ -5,14 +5,14 @@ all:
|
||||
"\tmake full - full documentation with dependency graphs (slow)\n" \
|
||||
"\tmake fast - fast mode without dependency graphs"
|
||||
|
||||
full: taler-mint.doxy
|
||||
full: taler-exchange.doxy
|
||||
doxygen $<
|
||||
|
||||
fast: taler-mint.doxy
|
||||
fast: taler-exchange.doxy
|
||||
sed 's/\(HAVE_DOT.*=\).*/\1 NO/' $< | doxygen -
|
||||
|
||||
clean:
|
||||
rm -rf html
|
||||
|
||||
|
||||
EXTRA_DIST = taler-mint.doxy
|
||||
EXTRA_DIST = taler-exchange.doxy
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "GNU Taler: Mint"
|
||||
PROJECT_NAME = "GNU Taler: Exchange"
|
||||
PROJECT_NUMBER = 0.0
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = YES
|
||||
|
0
doc/logos/fonts/OldNewspaperTypes.ttf
Executable file → Normal file
0
doc/logos/fonts/OldNewspaperTypes.ttf
Executable file → Normal file
@ -9025,7 +9025,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1978,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc748.txt",
|
||||
}
|
||||
|
||||
@ -13671,7 +13671,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1989,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1097.txt",
|
||||
}
|
||||
|
||||
@ -14377,7 +14377,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1990,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
note="Updated by RFCs 2549, 6214",
|
||||
url="http://www.ietf.org/rfc/rfc1149.txt",
|
||||
}
|
||||
@ -15260,7 +15260,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1991,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1216.txt",
|
||||
}
|
||||
|
||||
@ -15274,7 +15274,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1991,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1217.txt",
|
||||
}
|
||||
|
||||
@ -16551,7 +16551,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1992,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1313.txt",
|
||||
}
|
||||
|
||||
@ -18223,7 +18223,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1993,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1437.txt",
|
||||
}
|
||||
|
||||
@ -18237,7 +18237,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1993,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1438.txt",
|
||||
}
|
||||
|
||||
@ -20478,7 +20478,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1994,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1605.txt",
|
||||
}
|
||||
|
||||
@ -20492,7 +20492,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1994,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1606.txt",
|
||||
}
|
||||
|
||||
@ -20506,7 +20506,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1994,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1607.txt",
|
||||
}
|
||||
|
||||
@ -22753,7 +22753,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1995,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1776.txt",
|
||||
}
|
||||
|
||||
@ -24716,7 +24716,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1996,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1924.txt",
|
||||
}
|
||||
|
||||
@ -24730,7 +24730,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1996,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1925.txt",
|
||||
}
|
||||
|
||||
@ -24744,7 +24744,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1996,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1926.txt",
|
||||
}
|
||||
|
||||
@ -24758,7 +24758,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1996,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc1927.txt",
|
||||
}
|
||||
|
||||
@ -27077,7 +27077,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1997,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2100.txt",
|
||||
}
|
||||
|
||||
@ -30038,7 +30038,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1998,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2321.txt",
|
||||
}
|
||||
|
||||
@ -30052,7 +30052,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1998,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2322.txt",
|
||||
}
|
||||
|
||||
@ -30066,7 +30066,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1998,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2323.txt",
|
||||
}
|
||||
|
||||
@ -30080,7 +30080,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1998,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
note="Updated by RFC 7168",
|
||||
url="http://www.ietf.org/rfc/rfc2324.txt",
|
||||
}
|
||||
@ -30095,7 +30095,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1998,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2325.txt",
|
||||
}
|
||||
|
||||
@ -33099,7 +33099,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1999,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2549.txt",
|
||||
}
|
||||
|
||||
@ -33113,7 +33113,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1999,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2550.txt",
|
||||
}
|
||||
|
||||
@ -33127,7 +33127,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=1999,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2551.txt",
|
||||
}
|
||||
|
||||
@ -36388,7 +36388,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2000,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc2795.txt",
|
||||
}
|
||||
|
||||
@ -40323,7 +40323,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2001,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3091.txt",
|
||||
}
|
||||
|
||||
@ -40337,7 +40337,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2001,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3092.txt",
|
||||
}
|
||||
|
||||
@ -40351,7 +40351,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2001,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3093.txt",
|
||||
}
|
||||
|
||||
@ -42397,7 +42397,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2002,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3251.txt",
|
||||
}
|
||||
|
||||
@ -42411,7 +42411,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2002,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3252.txt",
|
||||
}
|
||||
|
||||
@ -45820,7 +45820,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2003,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3514.txt",
|
||||
}
|
||||
|
||||
@ -48951,7 +48951,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2004,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc3751.txt",
|
||||
}
|
||||
|
||||
@ -52675,7 +52675,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2005,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc4041.txt",
|
||||
}
|
||||
|
||||
@ -52689,7 +52689,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2005,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc4042.txt",
|
||||
}
|
||||
|
||||
@ -62743,7 +62743,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2007,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc4824.txt",
|
||||
}
|
||||
|
||||
@ -68094,7 +68094,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2008,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5241.txt",
|
||||
}
|
||||
|
||||
@ -68108,7 +68108,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2008,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5242.txt",
|
||||
}
|
||||
|
||||
@ -71194,7 +71194,7 @@
|
||||
|
||||
@misc{rfc5486,
|
||||
author="D. Malas and D. Meyer",
|
||||
title="{Session Peering for Multimedia Interconnect (SPEERMINT) Terminology}",
|
||||
title="{Session Peering for Multimedia Interconnect (SPEEREXCHANGE) Terminology}",
|
||||
series="Request for Comments",
|
||||
number="5486",
|
||||
howpublished="RFC 5486 (Informational)",
|
||||
@ -71529,7 +71529,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2009,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5513.txt",
|
||||
}
|
||||
|
||||
@ -71543,7 +71543,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2009,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5514.txt",
|
||||
}
|
||||
|
||||
@ -75706,7 +75706,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2010,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5841.txt",
|
||||
}
|
||||
|
||||
@ -77555,7 +77555,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2011,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc5984.txt",
|
||||
}
|
||||
|
||||
@ -80463,7 +80463,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2011,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6214.txt",
|
||||
}
|
||||
|
||||
@ -80503,7 +80503,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2011,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6217.txt",
|
||||
}
|
||||
|
||||
@ -82898,7 +82898,7 @@
|
||||
|
||||
@misc{rfc6404,
|
||||
author="J. Seedorf and S. Niccolini and E. Chen and H. Scholz",
|
||||
title="{Session PEERing for Multimedia INTerconnect (SPEERMINT) Security Threats and Suggested Countermeasures}",
|
||||
title="{Session PEERing for Multimedia INTerconnect (SPEEREXCHANGE) Security Threats and Suggested Countermeasures}",
|
||||
series="Request for Comments",
|
||||
number="6404",
|
||||
howpublished="RFC 6404 (Informational)",
|
||||
@ -82924,7 +82924,7 @@
|
||||
|
||||
@misc{rfc6406,
|
||||
author="D. Malas and J. Livingood",
|
||||
title="{Session PEERing for Multimedia INTerconnect (SPEERMINT) Architecture}",
|
||||
title="{Session PEERing for Multimedia INTerconnect (SPEEREXCHANGE) Architecture}",
|
||||
series="Request for Comments",
|
||||
number="6406",
|
||||
howpublished="RFC 6406 (Informational)",
|
||||
@ -85310,7 +85310,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2012,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6592.txt",
|
||||
}
|
||||
|
||||
@ -85324,7 +85324,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2012,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6593.txt",
|
||||
}
|
||||
|
||||
@ -89460,7 +89460,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2013,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6919.txt",
|
||||
}
|
||||
|
||||
@ -89487,7 +89487,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2013,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc6921.txt",
|
||||
}
|
||||
|
||||
@ -92639,7 +92639,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2014,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc7168.txt",
|
||||
}
|
||||
|
||||
@ -92653,7 +92653,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2014,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc7169.txt",
|
||||
}
|
||||
|
||||
@ -97095,7 +97095,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2015,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc7511.txt",
|
||||
}
|
||||
|
||||
@ -97135,7 +97135,7 @@
|
||||
organization="Internet Engineering Task Force",
|
||||
year=2015,
|
||||
month=apr,
|
||||
day="1",
|
||||
day="1",
|
||||
url="http://www.ietf.org/rfc/rfc7514.txt",
|
||||
}
|
||||
|
||||
@ -98711,4 +98711,3 @@
|
||||
month=sep,
|
||||
url="http://www.ietf.org/rfc/rfc7651.txt",
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
.TH TALER\-AUDITOR\-SIGN 1 "Sep 15, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-auditor\-sign \- Sign mint denomination as auditor.
|
||||
taler\-auditor\-sign \- Sign exchange denomination as auditor.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-auditor\-sign
|
||||
@ -9,7 +9,7 @@ taler\-auditor\-sign \- Sign mint denomination as auditor.
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-auditor\-sign\fP is a command line tool to be used by an auditor to sign that he is aware of certain keys being used by a mint. Using this signature, the auditor affirms that he will verify that the mint is properly accounting for those coins.
|
||||
\fBtaler\-auditor\-sign\fP is a command line tool to be used by an auditor to sign that he is aware of certain keys being used by a exchange. Using this signature, the auditor affirms that he will verify that the exchange is properly accounting for those coins.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
@ -19,11 +19,11 @@ Location of the private EdDSA auditor key. If it does not exist, it will be cre
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-m KEY, \-\-mint-key=KEY"
|
||||
Public key of the mint in Crockford base32 encoding, for example as generated by gnunet\-ecc \-p.
|
||||
.IP "\-m KEY, \-\-exchange-key=KEY"
|
||||
Public key of the exchange in Crockford base32 encoding, for example as generated by gnunet\-ecc \-p.
|
||||
.B
|
||||
.IP "\-r FILE, \-\-mint-request=FILE"
|
||||
File with the mint's denomination key signing request as generated by taler\-mint\-keyup \-o.
|
||||
.IP "\-r FILE, \-\-exchange-request=FILE"
|
||||
File with the exchange's denomination key signing request as generated by taler\-exchange\-keyup \-o.
|
||||
.B
|
||||
.IP "\-o FILE, \-\-output=FILE"
|
||||
File where the auditor should write the EdDSA signature.
|
||||
@ -32,4 +32,4 @@ File where the auditor should write the EdDSA signature.
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-keyup\fP(1), \fBgnunet\-ecc\fP(1), \fBtaler.conf\fP(5)
|
||||
\fBtaler\-exchange\-keyup\fP(1), \fBgnunet\-ecc\fP(1), \fBtaler.conf\fP(5)
|
||||
|
29
doc/taler-exchange-dbinit.1
Normal file
29
doc/taler-exchange-dbinit.1
Normal file
@ -0,0 +1,29 @@
|
||||
.TH TALER\-EXCHANGE\-DBINIT 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-exchange\-dbinit \- Initialize Taler exchange database.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-exchange\-dbinit
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-exchange\-dbinit\fP is a command line tool to initialize the Taler exchange database. It creates the necessary tables and indices for the Taler exchange to operate.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-exchange-dir=DIRNAME"
|
||||
Use the configuration and other resources for the exchange to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-reservemod\fP(1), \fBtaler.conf\fP(5)
|
39
doc/taler-exchange-httpd.1
Normal file
39
doc/taler-exchange-httpd.1
Normal file
@ -0,0 +1,39 @@
|
||||
.TH TALER\-EXCHANGE\-HTTPD 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-exchange\-httpd \- Run Taler exchange (with RESTful API)
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-exchange\-httpd
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-exchange\-httpd\fP is a command line tool to run the Taler exchange (HTTP server). The required configuration, keys and database must exist before running this command.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-C, \-\-connection-close"
|
||||
Force each HTTP connection to be closed after each request (useful in combination with \-f to avoid having to wait for nc to time out).
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-exchange-dir=DIRNAME"
|
||||
Use the configuration and other resources for the exchange to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
.B
|
||||
.IP "\-f FILENAME, \-\-file\-input=FILENAME"
|
||||
This option is only available if the exchange was compiled with the configure option
|
||||
\-\-enable\-developer\-mode. It is used for generating test cases against the exchange using AFL. When this option is present, the HTTP server will (1) terminate after the first client's HTTP connection is completed, and (2) automatically start such a client using a helper process based on the 'nc' or 'ncat' binary using FILENAME as the standard input to the helper process. As a result, the process will effectively run with FILENAME as the input from an HTTP client and then immediately exit. This is useful to test taler\-exchange\-httpd against many different possible inputs in a controlled way.
|
||||
.B
|
||||
.IP \"-t SECONDS, \-\-timeout=SECONDS"
|
||||
Specifies the number of SECONDS after which the HTTPD should close (idle) HTTP connections.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-exchange\-dbinit\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-reservemod\fP(1), \fBtaler.conf\fP(5)
|
29
doc/taler-exchange-keycheck.1
Normal file
29
doc/taler-exchange-keycheck.1
Normal file
@ -0,0 +1,29 @@
|
||||
.TH TALER\-EXCHANGE\-KEYCHECK 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-exchange\-keycheck \- Check validity of Taler signing and denomination keys.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-exchange\-keycheck
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-exchange\-keycheck\fP can be used to check if the signing and denomination keys in the operation directory are well-formed. This can be useful after importing fresh keys from the offline system to ensure that the files are correct.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-exchange-dir=DIRNAME"
|
||||
Use the configuration and other resources for the exchange to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-dbinit\fP(1), \fBtaler.conf\fP(5)
|
38
doc/taler-exchange-keyup.1
Normal file
38
doc/taler-exchange-keyup.1
Normal file
@ -0,0 +1,38 @@
|
||||
.TH TALER\-EXCHANGE\-KEYUP 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-exchange\-keyup \- Setup Taler exchange denomination and signing keys.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-exchange\-keyup
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-exchange\-keyup\fP is a command line tool to setup Taler denomination and signing keys. This tool requires access to the exchange's long-term offline signing key and should be run in a secure (offline) environment under strict controls. The resulting keys can then be copied to the main online directory where the Taler HTTP server operates.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-exchange-dir=DIRNAME"
|
||||
Use the configuration and other resources for the exchange to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-m FILE, \-\-master-key=FILE"
|
||||
Location of the private EdDSA offline master key of the exchange.
|
||||
.B
|
||||
.IP "\-o FILE, \-\-ouptut=FILE"
|
||||
Where to write a denomination key signing request file to be given to the auditor.
|
||||
.B
|
||||
.IP "\-t TIMESTAMP, \-\-time=TIMESTAMP"
|
||||
Operate as if the current time was TIMESTAMP.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-keycheck\fP(1), \fBtaler.conf\fP(5)
|
35
doc/taler-exchange-reservemod.1
Normal file
35
doc/taler-exchange-reservemod.1
Normal file
@ -0,0 +1,35 @@
|
||||
.TH TALER\-EXCHANGE\-RESERVEMOD 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-exchange\-reservemod \- Modify reserve balance in the Taler exchange database.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-exchange\-reservemod
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-exchange\-reservemod\fP is a command line tool to modify reserves in the Taler exchange database. Basically, it can be used to import deposits, either for testing or as part of the import from the list of incoming transactions.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-a DENOM, \-\-add=DENOM"
|
||||
Amount to add to the reserve.
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-exchange-dir=DIRNAME"
|
||||
Use the configuration and other resources for the exchange to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-R KEY, \-\-reserve=KEY"
|
||||
Public EdDSA key of the reserve to modify.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-dbinit\fP(1), \fBtaler.conf\fP(5)
|
@ -1,15 +1,15 @@
|
||||
.TH TALER\-MINT\-SEPA 1 "Apr 22, 2015" "GNU Taler"
|
||||
.TH TALER\-EXCHANGE\-SEPA 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-sepa \- Create the master-key signed response to /wire/sepa.
|
||||
taler\-exchange\-sepa \- Create the master-key signed response to /wire/sepa.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-sepa
|
||||
.B taler\-exchange\-sepa
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-sepa\fP is used to create the mint's reply to a /wire/sepa request. It converts the bank details into the appropriate signed response. This needs to be done using the long-term offline master key.
|
||||
\fBtaler\-exchange\-sepa\fP is used to create the exchange's reply to a /wire/sepa request. It converts the bank details into the appropriate signed response. This needs to be done using the long-term offline master key.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
@ -23,7 +23,7 @@ Specifies the IBAN to use.
|
||||
Specifies the name of the account holder.
|
||||
.B
|
||||
.IP "\-m MASTERKEYFILE, \-\-master=MASTERKEYFILE"
|
||||
Specifies the name of the file containing the mint's master key.
|
||||
Specifies the name of the file containing the exchange's master key.
|
||||
.B
|
||||
.IP "\-o FILENAME, \-\-output=FILENAME"
|
||||
Where to write the SEPA_RESPONSE_FILE.
|
||||
@ -38,4 +38,4 @@ Print version information.
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler.conf\fP(5)
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler.conf\fP(5)
|
@ -1,29 +0,0 @@
|
||||
.TH TALER\-MINT\-DBINIT 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-dbinit \- Initialize Taler mint database.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-dbinit
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-dbinit\fP is a command line tool to initialize the Taler mint database. It creates the necessary tables and indices for the Taler mint to operate.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-mint-dir=DIRNAME"
|
||||
Use the configuration and other resources for the mint to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-reservemod\fP(1), \fBtaler.conf\fP(5)
|
@ -1,39 +0,0 @@
|
||||
.TH TALER\-MINT\-HTTPD 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-httpd \- Run Taler mint (with RESTful API)
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-httpd
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-httpd\fP is a command line tool to run the Taler mint (HTTP server). The required configuration, keys and database must exist before running this command.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-C, \-\-connection-close"
|
||||
Force each HTTP connection to be closed after each request (useful in combination with \-f to avoid having to wait for nc to time out).
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-mint-dir=DIRNAME"
|
||||
Use the configuration and other resources for the mint to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
.B
|
||||
.IP "\-f FILENAME, \-\-file\-input=FILENAME"
|
||||
This option is only available if the mint was compiled with the configure option
|
||||
\-\-enable\-developer\-mode. It is used for generating test cases against the mint using AFL. When this option is present, the HTTP server will (1) terminate after the first client's HTTP connection is completed, and (2) automatically start such a client using a helper process based on the 'nc' or 'ncat' binary using FILENAME as the standard input to the helper process. As a result, the process will effectively run with FILENAME as the input from an HTTP client and then immediately exit. This is useful to test taler\-mint\-httpd against many different possible inputs in a controlled way.
|
||||
.B
|
||||
.IP \"-t SECONDS, \-\-timeout=SECONDS"
|
||||
Specifies the number of SECONDS after which the HTTPD should close (idle) HTTP connections.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-dbinit\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-reservemod\fP(1), \fBtaler.conf\fP(5)
|
@ -1,29 +0,0 @@
|
||||
.TH TALER\-MINT\-KEYCHECK 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-keycheck \- Check validity of Taler signing and denomination keys.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-keycheck
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-keycheck\fP can be used to check if the signing and denomination keys in the operation directory are well-formed. This can be useful after importing fresh keys from the offline system to ensure that the files are correct.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-mint-dir=DIRNAME"
|
||||
Use the configuration and other resources for the mint to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-dbinit\fP(1), \fBtaler.conf\fP(5)
|
@ -1,38 +0,0 @@
|
||||
.TH TALER\-MINT\-KEYUP 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-keyup \- Setup Taler mint denomination and signing keys.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-keyup
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-keyup\fP is a command line tool to setup Taler denomination and signing keys. This tool requires access to the mint's long-term offline signing key and should be run in a secure (offline) environment under strict controls. The resulting keys can then be copied to the main online directory where the Taler HTTP server operates.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-mint-dir=DIRNAME"
|
||||
Use the configuration and other resources for the mint to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-m FILE, \-\-master-key=FILE"
|
||||
Location of the private EdDSA offline master key of the mint.
|
||||
.B
|
||||
.IP "\-o FILE, \-\-ouptut=FILE"
|
||||
Where to write a denomination key signing request file to be given to the auditor.
|
||||
.B
|
||||
.IP "\-t TIMESTAMP, \-\-time=TIMESTAMP"
|
||||
Operate as if the current time was TIMESTAMP.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-keycheck\fP(1), \fBtaler.conf\fP(5)
|
@ -1,35 +0,0 @@
|
||||
.TH TALER\-MINT\-RESERVEMOD 1 "Apr 22, 2015" "GNU Taler"
|
||||
|
||||
.SH NAME
|
||||
taler\-mint\-reservemod \- Modify reserve balance in the Taler mint database.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B taler\-mint\-reservemod
|
||||
.RI [ options ]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBtaler\-mint\-reservemod\fP is a command line tool to modify reserves in the Taler mint database. Basically, it can be used to import deposits, either for testing or as part of the import from the list of incoming transactions.
|
||||
|
||||
.SH OPTIONS
|
||||
.B
|
||||
.IP "\-a DENOM, \-\-add=DENOM"
|
||||
Amount to add to the reserve.
|
||||
.B
|
||||
.IP "\-d DIRNAME, \-\-mint-dir=DIRNAME"
|
||||
Use the configuration and other resources for the mint to operate from DIRNAME.
|
||||
.B
|
||||
.IP "\-h, \-\-help"
|
||||
Print short help on options.
|
||||
.B
|
||||
.IP "\-R KEY, \-\-reserve=KEY"
|
||||
Public EdDSA key of the reserve to modify.
|
||||
.B
|
||||
.IP "\-v, \-\-version"
|
||||
Print version information.
|
||||
|
||||
.SH BUGS
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-dbinit\fP(1), \fBtaler.conf\fP(5)
|
@ -10,9 +10,9 @@ taler.conf \- Taler configuration file.
|
||||
|
||||
The basic structure of the configuration file is the following. The file is split into sections. Every section begins with "[SECTIONNAME]" and contains a number of options of the form "OPTION=VALUE". Empty lines and lines beginning with a "#" are treated as comments.
|
||||
|
||||
.SH MINT OPTIONS
|
||||
.SH EXCHANGE OPTIONS
|
||||
|
||||
The following options are from the "[mint]" section and used by most mint tools:
|
||||
The following options are from the "[exchange]" section and used by most exchange tools:
|
||||
|
||||
.IP CURRENCY
|
||||
Name of the currency, i.e. "EUR" for Euro.
|
||||
@ -23,32 +23,32 @@ The following options are from the "[mint]" section and used by most mint tools:
|
||||
.IP PORT
|
||||
Port on which the HTTP server listens, i.e. 8080.
|
||||
.IP MASTER_PUBLIC_KEY
|
||||
Crockford Base32-encoded master public key, public version of the mint\'s long\-time offline signing key.
|
||||
Crockford Base32-encoded master public key, public version of the exchange\'s long\-time offline signing key.
|
||||
|
||||
|
||||
.SH WIRE transfer details
|
||||
|
||||
The following options must be in section "[mint-wire-test]":
|
||||
The following options must be in section "[exchange-wire-test]":
|
||||
|
||||
.IP REDIRECT_URL
|
||||
URL to redirect /wire/test to. Should contain a Web form the user can use to charge his wallet with coins in a "test" currency for testing. If this option is not provided, /wire/test will return "501 NOT IMPLEMENTED".
|
||||
|
||||
The following options must be in section "[mint-wire-sepa]":
|
||||
The following options must be in section "[exchange-wire-sepa]":
|
||||
|
||||
.IP SEPA_RESPONSE_FILE
|
||||
Filename with the JSON body for the /wire/sepa response, signed using the mint's long-term offline master key. If this option is not provided, /wire/test will return "501 NOT IMPLEMENTED". Use "taler-mint-sepa" to create the SEPA_RESPONSE_FILE.
|
||||
Filename with the JSON body for the /wire/sepa response, signed using the exchange's long-term offline master key. If this option is not provided, /wire/test will return "501 NOT IMPLEMENTED". Use "taler-exchange-sepa" to create the SEPA_RESPONSE_FILE.
|
||||
|
||||
|
||||
.SH Postgres database options
|
||||
|
||||
The following options must be in section "[mintdb-postgres]":
|
||||
The following options must be in section "[exchangedb-postgres]":
|
||||
|
||||
.IP DB_CONN_STR
|
||||
How to access the database, i.e. "postgres:///taler" to use the "taler" database. Testcases use "talercheck".
|
||||
|
||||
.SH COIN OPTIONS
|
||||
|
||||
The following options must be in sections starting with "[coin_]" and are used by taler\-mint\-keyup to create denomination keys:
|
||||
The following options must be in sections starting with "[coin_]" and are used by taler\-exchange\-keyup to create denomination keys:
|
||||
|
||||
.IP VALUE
|
||||
Value of the coin, i.e. "EUR:1.50" for 1 Euro and 50 Cents (per coin).
|
||||
@ -69,7 +69,7 @@ The following options must be in sections starting with "[coin_]" and are used b
|
||||
|
||||
.SH KEY OPTIONS
|
||||
|
||||
The following options are from the "[mint_keys]" section and used by most taler\-mint\-keyup to create keys:
|
||||
The following options are from the "[exchange_keys]" section and used by most taler\-exchange\-keyup to create keys:
|
||||
|
||||
.IP SIGNKEY_DURATION
|
||||
For how long is a signing key valid?
|
||||
@ -85,5 +85,5 @@ The following options are from the "[mint_keys]" section and used by most taler\
|
||||
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <taler@gnu.org>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBtaler\-mint\-httpd\fP(1), \fBtaler\-mint\-keyup\fP(1), \fBtaler\-mint\-reservemod\fP(1), \fBtaler\-mint\-dbinit\fP(1), \fBtaler\-mint\-sepa(1)
|
||||
\fBtaler\-exchange\-httpd\fP(1), \fBtaler\-exchange\-keyup\fP(1), \fBtaler\-exchange\-reservemod\fP(1), \fBtaler\-exchange\-dbinit\fP(1), \fBtaler\-exchange\-sepa(1)
|
||||
|
||||
|
@ -3,16 +3,24 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
|
||||
if HAVE_POSTGRESQL
|
||||
PQ_DIR = pq
|
||||
endif
|
||||
if HAVE_LIBCURL
|
||||
BANK_LIB = bank-lib
|
||||
else
|
||||
if HAVE_LIBGNURL
|
||||
BANK_LIB = bank-lib
|
||||
endif
|
||||
endif
|
||||
|
||||
if WALLET_ONLY
|
||||
SUBDIRS = include util
|
||||
else
|
||||
|
||||
SUBDIRS = include util $(PQ_DIR) bank-lib wire mintdb mint mint-tools
|
||||
SUBDIRS = include util $(PQ_DIR) $(BANK_LIB) wire exchangedb exchange exchange-tools
|
||||
if HAVE_LIBCURL
|
||||
SUBDIRS += mint-lib
|
||||
SUBDIRS += exchange-lib
|
||||
else
|
||||
if HAVE_LIBGNURL
|
||||
SUBDIRS += mint-lib
|
||||
SUBDIRS += exchange-lib
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -390,7 +390,7 @@ TALER_BANK_fini (struct TALER_BANK_Context *ctx)
|
||||
/**
|
||||
* Obtain the URL to use for an API request.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @param path Taler API path (i.e. "/reserve/withdraw")
|
||||
* @return the full URI to use with cURL
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_json.h
|
||||
* @file exchange-lib/exchange_api_json.h
|
||||
* @brief functions to parse incoming requests (JSON snippets)
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
@ -349,4 +349,4 @@ BAJ_spec_rsa_signature (const char *name,
|
||||
|
||||
|
||||
|
||||
/* end of mint_api_json.h */
|
||||
/* end of exchange_api_json.h */
|
||||
|
62
src/exchange-lib/Makefile.am
Normal file
62
src/exchange-lib/Makefile.am
Normal file
@ -0,0 +1,62 @@
|
||||
# This Makefile.am is in the public domain
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/include
|
||||
|
||||
if USE_COVERAGE
|
||||
AM_CFLAGS = --coverage -O0
|
||||
XLIB = -lgcov
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libtalerexchange.la
|
||||
|
||||
libtalerexchange_la_LDFLAGS = \
|
||||
-version-info 0:0:0 \
|
||||
-no-undefined
|
||||
|
||||
libtalerexchange_la_SOURCES = \
|
||||
exchange_api_common.c exchange_api_common.h \
|
||||
exchange_api_context.c exchange_api_context.h \
|
||||
exchange_api_json.c exchange_api_json.h \
|
||||
exchange_api_handle.c exchange_api_handle.h \
|
||||
exchange_api_admin.c \
|
||||
exchange_api_deposit.c \
|
||||
exchange_api_deposit_wtid.c \
|
||||
exchange_api_refresh.c \
|
||||
exchange_api_refresh_link.c \
|
||||
exchange_api_reserve.c \
|
||||
exchange_api_wire.c \
|
||||
exchange_api_wire_deposits.c
|
||||
|
||||
libtalerexchange_la_LIBADD = \
|
||||
-lgnunetutil \
|
||||
-ljansson \
|
||||
$(XLIB)
|
||||
|
||||
if HAVE_LIBCURL
|
||||
libtalerexchange_la_LIBADD += -lcurl
|
||||
else
|
||||
if HAVE_LIBGNURL
|
||||
libtalerexchange_la_LIBADD += -lgnurl
|
||||
endif
|
||||
endif
|
||||
|
||||
check_PROGRAMS = \
|
||||
test_exchange_api
|
||||
|
||||
TESTS = \
|
||||
$(check_PROGRAMS)
|
||||
|
||||
test_exchange_api_SOURCES = \
|
||||
test_exchange_api.c
|
||||
test_exchange_api_LDADD = \
|
||||
libtalerexchange.la \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
-lgnunetutil \
|
||||
-ljansson
|
||||
|
||||
EXTRA_DIST = \
|
||||
test-exchange-home/config/exchange-common.conf \
|
||||
test-exchange-home/master.priv \
|
||||
test-exchange-home/denomkeys/ \
|
||||
test-exchange-home/signkeys/
|
@ -16,9 +16,9 @@
|
||||
#
|
||||
#
|
||||
# This will generate testcases in a directory 'afl-tests', which can then
|
||||
# be moved into src/mint/afl-tests/ to be run during mint-testing.
|
||||
# be moved into src/exchange/afl-tests/ to be run during exchange-testing.
|
||||
#
|
||||
# This script uses American Fuzzy Loop (AFL) to fuzz the mint to
|
||||
# This script uses American Fuzzy Loop (AFL) to fuzz the exchange to
|
||||
# automatically create tests with good coverage. You must install
|
||||
# AFL and set AFL_HOME to the directory where AFL is installed
|
||||
# before running. Also, a directory "baseline/" should exist with
|
||||
@ -31,4 +31,4 @@
|
||||
#
|
||||
# Must be run from this directory.
|
||||
#
|
||||
$AFL_HOME/afl-fuzz -i baseline/ -m 250 -o afl-tests/ -f /tmp/afl-input taler-mint-httpd -f /tmp/afl-input -d test-mint-home/ -C
|
||||
$AFL_HOME/afl-fuzz -i baseline/ -m 250 -o afl-tests/ -f /tmp/afl-input taler-exchange-httpd -f /tmp/afl-input -d test-exchange-home/ -C
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_admin.c
|
||||
* @brief Implementation of the /admin/ requests of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_admin.c
|
||||
* @brief Implementation of the /admin/ requests of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,23 +24,23 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief An admin/add/incoming Handle
|
||||
*/
|
||||
struct TALER_MINT_AdminAddIncomingHandle
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -65,7 +65,7 @@ struct TALER_MINT_AdminAddIncomingHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_AdminAddIncomingResultCallback cb;
|
||||
TALER_EXCHANGE_AdminAddIncomingResultCallback cb;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -84,14 +84,14 @@ struct TALER_MINT_AdminAddIncomingHandle
|
||||
* Function called when we're done processing the
|
||||
* HTTP /admin/add/incoming request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_AdminAddIncomingHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_AdminAddIncomingHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_admin_add_incoming_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_AdminAddIncomingHandle *aai = cls;
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle *aai = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -106,14 +106,14 @@ handle_admin_add_incoming_finished (void *cls,
|
||||
case MHD_HTTP_OK:
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_FORBIDDEN:
|
||||
/* Access denied */
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; as we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
@ -138,17 +138,17 @@ handle_admin_add_incoming_finished (void *cls,
|
||||
response_code,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_admin_add_incoming_cancel (aai);
|
||||
TALER_EXCHANGE_admin_add_incoming_cancel (aai);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notify the mint that we have received an incoming transaction
|
||||
* Notify the exchange that we have received an incoming transaction
|
||||
* which fills a reserve. Note that this API is an administrative
|
||||
* API and thus not accessible to typical mint clients, but only
|
||||
* to the operators of the mint.
|
||||
* API and thus not accessible to typical exchange clients, but only
|
||||
* to the operators of the exchange.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param reserve_pub public key of the reserve
|
||||
* @param amount amount that was deposited
|
||||
* @param execution_date when did we receive the amount
|
||||
@ -159,24 +159,24 @@ handle_admin_add_incoming_finished (void *cls,
|
||||
* if the inputs are invalid (i.e. invalid amount).
|
||||
* In this case, the callback is not called.
|
||||
*/
|
||||
struct TALER_MINT_AdminAddIncomingHandle *
|
||||
TALER_MINT_admin_add_incoming (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle *
|
||||
TALER_EXCHANGE_admin_add_incoming (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
struct GNUNET_TIME_Absolute execution_date,
|
||||
const json_t *wire,
|
||||
TALER_MINT_AdminAddIncomingResultCallback res_cb,
|
||||
TALER_EXCHANGE_AdminAddIncomingResultCallback res_cb,
|
||||
void *res_cb_cls)
|
||||
{
|
||||
struct TALER_MINT_AdminAddIncomingHandle *aai;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle *aai;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
json_t *admin_obj;
|
||||
CURL *eh;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_round_abs_time (&execution_date));
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -188,11 +188,11 @@ TALER_MINT_admin_add_incoming (struct TALER_MINT_Handle *mint,
|
||||
"amount", TALER_json_from_amount (amount),
|
||||
"execution_date", TALER_json_from_abs (execution_date),
|
||||
"wire", wire);
|
||||
aai = GNUNET_new (struct TALER_MINT_AdminAddIncomingHandle);
|
||||
aai->mint = mint;
|
||||
aai = GNUNET_new (struct TALER_EXCHANGE_AdminAddIncomingHandle);
|
||||
aai->exchange = exchange;
|
||||
aai->cb = res_cb;
|
||||
aai->cb_cls = res_cb_cls;
|
||||
aai->url = MAH_path_to_url (mint, "/admin/add/incoming");
|
||||
aai->url = MAH_path_to_url (exchange, "/admin/add/incoming");
|
||||
|
||||
eh = curl_easy_init ();
|
||||
GNUNET_assert (NULL != (aai->json_enc =
|
||||
@ -219,7 +219,7 @@ TALER_MINT_admin_add_incoming (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&aai->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
aai->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -236,7 +236,7 @@ TALER_MINT_admin_add_incoming (struct TALER_MINT_Handle *mint,
|
||||
* @param aai the admin add incoming request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_admin_add_incoming_cancel (struct TALER_MINT_AdminAddIncomingHandle *aai)
|
||||
TALER_EXCHANGE_admin_add_incoming_cancel (struct TALER_EXCHANGE_AdminAddIncomingHandle *aai)
|
||||
{
|
||||
if (NULL != aai->job)
|
||||
{
|
||||
@ -251,4 +251,4 @@ TALER_MINT_admin_add_incoming_cancel (struct TALER_MINT_AdminAddIncomingHandle *
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_admin.c */
|
||||
/* end of exchange_api_admin.c */
|
@ -15,20 +15,20 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_common.c
|
||||
* @brief common functions for the mint API
|
||||
* @file exchange-lib/exchange_api_common.c
|
||||
* @brief common functions for the exchange API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* Verify a coins transaction history as returned by the mint.
|
||||
* Verify a coins transaction history as returned by the exchange.
|
||||
*
|
||||
* @param currency expected currency for the coin
|
||||
* @param coin_pub public key of the coin
|
||||
@ -37,7 +37,7 @@
|
||||
* @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
int
|
||||
TALER_MINT_verify_coin_history_ (const char *currency,
|
||||
TALER_EXCHANGE_verify_coin_history_ (const char *currency,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
json_t *history,
|
||||
struct TALER_Amount *total)
|
||||
@ -180,7 +180,7 @@ TALER_MINT_verify_coin_history_ (const char *currency,
|
||||
total,
|
||||
&amount))
|
||||
{
|
||||
/* overflow in history already!? inconceivable! Bad mint! */
|
||||
/* overflow in history already!? inconceivable! Bad exchange! */
|
||||
GNUNET_break_op (0);
|
||||
MAJ_parse_free (spec);
|
||||
return GNUNET_SYSERR;
|
||||
@ -191,4 +191,4 @@ TALER_MINT_verify_coin_history_ (const char *currency,
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_common.c */
|
||||
/* end of exchange_api_common.c */
|
@ -15,16 +15,16 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_common.h
|
||||
* @brief common functions for the mint API
|
||||
* @file exchange-lib/exchange_api_common.h
|
||||
* @brief common functions for the exchange API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include <jansson.h>
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "taler_exchange_service.h"
|
||||
|
||||
/**
|
||||
* Verify a coins transaction history as returned by the mint.
|
||||
* Verify a coins transaction history as returned by the exchange.
|
||||
*
|
||||
* @param currency expected currency for the coin
|
||||
* @param coin_pub public key of the coin
|
||||
@ -33,9 +33,9 @@
|
||||
* @return #GNUNET_OK if @a history is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
int
|
||||
TALER_MINT_verify_coin_history_ (const char *currency,
|
||||
TALER_EXCHANGE_verify_coin_history_ (const char *currency,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
json_t *history,
|
||||
struct TALER_Amount *total);
|
||||
|
||||
/* end of mint_api_common.h */
|
||||
/* end of exchange_api_common.h */
|
@ -15,15 +15,15 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_context.c
|
||||
* @brief Implementation of the context part of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_context.c
|
||||
* @brief Implementation of the context part of the exchange's HTTP API
|
||||
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include <curl/curl.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_context.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -51,11 +51,11 @@
|
||||
* Failsafe flag. Raised if our constructor fails to initialize
|
||||
* the Curl library.
|
||||
*/
|
||||
static int TALER_MINT_curl_fail;
|
||||
static int TALER_EXCHANGE_curl_fail;
|
||||
|
||||
|
||||
/**
|
||||
* Jobs are CURL requests running within a `struct TALER_MINT_Context`.
|
||||
* Jobs are CURL requests running within a `struct TALER_EXCHANGE_Context`.
|
||||
*/
|
||||
struct MAC_Job
|
||||
{
|
||||
@ -78,7 +78,7 @@ struct MAC_Job
|
||||
/**
|
||||
* Context this job runs in.
|
||||
*/
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
|
||||
/**
|
||||
* Function to call upon completion.
|
||||
@ -96,7 +96,7 @@ struct MAC_Job
|
||||
/**
|
||||
* Context
|
||||
*/
|
||||
struct TALER_MINT_Context
|
||||
struct TALER_EXCHANGE_Context
|
||||
{
|
||||
/**
|
||||
* Curl multi handle
|
||||
@ -133,14 +133,14 @@ struct TALER_MINT_Context
|
||||
*
|
||||
* @return library context
|
||||
*/
|
||||
struct TALER_MINT_Context *
|
||||
TALER_MINT_init ()
|
||||
struct TALER_EXCHANGE_Context *
|
||||
TALER_EXCHANGE_init ()
|
||||
{
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
CURLM *multi;
|
||||
CURLSH *share;
|
||||
|
||||
if (TALER_MINT_curl_fail)
|
||||
if (TALER_EXCHANGE_curl_fail)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||
"Curl was not initialised properly\n");
|
||||
@ -158,7 +158,7 @@ TALER_MINT_init ()
|
||||
"Failed to create a Curl share handle\n");
|
||||
return NULL;
|
||||
}
|
||||
ctx = GNUNET_new (struct TALER_MINT_Context);
|
||||
ctx = GNUNET_new (struct TALER_EXCHANGE_Context);
|
||||
ctx->multi = multi;
|
||||
ctx->share = share;
|
||||
GNUNET_assert (NULL != (ctx->json_header =
|
||||
@ -186,7 +186,7 @@ TALER_MINT_init ()
|
||||
* @param jcc_cls closure for @a jcc
|
||||
*/
|
||||
struct MAC_Job *
|
||||
MAC_job_add (struct TALER_MINT_Context *ctx,
|
||||
MAC_job_add (struct TALER_EXCHANGE_Context *ctx,
|
||||
CURL *eh,
|
||||
int add_json,
|
||||
MAC_JobCompletionCallback jcc,
|
||||
@ -252,7 +252,7 @@ MAC_easy_to_closure (CURL *eh)
|
||||
void
|
||||
MAC_job_cancel (struct MAC_Job *job)
|
||||
{
|
||||
struct TALER_MINT_Context *ctx = job->ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx = job->ctx;
|
||||
|
||||
GNUNET_CONTAINER_DLL_remove (ctx->jobs_head,
|
||||
ctx->jobs_tail,
|
||||
@ -271,7 +271,7 @@ MAC_job_cancel (struct MAC_Job *job)
|
||||
* @param ctx the library context
|
||||
*/
|
||||
void
|
||||
TALER_MINT_perform (struct TALER_MINT_Context *ctx)
|
||||
TALER_EXCHANGE_perform (struct TALER_EXCHANGE_Context *ctx)
|
||||
{
|
||||
CURLMsg *cmsg;
|
||||
struct MAC_Job *job;
|
||||
@ -299,12 +299,12 @@ TALER_MINT_perform (struct TALER_MINT_Context *ctx)
|
||||
|
||||
/**
|
||||
* Obtain the information for a select() call to wait until
|
||||
* #TALER_MINT_perform() is ready again. Note that calling
|
||||
* any other TALER_MINT-API may also imply that the library
|
||||
* is again ready for #TALER_MINT_perform().
|
||||
* #TALER_EXCHANGE_perform() is ready again. Note that calling
|
||||
* any other TALER_EXCHANGE-API may also imply that the library
|
||||
* is again ready for #TALER_EXCHANGE_perform().
|
||||
*
|
||||
* Basically, a client should use this API to prepare for select(),
|
||||
* then block on select(), then call #TALER_MINT_perform() and then
|
||||
* then block on select(), then call #TALER_EXCHANGE_perform() and then
|
||||
* start again until the work with the context is done.
|
||||
*
|
||||
* This function will NOT zero out the sets and assumes that @a max_fd
|
||||
@ -323,10 +323,10 @@ TALER_MINT_perform (struct TALER_MINT_Context *ctx)
|
||||
* to be passed to select().)
|
||||
* @param timeout set to the timeout in milliseconds (!); -1 means
|
||||
* no timeout (NULL, blocking forever is OK), 0 means to
|
||||
* proceed immediately with #TALER_MINT_perform().
|
||||
* proceed immediately with #TALER_EXCHANGE_perform().
|
||||
*/
|
||||
void
|
||||
TALER_MINT_get_select_info (struct TALER_MINT_Context *ctx,
|
||||
TALER_EXCHANGE_get_select_info (struct TALER_EXCHANGE_Context *ctx,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *except_fd_set,
|
||||
@ -368,7 +368,7 @@ TALER_MINT_get_select_info (struct TALER_MINT_Context *ctx,
|
||||
* @param ctx the library context
|
||||
*/
|
||||
void
|
||||
TALER_MINT_fini (struct TALER_MINT_Context *ctx)
|
||||
TALER_EXCHANGE_fini (struct TALER_EXCHANGE_Context *ctx)
|
||||
{
|
||||
/* all jobs must have been cancelled at this time, assert this */
|
||||
GNUNET_assert (NULL == ctx->jobs_head);
|
||||
@ -508,7 +508,7 @@ MAC_download_get_result (struct MAC_DownloadBuffer *db,
|
||||
*/
|
||||
__attribute__ ((constructor))
|
||||
void
|
||||
TALER_MINT_constructor__ (void)
|
||||
TALER_EXCHANGE_constructor__ (void)
|
||||
{
|
||||
CURLcode ret;
|
||||
|
||||
@ -517,7 +517,7 @@ TALER_MINT_constructor__ (void)
|
||||
CURL_STRERROR (GNUNET_ERROR_TYPE_ERROR,
|
||||
"curl_global_init",
|
||||
ret);
|
||||
TALER_MINT_curl_fail = 1;
|
||||
TALER_EXCHANGE_curl_fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,11 +527,11 @@ TALER_MINT_constructor__ (void)
|
||||
*/
|
||||
__attribute__ ((destructor))
|
||||
void
|
||||
TALER_MINT_destructor__ (void)
|
||||
TALER_EXCHANGE_destructor__ (void)
|
||||
{
|
||||
if (TALER_MINT_curl_fail)
|
||||
if (TALER_EXCHANGE_curl_fail)
|
||||
return;
|
||||
curl_global_cleanup ();
|
||||
}
|
||||
|
||||
/* end of mint_api_context.c */
|
||||
/* end of exchange_api_context.c */
|
@ -15,15 +15,15 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_context.h
|
||||
* @brief Internal interface to the context part of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_context.h
|
||||
* @brief Internal interface to the context part of the exchange's HTTP API
|
||||
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include <curl/curl.h>
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ typedef void
|
||||
* @param jcc_cls closure for @a jcc
|
||||
*/
|
||||
struct MAC_Job *
|
||||
MAC_job_add (struct TALER_MINT_Context *ctx,
|
||||
MAC_job_add (struct TALER_EXCHANGE_Context *ctx,
|
||||
CURL *eh,
|
||||
int add_json,
|
||||
MAC_JobCompletionCallback jcc,
|
||||
@ -166,4 +166,4 @@ MAC_download_get_result (struct MAC_DownloadBuffer *db,
|
||||
long *response_code);
|
||||
|
||||
|
||||
/* end of mint_api_context.h */
|
||||
/* end of exchange_api_context.h */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_deposit.c
|
||||
* @brief Implementation of the /deposit request of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_deposit.c
|
||||
* @brief Implementation of the /deposit request of the exchange's HTTP API
|
||||
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
@ -25,24 +25,24 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A Deposit Handle
|
||||
*/
|
||||
struct TALER_MINT_DepositHandle
|
||||
struct TALER_EXCHANGE_DepositHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -62,7 +62,7 @@ struct TALER_MINT_DepositHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_DepositResultCallback cb;
|
||||
TALER_EXCHANGE_DepositResultCallback cb;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -75,7 +75,7 @@ struct TALER_MINT_DepositHandle
|
||||
struct MAC_DownloadBuffer db;
|
||||
|
||||
/**
|
||||
* Information the mint should sign in response.
|
||||
* Information the exchange should sign in response.
|
||||
*/
|
||||
struct TALER_DepositConfirmationPS depconf;
|
||||
|
||||
@ -94,22 +94,22 @@ struct TALER_MINT_DepositHandle
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* from the mint is valid.
|
||||
* from the exchange is valid.
|
||||
*
|
||||
* @param dh deposit handle
|
||||
* @param json json reply with the signature
|
||||
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_deposit_signature_ok (const struct TALER_MINT_DepositHandle *dh,
|
||||
verify_deposit_signature_ok (const struct TALER_EXCHANGE_DepositHandle *dh,
|
||||
json_t *json)
|
||||
{
|
||||
struct TALER_MintSignatureP mint_sig;
|
||||
struct TALER_MintPublicKeyP mint_pub;
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
struct TALER_ExchangeSignatureP exchange_sig;
|
||||
struct TALER_ExchangePublicKeyP exchange_pub;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("sig", &mint_sig),
|
||||
MAJ_spec_fixed_auto ("pub", &mint_pub),
|
||||
MAJ_spec_fixed_auto ("sig", &exchange_sig),
|
||||
MAJ_spec_fixed_auto ("pub", &exchange_pub),
|
||||
MAJ_spec_end
|
||||
};
|
||||
|
||||
@ -120,19 +120,19 @@ verify_deposit_signature_ok (const struct TALER_MINT_DepositHandle *dh,
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
key_state = TALER_MINT_get_keys (dh->mint);
|
||||
key_state = TALER_EXCHANGE_get_keys (dh->exchange);
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_test_signing_key (key_state,
|
||||
&mint_pub))
|
||||
TALER_EXCHANGE_test_signing_key (key_state,
|
||||
&exchange_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MINT_CONFIRM_DEPOSIT,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT,
|
||||
&dh->depconf.purpose,
|
||||
&mint_sig.eddsa_signature,
|
||||
&mint_pub.eddsa_pub))
|
||||
&exchange_sig.eddsa_signature,
|
||||
&exchange_pub.eddsa_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -143,14 +143,14 @@ verify_deposit_signature_ok (const struct TALER_MINT_DepositHandle *dh,
|
||||
|
||||
/**
|
||||
* Verify that the signatures on the "403 FORBIDDEN" response from the
|
||||
* mint demonstrating customer double-spending are valid.
|
||||
* exchange demonstrating customer double-spending are valid.
|
||||
*
|
||||
* @param dh deposit handle
|
||||
* @param json json reply with the signature(s) and transaction history
|
||||
* @return #GNUNET_OK if the signature(s) is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_deposit_signature_forbidden (const struct TALER_MINT_DepositHandle *dh,
|
||||
verify_deposit_signature_forbidden (const struct TALER_EXCHANGE_DepositHandle *dh,
|
||||
json_t *json)
|
||||
{
|
||||
json_t *history;
|
||||
@ -159,7 +159,7 @@ verify_deposit_signature_forbidden (const struct TALER_MINT_DepositHandle *dh,
|
||||
history = json_object_get (json,
|
||||
"history");
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_verify_coin_history_ (dh->coin_value.currency,
|
||||
TALER_EXCHANGE_verify_coin_history_ (dh->coin_value.currency,
|
||||
&dh->depconf.coin_pub,
|
||||
history,
|
||||
&total))
|
||||
@ -193,14 +193,14 @@ verify_deposit_signature_forbidden (const struct TALER_MINT_DepositHandle *dh,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /deposit request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_DepositHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_DepositHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_deposit_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_DepositHandle *dh = cls;
|
||||
struct TALER_EXCHANGE_DepositHandle *dh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -222,7 +222,7 @@ handle_deposit_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_FORBIDDEN:
|
||||
@ -236,7 +236,7 @@ handle_deposit_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; as we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
@ -261,7 +261,7 @@ handle_deposit_finished (void *cls,
|
||||
response_code,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_deposit_cancel (dh);
|
||||
TALER_EXCHANGE_deposit_cancel (dh);
|
||||
}
|
||||
|
||||
|
||||
@ -271,19 +271,19 @@ handle_deposit_finished (void *cls,
|
||||
* @param dki public key information
|
||||
* @param amount the amount to be deposited
|
||||
* @param h_wire hash of the merchant’s account details
|
||||
* @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the mint)
|
||||
* @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
|
||||
* @param coin_pub coin’s public key
|
||||
* @param denom_pub denomination key with which the coin is signed
|
||||
* @param denom_sig mint’s unblinded signature of the coin
|
||||
* @param timestamp timestamp when the contract was finalized, must match approximately the current time of the mint
|
||||
* @param denom_sig exchange’s unblinded signature of the coin
|
||||
* @param timestamp timestamp when the contract was finalized, must match approximately the current time of the exchange
|
||||
* @param transaction_id transaction id for the transaction between merchant and customer
|
||||
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
|
||||
* @param refund_deadline date until which the merchant can issue a refund to the customer via the mint (can be zero if refunds are not allowed)
|
||||
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed)
|
||||
* @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key.
|
||||
* @return #GNUNET_OK if signatures are OK, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_signatures (const struct TALER_MINT_DenomPublicKey *dki,
|
||||
verify_signatures (const struct TALER_EXCHANGE_DenomPublicKey *dki,
|
||||
const struct TALER_Amount *amount,
|
||||
const struct GNUNET_HashCode *h_wire,
|
||||
const struct GNUNET_HashCode *h_contract,
|
||||
@ -353,40 +353,40 @@ verify_signatures (const struct TALER_MINT_DenomPublicKey *dki,
|
||||
|
||||
|
||||
/**
|
||||
* Submit a deposit permission to the mint and get the mint's response.
|
||||
* Submit a deposit permission to the exchange and get the exchange's response.
|
||||
* Note that while we return the response verbatim to the caller for
|
||||
* further processing, we do already verify that the response is
|
||||
* well-formed (i.e. that signatures included in the response are all
|
||||
* valid). If the mint's reply is not well-formed, we return an
|
||||
* valid). If the exchange's reply is not well-formed, we return an
|
||||
* HTTP status code of zero to @a cb.
|
||||
*
|
||||
* We also verify that the @a coin_sig is valid for this deposit
|
||||
* request, and that the @a ub_sig is a valid signature for @a
|
||||
* coin_pub. Also, the @a mint must be ready to operate (i.e. have
|
||||
* coin_pub. Also, the @a exchange must be ready to operate (i.e. have
|
||||
* finished processing the /keys reply). If either check fails, we do
|
||||
* NOT initiate the transaction with the mint and instead return NULL.
|
||||
* NOT initiate the transaction with the exchange and instead return NULL.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param amount the amount to be deposited
|
||||
* @param wire_deadline date until which the merchant would like the mint to settle the balance (advisory, the mint cannot be
|
||||
* forced to settle in the past or upon very short notice, but of course a well-behaved mint will limit aggregation based on the advice received)
|
||||
* @param wire_details the merchant’s account details, in a format supported by the mint
|
||||
* @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the mint)
|
||||
* @param wire_deadline date until which the merchant would like the exchange to settle the balance (advisory, the exchange cannot be
|
||||
* forced to settle in the past or upon very short notice, but of course a well-behaved exchange will limit aggregation based on the advice received)
|
||||
* @param wire_details the merchant’s account details, in a format supported by the exchange
|
||||
* @param h_contract hash of the contact of the merchant with the customer (further details are never disclosed to the exchange)
|
||||
* @param coin_pub coin’s public key
|
||||
* @param denom_pub denomination key with which the coin is signed
|
||||
* @param denom_sig mint’s unblinded signature of the coin
|
||||
* @param timestamp timestamp when the contract was finalized, must match approximately the current time of the mint
|
||||
* @param denom_sig exchange’s unblinded signature of the coin
|
||||
* @param timestamp timestamp when the contract was finalized, must match approximately the current time of the exchange
|
||||
* @param transaction_id transaction id for the transaction between merchant and customer
|
||||
* @param merchant_pub the public key of the merchant (used to identify the merchant for refund requests)
|
||||
* @param refund_deadline date until which the merchant can issue a refund to the customer via the mint (can be zero if refunds are not allowed)
|
||||
* @param refund_deadline date until which the merchant can issue a refund to the customer via the exchange (can be zero if refunds are not allowed)
|
||||
* @param coin_sig the signature made with purpose #TALER_SIGNATURE_WALLET_COIN_DEPOSIT made by the customer with the coin’s private key.
|
||||
* @param cb the callback to call when a reply for this request is available
|
||||
* @param cb_cls closure for the above callback
|
||||
* @return a handle for this request; NULL if the inputs are invalid (i.e.
|
||||
* signatures fail to verify). In this case, the callback is not called.
|
||||
*/
|
||||
struct TALER_MINT_DepositHandle *
|
||||
TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_DepositHandle *
|
||||
TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_Amount *amount,
|
||||
struct GNUNET_TIME_Absolute wire_deadline,
|
||||
json_t *wire_details,
|
||||
@ -399,13 +399,13 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
const struct TALER_MerchantPublicKeyP *merchant_pub,
|
||||
struct GNUNET_TIME_Absolute refund_deadline,
|
||||
const struct TALER_CoinSpendSignatureP *coin_sig,
|
||||
TALER_MINT_DepositResultCallback cb,
|
||||
TALER_EXCHANGE_DepositResultCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
const struct TALER_MINT_DenomPublicKey *dki;
|
||||
struct TALER_MINT_DepositHandle *dh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *dki;
|
||||
struct TALER_EXCHANGE_DepositHandle *dh;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
json_t *deposit_obj;
|
||||
CURL *eh;
|
||||
struct GNUNET_HashCode h_wire;
|
||||
@ -413,7 +413,7 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
|
||||
(void) TALER_round_abs_time (&wire_deadline);
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -426,12 +426,12 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
key_state = TALER_MINT_get_keys (mint);
|
||||
dki = TALER_MINT_get_denomination_key (key_state,
|
||||
key_state = TALER_EXCHANGE_get_keys (exchange);
|
||||
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
||||
denom_pub);
|
||||
if (NULL == dki)
|
||||
{
|
||||
TALER_LOG_WARNING ("Denomination key unknown to mint\n");
|
||||
TALER_LOG_WARNING ("Denomination key unknown to exchange\n");
|
||||
return NULL;
|
||||
}
|
||||
if (GNUNET_SYSERR ==
|
||||
@ -488,13 +488,13 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
sizeof (*coin_sig))
|
||||
);
|
||||
|
||||
dh = GNUNET_new (struct TALER_MINT_DepositHandle);
|
||||
dh->mint = mint;
|
||||
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);
|
||||
dh->exchange = exchange;
|
||||
dh->cb = cb;
|
||||
dh->cb_cls = cb_cls;
|
||||
dh->url = MAH_path_to_url (mint, "/deposit");
|
||||
dh->url = MAH_path_to_url (exchange, "/deposit");
|
||||
dh->depconf.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
|
||||
dh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_MINT_CONFIRM_DEPOSIT);
|
||||
dh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT);
|
||||
dh->depconf.h_contract = *h_contract;
|
||||
dh->depconf.h_wire = h_wire;
|
||||
dh->depconf.transaction_id = GNUNET_htonll (transaction_id);
|
||||
@ -535,7 +535,7 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&dh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
dh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -552,7 +552,7 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
||||
* @param deposit the deposit permission request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_deposit_cancel (struct TALER_MINT_DepositHandle *deposit)
|
||||
TALER_EXCHANGE_deposit_cancel (struct TALER_EXCHANGE_DepositHandle *deposit)
|
||||
{
|
||||
if (NULL != deposit->job)
|
||||
{
|
||||
@ -566,4 +566,4 @@ TALER_MINT_deposit_cancel (struct TALER_MINT_DepositHandle *deposit)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_deposit.c */
|
||||
/* end of exchange_api_deposit.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_deposit_wtid.c
|
||||
* @brief Implementation of the /deposit/wtid request of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_deposit_wtid.c
|
||||
* @brief Implementation of the /deposit/wtid request of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,24 +24,24 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A Deposit Wtid Handle
|
||||
*/
|
||||
struct TALER_MINT_DepositWtidHandle
|
||||
struct TALER_EXCHANGE_DepositWtidHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -61,7 +61,7 @@ struct TALER_MINT_DepositWtidHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_DepositWtidCallback cb;
|
||||
TALER_EXCHANGE_DepositWtidCallback cb;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -74,7 +74,7 @@ struct TALER_MINT_DepositWtidHandle
|
||||
struct MAC_DownloadBuffer db;
|
||||
|
||||
/**
|
||||
* Information the mint should sign in response.
|
||||
* Information the exchange should sign in response.
|
||||
* (with pre-filled fields from the request).
|
||||
*/
|
||||
struct TALER_ConfirmWirePS depconf;
|
||||
@ -84,22 +84,22 @@ struct TALER_MINT_DepositWtidHandle
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* from the mint is valid.
|
||||
* from the exchange is valid.
|
||||
*
|
||||
* @param dwh deposit wtid handle
|
||||
* @param json json reply with the signature
|
||||
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_deposit_wtid_signature_ok (const struct TALER_MINT_DepositWtidHandle *dwh,
|
||||
verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_DepositWtidHandle *dwh,
|
||||
json_t *json)
|
||||
{
|
||||
struct TALER_MintSignatureP mint_sig;
|
||||
struct TALER_MintPublicKeyP mint_pub;
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
struct TALER_ExchangeSignatureP exchange_sig;
|
||||
struct TALER_ExchangePublicKeyP exchange_pub;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("mint_sig", &mint_sig),
|
||||
MAJ_spec_fixed_auto ("mint_pub", &mint_pub),
|
||||
MAJ_spec_fixed_auto ("exchange_sig", &exchange_sig),
|
||||
MAJ_spec_fixed_auto ("exchange_pub", &exchange_pub),
|
||||
MAJ_spec_end
|
||||
};
|
||||
|
||||
@ -110,19 +110,19 @@ verify_deposit_wtid_signature_ok (const struct TALER_MINT_DepositWtidHandle *dwh
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
key_state = TALER_MINT_get_keys (dwh->mint);
|
||||
key_state = TALER_EXCHANGE_get_keys (dwh->exchange);
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_test_signing_key (key_state,
|
||||
&mint_pub))
|
||||
TALER_EXCHANGE_test_signing_key (key_state,
|
||||
&exchange_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MINT_CONFIRM_WIRE,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE,
|
||||
&dwh->depconf.purpose,
|
||||
&mint_sig.eddsa_signature,
|
||||
&mint_pub.eddsa_pub))
|
||||
&exchange_sig.eddsa_signature,
|
||||
&exchange_pub.eddsa_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -135,14 +135,14 @@ verify_deposit_wtid_signature_ok (const struct TALER_MINT_DepositWtidHandle *dwh
|
||||
* Function called when we're done processing the
|
||||
* HTTP /deposit/wtid request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_DepositWtidHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_DepositWtidHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_deposit_wtid_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_DepositWtidHandle *dwh = cls;
|
||||
struct TALER_EXCHANGE_DepositWtidHandle *dwh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
const struct TALER_WireTransferIdentifierRawP *wtid = NULL;
|
||||
@ -208,16 +208,16 @@ handle_deposit_wtid_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; as we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
/* Mint does not know about transaction;
|
||||
/* Exchange does not know about transaction;
|
||||
we should pass the reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_INTERNAL_SERVER_ERROR:
|
||||
@ -240,14 +240,14 @@ handle_deposit_wtid_finished (void *cls,
|
||||
execution_time,
|
||||
coin_contribution);
|
||||
json_decref (json);
|
||||
TALER_MINT_deposit_wtid_cancel (dwh);
|
||||
TALER_EXCHANGE_deposit_wtid_cancel (dwh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain wire transfer details about an existing deposit operation.
|
||||
*
|
||||
* @param mint the mint to query
|
||||
* @param exchange the exchange to query
|
||||
* @param merchant_priv the merchant's private key
|
||||
* @param h_wire hash of merchant's wire transfer details
|
||||
* @param h_contract hash of the contract
|
||||
@ -257,25 +257,25 @@ handle_deposit_wtid_finished (void *cls,
|
||||
* @param cb_cls closure for @a cb
|
||||
* @return handle to abort request
|
||||
*/
|
||||
struct TALER_MINT_DepositWtidHandle *
|
||||
TALER_MINT_deposit_wtid (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_DepositWtidHandle *
|
||||
TALER_EXCHANGE_deposit_wtid (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_MerchantPrivateKeyP *merchant_priv,
|
||||
const struct GNUNET_HashCode *h_wire,
|
||||
const struct GNUNET_HashCode *h_contract,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub,
|
||||
uint64_t transaction_id,
|
||||
TALER_MINT_DepositWtidCallback cb,
|
||||
TALER_EXCHANGE_DepositWtidCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct TALER_DepositTrackPS dtp;
|
||||
struct TALER_MerchantSignatureP merchant_sig;
|
||||
struct TALER_MINT_DepositWtidHandle *dwh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_DepositWtidHandle *dwh;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
json_t *deposit_wtid_obj;
|
||||
CURL *eh;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -308,13 +308,13 @@ TALER_MINT_deposit_wtid (struct TALER_MINT_Handle *mint,
|
||||
"merchant_sig", TALER_json_from_data (&merchant_sig,
|
||||
sizeof (merchant_sig)));
|
||||
|
||||
dwh = GNUNET_new (struct TALER_MINT_DepositWtidHandle);
|
||||
dwh->mint = mint;
|
||||
dwh = GNUNET_new (struct TALER_EXCHANGE_DepositWtidHandle);
|
||||
dwh->exchange = exchange;
|
||||
dwh->cb = cb;
|
||||
dwh->cb_cls = cb_cls;
|
||||
dwh->url = MAH_path_to_url (mint, "/deposit/wtid");
|
||||
dwh->url = MAH_path_to_url (exchange, "/deposit/wtid");
|
||||
dwh->depconf.purpose.size = htonl (sizeof (struct TALER_DepositConfirmationPS));
|
||||
dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_MINT_CONFIRM_WIRE);
|
||||
dwh->depconf.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE);
|
||||
dwh->depconf.h_wire = *h_wire;
|
||||
dwh->depconf.h_contract = *h_contract;
|
||||
dwh->depconf.coin_pub = *coin_pub;
|
||||
@ -345,7 +345,7 @@ TALER_MINT_deposit_wtid (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&dwh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
dwh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -362,7 +362,7 @@ TALER_MINT_deposit_wtid (struct TALER_MINT_Handle *mint,
|
||||
* @param dwh the wire deposits request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_deposit_wtid_cancel (struct TALER_MINT_DepositWtidHandle *dwh)
|
||||
TALER_EXCHANGE_deposit_wtid_cancel (struct TALER_EXCHANGE_DepositWtidHandle *dwh)
|
||||
{
|
||||
if (NULL != dwh->job)
|
||||
{
|
||||
@ -376,4 +376,4 @@ TALER_MINT_deposit_wtid_cancel (struct TALER_MINT_DepositWtidHandle *dwh)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_deposit_wtid.c */
|
||||
/* end of exchange_api_deposit_wtid.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_handle.c
|
||||
* @brief Implementation of the "handle" component of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_handle.c
|
||||
* @brief Implementation of the "handle" component of the exchange's HTTP API
|
||||
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
@ -25,11 +25,11 @@
|
||||
#include <jansson.h>
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <microhttpd.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_handle.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -45,9 +45,9 @@
|
||||
|
||||
|
||||
/**
|
||||
* Stages of initialization for the `struct TALER_MINT_Handle`
|
||||
* Stages of initialization for the `struct TALER_EXCHANGE_Handle`
|
||||
*/
|
||||
enum MintHandleState
|
||||
enum ExchangeHandleState
|
||||
{
|
||||
/**
|
||||
* Just allocated.
|
||||
@ -55,7 +55,7 @@ enum MintHandleState
|
||||
MHS_INIT = 0,
|
||||
|
||||
/**
|
||||
* Obtained the mint's certification data and keys.
|
||||
* Obtained the exchange's certification data and keys.
|
||||
*/
|
||||
MHS_CERT = 1,
|
||||
|
||||
@ -67,31 +67,31 @@ enum MintHandleState
|
||||
|
||||
|
||||
/**
|
||||
* Data for the request to get the /keys of a mint.
|
||||
* Data for the request to get the /keys of a exchange.
|
||||
*/
|
||||
struct KeysRequest;
|
||||
|
||||
|
||||
/**
|
||||
* Handle to the mint
|
||||
* Handle to the exchange
|
||||
*/
|
||||
struct TALER_MINT_Handle
|
||||
struct TALER_EXCHANGE_Handle
|
||||
{
|
||||
/**
|
||||
* The context of this handle
|
||||
*/
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
|
||||
/**
|
||||
* The URL of the mint (i.e. "http://mint.taler.net/")
|
||||
* The URL of the exchange (i.e. "http://exchange.taler.net/")
|
||||
*/
|
||||
char *url;
|
||||
|
||||
/**
|
||||
* Function to call with the mint's certification data,
|
||||
* Function to call with the exchange's certification data,
|
||||
* NULL if this has already been done.
|
||||
*/
|
||||
TALER_MINT_CertificationCallback cert_cb;
|
||||
TALER_EXCHANGE_CertificationCallback cert_cb;
|
||||
|
||||
/**
|
||||
* Closure to pass to @e cert_cb.
|
||||
@ -99,21 +99,21 @@ struct TALER_MINT_Handle
|
||||
void *cert_cb_cls;
|
||||
|
||||
/**
|
||||
* Data for the request to get the /keys of a mint,
|
||||
* Data for the request to get the /keys of a exchange,
|
||||
* NULL once we are past stage #MHS_INIT.
|
||||
*/
|
||||
struct KeysRequest *kr;
|
||||
|
||||
/**
|
||||
* Key data of the mint, only valid if
|
||||
* Key data of the exchange, only valid if
|
||||
* @e handshake_complete is past stage #MHS_CERT.
|
||||
*/
|
||||
struct TALER_MINT_Keys key_data;
|
||||
struct TALER_EXCHANGE_Keys key_data;
|
||||
|
||||
/**
|
||||
* Stage of the mint's initialization routines.
|
||||
* Stage of the exchange's initialization routines.
|
||||
*/
|
||||
enum MintHandleState state;
|
||||
enum ExchangeHandleState state;
|
||||
|
||||
};
|
||||
|
||||
@ -121,14 +121,14 @@ struct TALER_MINT_Handle
|
||||
/* ***************** Internal /keys fetching ************* */
|
||||
|
||||
/**
|
||||
* Data for the request to get the /keys of a mint.
|
||||
* Data for the request to get the /keys of a exchange.
|
||||
*/
|
||||
struct KeysRequest
|
||||
{
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this handle
|
||||
@ -136,7 +136,7 @@ struct KeysRequest
|
||||
char *url;
|
||||
|
||||
/**
|
||||
* Entry for this request with the `struct TALER_MINT_Context`.
|
||||
* Entry for this request with the `struct TALER_EXCHANGE_Context`.
|
||||
*/
|
||||
struct MAC_Job *job;
|
||||
|
||||
@ -171,7 +171,7 @@ free_keys_request (struct KeysRequest *kr)
|
||||
|
||||
|
||||
/**
|
||||
* Parse a mint's signing key encoded in JSON.
|
||||
* Parse a exchange's signing key encoded in JSON.
|
||||
*
|
||||
* @param[out] sign_key where to return the result
|
||||
* @param[in] sign_key_obj json to parse
|
||||
@ -180,11 +180,11 @@ free_keys_request (struct KeysRequest *kr)
|
||||
* invalid or the json malformed.
|
||||
*/
|
||||
static int
|
||||
parse_json_signkey (struct TALER_MINT_SigningPublicKey *sign_key,
|
||||
parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key,
|
||||
json_t *sign_key_obj,
|
||||
const struct TALER_MasterPublicKeyP *master_key)
|
||||
{
|
||||
struct TALER_MintSigningKeyValidityPS sign_key_issue;
|
||||
struct TALER_ExchangeSigningKeyValidityPS sign_key_issue;
|
||||
struct GNUNET_CRYPTO_EddsaSignature sig;
|
||||
struct GNUNET_TIME_Absolute valid_from;
|
||||
struct GNUNET_TIME_Absolute valid_until;
|
||||
@ -213,8 +213,8 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey *sign_key,
|
||||
|
||||
sign_key_issue.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
|
||||
sign_key_issue.purpose.size =
|
||||
htonl (sizeof (struct TALER_MintSigningKeyValidityPS)
|
||||
- offsetof (struct TALER_MintSigningKeyValidityPS,
|
||||
htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)
|
||||
- offsetof (struct TALER_ExchangeSigningKeyValidityPS,
|
||||
purpose));
|
||||
sign_key_issue.master_public_key = *master_key;
|
||||
sign_key_issue.start = GNUNET_TIME_absolute_hton (valid_from);
|
||||
@ -237,7 +237,7 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey *sign_key,
|
||||
|
||||
|
||||
/**
|
||||
* Parse a mint's denomination key encoded in JSON.
|
||||
* Parse a exchange's denomination key encoded in JSON.
|
||||
*
|
||||
* @param[out] denom_key where to return the result
|
||||
* @param[in] denom_key_obj json to parse
|
||||
@ -247,7 +247,7 @@ parse_json_signkey (struct TALER_MINT_SigningPublicKey *sign_key,
|
||||
* invalid or the json malformed.
|
||||
*/
|
||||
static int
|
||||
parse_json_denomkey (struct TALER_MINT_DenomPublicKey *denom_key,
|
||||
parse_json_denomkey (struct TALER_EXCHANGE_DenomPublicKey *denom_key,
|
||||
json_t *denom_key_obj,
|
||||
struct TALER_MasterPublicKeyP *master_key,
|
||||
struct GNUNET_HashContext *hash_context)
|
||||
@ -343,7 +343,7 @@ parse_json_denomkey (struct TALER_MINT_DenomPublicKey *denom_key,
|
||||
|
||||
|
||||
/**
|
||||
* Parse a mint's auditor information encoded in JSON.
|
||||
* Parse a exchange's auditor information encoded in JSON.
|
||||
*
|
||||
* @param[out] auditor where to return the result
|
||||
* @param[in] auditor_obj json to parse
|
||||
@ -352,16 +352,16 @@ parse_json_denomkey (struct TALER_MINT_DenomPublicKey *denom_key,
|
||||
* invalid or the json malformed.
|
||||
*/
|
||||
static int
|
||||
parse_json_auditor (struct TALER_MINT_AuditorInformation *auditor,
|
||||
parse_json_auditor (struct TALER_EXCHANGE_AuditorInformation *auditor,
|
||||
json_t *auditor_obj,
|
||||
const struct TALER_MINT_Keys *key_data)
|
||||
const struct TALER_EXCHANGE_Keys *key_data)
|
||||
{
|
||||
json_t *keys;
|
||||
json_t *key;
|
||||
unsigned int len;
|
||||
unsigned int off;
|
||||
unsigned int i;
|
||||
struct TALER_MintKeyValidityPS kv;
|
||||
struct TALER_ExchangeKeyValidityPS kv;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("auditor_pub",
|
||||
&auditor->auditor_pub),
|
||||
@ -378,18 +378,18 @@ parse_json_auditor (struct TALER_MINT_AuditorInformation *auditor,
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_MINT_KEYS);
|
||||
kv.purpose.size = htonl (sizeof (struct TALER_MintKeyValidityPS));
|
||||
kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS);
|
||||
kv.purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS));
|
||||
kv.master = key_data->master_pub;
|
||||
len = json_array_size (keys);
|
||||
auditor->denom_keys = GNUNET_new_array (len,
|
||||
const struct TALER_MINT_DenomPublicKey *);
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *);
|
||||
i = 0;
|
||||
off = 0;
|
||||
json_array_foreach (keys, i, key) {
|
||||
struct TALER_AuditorSignatureP auditor_sig;
|
||||
struct GNUNET_HashCode denom_h;
|
||||
const struct TALER_MINT_DenomPublicKey *dk;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *dk;
|
||||
unsigned int j;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("denom_pub_h",
|
||||
@ -436,7 +436,7 @@ parse_json_auditor (struct TALER_MINT_AuditorInformation *auditor,
|
||||
&dk->fee_refresh);
|
||||
kv.denom_hash = dk->h_key;
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_MINT_KEYS,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS,
|
||||
&kv.purpose,
|
||||
&auditor_sig.eddsa_sig,
|
||||
&auditor->auditor_pub.eddsa_pub))
|
||||
@ -462,13 +462,13 @@ parse_json_auditor (struct TALER_MINT_AuditorInformation *auditor,
|
||||
*/
|
||||
static int
|
||||
decode_keys_json (json_t *resp_obj,
|
||||
struct TALER_MINT_Keys *key_data)
|
||||
struct TALER_EXCHANGE_Keys *key_data)
|
||||
{
|
||||
struct GNUNET_TIME_Absolute list_issue_date;
|
||||
struct TALER_MintSignatureP sig;
|
||||
struct TALER_MintKeySetPS ks;
|
||||
struct TALER_ExchangeSignatureP sig;
|
||||
struct TALER_ExchangeKeySetPS ks;
|
||||
struct GNUNET_HashContext *hash_context;
|
||||
struct TALER_MintPublicKeyP pub;
|
||||
struct TALER_ExchangePublicKeyP pub;
|
||||
|
||||
if (JSON_OBJECT != json_typeof (resp_obj))
|
||||
return GNUNET_SYSERR;
|
||||
@ -507,7 +507,7 @@ decode_keys_json (json_t *resp_obj,
|
||||
json_array_size (sign_keys_array)));
|
||||
key_data->sign_keys
|
||||
= GNUNET_new_array (key_data->num_sign_keys,
|
||||
struct TALER_MINT_SigningPublicKey);
|
||||
struct TALER_EXCHANGE_SigningPublicKey);
|
||||
index = 0;
|
||||
json_array_foreach (sign_keys_array, index, sign_key_obj) {
|
||||
EXITIF (GNUNET_SYSERR ==
|
||||
@ -528,7 +528,7 @@ decode_keys_json (json_t *resp_obj,
|
||||
EXITIF (JSON_ARRAY != json_typeof (denom_keys_array));
|
||||
EXITIF (0 == (key_data->num_denom_keys = json_array_size (denom_keys_array)));
|
||||
key_data->denom_keys = GNUNET_new_array (key_data->num_denom_keys,
|
||||
struct TALER_MINT_DenomPublicKey);
|
||||
struct TALER_EXCHANGE_DenomPublicKey);
|
||||
index = 0;
|
||||
json_array_foreach (denom_keys_array, index, denom_key_obj) {
|
||||
EXITIF (GNUNET_SYSERR ==
|
||||
@ -553,7 +553,7 @@ decode_keys_json (json_t *resp_obj,
|
||||
if (0 != len)
|
||||
{
|
||||
key_data->auditors = GNUNET_new_array (len,
|
||||
struct TALER_MINT_AuditorInformation);
|
||||
struct TALER_EXCHANGE_AuditorInformation);
|
||||
index = 0;
|
||||
json_array_foreach (auditors_array, index, auditor_info) {
|
||||
EXITIF (GNUNET_SYSERR ==
|
||||
@ -566,16 +566,16 @@ decode_keys_json (json_t *resp_obj,
|
||||
|
||||
/* Validate signature... */
|
||||
ks.purpose.size = htonl (sizeof (ks));
|
||||
ks.purpose.purpose = htonl (TALER_SIGNATURE_MINT_KEY_SET);
|
||||
ks.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET);
|
||||
ks.list_issue_date = GNUNET_TIME_absolute_hton (list_issue_date);
|
||||
GNUNET_CRYPTO_hash_context_finish (hash_context,
|
||||
&ks.hc);
|
||||
hash_context = NULL;
|
||||
EXITIF (GNUNET_OK !=
|
||||
TALER_MINT_test_signing_key (key_data,
|
||||
TALER_EXCHANGE_test_signing_key (key_data,
|
||||
&pub));
|
||||
EXITIF (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MINT_KEY_SET,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_KEY_SET,
|
||||
&ks.purpose,
|
||||
&sig.eddsa_signature,
|
||||
&pub.eddsa_pub));
|
||||
@ -600,10 +600,10 @@ keys_completed_cb (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct KeysRequest *kr = cls;
|
||||
struct TALER_MINT_Handle *mint = kr->mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange = kr->exchange;
|
||||
json_t *resp_obj;
|
||||
long response_code;
|
||||
TALER_MINT_CertificationCallback cb;
|
||||
TALER_EXCHANGE_CertificationCallback cb;
|
||||
|
||||
resp_obj = MAC_download_get_result (&kr->db,
|
||||
eh,
|
||||
@ -619,7 +619,7 @@ keys_completed_cb (void *cls,
|
||||
if ( (NULL == resp_obj) ||
|
||||
(GNUNET_OK !=
|
||||
decode_keys_json (resp_obj,
|
||||
&kr->mint->key_data)) )
|
||||
&kr->exchange->key_data)) )
|
||||
response_code = 0;
|
||||
break;
|
||||
default:
|
||||
@ -633,27 +633,27 @@ keys_completed_cb (void *cls,
|
||||
|
||||
if (MHD_HTTP_OK != response_code)
|
||||
{
|
||||
mint->kr = NULL;
|
||||
exchange->kr = NULL;
|
||||
free_keys_request (kr);
|
||||
mint->state = MHS_FAILED;
|
||||
exchange->state = MHS_FAILED;
|
||||
/* notify application that we failed */
|
||||
if (NULL != (cb = mint->cert_cb))
|
||||
if (NULL != (cb = exchange->cert_cb))
|
||||
{
|
||||
mint->cert_cb = NULL;
|
||||
cb (mint->cert_cb_cls,
|
||||
exchange->cert_cb = NULL;
|
||||
cb (exchange->cert_cb_cls,
|
||||
NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
mint->kr = NULL;
|
||||
exchange->kr = NULL;
|
||||
free_keys_request (kr);
|
||||
mint->state = MHS_CERT;
|
||||
exchange->state = MHS_CERT;
|
||||
/* notify application about the key information */
|
||||
if (NULL != (cb = mint->cert_cb))
|
||||
if (NULL != (cb = exchange->cert_cb))
|
||||
{
|
||||
mint->cert_cb = NULL;
|
||||
cb (mint->cert_cb_cls,
|
||||
&mint->key_data);
|
||||
exchange->cert_cb = NULL;
|
||||
cb (exchange->cert_cb_cls,
|
||||
&exchange->key_data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -662,13 +662,13 @@ keys_completed_cb (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Get the context of a mint.
|
||||
* Get the context of a exchange.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @return ctx context to execute jobs in
|
||||
*/
|
||||
struct TALER_MINT_Context *
|
||||
MAH_handle_to_context (struct TALER_MINT_Handle *h)
|
||||
struct TALER_EXCHANGE_Context *
|
||||
MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h)
|
||||
{
|
||||
return h->ctx;
|
||||
}
|
||||
@ -677,11 +677,11 @@ MAH_handle_to_context (struct TALER_MINT_Handle *h)
|
||||
/**
|
||||
* Check if the handle is ready to process requests.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @return #GNUNET_YES if we are ready, #GNUNET_NO if not
|
||||
*/
|
||||
int
|
||||
MAH_handle_is_ready (struct TALER_MINT_Handle *h)
|
||||
MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h)
|
||||
{
|
||||
return (MHS_CERT == h->state) ? GNUNET_YES : GNUNET_NO;
|
||||
}
|
||||
@ -690,12 +690,12 @@ MAH_handle_is_ready (struct TALER_MINT_Handle *h)
|
||||
/**
|
||||
* Obtain the URL to use for an API request.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @param path Taler API path (i.e. "/reserve/withdraw")
|
||||
* @return the full URI to use with cURL
|
||||
*/
|
||||
char *
|
||||
MAH_path_to_url (struct TALER_MINT_Handle *h,
|
||||
MAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
|
||||
const char *path)
|
||||
{
|
||||
char *url;
|
||||
@ -715,39 +715,39 @@ MAH_path_to_url (struct TALER_MINT_Handle *h,
|
||||
/* ********************* public API ******************* */
|
||||
|
||||
/**
|
||||
* Initialise a connection to the mint. Will connect to the
|
||||
* mint and obtain information about the mint's master public
|
||||
* key and the mint's auditor. The respective information will
|
||||
* Initialise a connection to the exchange. Will connect to the
|
||||
* exchange and obtain information about the exchange's master public
|
||||
* key and the exchange's auditor. The respective information will
|
||||
* be passed to the @a cert_cb once available, and all future
|
||||
* interactions with the mint will be checked to be signed
|
||||
* interactions with the exchange will be checked to be signed
|
||||
* (where appropriate) by the respective master key.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param url HTTP base URL for the mint
|
||||
* @param cert_cb function to call with the mint's certification information
|
||||
* @param url HTTP base URL for the exchange
|
||||
* @param cert_cb function to call with the exchange's certification information
|
||||
* @param cert_cb_cls closure for @a cert_cb
|
||||
* @param ... list of additional arguments, terminated by #TALER_MINT_OPTION_END.
|
||||
* @return the mint handle; NULL upon error
|
||||
* @param ... list of additional arguments, terminated by #TALER_EXCHANGE_OPTION_END.
|
||||
* @return the exchange handle; NULL upon error
|
||||
*/
|
||||
struct TALER_MINT_Handle *
|
||||
TALER_MINT_connect (struct TALER_MINT_Context *ctx,
|
||||
struct TALER_EXCHANGE_Handle *
|
||||
TALER_EXCHANGE_connect (struct TALER_EXCHANGE_Context *ctx,
|
||||
const char *url,
|
||||
TALER_MINT_CertificationCallback cert_cb,
|
||||
TALER_EXCHANGE_CertificationCallback cert_cb,
|
||||
void *cert_cb_cls,
|
||||
...)
|
||||
{
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
struct KeysRequest *kr;
|
||||
CURL *c;
|
||||
|
||||
mint = GNUNET_new (struct TALER_MINT_Handle);
|
||||
mint->ctx = ctx;
|
||||
mint->url = GNUNET_strdup (url);
|
||||
mint->cert_cb = cert_cb;
|
||||
mint->cert_cb_cls = cert_cb_cls;
|
||||
exchange = GNUNET_new (struct TALER_EXCHANGE_Handle);
|
||||
exchange->ctx = ctx;
|
||||
exchange->url = GNUNET_strdup (url);
|
||||
exchange->cert_cb = cert_cb;
|
||||
exchange->cert_cb_cls = cert_cb_cls;
|
||||
kr = GNUNET_new (struct KeysRequest);
|
||||
kr->mint = mint;
|
||||
kr->url = MAH_path_to_url (mint, "/keys");
|
||||
kr->exchange = exchange;
|
||||
kr->url = MAH_path_to_url (exchange, "/keys");
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Requesting keys with URL `%s'.\n",
|
||||
kr->url);
|
||||
@ -772,59 +772,59 @@ TALER_MINT_connect (struct TALER_MINT_Context *ctx,
|
||||
curl_easy_setopt (c,
|
||||
CURLOPT_WRITEDATA,
|
||||
&kr->db));
|
||||
kr->job = MAC_job_add (mint->ctx,
|
||||
kr->job = MAC_job_add (exchange->ctx,
|
||||
c,
|
||||
GNUNET_NO,
|
||||
&keys_completed_cb,
|
||||
kr);
|
||||
mint->kr = kr;
|
||||
return mint;
|
||||
exchange->kr = kr;
|
||||
return exchange;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disconnect from the mint
|
||||
* Disconnect from the exchange
|
||||
*
|
||||
* @param mint the mint handle
|
||||
* @param exchange the exchange handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_disconnect (struct TALER_MINT_Handle *mint)
|
||||
TALER_EXCHANGE_disconnect (struct TALER_EXCHANGE_Handle *exchange)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (NULL != mint->kr)
|
||||
if (NULL != exchange->kr)
|
||||
{
|
||||
MAC_job_cancel (mint->kr->job);
|
||||
free_keys_request (mint->kr);
|
||||
mint->kr = NULL;
|
||||
MAC_job_cancel (exchange->kr->job);
|
||||
free_keys_request (exchange->kr);
|
||||
exchange->kr = NULL;
|
||||
}
|
||||
GNUNET_array_grow (mint->key_data.sign_keys,
|
||||
mint->key_data.num_sign_keys,
|
||||
GNUNET_array_grow (exchange->key_data.sign_keys,
|
||||
exchange->key_data.num_sign_keys,
|
||||
0);
|
||||
for (i=0;i<mint->key_data.num_denom_keys;i++)
|
||||
GNUNET_CRYPTO_rsa_public_key_free (mint->key_data.denom_keys[i].key.rsa_public_key);
|
||||
GNUNET_array_grow (mint->key_data.denom_keys,
|
||||
mint->key_data.num_denom_keys,
|
||||
for (i=0;i<exchange->key_data.num_denom_keys;i++)
|
||||
GNUNET_CRYPTO_rsa_public_key_free (exchange->key_data.denom_keys[i].key.rsa_public_key);
|
||||
GNUNET_array_grow (exchange->key_data.denom_keys,
|
||||
exchange->key_data.num_denom_keys,
|
||||
0);
|
||||
GNUNET_array_grow (mint->key_data.auditors,
|
||||
mint->key_data.num_auditors,
|
||||
GNUNET_array_grow (exchange->key_data.auditors,
|
||||
exchange->key_data.num_auditors,
|
||||
0);
|
||||
GNUNET_free (mint->url);
|
||||
GNUNET_free (mint);
|
||||
GNUNET_free (exchange->url);
|
||||
GNUNET_free (exchange);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the given @a pub is a the current signing key from the mint
|
||||
* Test if the given @a pub is a the current signing key from the exchange
|
||||
* according to @a keys.
|
||||
*
|
||||
* @param keys the mint's key set
|
||||
* @param pub claimed current online signing key for the mint
|
||||
* @param keys the exchange's key set
|
||||
* @param pub claimed current online signing key for the exchange
|
||||
* @return #GNUNET_OK if @a pub is (according to /keys) a current signing key
|
||||
*/
|
||||
int
|
||||
TALER_MINT_test_signing_key (const struct TALER_MINT_Keys *keys,
|
||||
const struct TALER_MintPublicKeyP *pub)
|
||||
TALER_EXCHANGE_test_signing_key (const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_ExchangePublicKeyP *pub)
|
||||
{
|
||||
struct GNUNET_TIME_Absolute now;
|
||||
unsigned int i;
|
||||
@ -836,22 +836,22 @@ TALER_MINT_test_signing_key (const struct TALER_MINT_Keys *keys,
|
||||
(keys->sign_keys[i].valid_until.abs_value_us > now.abs_value_us - 60 * 60 * 1000LL * 1000LL) &&
|
||||
(0 == memcmp (pub,
|
||||
&keys->sign_keys[i].key,
|
||||
sizeof (struct TALER_MintPublicKeyP))) )
|
||||
sizeof (struct TALER_ExchangePublicKeyP))) )
|
||||
return GNUNET_OK;
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the denomination key details from the mint.
|
||||
* Obtain the denomination key details from the exchange.
|
||||
*
|
||||
* @param keys the mint's key set
|
||||
* @param keys the exchange's key set
|
||||
* @param pk public key of the denomination to lookup
|
||||
* @return details about the given denomination key, NULL if the key is
|
||||
* not found
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey *
|
||||
TALER_MINT_get_denomination_key (const struct TALER_MINT_Keys *keys,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *
|
||||
TALER_EXCHANGE_get_denomination_key (const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_DenominationPublicKey *pk)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -865,14 +865,14 @@ TALER_MINT_get_denomination_key (const struct TALER_MINT_Keys *keys,
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the denomination key details from the mint.
|
||||
* Obtain the denomination key details from the exchange.
|
||||
*
|
||||
* @param keys the mint's key set
|
||||
* @param keys the exchange's key set
|
||||
* @param hc hash of the public key of the denomination to lookup
|
||||
* @return details about the given denomination key
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey *
|
||||
TALER_MINT_get_denomination_key_by_hash (const struct TALER_MINT_Keys *keys,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *
|
||||
TALER_EXCHANGE_get_denomination_key_by_hash (const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct GNUNET_HashCode *hc)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -887,16 +887,16 @@ TALER_MINT_get_denomination_key_by_hash (const struct TALER_MINT_Keys *keys,
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the keys from the mint.
|
||||
* Obtain the keys from the exchange.
|
||||
*
|
||||
* @param mint the mint handle
|
||||
* @return the mint's key set
|
||||
* @param exchange the exchange handle
|
||||
* @return the exchange's key set
|
||||
*/
|
||||
const struct TALER_MINT_Keys *
|
||||
TALER_MINT_get_keys (const struct TALER_MINT_Handle *mint)
|
||||
const struct TALER_EXCHANGE_Keys *
|
||||
TALER_EXCHANGE_get_keys (const struct TALER_EXCHANGE_Handle *exchange)
|
||||
{
|
||||
return &mint->key_data;
|
||||
return &exchange->key_data;
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_handle.c */
|
||||
/* end of exchange_api_handle.c */
|
@ -15,45 +15,45 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_handle.h
|
||||
* @brief Internal interface to the handle part of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_handle.h
|
||||
* @brief Internal interface to the handle part of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include <curl/curl.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "taler_exchange_service.h"
|
||||
|
||||
|
||||
/**
|
||||
* Get the context of a mint.
|
||||
* Get the context of a exchange.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @return ctx context to execute jobs in
|
||||
*/
|
||||
struct TALER_MINT_Context *
|
||||
MAH_handle_to_context (struct TALER_MINT_Handle *h);
|
||||
struct TALER_EXCHANGE_Context *
|
||||
MAH_handle_to_context (struct TALER_EXCHANGE_Handle *h);
|
||||
|
||||
|
||||
/**
|
||||
* Check if the handle is ready to process requests.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @return #GNUNET_YES if we are ready, #GNUNET_NO if not
|
||||
*/
|
||||
int
|
||||
MAH_handle_is_ready (struct TALER_MINT_Handle *h);
|
||||
MAH_handle_is_ready (struct TALER_EXCHANGE_Handle *h);
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the URL to use for an API request.
|
||||
*
|
||||
* @param h the mint handle to query
|
||||
* @param h the exchange handle to query
|
||||
* @param path Taler API path (i.e. "/reserve/withdraw")
|
||||
* @return the full URI to use with cURL
|
||||
*/
|
||||
char *
|
||||
MAH_path_to_url (struct TALER_MINT_Handle *h,
|
||||
MAH_path_to_url (struct TALER_EXCHANGE_Handle *h,
|
||||
const char *path);
|
||||
|
||||
|
||||
/* end of mint_api_handle.h */
|
||||
/* end of exchange_api_handle.h */
|
@ -14,14 +14,14 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_json.c
|
||||
* @file exchange-lib/exchange_api_json.c
|
||||
* @brief functions to parse incoming requests (JSON snippets)
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "exchange_api_json.h"
|
||||
|
||||
/**
|
||||
* Navigate and parse data in a JSON tree.
|
||||
@ -522,4 +522,4 @@ MAJ_spec_rsa_signature (const char *name,
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_json.c */
|
||||
/* end of exchange_api_json.c */
|
@ -14,7 +14,7 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_json.h
|
||||
* @file exchange-lib/exchange_api_json.h
|
||||
* @brief functions to parse incoming requests (JSON snippets)
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
@ -349,4 +349,4 @@ MAJ_spec_rsa_signature (const char *name,
|
||||
|
||||
|
||||
|
||||
/* end of mint_api_json.h */
|
||||
/* end of exchange_api_json.h */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_refresh.c
|
||||
* @brief Implementation of the /refresh/melt+reveal requests of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_refresh.c
|
||||
* @brief Implementation of the /refresh/melt+reveal requests of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,11 +24,11 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
@ -145,7 +145,7 @@ struct MeltDataP
|
||||
|
||||
/* Followed by serializations of:
|
||||
1) struct MeltedCoinP melted_coins[num_melted_coins];
|
||||
2) struct TALER_MINT_DenomPublicKey fresh_pks[num_fresh_coins];
|
||||
2) struct TALER_EXCHANGE_DenomPublicKey fresh_pks[num_fresh_coins];
|
||||
3) TALER_CNC_KAPPA times:
|
||||
3a) struct FreshCoinP fresh_coins[num_fresh_coins];
|
||||
*/
|
||||
@ -196,7 +196,7 @@ struct MeltedCoin
|
||||
struct TALER_DenominationPublicKey pub_key;
|
||||
|
||||
/**
|
||||
* Mint's signature over the coin.
|
||||
* Exchange's signature over the coin.
|
||||
*/
|
||||
struct TALER_DenominationSignature sig;
|
||||
|
||||
@ -257,7 +257,7 @@ struct MeltData
|
||||
|
||||
/**
|
||||
* Array of @e num_fresh_coins denomination keys for the coins to be
|
||||
* freshly minted.
|
||||
* freshly exchangeed.
|
||||
*/
|
||||
struct TALER_DenominationPublicKey *fresh_pks;
|
||||
|
||||
@ -794,7 +794,7 @@ deserialize_melt_data (const char *buf,
|
||||
*/
|
||||
static void
|
||||
setup_fresh_coin (struct FreshCoin *fc,
|
||||
const struct TALER_MINT_DenomPublicKey *pk)
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *pk)
|
||||
{
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *epk;
|
||||
unsigned int len;
|
||||
@ -818,7 +818,7 @@ setup_fresh_coin (struct FreshCoin *fc,
|
||||
* no money is lost in case of hardware failures, is operation does
|
||||
* not actually initiate the request. Instead, it generates a buffer
|
||||
* which the caller must store before proceeding with the actual call
|
||||
* to #TALER_MINT_refresh_melt() that will generate the request.
|
||||
* to #TALER_EXCHANGE_refresh_melt() that will generate the request.
|
||||
*
|
||||
* This function does verify that the given request data is internally
|
||||
* consistent. However, the @a melts_sigs are only verified if
|
||||
@ -845,20 +845,20 @@ setup_fresh_coin (struct FreshCoin *fc,
|
||||
* @param fresh_pks array of @a pks_len denominations of fresh coins to create
|
||||
* @param[out] res_size set to the size of the return value, or 0 on error
|
||||
* @return NULL
|
||||
* if the inputs are invalid (i.e. denomination key not with this mint).
|
||||
* if the inputs are invalid (i.e. denomination key not with this exchange).
|
||||
* Otherwise, pointer to a buffer of @a res_size to store persistently
|
||||
* before proceeding to #TALER_MINT_refresh_melt().
|
||||
* before proceeding to #TALER_EXCHANGE_refresh_melt().
|
||||
* Non-null results should be freed using #GNUNET_free().
|
||||
*/
|
||||
char *
|
||||
TALER_MINT_refresh_prepare (unsigned int num_melts,
|
||||
TALER_EXCHANGE_refresh_prepare (unsigned int num_melts,
|
||||
const struct TALER_CoinSpendPrivateKeyP *melt_privs,
|
||||
const struct TALER_Amount *melt_amounts,
|
||||
const struct TALER_DenominationSignature *melt_sigs,
|
||||
const struct TALER_MINT_DenomPublicKey *melt_pks,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *melt_pks,
|
||||
int check_sigs,
|
||||
unsigned int fresh_pks_len,
|
||||
const struct TALER_MINT_DenomPublicKey *fresh_pks,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pks,
|
||||
size_t *res_size)
|
||||
{
|
||||
struct MeltData md;
|
||||
@ -1022,13 +1022,13 @@ TALER_MINT_refresh_prepare (unsigned int num_melts,
|
||||
/**
|
||||
* @brief A /refresh/melt Handle
|
||||
*/
|
||||
struct TALER_MINT_RefreshMeltHandle
|
||||
struct TALER_EXCHANGE_RefreshMeltHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -1048,7 +1048,7 @@ struct TALER_MINT_RefreshMeltHandle
|
||||
/**
|
||||
* Function to call with refresh melt failure results.
|
||||
*/
|
||||
TALER_MINT_RefreshMeltCallback melt_cb;
|
||||
TALER_EXCHANGE_RefreshMeltCallback melt_cb;
|
||||
|
||||
/**
|
||||
* Closure for @e result_cb and @e melt_failure_cb.
|
||||
@ -1069,24 +1069,24 @@ struct TALER_MINT_RefreshMeltHandle
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* from the mint is valid.
|
||||
* from the exchange is valid.
|
||||
*
|
||||
* @param rmh melt handle
|
||||
* @param json json reply with the signature
|
||||
* @param[out] noreveal_index set to the noreveal index selected by the mint
|
||||
* @param[out] noreveal_index set to the noreveal index selected by the exchange
|
||||
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_refresh_melt_signature_ok (struct TALER_MINT_RefreshMeltHandle *rmh,
|
||||
verify_refresh_melt_signature_ok (struct TALER_EXCHANGE_RefreshMeltHandle *rmh,
|
||||
json_t *json,
|
||||
uint16_t *noreveal_index)
|
||||
{
|
||||
struct TALER_MintSignatureP mint_sig;
|
||||
struct TALER_MintPublicKeyP mint_pub;
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
struct TALER_ExchangeSignatureP exchange_sig;
|
||||
struct TALER_ExchangePublicKeyP exchange_pub;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("mint_sig", &mint_sig),
|
||||
MAJ_spec_fixed_auto ("mint_pub", &mint_pub),
|
||||
MAJ_spec_fixed_auto ("exchange_sig", &exchange_sig),
|
||||
MAJ_spec_fixed_auto ("exchange_pub", &exchange_pub),
|
||||
MAJ_spec_uint16 ("noreveal_index", noreveal_index),
|
||||
MAJ_spec_end
|
||||
};
|
||||
@ -1100,11 +1100,11 @@ verify_refresh_melt_signature_ok (struct TALER_MINT_RefreshMeltHandle *rmh,
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
/* check that mint signing key is permitted */
|
||||
key_state = TALER_MINT_get_keys (rmh->mint);
|
||||
/* check that exchange signing key is permitted */
|
||||
key_state = TALER_EXCHANGE_get_keys (rmh->exchange);
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_test_signing_key (key_state,
|
||||
&mint_pub))
|
||||
TALER_EXCHANGE_test_signing_key (key_state,
|
||||
&exchange_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -1117,17 +1117,17 @@ verify_refresh_melt_signature_ok (struct TALER_MINT_RefreshMeltHandle *rmh,
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
/* verify signature by mint */
|
||||
confirm.purpose.purpose = htonl (TALER_SIGNATURE_MINT_CONFIRM_MELT);
|
||||
/* verify signature by exchange */
|
||||
confirm.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT);
|
||||
confirm.purpose.size = htonl (sizeof (struct TALER_RefreshMeltConfirmationPS));
|
||||
confirm.session_hash = rmh->md->melt_session_hash;
|
||||
confirm.noreveal_index = htons (*noreveal_index);
|
||||
confirm.reserved = htons (0);
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MINT_CONFIRM_MELT,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT,
|
||||
&confirm.purpose,
|
||||
&mint_sig.eddsa_signature,
|
||||
&mint_pub.eddsa_pub))
|
||||
&exchange_sig.eddsa_signature,
|
||||
&exchange_pub.eddsa_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -1138,14 +1138,14 @@ verify_refresh_melt_signature_ok (struct TALER_MINT_RefreshMeltHandle *rmh,
|
||||
|
||||
/**
|
||||
* Verify that the signatures on the "403 FORBIDDEN" response from the
|
||||
* mint demonstrating customer double-spending are valid.
|
||||
* exchange demonstrating customer double-spending are valid.
|
||||
*
|
||||
* @param rmh melt handle
|
||||
* @param json json reply with the signature(s) and transaction history
|
||||
* @return #GNUNET_OK if the signature(s) is valid, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
verify_refresh_melt_signature_forbidden (struct TALER_MINT_RefreshMeltHandle *rmh,
|
||||
verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle *rmh,
|
||||
json_t *json)
|
||||
{
|
||||
json_t *history;
|
||||
@ -1172,7 +1172,7 @@ verify_refresh_melt_signature_forbidden (struct TALER_MINT_RefreshMeltHandle *rm
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
/* Find out which coin was deemed problematic by the mint */
|
||||
/* Find out which coin was deemed problematic by the exchange */
|
||||
mc = NULL;
|
||||
for (i=0;i<rmh->md->num_melted_coins;i++)
|
||||
{
|
||||
@ -1222,7 +1222,7 @@ verify_refresh_melt_signature_forbidden (struct TALER_MINT_RefreshMeltHandle *rm
|
||||
history = json_object_get (json,
|
||||
"history");
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_verify_coin_history_ (original_value.currency,
|
||||
TALER_EXCHANGE_verify_coin_history_ (original_value.currency,
|
||||
&coin_pub,
|
||||
history,
|
||||
&total))
|
||||
@ -1261,14 +1261,14 @@ verify_refresh_melt_signature_forbidden (struct TALER_MINT_RefreshMeltHandle *rm
|
||||
* Function called when we're done processing the
|
||||
* HTTP /refresh/melt request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_RefreshMeltHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_RefreshMeltHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_refresh_melt_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_RefreshMeltHandle *rmh = cls;
|
||||
struct TALER_EXCHANGE_RefreshMeltHandle *rmh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
uint16_t noreveal_index = TALER_CNC_KAPPA; /* invalid value */
|
||||
@ -1300,7 +1300,7 @@ handle_refresh_melt_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_FORBIDDEN:
|
||||
@ -1314,7 +1314,7 @@ handle_refresh_melt_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; assuming we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
@ -1341,7 +1341,7 @@ handle_refresh_melt_finished (void *cls,
|
||||
UINT16_MAX,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_refresh_melt_cancel (rmh);
|
||||
TALER_EXCHANGE_refresh_melt_cancel (rmh);
|
||||
}
|
||||
|
||||
|
||||
@ -1388,30 +1388,30 @@ melted_coin_to_json (const struct GNUNET_HashCode *melt_session_hash,
|
||||
|
||||
|
||||
/**
|
||||
* Submit a melt request to the mint and get the mint's
|
||||
* Submit a melt request to the exchange and get the exchange's
|
||||
* response.
|
||||
*
|
||||
* This API is typically used by a wallet. Note that to ensure that
|
||||
* no money is lost in case of hardware failures, the provided
|
||||
* argument should have been constructed using
|
||||
* #TALER_MINT_refresh_prepare and committed to persistent storage
|
||||
* #TALER_EXCHANGE_refresh_prepare and committed to persistent storage
|
||||
* prior to calling this function.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param refresh_data_length size of the @a refresh_data (returned
|
||||
* in the `res_size` argument from #TALER_MINT_refresh_prepare())
|
||||
* in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare())
|
||||
* @param refresh_data the refresh data as returned from
|
||||
#TALER_MINT_refresh_prepare())
|
||||
#TALER_EXCHANGE_refresh_prepare())
|
||||
* @param melt_cb the callback to call with the result
|
||||
* @param melt_cb_cls closure for @a melt_cb
|
||||
* @return a handle for this request; NULL if the argument was invalid.
|
||||
* In this case, neither callback will be called.
|
||||
*/
|
||||
struct TALER_MINT_RefreshMeltHandle *
|
||||
TALER_MINT_refresh_melt (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_RefreshMeltHandle *
|
||||
TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
|
||||
size_t refresh_data_length,
|
||||
const char *refresh_data,
|
||||
TALER_MINT_RefreshMeltCallback melt_cb,
|
||||
TALER_EXCHANGE_RefreshMeltCallback melt_cb,
|
||||
void *melt_cb_cls)
|
||||
{
|
||||
json_t *melt_obj;
|
||||
@ -1422,15 +1422,15 @@ TALER_MINT_refresh_melt (struct TALER_MINT_Handle *mint,
|
||||
json_t *secret_encs;
|
||||
json_t *link_encs;
|
||||
json_t *tmp;
|
||||
struct TALER_MINT_RefreshMeltHandle *rmh;
|
||||
struct TALER_EXCHANGE_RefreshMeltHandle *rmh;
|
||||
CURL *eh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
struct MeltData *md;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -1582,12 +1582,12 @@ TALER_MINT_refresh_melt (struct TALER_MINT_Handle *mint,
|
||||
"link_encs", link_encs);
|
||||
|
||||
/* and now we can at last begin the actual request handling */
|
||||
rmh = GNUNET_new (struct TALER_MINT_RefreshMeltHandle);
|
||||
rmh->mint = mint;
|
||||
rmh = GNUNET_new (struct TALER_EXCHANGE_RefreshMeltHandle);
|
||||
rmh->exchange = exchange;
|
||||
rmh->melt_cb = melt_cb;
|
||||
rmh->melt_cb_cls = melt_cb_cls;
|
||||
rmh->md = md;
|
||||
rmh->url = MAH_path_to_url (mint,
|
||||
rmh->url = MAH_path_to_url (exchange,
|
||||
"/refresh/melt");
|
||||
|
||||
eh = curl_easy_init ();
|
||||
@ -1615,7 +1615,7 @@ TALER_MINT_refresh_melt (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&rmh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
rmh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -1632,7 +1632,7 @@ TALER_MINT_refresh_melt (struct TALER_MINT_Handle *mint,
|
||||
* @param rmh the refresh melt handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_refresh_melt_cancel (struct TALER_MINT_RefreshMeltHandle *rmh)
|
||||
TALER_EXCHANGE_refresh_melt_cancel (struct TALER_EXCHANGE_RefreshMeltHandle *rmh)
|
||||
{
|
||||
if (NULL != rmh->job)
|
||||
{
|
||||
@ -1654,13 +1654,13 @@ TALER_MINT_refresh_melt_cancel (struct TALER_MINT_RefreshMeltHandle *rmh)
|
||||
/**
|
||||
* @brief A /refresh/reveal Handle
|
||||
*/
|
||||
struct TALER_MINT_RefreshRevealHandle
|
||||
struct TALER_EXCHANGE_RefreshRevealHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -1680,7 +1680,7 @@ struct TALER_MINT_RefreshRevealHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_RefreshRevealCallback reveal_cb;
|
||||
TALER_EXCHANGE_RefreshRevealCallback reveal_cb;
|
||||
|
||||
/**
|
||||
* Closure for @e reveal_cb.
|
||||
@ -1698,7 +1698,7 @@ struct TALER_MINT_RefreshRevealHandle
|
||||
struct MeltData *md;
|
||||
|
||||
/**
|
||||
* The index selected by the mint in cut-and-choose to not be revealed.
|
||||
* The index selected by the exchange in cut-and-choose to not be revealed.
|
||||
*/
|
||||
uint16_t noreveal_index;
|
||||
|
||||
@ -1708,7 +1708,7 @@ struct TALER_MINT_RefreshRevealHandle
|
||||
/**
|
||||
* We got a 200 OK response for the /refresh/reveal operation.
|
||||
* Extract the coin signatures and return them to the caller.
|
||||
* The signatures we get from the mint is for the blinded value.
|
||||
* The signatures we get from the exchange is for the blinded value.
|
||||
* Thus, we first must unblind them and then should verify their
|
||||
* validity.
|
||||
*
|
||||
@ -1716,13 +1716,13 @@ struct TALER_MINT_RefreshRevealHandle
|
||||
* to the application via the callback.
|
||||
*
|
||||
* @param rrh operation handle
|
||||
* @param json reply from the mint
|
||||
* @param json reply from the exchange
|
||||
* @param[out] coin_privs array of length `num_fresh_coins`, initialized to contain private keys
|
||||
* @param[out] sigs array of length `num_fresh_coins`, initialized to cointain RSA signatures
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
||||
*/
|
||||
static int
|
||||
refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
|
||||
refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
|
||||
json_t *json,
|
||||
struct TALER_CoinSpendPrivateKeyP *coin_privs,
|
||||
struct TALER_DenominationSignature *sigs)
|
||||
@ -1814,14 +1814,14 @@ refresh_reveal_ok (struct TALER_MINT_RefreshRevealHandle *rrh,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /refresh/reveal request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_RefreshHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_RefreshHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_refresh_reveal_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_RefreshRevealHandle *rrh = cls;
|
||||
struct TALER_EXCHANGE_RefreshRevealHandle *rrh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -1865,11 +1865,11 @@ handle_refresh_reveal_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_CONFLICT:
|
||||
/* Nothing really to verify, mint says our reveal is inconsitent
|
||||
/* Nothing really to verify, exchange says our reveal is inconsitent
|
||||
with our commitment, so either side is buggy; we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
@ -1892,12 +1892,12 @@ handle_refresh_reveal_finished (void *cls,
|
||||
0, NULL, NULL,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_refresh_reveal_cancel (rrh);
|
||||
TALER_EXCHANGE_refresh_reveal_cancel (rrh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit a /refresh/reval request to the mint and get the mint's
|
||||
* Submit a /refresh/reval request to the exchange and get the exchange's
|
||||
* response.
|
||||
*
|
||||
* This API is typically used by a wallet. Note that to ensure that
|
||||
@ -1905,39 +1905,39 @@ handle_refresh_reveal_finished (void *cls,
|
||||
* arguments should have been committed to persistent storage
|
||||
* prior to calling this function.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param refresh_data_length size of the @a refresh_data (returned
|
||||
* in the `res_size` argument from #TALER_MINT_refresh_prepare())
|
||||
* in the `res_size` argument from #TALER_EXCHANGE_refresh_prepare())
|
||||
* @param refresh_data the refresh data as returned from
|
||||
#TALER_MINT_refresh_prepare())
|
||||
* @param noreveal_index response from the mint to the
|
||||
* #TALER_MINT_refresh_melt() invocation
|
||||
#TALER_EXCHANGE_refresh_prepare())
|
||||
* @param noreveal_index response from the exchange to the
|
||||
* #TALER_EXCHANGE_refresh_melt() invocation
|
||||
* @param reveal_cb the callback to call with the final result of the
|
||||
* refresh operation
|
||||
* @param reveal_cb_cls closure for the above callback
|
||||
* @return a handle for this request; NULL if the argument was invalid.
|
||||
* In this case, neither callback will be called.
|
||||
*/
|
||||
struct TALER_MINT_RefreshRevealHandle *
|
||||
TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_RefreshRevealHandle *
|
||||
TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
|
||||
size_t refresh_data_length,
|
||||
const char *refresh_data,
|
||||
uint16_t noreveal_index,
|
||||
TALER_MINT_RefreshRevealCallback reveal_cb,
|
||||
TALER_EXCHANGE_RefreshRevealCallback reveal_cb,
|
||||
void *reveal_cb_cls)
|
||||
{
|
||||
struct TALER_MINT_RefreshRevealHandle *rrh;
|
||||
struct TALER_EXCHANGE_RefreshRevealHandle *rrh;
|
||||
json_t *transfer_privs;
|
||||
json_t *reveal_obj;
|
||||
json_t *tmp;
|
||||
CURL *eh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
struct MeltData *md;
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -1953,7 +1953,7 @@ TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
|
||||
{
|
||||
/* We check this here, as it would be really bad to below just
|
||||
disclose all the transfer keys. Note that this error should
|
||||
have been caught way earlier when the mint replied, but maybe
|
||||
have been caught way earlier when the exchange replied, but maybe
|
||||
we had some internal corruption that changed the value... */
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -1991,13 +1991,13 @@ TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
|
||||
transfer_privs);
|
||||
|
||||
/* finally, we can actually issue the request */
|
||||
rrh = GNUNET_new (struct TALER_MINT_RefreshRevealHandle);
|
||||
rrh->mint = mint;
|
||||
rrh = GNUNET_new (struct TALER_EXCHANGE_RefreshRevealHandle);
|
||||
rrh->exchange = exchange;
|
||||
rrh->noreveal_index = noreveal_index;
|
||||
rrh->reveal_cb = reveal_cb;
|
||||
rrh->reveal_cb_cls = reveal_cb_cls;
|
||||
rrh->md = md;
|
||||
rrh->url = MAH_path_to_url (rrh->mint,
|
||||
rrh->url = MAH_path_to_url (rrh->exchange,
|
||||
"/refresh/reveal");
|
||||
|
||||
eh = curl_easy_init ();
|
||||
@ -2025,7 +2025,7 @@ TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&rrh->db));
|
||||
ctx = MAH_handle_to_context (rrh->mint);
|
||||
ctx = MAH_handle_to_context (rrh->exchange);
|
||||
rrh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -2042,7 +2042,7 @@ TALER_MINT_refresh_reveal (struct TALER_MINT_Handle *mint,
|
||||
* @param rrh the refresh reval handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_refresh_reveal_cancel (struct TALER_MINT_RefreshRevealHandle *rrh)
|
||||
TALER_EXCHANGE_refresh_reveal_cancel (struct TALER_EXCHANGE_RefreshRevealHandle *rrh)
|
||||
{
|
||||
if (NULL != rrh->job)
|
||||
{
|
||||
@ -2058,4 +2058,4 @@ TALER_MINT_refresh_reveal_cancel (struct TALER_MINT_RefreshRevealHandle *rrh)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_refresh.c */
|
||||
/* end of exchange_api_refresh.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_refresh_link.c
|
||||
* @brief Implementation of the /refresh/link request of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_refresh_link.c
|
||||
* @brief Implementation of the /refresh/link request of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,23 +24,23 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A /refresh/link Handle
|
||||
*/
|
||||
struct TALER_MINT_RefreshLinkHandle
|
||||
struct TALER_EXCHANGE_RefreshLinkHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -55,7 +55,7 @@ struct TALER_MINT_RefreshLinkHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_RefreshLinkCallback link_cb;
|
||||
TALER_EXCHANGE_RefreshLinkCallback link_cb;
|
||||
|
||||
/**
|
||||
* Closure for @e cb.
|
||||
@ -89,7 +89,7 @@ struct TALER_MINT_RefreshLinkHandle
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||
*/
|
||||
static int
|
||||
parse_refresh_link_coin (const struct TALER_MINT_RefreshLinkHandle *rlh,
|
||||
parse_refresh_link_coin (const struct TALER_EXCHANGE_RefreshLinkHandle *rlh,
|
||||
json_t *json,
|
||||
const struct TALER_TransferPublicKeyP *trans_pub,
|
||||
const struct TALER_EncryptedLinkSecretP *secret_enc,
|
||||
@ -172,7 +172,7 @@ parse_refresh_link_coin (const struct TALER_MINT_RefreshLinkHandle *rlh,
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||
*/
|
||||
static int
|
||||
parse_refresh_link_ok (struct TALER_MINT_RefreshLinkHandle *rlh,
|
||||
parse_refresh_link_ok (struct TALER_EXCHANGE_RefreshLinkHandle *rlh,
|
||||
json_t *json)
|
||||
{
|
||||
unsigned int session;
|
||||
@ -326,14 +326,14 @@ parse_refresh_link_ok (struct TALER_MINT_RefreshLinkHandle *rlh,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /refresh/link request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_RefreshLinkHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_RefreshLinkHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_refresh_link_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_RefreshLinkHandle *rlh = cls;
|
||||
struct TALER_EXCHANGE_RefreshLinkHandle *rlh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -355,11 +355,11 @@ handle_refresh_link_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
/* Nothing really to verify, mint says this coin was not melted; we
|
||||
/* Nothing really to verify, exchange says this coin was not melted; we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_INTERNAL_SERVER_ERROR:
|
||||
@ -381,39 +381,39 @@ handle_refresh_link_finished (void *cls,
|
||||
0, NULL, NULL, NULL,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_refresh_link_cancel (rlh);
|
||||
TALER_EXCHANGE_refresh_link_cancel (rlh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit a link request to the mint and get the mint's response.
|
||||
* Submit a link request to the exchange and get the exchange's response.
|
||||
*
|
||||
* This API is typically not used by anyone, it is more a threat
|
||||
* against those trying to receive a funds transfer by abusing the
|
||||
* /refresh protocol.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param coin_priv private key to request link data for
|
||||
* @param link_cb the callback to call with the useful result of the
|
||||
* refresh operation the @a coin_priv was involved in (if any)
|
||||
* @param link_cb_cls closure for @a link_cb
|
||||
* @return a handle for this request
|
||||
*/
|
||||
struct TALER_MINT_RefreshLinkHandle *
|
||||
TALER_MINT_refresh_link (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_RefreshLinkHandle *
|
||||
TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
|
||||
TALER_MINT_RefreshLinkCallback link_cb,
|
||||
TALER_EXCHANGE_RefreshLinkCallback link_cb,
|
||||
void *link_cb_cls)
|
||||
{
|
||||
struct TALER_MINT_RefreshLinkHandle *rlh;
|
||||
struct TALER_EXCHANGE_RefreshLinkHandle *rlh;
|
||||
CURL *eh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
char *pub_str;
|
||||
char *arg_str;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -428,12 +428,12 @@ TALER_MINT_refresh_link (struct TALER_MINT_Handle *mint,
|
||||
pub_str);
|
||||
GNUNET_free (pub_str);
|
||||
|
||||
rlh = GNUNET_new (struct TALER_MINT_RefreshLinkHandle);
|
||||
rlh->mint = mint;
|
||||
rlh = GNUNET_new (struct TALER_EXCHANGE_RefreshLinkHandle);
|
||||
rlh->exchange = exchange;
|
||||
rlh->link_cb = link_cb;
|
||||
rlh->link_cb_cls = link_cb_cls;
|
||||
rlh->coin_priv = *coin_priv;
|
||||
rlh->url = MAH_path_to_url (mint, arg_str);
|
||||
rlh->url = MAH_path_to_url (exchange, arg_str);
|
||||
GNUNET_free (arg_str);
|
||||
|
||||
eh = curl_easy_init ();
|
||||
@ -449,7 +449,7 @@ TALER_MINT_refresh_link (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&rlh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
rlh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -466,7 +466,7 @@ TALER_MINT_refresh_link (struct TALER_MINT_Handle *mint,
|
||||
* @param rlh the refresh link handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_refresh_link_cancel (struct TALER_MINT_RefreshLinkHandle *rlh)
|
||||
TALER_EXCHANGE_refresh_link_cancel (struct TALER_EXCHANGE_RefreshLinkHandle *rlh)
|
||||
{
|
||||
if (NULL != rlh->job)
|
||||
{
|
||||
@ -479,4 +479,4 @@ TALER_MINT_refresh_link_cancel (struct TALER_MINT_RefreshLinkHandle *rlh)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_refresh_link.c */
|
||||
/* end of exchange_api_refresh_link.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_reserve.c
|
||||
* @brief Implementation of the /reserve requests of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_reserve.c
|
||||
* @brief Implementation of the /reserve requests of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,10 +24,10 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
@ -36,13 +36,13 @@
|
||||
/**
|
||||
* @brief A Withdraw Status Handle
|
||||
*/
|
||||
struct TALER_MINT_ReserveStatusHandle
|
||||
struct TALER_EXCHANGE_ReserveStatusHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -57,7 +57,7 @@ struct TALER_MINT_ReserveStatusHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_ReserveStatusResultCallback cb;
|
||||
TALER_EXCHANGE_ReserveStatusResultCallback cb;
|
||||
|
||||
/**
|
||||
* Public key of the reserve we are querying.
|
||||
@ -98,7 +98,7 @@ parse_reserve_history (json_t *history,
|
||||
const char *currency,
|
||||
struct TALER_Amount *balance,
|
||||
unsigned int history_length,
|
||||
struct TALER_MINT_ReserveHistory *rhistory)
|
||||
struct TALER_EXCHANGE_ReserveHistory *rhistory)
|
||||
{
|
||||
struct GNUNET_HashCode uuid[history_length];
|
||||
unsigned int uuid_off;
|
||||
@ -140,13 +140,13 @@ parse_reserve_history (json_t *history,
|
||||
{
|
||||
json_t *wire;
|
||||
|
||||
rhistory[off].type = TALER_MINT_RTT_DEPOSIT;
|
||||
rhistory[off].type = TALER_EXCHANGE_RTT_DEPOSIT;
|
||||
if (GNUNET_OK !=
|
||||
TALER_amount_add (&total_in,
|
||||
&total_in,
|
||||
&amount))
|
||||
{
|
||||
/* overflow in history already!? inconceivable! Bad mint! */
|
||||
/* overflow in history already!? inconceivable! Bad exchange! */
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
@ -179,7 +179,7 @@ parse_reserve_history (json_t *history,
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
rhistory[off].type = TALER_MINT_RTT_WITHDRAWAL;
|
||||
rhistory[off].type = TALER_EXCHANGE_RTT_WITHDRAWAL;
|
||||
if (GNUNET_OK !=
|
||||
MAJ_parse_json (transaction,
|
||||
withdraw_spec))
|
||||
@ -210,7 +210,7 @@ parse_reserve_history (json_t *history,
|
||||
rhistory[off].details.out_authorization_sig = json_object_get (transaction,
|
||||
"signature");
|
||||
/* Check check that the same withdraw transaction
|
||||
isn't listed twice by the mint. We use the
|
||||
isn't listed twice by the exchange. We use the
|
||||
"uuid" array to remember the hashes of all
|
||||
purposes, and compare the hashes to find
|
||||
duplicates. */
|
||||
@ -235,7 +235,7 @@ parse_reserve_history (json_t *history,
|
||||
&total_out,
|
||||
&amount))
|
||||
{
|
||||
/* overflow in history already!? inconceivable! Bad mint! */
|
||||
/* overflow in history already!? inconceivable! Bad exchange! */
|
||||
GNUNET_break_op (0);
|
||||
MAJ_parse_free (withdraw_spec);
|
||||
return GNUNET_SYSERR;
|
||||
@ -256,7 +256,7 @@ parse_reserve_history (json_t *history,
|
||||
&total_in,
|
||||
&total_out))
|
||||
{
|
||||
/* total_in < total_out, why did the mint ever allow this!? */
|
||||
/* total_in < total_out, why did the exchange ever allow this!? */
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
@ -269,14 +269,14 @@ parse_reserve_history (json_t *history,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /reserve/status request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_ReserveStatusHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_ReserveStatusHandle`
|
||||
* @param eh curl handle of the request that finished
|
||||
*/
|
||||
static void
|
||||
handle_reserve_status_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_ReserveStatusHandle *wsh = cls;
|
||||
struct TALER_EXCHANGE_ReserveStatusHandle *wsh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -318,7 +318,7 @@ handle_reserve_status_finished (void *cls,
|
||||
}
|
||||
len = json_array_size (history);
|
||||
{
|
||||
struct TALER_MINT_ReserveHistory rhistory[len];
|
||||
struct TALER_EXCHANGE_ReserveHistory rhistory[len];
|
||||
|
||||
if (GNUNET_OK !=
|
||||
parse_reserve_history (history,
|
||||
@ -336,7 +336,7 @@ handle_reserve_status_finished (void *cls,
|
||||
TALER_amount_cmp (&balance_from_history,
|
||||
&balance))
|
||||
{
|
||||
/* mint cannot add up balances!? */
|
||||
/* exchange cannot add up balances!? */
|
||||
GNUNET_break_op (0);
|
||||
response_code = 0;
|
||||
break;
|
||||
@ -352,7 +352,7 @@ handle_reserve_status_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
@ -379,40 +379,40 @@ handle_reserve_status_finished (void *cls,
|
||||
NULL,
|
||||
0, NULL);
|
||||
json_decref (json);
|
||||
TALER_MINT_reserve_status_cancel (wsh);
|
||||
TALER_EXCHANGE_reserve_status_cancel (wsh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submit a request to obtain the transaction history of a reserve
|
||||
* from the mint. Note that while we return the full response to the
|
||||
* from the exchange. Note that while we return the full response to the
|
||||
* caller for further processing, we do already verify that the
|
||||
* response is well-formed (i.e. that signatures included in the
|
||||
* response are all valid and add up to the balance). If the mint's
|
||||
* response are all valid and add up to the balance). If the exchange's
|
||||
* reply is not well-formed, we return an HTTP status code of zero to
|
||||
* @a cb.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param reserve_pub public key of the reserve to inspect
|
||||
* @param cb the callback to call when a reply for this request is available
|
||||
* @param cb_cls closure for the above callback
|
||||
* @return a handle for this request; NULL if the inputs are invalid (i.e.
|
||||
* signatures fail to verify). In this case, the callback is not called.
|
||||
*/
|
||||
struct TALER_MINT_ReserveStatusHandle *
|
||||
TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_ReserveStatusHandle *
|
||||
TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
TALER_MINT_ReserveStatusResultCallback cb,
|
||||
TALER_EXCHANGE_ReserveStatusResultCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct TALER_MINT_ReserveStatusHandle *wsh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_ReserveStatusHandle *wsh;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
CURL *eh;
|
||||
char *pub_str;
|
||||
char *arg_str;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
@ -423,12 +423,12 @@ TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
|
||||
"/reserve/status?reserve_pub=%s",
|
||||
pub_str);
|
||||
GNUNET_free (pub_str);
|
||||
wsh = GNUNET_new (struct TALER_MINT_ReserveStatusHandle);
|
||||
wsh->mint = mint;
|
||||
wsh = GNUNET_new (struct TALER_EXCHANGE_ReserveStatusHandle);
|
||||
wsh->exchange = exchange;
|
||||
wsh->cb = cb;
|
||||
wsh->cb_cls = cb_cls;
|
||||
wsh->reserve_pub = *reserve_pub;
|
||||
wsh->url = MAH_path_to_url (mint,
|
||||
wsh->url = MAH_path_to_url (exchange,
|
||||
arg_str);
|
||||
GNUNET_free (arg_str);
|
||||
|
||||
@ -445,7 +445,7 @@ TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&wsh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
wsh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_NO,
|
||||
@ -462,7 +462,7 @@ TALER_MINT_reserve_status (struct TALER_MINT_Handle *mint,
|
||||
* @param wsh the withdraw status request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_reserve_status_cancel (struct TALER_MINT_ReserveStatusHandle *wsh)
|
||||
TALER_EXCHANGE_reserve_status_cancel (struct TALER_EXCHANGE_ReserveStatusHandle *wsh)
|
||||
{
|
||||
if (NULL != wsh->job)
|
||||
{
|
||||
@ -480,13 +480,13 @@ TALER_MINT_reserve_status_cancel (struct TALER_MINT_ReserveStatusHandle *wsh)
|
||||
/**
|
||||
* @brief A Withdraw Sign Handle
|
||||
*/
|
||||
struct TALER_MINT_ReserveWithdrawHandle
|
||||
struct TALER_EXCHANGE_ReserveWithdrawHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -506,7 +506,7 @@ struct TALER_MINT_ReserveWithdrawHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_ReserveWithdrawResultCallback cb;
|
||||
TALER_EXCHANGE_ReserveWithdrawResultCallback cb;
|
||||
|
||||
/**
|
||||
* Key used to blind the value.
|
||||
@ -516,7 +516,7 @@ struct TALER_MINT_ReserveWithdrawHandle
|
||||
/**
|
||||
* Denomination key we are withdrawing.
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey *pk;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *pk;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -544,7 +544,7 @@ struct TALER_MINT_ReserveWithdrawHandle
|
||||
/**
|
||||
* We got a 200 OK response for the /reserve/withdraw operation.
|
||||
* Extract the coin's signature and return it to the caller.
|
||||
* The signature we get from the mint is for the blinded value.
|
||||
* The signature we get from the exchange is for the blinded value.
|
||||
* Thus, we first must unblind it and then should verify its
|
||||
* validity against our coin's hash.
|
||||
*
|
||||
@ -552,11 +552,11 @@ struct TALER_MINT_ReserveWithdrawHandle
|
||||
* to the application via the callback.
|
||||
*
|
||||
* @param wsh operation handle
|
||||
* @param json reply from the mint
|
||||
* @param json reply from the exchange
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
||||
*/
|
||||
static int
|
||||
reserve_withdraw_ok (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
|
||||
json_t *json)
|
||||
{
|
||||
struct GNUNET_CRYPTO_rsa_Signature *blind_sig;
|
||||
@ -605,15 +605,15 @@ reserve_withdraw_ok (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
* Check the signatures on the withdraw transactions in the provided
|
||||
* history and that the balances add up. We don't do anything directly
|
||||
* with the information, as the JSON will be returned to the application.
|
||||
* However, our job is ensuring that the mint followed the protocol, and
|
||||
* However, our job is ensuring that the exchange followed the protocol, and
|
||||
* this in particular means checking all of the signatures in the history.
|
||||
*
|
||||
* @param wsh operation handle
|
||||
* @param json reply from the mint
|
||||
* @param json reply from the exchange
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
|
||||
*/
|
||||
static int
|
||||
reserve_withdraw_payment_required (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
|
||||
json_t *json)
|
||||
{
|
||||
struct TALER_Amount balance;
|
||||
@ -645,7 +645,7 @@ reserve_withdraw_payment_required (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
total incoming and outgoing amounts */
|
||||
len = json_array_size (history);
|
||||
{
|
||||
struct TALER_MINT_ReserveHistory rhistory[len];
|
||||
struct TALER_EXCHANGE_ReserveHistory rhistory[len];
|
||||
|
||||
if (GNUNET_OK !=
|
||||
parse_reserve_history (history,
|
||||
@ -664,7 +664,7 @@ reserve_withdraw_payment_required (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
TALER_amount_cmp (&balance_from_history,
|
||||
&balance))
|
||||
{
|
||||
/* mint cannot add up balances!? */
|
||||
/* exchange cannot add up balances!? */
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
@ -695,14 +695,14 @@ reserve_withdraw_payment_required (struct TALER_MINT_ReserveWithdrawHandle *wsh,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /reserve/withdraw request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_ReserveWithdrawHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_ReserveWithdrawHandle`
|
||||
* @param eh curl handle of the request that finished
|
||||
*/
|
||||
static void
|
||||
handle_reserve_withdraw_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_ReserveWithdrawHandle *wsh = cls;
|
||||
struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -724,11 +724,11 @@ handle_reserve_withdraw_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_PAYMENT_REQUIRED:
|
||||
/* The mint says that the reserve has insufficient funds;
|
||||
/* The exchange says that the reserve has insufficient funds;
|
||||
check the signatures in the history... */
|
||||
if (GNUNET_OK !=
|
||||
reserve_withdraw_payment_required (wsh,
|
||||
@ -740,12 +740,12 @@ handle_reserve_withdraw_finished (void *cls,
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
GNUNET_break (0);
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; as we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
/* Nothing really to verify, the mint basically just says
|
||||
/* Nothing really to verify, the exchange basically just says
|
||||
that it doesn't know this reserve. Can happen if we
|
||||
query before the wire transfer went through.
|
||||
We should simply pass the JSON reply to the application. */
|
||||
@ -769,18 +769,18 @@ handle_reserve_withdraw_finished (void *cls,
|
||||
NULL,
|
||||
json);
|
||||
json_decref (json);
|
||||
TALER_MINT_reserve_withdraw_cancel (wsh);
|
||||
TALER_EXCHANGE_reserve_withdraw_cancel (wsh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Withdraw a coin from the mint using a /reserve/withdraw request. Note
|
||||
* Withdraw a coin from the exchange using a /reserve/withdraw request. Note
|
||||
* that to ensure that no money is lost in case of hardware failures,
|
||||
* the caller must have committed (most of) the arguments to disk
|
||||
* before calling, and be ready to repeat the request with the same
|
||||
* arguments in case of failures.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param pk kind of coin to create
|
||||
* @param reserve_priv private key of the reserve to withdraw from
|
||||
* @param coin_priv where to store the coin's private key,
|
||||
@ -790,31 +790,31 @@ handle_reserve_withdraw_finished (void *cls,
|
||||
* @param res_cb the callback to call when the final result for this request is available
|
||||
* @param res_cb_cls closure for the above callback
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR
|
||||
* if the inputs are invalid (i.e. denomination key not with this mint).
|
||||
* if the inputs are invalid (i.e. denomination key not with this exchange).
|
||||
* In this case, the callback is not called.
|
||||
*/
|
||||
struct TALER_MINT_ReserveWithdrawHandle *
|
||||
TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
|
||||
const struct TALER_MINT_DenomPublicKey *pk,
|
||||
struct TALER_EXCHANGE_ReserveWithdrawHandle *
|
||||
TALER_EXCHANGE_reserve_withdraw (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *pk,
|
||||
const struct TALER_ReservePrivateKeyP *reserve_priv,
|
||||
const struct TALER_CoinSpendPrivateKeyP *coin_priv,
|
||||
const struct TALER_DenominationBlindingKey *blinding_key,
|
||||
TALER_MINT_ReserveWithdrawResultCallback res_cb,
|
||||
TALER_EXCHANGE_ReserveWithdrawResultCallback res_cb,
|
||||
void *res_cb_cls)
|
||||
{
|
||||
struct TALER_MINT_ReserveWithdrawHandle *wsh;
|
||||
struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh;
|
||||
struct TALER_WithdrawRequestPS req;
|
||||
struct TALER_ReserveSignatureP reserve_sig;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
char *coin_ev;
|
||||
size_t coin_ev_size;
|
||||
json_t *withdraw_obj;
|
||||
CURL *eh;
|
||||
|
||||
wsh = GNUNET_new (struct TALER_MINT_ReserveWithdrawHandle);
|
||||
wsh->mint = mint;
|
||||
wsh = GNUNET_new (struct TALER_EXCHANGE_ReserveWithdrawHandle);
|
||||
wsh->exchange = exchange;
|
||||
wsh->cb = res_cb;
|
||||
wsh->cb_cls = res_cb_cls;
|
||||
wsh->pk = pk;
|
||||
@ -838,7 +838,7 @@ TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
|
||||
&pk->fee_withdraw,
|
||||
&pk->value))
|
||||
{
|
||||
/* mint gave us denomination keys that overflow like this!? */
|
||||
/* exchange gave us denomination keys that overflow like this!? */
|
||||
GNUNET_break_op (0);
|
||||
GNUNET_free (coin_ev);
|
||||
GNUNET_free (wsh);
|
||||
@ -869,7 +869,7 @@ TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
|
||||
GNUNET_free (coin_ev);
|
||||
|
||||
wsh->blinding_key = blinding_key;
|
||||
wsh->url = MAH_path_to_url (mint, "/reserve/withdraw");
|
||||
wsh->url = MAH_path_to_url (exchange, "/reserve/withdraw");
|
||||
|
||||
eh = curl_easy_init ();
|
||||
GNUNET_assert (NULL != (wsh->json_enc =
|
||||
@ -896,7 +896,7 @@ TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&wsh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
wsh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -913,7 +913,7 @@ TALER_MINT_reserve_withdraw (struct TALER_MINT_Handle *mint,
|
||||
* @param sign the withdraw sign request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_reserve_withdraw_cancel (struct TALER_MINT_ReserveWithdrawHandle *sign)
|
||||
TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHandle *sign)
|
||||
{
|
||||
if (NULL != sign->job)
|
||||
{
|
||||
@ -927,4 +927,4 @@ TALER_MINT_reserve_withdraw_cancel (struct TALER_MINT_ReserveWithdrawHandle *sig
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_reserve.c */
|
||||
/* end of exchange_api_reserve.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_wire.c
|
||||
* @brief Implementation of the /wire request of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_wire.c
|
||||
* @brief Implementation of the /wire request of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,24 +24,24 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A Wire Handle
|
||||
*/
|
||||
struct TALER_MINT_WireHandle
|
||||
struct TALER_EXCHANGE_WireHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -56,7 +56,7 @@ struct TALER_MINT_WireHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_WireResultCallback cb;
|
||||
TALER_EXCHANGE_WireResultCallback cb;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -84,7 +84,7 @@ struct TALER_MINT_WireHandle
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* for /wire/sepa from the mint is valid.
|
||||
* for /wire/sepa from the exchange is valid.
|
||||
*
|
||||
* @param wh wire handle
|
||||
* @param json json reply with the signature
|
||||
@ -93,18 +93,18 @@ struct TALER_MINT_WireHandle
|
||||
* #GNUNET_OK if the json is valid
|
||||
*/
|
||||
static int
|
||||
verify_wire_sepa_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
verify_wire_sepa_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
|
||||
json_t *json)
|
||||
{
|
||||
struct TALER_MasterSignatureP mint_sig;
|
||||
struct TALER_MasterSignatureP exchange_sig;
|
||||
struct TALER_MasterWireSepaDetailsPS mp;
|
||||
const char *receiver_name;
|
||||
const char *iban;
|
||||
const char *bic;
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
struct GNUNET_HashContext *hc;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("sig", &mint_sig),
|
||||
MAJ_spec_fixed_auto ("sig", &exchange_sig),
|
||||
MAJ_spec_string ("receiver_name", &receiver_name),
|
||||
MAJ_spec_string ("iban", &iban),
|
||||
MAJ_spec_string ("bic", &bic),
|
||||
@ -119,7 +119,7 @@ verify_wire_sepa_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
|
||||
key_state = TALER_MINT_get_keys (wh->mint);
|
||||
key_state = TALER_EXCHANGE_get_keys (wh->exchange);
|
||||
mp.purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SEPA_DETAILS);
|
||||
mp.purpose.size = htonl (sizeof (struct TALER_MasterWireSepaDetailsPS));
|
||||
hc = GNUNET_CRYPTO_hash_context_start ();
|
||||
@ -138,7 +138,7 @@ verify_wire_sepa_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_SEPA_DETAILS,
|
||||
&mp.purpose,
|
||||
&mint_sig.eddsa_signature,
|
||||
&exchange_sig.eddsa_signature,
|
||||
&key_state->master_pub.eddsa_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
@ -152,7 +152,7 @@ verify_wire_sepa_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* for /wire/METHOD from the mint is valid.
|
||||
* for /wire/METHOD from the exchange is valid.
|
||||
*
|
||||
* @param wh wire handle with key material
|
||||
* @param method method to verify the reply for
|
||||
@ -162,7 +162,7 @@ verify_wire_sepa_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
* #GNUNET_OK if the json is valid
|
||||
*/
|
||||
static int
|
||||
verify_wire_method_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
verify_wire_method_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
|
||||
const char *method,
|
||||
json_t *json)
|
||||
{
|
||||
@ -179,7 +179,7 @@ verify_wire_method_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
* @param wh wire handle with key material
|
||||
* @param json json reply with signature to verify
|
||||
*/
|
||||
int (*handler)(const struct TALER_MINT_WireHandle *wh,
|
||||
int (*handler)(const struct TALER_EXCHANGE_WireHandle *wh,
|
||||
json_t *json);
|
||||
} handlers[] = {
|
||||
{ "sepa", &verify_wire_sepa_signature_ok },
|
||||
@ -207,21 +207,21 @@ verify_wire_method_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
* @return a handle for this request
|
||||
*/
|
||||
static void
|
||||
request_wire_method (struct TALER_MINT_WireHandle *wh);
|
||||
request_wire_method (struct TALER_EXCHANGE_WireHandle *wh);
|
||||
|
||||
|
||||
/**
|
||||
* Function called when we're done processing the
|
||||
* HTTP /wire/METHOD request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_WireHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_WireHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_wire_method_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_WireHandle *wh = cls;
|
||||
struct TALER_EXCHANGE_WireHandle *wh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -255,7 +255,7 @@ handle_wire_method_finished (void *cls,
|
||||
this information back to the callback below */
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
@ -283,7 +283,7 @@ handle_wire_method_finished (void *cls,
|
||||
NULL,
|
||||
NULL);
|
||||
json_decref (json);
|
||||
TALER_MINT_wire_cancel (wh);
|
||||
TALER_EXCHANGE_wire_cancel (wh);
|
||||
return;
|
||||
}
|
||||
/* pass on successful reply */
|
||||
@ -305,9 +305,9 @@ handle_wire_method_finished (void *cls,
|
||||
* @return a handle for this request
|
||||
*/
|
||||
static void
|
||||
request_wire_method (struct TALER_MINT_WireHandle *wh)
|
||||
request_wire_method (struct TALER_EXCHANGE_WireHandle *wh)
|
||||
{
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
CURL *eh;
|
||||
char *path;
|
||||
|
||||
@ -318,7 +318,7 @@ request_wire_method (struct TALER_MINT_WireHandle *wh)
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
TALER_MINT_wire_cancel (wh);
|
||||
TALER_EXCHANGE_wire_cancel (wh);
|
||||
return;
|
||||
}
|
||||
GNUNET_free_non_null (wh->db.buf);
|
||||
@ -330,7 +330,7 @@ request_wire_method (struct TALER_MINT_WireHandle *wh)
|
||||
"/wire/%s",
|
||||
json_string_value (json_array_get (wh->methods,
|
||||
wh->methods_off++)));
|
||||
wh->url = MAH_path_to_url (wh->mint,
|
||||
wh->url = MAH_path_to_url (wh->exchange,
|
||||
path);
|
||||
GNUNET_free (path);
|
||||
|
||||
@ -352,19 +352,19 @@ request_wire_method (struct TALER_MINT_WireHandle *wh)
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_FOLLOWLOCATION,
|
||||
(long) 0));
|
||||
ctx = MAH_handle_to_context (wh->mint);
|
||||
ctx = MAH_handle_to_context (wh->exchange);
|
||||
wh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
&handle_wire_method_finished,
|
||||
wh);
|
||||
TALER_MINT_perform (ctx);
|
||||
TALER_EXCHANGE_perform (ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verify that the signature on the "200 OK" response
|
||||
* for /wire from the mint is valid.
|
||||
* for /wire from the exchange is valid.
|
||||
*
|
||||
* @param wh wire handle
|
||||
* @param json json reply with the signature
|
||||
@ -372,18 +372,18 @@ request_wire_method (struct TALER_MINT_WireHandle *wh)
|
||||
* "methods" array (with an RC of 1)
|
||||
*/
|
||||
static json_t *
|
||||
verify_wire_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
verify_wire_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh,
|
||||
json_t *json)
|
||||
{
|
||||
struct TALER_MintSignatureP mint_sig;
|
||||
struct TALER_MintPublicKeyP mint_pub;
|
||||
struct TALER_MintWireSupportMethodsPS mp;
|
||||
struct TALER_ExchangeSignatureP exchange_sig;
|
||||
struct TALER_ExchangePublicKeyP exchange_pub;
|
||||
struct TALER_ExchangeWireSupportMethodsPS mp;
|
||||
json_t *methods;
|
||||
const struct TALER_MINT_Keys *key_state;
|
||||
const struct TALER_EXCHANGE_Keys *key_state;
|
||||
struct GNUNET_HashContext *hc;
|
||||
struct MAJ_Specification spec[] = {
|
||||
MAJ_spec_fixed_auto ("sig", &mint_sig),
|
||||
MAJ_spec_fixed_auto ("pub", &mint_pub),
|
||||
MAJ_spec_fixed_auto ("sig", &exchange_sig),
|
||||
MAJ_spec_fixed_auto ("pub", &exchange_pub),
|
||||
MAJ_spec_json ("methods", &methods),
|
||||
MAJ_spec_end
|
||||
};
|
||||
@ -403,10 +403,10 @@ verify_wire_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
key_state = TALER_MINT_get_keys (wh->mint);
|
||||
key_state = TALER_EXCHANGE_get_keys (wh->exchange);
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINT_test_signing_key (key_state,
|
||||
&mint_pub))
|
||||
TALER_EXCHANGE_test_signing_key (key_state,
|
||||
&exchange_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return NULL;
|
||||
@ -429,16 +429,16 @@ verify_wire_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
method,
|
||||
strlen (method) + 1);
|
||||
}
|
||||
mp.purpose.purpose = htonl (TALER_SIGNATURE_MINT_WIRE_TYPES);
|
||||
mp.purpose.size = htonl (sizeof (struct TALER_MintWireSupportMethodsPS));
|
||||
mp.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_WIRE_TYPES);
|
||||
mp.purpose.size = htonl (sizeof (struct TALER_ExchangeWireSupportMethodsPS));
|
||||
GNUNET_CRYPTO_hash_context_finish (hc,
|
||||
&mp.h_wire_types);
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MINT_WIRE_TYPES,
|
||||
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_EXCHANGE_WIRE_TYPES,
|
||||
&mp.purpose,
|
||||
&mint_sig.eddsa_signature,
|
||||
&mint_pub.eddsa_pub))
|
||||
&exchange_sig.eddsa_signature,
|
||||
&exchange_pub.eddsa_pub))
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
MAJ_parse_free (spec);
|
||||
@ -452,14 +452,14 @@ verify_wire_signature_ok (const struct TALER_MINT_WireHandle *wh,
|
||||
* Function called when we're done processing the
|
||||
* HTTP /wire request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_WireHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_WireHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_wire_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_WireHandle *wh = cls;
|
||||
struct TALER_EXCHANGE_WireHandle *wh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -489,7 +489,7 @@ handle_wire_finished (void *cls,
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
@ -524,15 +524,15 @@ handle_wire_finished (void *cls,
|
||||
NULL);
|
||||
if (NULL != json)
|
||||
json_decref (json);
|
||||
TALER_MINT_wire_cancel (wh);
|
||||
TALER_EXCHANGE_wire_cancel (wh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain information about a mint's wire instructions.
|
||||
* A mint may provide wire instructions for creating
|
||||
* Obtain information about a exchange's wire instructions.
|
||||
* A exchange may provide wire instructions for creating
|
||||
* a reserve. The wire instructions also indicate
|
||||
* which wire formats merchants may use with the mint.
|
||||
* which wire formats merchants may use with the exchange.
|
||||
* This API is typically used by a wallet for wiring
|
||||
* funds, and possibly by a merchant to determine
|
||||
* supported wire formats.
|
||||
@ -540,34 +540,34 @@ handle_wire_finished (void *cls,
|
||||
* Note that while we return the (main) response verbatim to the
|
||||
* caller for further processing, we do already verify that the
|
||||
* response is well-formed (i.e. that signatures included in the
|
||||
* response are all valid). If the mint's reply is not well-formed,
|
||||
* response are all valid). If the exchange's reply is not well-formed,
|
||||
* we return an HTTP status code of zero to @a cb.
|
||||
*
|
||||
* @param mint the mint handle; the mint must be ready to operate
|
||||
* @param exchange the exchange handle; the exchange must be ready to operate
|
||||
* @param wire_cb the callback to call when a reply for this request is available
|
||||
* @param wire_cb_cls closure for the above callback
|
||||
* @return a handle for this request
|
||||
*/
|
||||
struct TALER_MINT_WireHandle *
|
||||
TALER_MINT_wire (struct TALER_MINT_Handle *mint,
|
||||
TALER_MINT_WireResultCallback wire_cb,
|
||||
struct TALER_EXCHANGE_WireHandle *
|
||||
TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
|
||||
TALER_EXCHANGE_WireResultCallback wire_cb,
|
||||
void *wire_cb_cls)
|
||||
{
|
||||
struct TALER_MINT_WireHandle *wh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_WireHandle *wh;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
CURL *eh;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
wh = GNUNET_new (struct TALER_MINT_WireHandle);
|
||||
wh->mint = mint;
|
||||
wh = GNUNET_new (struct TALER_EXCHANGE_WireHandle);
|
||||
wh->exchange = exchange;
|
||||
wh->cb = wire_cb;
|
||||
wh->cb_cls = wire_cb_cls;
|
||||
wh->url = MAH_path_to_url (mint, "/wire");
|
||||
wh->url = MAH_path_to_url (exchange, "/wire");
|
||||
|
||||
eh = curl_easy_init ();
|
||||
GNUNET_assert (CURLE_OK ==
|
||||
@ -582,7 +582,7 @@ TALER_MINT_wire (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&wh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
wh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -599,7 +599,7 @@ TALER_MINT_wire (struct TALER_MINT_Handle *mint,
|
||||
* @param wh the wire information request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_wire_cancel (struct TALER_MINT_WireHandle *wh)
|
||||
TALER_EXCHANGE_wire_cancel (struct TALER_EXCHANGE_WireHandle *wh)
|
||||
{
|
||||
if (NULL != wh->job)
|
||||
{
|
||||
@ -617,4 +617,4 @@ TALER_MINT_wire_cancel (struct TALER_MINT_WireHandle *wh)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_wire.c */
|
||||
/* end of exchange_api_wire.c */
|
@ -15,8 +15,8 @@
|
||||
<http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-lib/mint_api_wire_deposits.c
|
||||
* @brief Implementation of the /wire/deposits request of the mint's HTTP API
|
||||
* @file exchange-lib/exchange_api_wire_deposits.c
|
||||
* @brief Implementation of the /wire/deposits request of the exchange's HTTP API
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
@ -24,24 +24,24 @@
|
||||
#include <jansson.h>
|
||||
#include <microhttpd.h> /* just for HTTP status codes */
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mint_service.h"
|
||||
#include "mint_api_common.h"
|
||||
#include "mint_api_json.h"
|
||||
#include "mint_api_context.h"
|
||||
#include "mint_api_handle.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include "exchange_api_common.h"
|
||||
#include "exchange_api_json.h"
|
||||
#include "exchange_api_context.h"
|
||||
#include "exchange_api_handle.h"
|
||||
#include "taler_signatures.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief A /wire/deposits Handle
|
||||
*/
|
||||
struct TALER_MINT_WireDepositsHandle
|
||||
struct TALER_EXCHANGE_WireDepositsHandle
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection to mint this request handle will use
|
||||
* The connection to exchange this request handle will use
|
||||
*/
|
||||
struct TALER_MINT_Handle *mint;
|
||||
struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* The url for this request.
|
||||
@ -56,7 +56,7 @@ struct TALER_MINT_WireDepositsHandle
|
||||
/**
|
||||
* Function to call with the result.
|
||||
*/
|
||||
TALER_MINT_WireDepositsCallback cb;
|
||||
TALER_EXCHANGE_WireDepositsCallback cb;
|
||||
|
||||
/**
|
||||
* Closure for @a cb.
|
||||
@ -75,14 +75,14 @@ struct TALER_MINT_WireDepositsHandle
|
||||
* Function called when we're done processing the
|
||||
* HTTP /wire/deposits request.
|
||||
*
|
||||
* @param cls the `struct TALER_MINT_WireDepositsHandle`
|
||||
* @param cls the `struct TALER_EXCHANGE_WireDepositsHandle`
|
||||
* @param eh the curl request handle
|
||||
*/
|
||||
static void
|
||||
handle_wire_deposits_finished (void *cls,
|
||||
CURL *eh)
|
||||
{
|
||||
struct TALER_MINT_WireDepositsHandle *wdh = cls;
|
||||
struct TALER_EXCHANGE_WireDepositsHandle *wdh = cls;
|
||||
long response_code;
|
||||
json_t *json;
|
||||
|
||||
@ -154,22 +154,22 @@ handle_wire_deposits_finished (void *cls,
|
||||
num_details,
|
||||
details);
|
||||
json_decref (json);
|
||||
TALER_MINT_wire_deposits_cancel (wdh);
|
||||
TALER_EXCHANGE_wire_deposits_cancel (wdh);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MHD_HTTP_BAD_REQUEST:
|
||||
/* This should never happen, either us or the mint is buggy
|
||||
/* This should never happen, either us or the exchange is buggy
|
||||
(or API version conflict); just pass JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_UNAUTHORIZED:
|
||||
/* Nothing really to verify, mint says one of the signatures is
|
||||
/* Nothing really to verify, exchange says one of the signatures is
|
||||
invalid; as we checked them, this should never happen, we
|
||||
should pass the JSON reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_NOT_FOUND:
|
||||
/* Mint does not know about transaction;
|
||||
/* Exchange does not know about transaction;
|
||||
we should pass the reply to the application */
|
||||
break;
|
||||
case MHD_HTTP_INTERNAL_SERVER_ERROR:
|
||||
@ -190,41 +190,41 @@ handle_wire_deposits_finished (void *cls,
|
||||
json,
|
||||
NULL, NULL, 0, NULL);
|
||||
json_decref (json);
|
||||
TALER_MINT_wire_deposits_cancel (wdh);
|
||||
TALER_EXCHANGE_wire_deposits_cancel (wdh);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Query the mint about which transactions were combined
|
||||
* Query the exchange about which transactions were combined
|
||||
* to create a wire transfer.
|
||||
*
|
||||
* @param mint mint to query
|
||||
* @param exchange exchange to query
|
||||
* @param wtid raw wire transfer identifier to get information about
|
||||
* @param cb callback to call
|
||||
* @param cb_cls closure for @a cb
|
||||
* @return handle to cancel operation
|
||||
*/
|
||||
struct TALER_MINT_WireDepositsHandle *
|
||||
TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint,
|
||||
struct TALER_EXCHANGE_WireDepositsHandle *
|
||||
TALER_EXCHANGE_wire_deposits (struct TALER_EXCHANGE_Handle *exchange,
|
||||
const struct TALER_WireTransferIdentifierRawP *wtid,
|
||||
TALER_MINT_WireDepositsCallback cb,
|
||||
TALER_EXCHANGE_WireDepositsCallback cb,
|
||||
void *cb_cls)
|
||||
{
|
||||
struct TALER_MINT_WireDepositsHandle *wdh;
|
||||
struct TALER_MINT_Context *ctx;
|
||||
struct TALER_EXCHANGE_WireDepositsHandle *wdh;
|
||||
struct TALER_EXCHANGE_Context *ctx;
|
||||
char *buf;
|
||||
char *path;
|
||||
CURL *eh;
|
||||
|
||||
if (GNUNET_YES !=
|
||||
MAH_handle_is_ready (mint))
|
||||
MAH_handle_is_ready (exchange))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wdh = GNUNET_new (struct TALER_MINT_WireDepositsHandle);
|
||||
wdh->mint = mint;
|
||||
wdh = GNUNET_new (struct TALER_EXCHANGE_WireDepositsHandle);
|
||||
wdh->exchange = exchange;
|
||||
wdh->cb = cb;
|
||||
wdh->cb_cls = cb_cls;
|
||||
|
||||
@ -233,7 +233,7 @@ TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint,
|
||||
GNUNET_asprintf (&path,
|
||||
"/wire/deposits?wtid=%s",
|
||||
buf);
|
||||
wdh->url = MAH_path_to_url (wdh->mint,
|
||||
wdh->url = MAH_path_to_url (wdh->exchange,
|
||||
path);
|
||||
GNUNET_free (buf);
|
||||
GNUNET_free (path);
|
||||
@ -251,7 +251,7 @@ TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint,
|
||||
curl_easy_setopt (eh,
|
||||
CURLOPT_WRITEDATA,
|
||||
&wdh->db));
|
||||
ctx = MAH_handle_to_context (mint);
|
||||
ctx = MAH_handle_to_context (exchange);
|
||||
wdh->job = MAC_job_add (ctx,
|
||||
eh,
|
||||
GNUNET_YES,
|
||||
@ -268,7 +268,7 @@ TALER_MINT_wire_deposits (struct TALER_MINT_Handle *mint,
|
||||
* @param wdh the wire deposits request handle
|
||||
*/
|
||||
void
|
||||
TALER_MINT_wire_deposits_cancel (struct TALER_MINT_WireDepositsHandle *wdh)
|
||||
TALER_EXCHANGE_wire_deposits_cancel (struct TALER_EXCHANGE_WireDepositsHandle *wdh)
|
||||
{
|
||||
if (NULL != wdh->job)
|
||||
{
|
||||
@ -281,4 +281,4 @@ TALER_MINT_wire_deposits_cancel (struct TALER_MINT_WireDepositsHandle *wdh)
|
||||
}
|
||||
|
||||
|
||||
/* end of mint_api_wire_deposits.c */
|
||||
/* end of exchange_api_wire_deposits.c */
|
@ -1,16 +1,16 @@
|
||||
[mint]
|
||||
# Currency supported by the mint (can only be one)
|
||||
[exchange]
|
||||
# Currency supported by the exchange (can only be one)
|
||||
CURRENCY = EUR
|
||||
|
||||
# Wire format supported by the mint
|
||||
# Wire format supported by the exchange
|
||||
# We use 'test' for testing of the actual
|
||||
# coin operations, and 'sepa' to test SEPA-specific routines.
|
||||
WIREFORMAT = test sepa
|
||||
|
||||
# HTTP port the mint listens to
|
||||
# HTTP port the exchange listens to
|
||||
PORT = 8081
|
||||
|
||||
# Master public key used to sign the mint's various keys
|
||||
# Master public key used to sign the exchange's various keys
|
||||
MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
|
||||
|
||||
# How to access our database
|
||||
@ -19,12 +19,12 @@ DB = postgres
|
||||
# Is this is a testcase, use transient DB actions?
|
||||
TESTRUN = YES
|
||||
|
||||
[mintdb-postgres]
|
||||
[exchangedb-postgres]
|
||||
|
||||
DB_CONN_STR = "postgres:///talercheck"
|
||||
|
||||
[mint-wire-sepa]
|
||||
SEPA_RESPONSE_FILE = "test-mint-home/sepa.json"
|
||||
[exchange-wire-sepa]
|
||||
SEPA_RESPONSE_FILE = "test-exchange-home/sepa.json"
|
||||
|
||||
[mint-wire-test]
|
||||
[exchange-wire-test]
|
||||
REDIRECT_URL = "http://www.taler.net/"
|
@ -1,4 +1,4 @@
|
||||
[mint_keys]
|
||||
[exchange_keys]
|
||||
|
||||
# how long is one signkey valid?
|
||||
signkey_duration = 4 weeks
|
@ -14,15 +14,15 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint/test_mint_api.c
|
||||
* @brief testcase to test mint's HTTP API interface
|
||||
* @file exchange/test_exchange_api.c
|
||||
* @brief testcase to test exchange's HTTP API interface
|
||||
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include "taler_util.h"
|
||||
#include "taler_signatures.h"
|
||||
#include "taler_mint_service.h"
|
||||
#include "taler_exchange_service.h"
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <microhttpd.h>
|
||||
|
||||
@ -39,12 +39,12 @@
|
||||
/**
|
||||
* Main execution context for the main loop.
|
||||
*/
|
||||
static struct TALER_MINT_Context *ctx;
|
||||
static struct TALER_EXCHANGE_Context *ctx;
|
||||
|
||||
/**
|
||||
* Handle to access the mint.
|
||||
* Handle to access the exchange.
|
||||
*/
|
||||
static struct TALER_MINT_Handle *mint;
|
||||
static struct TALER_EXCHANGE_Handle *exchange;
|
||||
|
||||
/**
|
||||
* Task run on shutdown.
|
||||
@ -103,23 +103,23 @@ enum OpCode
|
||||
OC_REFRESH_REVEAL,
|
||||
|
||||
/**
|
||||
* Verify mint's /refresh/link by linking original private key to
|
||||
* Verify exchange's /refresh/link by linking original private key to
|
||||
* results from #OC_REFRESH_REVEAL step.
|
||||
*/
|
||||
OC_REFRESH_LINK,
|
||||
|
||||
/**
|
||||
* Verify the mint's /wire-method.
|
||||
* Verify the exchange's /wire-method.
|
||||
*/
|
||||
OC_WIRE,
|
||||
|
||||
/**
|
||||
* Verify mint's /wire/deposits method.
|
||||
* Verify exchange's /wire/deposits method.
|
||||
*/
|
||||
OC_WIRE_DEPOSITS,
|
||||
|
||||
/**
|
||||
* Verify mint's /deposit/wtid method.
|
||||
* Verify exchange's /deposit/wtid method.
|
||||
*/
|
||||
OC_DEPOSIT_WTID
|
||||
|
||||
@ -159,10 +159,10 @@ struct FreshCoin
|
||||
* use. Otherwise, this will be set (by the interpreter) to the
|
||||
* denomination PK matching @e amount.
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey *pk;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *pk;
|
||||
|
||||
/**
|
||||
* Set (by the interpreter) to the mint's signature over the
|
||||
* Set (by the interpreter) to the exchange's signature over the
|
||||
* coin's public key.
|
||||
*/
|
||||
struct TALER_DenominationSignature sig;
|
||||
@ -176,7 +176,7 @@ struct FreshCoin
|
||||
|
||||
|
||||
/**
|
||||
* Details for a mint operation to execute.
|
||||
* Details for a exchange operation to execute.
|
||||
*/
|
||||
struct Command
|
||||
{
|
||||
@ -233,7 +233,7 @@ struct Command
|
||||
/**
|
||||
* Set to the API's handle during the operation.
|
||||
*/
|
||||
struct TALER_MINT_AdminAddIncomingHandle *aih;
|
||||
struct TALER_EXCHANGE_AdminAddIncomingHandle *aih;
|
||||
|
||||
} admin_add_incoming;
|
||||
|
||||
@ -252,7 +252,7 @@ struct Command
|
||||
/**
|
||||
* Set to the API's handle during the operation.
|
||||
*/
|
||||
struct TALER_MINT_ReserveStatusHandle *wsh;
|
||||
struct TALER_EXCHANGE_ReserveStatusHandle *wsh;
|
||||
|
||||
/**
|
||||
* Expected reserve balance.
|
||||
@ -274,7 +274,7 @@ struct Command
|
||||
|
||||
/**
|
||||
* String describing the denomination value we should withdraw.
|
||||
* A corresponding denomination key must exist in the mint's
|
||||
* A corresponding denomination key must exist in the exchange's
|
||||
* offerings. Can be NULL if @e pk is set instead.
|
||||
*/
|
||||
const char *amount;
|
||||
@ -284,10 +284,10 @@ struct Command
|
||||
* use. Otherwise, this will be set (by the interpreter) to the
|
||||
* denomination PK matching @e amount.
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey *pk;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *pk;
|
||||
|
||||
/**
|
||||
* Set (by the interpreter) to the mint's signature over the
|
||||
* Set (by the interpreter) to the exchange's signature over the
|
||||
* coin's public key.
|
||||
*/
|
||||
struct TALER_DenominationSignature sig;
|
||||
@ -305,7 +305,7 @@ struct Command
|
||||
/**
|
||||
* Withdraw handle (while operation is running).
|
||||
*/
|
||||
struct TALER_MINT_ReserveWithdrawHandle *wsh;
|
||||
struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh;
|
||||
|
||||
} reserve_withdraw;
|
||||
|
||||
@ -362,7 +362,7 @@ struct Command
|
||||
/**
|
||||
* Deposit handle while operation is running.
|
||||
*/
|
||||
struct TALER_MINT_DepositHandle *dh;
|
||||
struct TALER_EXCHANGE_DepositHandle *dh;
|
||||
|
||||
} deposit;
|
||||
|
||||
@ -386,12 +386,12 @@ struct Command
|
||||
* Array of the public keys corresponding to
|
||||
* the @e fresh_amounts, set by the interpreter.
|
||||
*/
|
||||
const struct TALER_MINT_DenomPublicKey **fresh_pks;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey **fresh_pks;
|
||||
|
||||
/**
|
||||
* Melt handle while operation is running.
|
||||
*/
|
||||
struct TALER_MINT_RefreshMeltHandle *rmh;
|
||||
struct TALER_EXCHANGE_RefreshMeltHandle *rmh;
|
||||
|
||||
/**
|
||||
* Data used in the refresh operation, set by the interpreter.
|
||||
@ -405,7 +405,7 @@ struct Command
|
||||
|
||||
/**
|
||||
* Set by the interpreter (upon completion) to the noreveal
|
||||
* index selected by the mint.
|
||||
* index selected by the exchange.
|
||||
*/
|
||||
uint16_t noreveal_index;
|
||||
|
||||
@ -425,7 +425,7 @@ struct Command
|
||||
/**
|
||||
* Reveal handle while operation is running.
|
||||
*/
|
||||
struct TALER_MINT_RefreshRevealHandle *rrh;
|
||||
struct TALER_EXCHANGE_RefreshRevealHandle *rrh;
|
||||
|
||||
/**
|
||||
* Number of fresh coins withdrawn, set by the interpreter.
|
||||
@ -454,7 +454,7 @@ struct Command
|
||||
/**
|
||||
* Link handle while operation is running.
|
||||
*/
|
||||
struct TALER_MINT_RefreshLinkHandle *rlh;
|
||||
struct TALER_EXCHANGE_RefreshLinkHandle *rlh;
|
||||
|
||||
/**
|
||||
* Which of the melted coins should be used for the linkage?
|
||||
@ -471,7 +471,7 @@ struct Command
|
||||
/**
|
||||
* Handle to the wire request.
|
||||
*/
|
||||
struct TALER_MINT_WireHandle *wh;
|
||||
struct TALER_EXCHANGE_WireHandle *wh;
|
||||
|
||||
/**
|
||||
* Format we expect to see, others will be *ignored*.
|
||||
@ -488,7 +488,7 @@ struct Command
|
||||
/**
|
||||
* Handle to the wire deposits request.
|
||||
*/
|
||||
struct TALER_MINT_WireDepositsHandle *wdh;
|
||||
struct TALER_EXCHANGE_WireDepositsHandle *wdh;
|
||||
|
||||
/**
|
||||
* Reference to a /deposit/wtid command. If set, we use the
|
||||
@ -514,7 +514,7 @@ struct Command
|
||||
/**
|
||||
* Handle to the deposit wtid request.
|
||||
*/
|
||||
struct TALER_MINT_DepositWtidHandle *dwh;
|
||||
struct TALER_EXCHANGE_DepositWtidHandle *dwh;
|
||||
|
||||
/**
|
||||
* Which /deposit operation should we obtain WTID data for?
|
||||
@ -545,9 +545,9 @@ struct Command
|
||||
struct InterpreterState
|
||||
{
|
||||
/**
|
||||
* Keys from the mint.
|
||||
* Keys from the exchange.
|
||||
*/
|
||||
const struct TALER_MINT_Keys *keys;
|
||||
const struct TALER_EXCHANGE_Keys *keys;
|
||||
|
||||
/**
|
||||
* Commands the interpreter will run.
|
||||
@ -637,7 +637,7 @@ find_command (const struct InterpreterState *is,
|
||||
|
||||
|
||||
/**
|
||||
* Run the main interpreter loop that performs mint operations.
|
||||
* Run the main interpreter loop that performs exchange operations.
|
||||
*
|
||||
* @param cls contains the `struct InterpreterState`
|
||||
* @param tc scheduler context
|
||||
@ -652,8 +652,8 @@ interpreter_run (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* @param full_response full response from the mint (for logging, in case of errors)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
add_incoming_cb (void *cls,
|
||||
@ -685,12 +685,12 @@ add_incoming_cb (void *cls,
|
||||
* @return #GNUNET_OK if they match, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
compare_admin_add_incoming_history (const struct TALER_MINT_ReserveHistory *h,
|
||||
compare_admin_add_incoming_history (const struct TALER_EXCHANGE_ReserveHistory *h,
|
||||
const struct Command *cmd)
|
||||
{
|
||||
struct TALER_Amount amount;
|
||||
|
||||
if (TALER_MINT_RTT_DEPOSIT != h->type)
|
||||
if (TALER_EXCHANGE_RTT_DEPOSIT != h->type)
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -717,13 +717,13 @@ compare_admin_add_incoming_history (const struct TALER_MINT_ReserveHistory *h,
|
||||
* @return #GNUNET_OK if they match, #GNUNET_SYSERR if not
|
||||
*/
|
||||
static int
|
||||
compare_reserve_withdraw_history (const struct TALER_MINT_ReserveHistory *h,
|
||||
compare_reserve_withdraw_history (const struct TALER_EXCHANGE_ReserveHistory *h,
|
||||
const struct Command *cmd)
|
||||
{
|
||||
struct TALER_Amount amount;
|
||||
struct TALER_Amount amount_with_fee;
|
||||
|
||||
if (TALER_MINT_RTT_WITHDRAWAL != h->type)
|
||||
if (TALER_EXCHANGE_RTT_WITHDRAWAL != h->type)
|
||||
{
|
||||
GNUNET_break_op (0);
|
||||
return GNUNET_SYSERR;
|
||||
@ -750,7 +750,7 @@ compare_reserve_withdraw_history (const struct TALER_MINT_ReserveHistory *h,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param[in] json original response in JSON format (useful only for diagnostics)
|
||||
* @param balance current balance in the reserve, NULL on error
|
||||
* @param history_length number of entries in the transaction history, 0 on error
|
||||
@ -762,7 +762,7 @@ reserve_status_cb (void *cls,
|
||||
json_t *json,
|
||||
const struct TALER_Amount *balance,
|
||||
unsigned int history_length,
|
||||
const struct TALER_MINT_ReserveHistory *history)
|
||||
const struct TALER_EXCHANGE_ReserveHistory *history)
|
||||
{
|
||||
struct InterpreterState *is = cls;
|
||||
struct Command *cmd = &is->commands[is->ip];
|
||||
@ -868,9 +868,9 @@ reserve_status_cb (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param sig signature over the coin, NULL on error
|
||||
* @param full_response full response from the mint (for logging, in case of errors)
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
reserve_withdraw_cb (void *cls,
|
||||
@ -924,7 +924,7 @@ reserve_withdraw_cb (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful deposit;
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param obj the received JSON reply, should be kept as proof (and, in case of errors,
|
||||
* be forwarded to the customer)
|
||||
*/
|
||||
@ -958,10 +958,10 @@ deposit_cb (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, never #MHD_HTTP_OK (200) as for successful intermediate response this callback is skipped.
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* @param noreveal_index choice by the mint in the cut-and-choose protocol,
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param noreveal_index choice by the exchange in the cut-and-choose protocol,
|
||||
* UINT16_MAX on error
|
||||
* @param full_response full response from the mint (for logging, in case of errors)
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
melt_cb (void *cls,
|
||||
@ -995,11 +995,11 @@ melt_cb (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param num_coins number of fresh coins created, length of the @a sigs and @a coin_privs arrays, 0 if the operation failed
|
||||
* @param coin_privs array of @a num_coins private keys for the coins that were created, NULL on error
|
||||
* @param sigs array of signature over @a num_coins coins, NULL on error
|
||||
* @param full_response full response from the mint (for logging, in case of errors)
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
reveal_cb (void *cls,
|
||||
@ -1059,12 +1059,12 @@ reveal_cb (void *cls,
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param num_coins number of fresh coins created, length of the @a sigs and @a coin_privs arrays, 0 if the operation failed
|
||||
* @param coin_privs array of @a num_coins private keys for the coins that were created, NULL on error
|
||||
* @param sigs array of signature over @a num_coins coins, NULL on error
|
||||
* @param pubs array of public keys for the @a sigs, NULL on error
|
||||
* @param full_response full response from the mint (for logging, in case of errors)
|
||||
* @param full_response full response from the exchange (for logging, in case of errors)
|
||||
*/
|
||||
static void
|
||||
link_cb (void *cls,
|
||||
@ -1159,13 +1159,13 @@ link_cb (void *cls,
|
||||
* @param amount coin value to look for
|
||||
* @return NULL if no matching key was found
|
||||
*/
|
||||
static const struct TALER_MINT_DenomPublicKey *
|
||||
find_pk (const struct TALER_MINT_Keys *keys,
|
||||
static const struct TALER_EXCHANGE_DenomPublicKey *
|
||||
find_pk (const struct TALER_EXCHANGE_Keys *keys,
|
||||
const struct TALER_Amount *amount)
|
||||
{
|
||||
unsigned int i;
|
||||
struct GNUNET_TIME_Absolute now;
|
||||
struct TALER_MINT_DenomPublicKey *pk;
|
||||
struct TALER_EXCHANGE_DenomPublicKey *pk;
|
||||
char *str;
|
||||
|
||||
now = GNUNET_TIME_absolute_get ();
|
||||
@ -1208,26 +1208,26 @@ find_pk (const struct TALER_MINT_Keys *keys,
|
||||
|
||||
/**
|
||||
* Callbacks called with the result(s) of a
|
||||
* wire format inquiry request to the mint.
|
||||
* wire format inquiry request to the exchange.
|
||||
*
|
||||
* The callback is invoked multiple times, once for each supported @a
|
||||
* method. Finally, it is invoked one more time with cls/0/NULL/NULL
|
||||
* to indicate the end of the iteration. If any request fails to
|
||||
* generate a valid response from the mint, @a http_status will also
|
||||
* generate a valid response from the exchange, @a http_status will also
|
||||
* be zero and the iteration will also end. Thus, the iteration
|
||||
* always ends with a final call with an @a http_status of 0. If the
|
||||
* @a http_status is already 0 on the first call, then the response to
|
||||
* the /wire request was invalid. Later, clients can tell the
|
||||
* difference between @a http_status of 0 indicating a failed
|
||||
* /wire/method request and a regular end of the iteration by @a
|
||||
* method being non-NULL. If the mint simply correctly asserts that
|
||||
* method being non-NULL. If the exchange simply correctly asserts that
|
||||
* it does not support any methods, @a method will be NULL but the @a
|
||||
* http_status will be #MHD_HTTP_OK for the first call (followed by a
|
||||
* cls/0/NULL/NULL call to signal the end of the iteration).
|
||||
*
|
||||
* @param cls closure with the interpreter state
|
||||
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful request;
|
||||
* 0 if the mint's reply is bogus (fails to follow the protocol)
|
||||
* 0 if the exchange's reply is bogus (fails to follow the protocol)
|
||||
* @param method wire format method supported, i.e. "test" or "sepa", or NULL
|
||||
* if already the /wire request failed.
|
||||
* @param obj the received JSON reply, if successful this should be the wire
|
||||
@ -1288,12 +1288,12 @@ wire_cb (void *cls,
|
||||
* of the coin transactions that were combined into the wire transfer.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param http_status HTTP status code we got, 0 on mint protocol violation
|
||||
* @param http_status HTTP status code we got, 0 on exchange protocol violation
|
||||
* @param json original json reply (may include signatures, those have then been
|
||||
* validated already)
|
||||
* @param wtid extracted wire transfer identifier, or NULL if the mint could
|
||||
* @param wtid extracted wire transfer identifier, or NULL if the exchange could
|
||||
* not provide any (set only if @a http_status is #MHD_HTTP_OK)
|
||||
* @param total_amount total amount of the wire transfer, or NULL if the mint could
|
||||
* @param total_amount total amount of the wire transfer, or NULL if the exchange could
|
||||
* not provide any @a wtid (set only if @a http_status is #MHD_HTTP_OK)
|
||||
* @param details_length length of the @a details array
|
||||
* @param details array with details about the combined transactions
|
||||
@ -1376,14 +1376,14 @@ wire_deposits_cb (void *cls,
|
||||
* Function called with detailed wire transfer data.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param http_status HTTP status code we got, 0 on mint protocol violation
|
||||
* @param http_status HTTP status code we got, 0 on exchange protocol violation
|
||||
* @param json original json reply (may include signatures, those have then been
|
||||
* validated already)
|
||||
* @param wtid wire transfer identifier used by the mint, NULL if mint did not
|
||||
* @param wtid wire transfer identifier used by the exchange, NULL if exchange did not
|
||||
* yet execute the transaction
|
||||
* @param execution_time actual or planned execution time for the wire transfer
|
||||
* @param coin_contribution contribution to the @a total_amount of the deposited coin (may be NULL)
|
||||
* @param total_amount total amount of the wire transfer, or NULL if the mint could
|
||||
* @param total_amount total amount of the wire transfer, or NULL if the exchange could
|
||||
* not provide any @a wtid (set only if @a http_status is #MHD_HTTP_OK)
|
||||
*/
|
||||
static void
|
||||
@ -1425,7 +1425,7 @@ deposit_wtid_cb (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Run the main interpreter loop that performs mint operations.
|
||||
* Run the main interpreter loop that performs exchange operations.
|
||||
*
|
||||
* @param cls contains the `struct InterpreterState`
|
||||
* @param tc scheduler context
|
||||
@ -1504,7 +1504,7 @@ interpreter_run (void *cls,
|
||||
execution_date = GNUNET_TIME_absolute_get ();
|
||||
TALER_round_abs_time (&execution_date);
|
||||
cmd->details.admin_add_incoming.aih
|
||||
= TALER_MINT_admin_add_incoming (mint,
|
||||
= TALER_EXCHANGE_admin_add_incoming (exchange,
|
||||
&reserve_pub,
|
||||
&amount,
|
||||
execution_date,
|
||||
@ -1529,7 +1529,7 @@ interpreter_run (void *cls,
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&ref->details.admin_add_incoming.reserve_priv.eddsa_priv,
|
||||
&reserve_pub.eddsa_pub);
|
||||
cmd->details.reserve_status.wsh
|
||||
= TALER_MINT_reserve_status (mint,
|
||||
= TALER_EXCHANGE_reserve_status (exchange,
|
||||
&reserve_pub,
|
||||
&reserve_status_cb,
|
||||
is);
|
||||
@ -1580,7 +1580,7 @@ interpreter_run (void *cls,
|
||||
cmd->details.reserve_withdraw.blinding_key.rsa_blinding_key
|
||||
= GNUNET_CRYPTO_rsa_blinding_key_create (GNUNET_CRYPTO_rsa_public_key_len (cmd->details.reserve_withdraw.pk->key.rsa_public_key));
|
||||
cmd->details.reserve_withdraw.wsh
|
||||
= TALER_MINT_reserve_withdraw (mint,
|
||||
= TALER_EXCHANGE_reserve_withdraw (exchange,
|
||||
cmd->details.reserve_withdraw.pk,
|
||||
&ref->details.admin_add_incoming.reserve_priv,
|
||||
&cmd->details.reserve_withdraw.coin_priv,
|
||||
@ -1599,7 +1599,7 @@ interpreter_run (void *cls,
|
||||
{
|
||||
struct GNUNET_HashCode h_contract;
|
||||
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
|
||||
const struct TALER_MINT_DenomPublicKey *coin_pk;
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *coin_pk;
|
||||
const struct TALER_DenominationSignature *coin_pk_sig;
|
||||
struct TALER_CoinSpendPublicKeyP coin_pub;
|
||||
struct TALER_CoinSpendSignatureP coin_sig;
|
||||
@ -1723,7 +1723,7 @@ interpreter_run (void *cls,
|
||||
&coin_sig.eddsa_signature));
|
||||
}
|
||||
cmd->details.deposit.dh
|
||||
= TALER_MINT_deposit (mint,
|
||||
= TALER_EXCHANGE_deposit (exchange,
|
||||
&amount,
|
||||
wire_deadline,
|
||||
wire,
|
||||
@ -1764,13 +1764,13 @@ interpreter_run (void *cls,
|
||||
|
||||
cmd->details.refresh_melt.fresh_pks
|
||||
= GNUNET_new_array (num_fresh_coins,
|
||||
const struct TALER_MINT_DenomPublicKey *);
|
||||
const struct TALER_EXCHANGE_DenomPublicKey *);
|
||||
{
|
||||
struct TALER_CoinSpendPrivateKeyP melt_privs[num_melted_coins];
|
||||
struct TALER_Amount melt_amounts[num_melted_coins];
|
||||
struct TALER_DenominationSignature melt_sigs[num_melted_coins];
|
||||
struct TALER_MINT_DenomPublicKey melt_pks[num_melted_coins];
|
||||
struct TALER_MINT_DenomPublicKey fresh_pks[num_fresh_coins];
|
||||
struct TALER_EXCHANGE_DenomPublicKey melt_pks[num_melted_coins];
|
||||
struct TALER_EXCHANGE_DenomPublicKey fresh_pks[num_fresh_coins];
|
||||
unsigned int i;
|
||||
|
||||
for (i=0;i<num_melted_coins;i++)
|
||||
@ -1815,7 +1815,7 @@ interpreter_run (void *cls,
|
||||
fresh_pks[i] = *cmd->details.refresh_melt.fresh_pks[i];
|
||||
}
|
||||
cmd->details.refresh_melt.refresh_data
|
||||
= TALER_MINT_refresh_prepare (num_melted_coins,
|
||||
= TALER_EXCHANGE_refresh_prepare (num_melted_coins,
|
||||
melt_privs,
|
||||
melt_amounts,
|
||||
melt_sigs,
|
||||
@ -1831,7 +1831,7 @@ interpreter_run (void *cls,
|
||||
return;
|
||||
}
|
||||
cmd->details.refresh_melt.rmh
|
||||
= TALER_MINT_refresh_melt (mint,
|
||||
= TALER_EXCHANGE_refresh_melt (exchange,
|
||||
cmd->details.refresh_melt.refresh_data_length,
|
||||
cmd->details.refresh_melt.refresh_data,
|
||||
&melt_cb,
|
||||
@ -1850,7 +1850,7 @@ interpreter_run (void *cls,
|
||||
ref = find_command (is,
|
||||
cmd->details.refresh_reveal.melt_ref);
|
||||
cmd->details.refresh_reveal.rrh
|
||||
= TALER_MINT_refresh_reveal (mint,
|
||||
= TALER_EXCHANGE_refresh_reveal (exchange,
|
||||
ref->details.refresh_melt.refresh_data_length,
|
||||
ref->details.refresh_melt.refresh_data,
|
||||
ref->details.refresh_melt.noreveal_index,
|
||||
@ -1889,7 +1889,7 @@ interpreter_run (void *cls,
|
||||
GNUNET_assert (OC_WITHDRAW_SIGN == ref->oc);
|
||||
/* finally, use private key from withdraw sign command */
|
||||
cmd->details.refresh_link.rlh
|
||||
= TALER_MINT_refresh_link (mint,
|
||||
= TALER_EXCHANGE_refresh_link (exchange,
|
||||
&ref->details.reserve_withdraw.coin_priv,
|
||||
&link_cb,
|
||||
is);
|
||||
@ -1902,7 +1902,7 @@ interpreter_run (void *cls,
|
||||
trigger_context_task ();
|
||||
return;
|
||||
case OC_WIRE:
|
||||
cmd->details.wire.wh = TALER_MINT_wire (mint,
|
||||
cmd->details.wire.wh = TALER_EXCHANGE_wire (exchange,
|
||||
&wire_cb,
|
||||
is);
|
||||
trigger_context_task ();
|
||||
@ -1916,7 +1916,7 @@ interpreter_run (void *cls,
|
||||
cmd->details.wire_deposits.wtid = ref->details.deposit_wtid.wtid;
|
||||
}
|
||||
cmd->details.wire_deposits.wdh
|
||||
= TALER_MINT_wire_deposits (mint,
|
||||
= TALER_EXCHANGE_wire_deposits (exchange,
|
||||
&cmd->details.wire_deposits.wtid,
|
||||
&wire_deposits_cb,
|
||||
is);
|
||||
@ -1975,7 +1975,7 @@ interpreter_run (void *cls,
|
||||
&h_contract);
|
||||
json_decref (contract);
|
||||
cmd->details.deposit_wtid.dwh
|
||||
= TALER_MINT_deposit_wtid (mint,
|
||||
= TALER_EXCHANGE_deposit_wtid (exchange,
|
||||
&ref->details.deposit.merchant_priv,
|
||||
&h_wire,
|
||||
&h_contract,
|
||||
@ -2028,7 +2028,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih);
|
||||
TALER_EXCHANGE_admin_add_incoming_cancel (cmd->details.admin_add_incoming.aih);
|
||||
cmd->details.admin_add_incoming.aih = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2039,7 +2039,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_reserve_status_cancel (cmd->details.reserve_status.wsh);
|
||||
TALER_EXCHANGE_reserve_status_cancel (cmd->details.reserve_status.wsh);
|
||||
cmd->details.reserve_status.wsh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2050,7 +2050,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_reserve_withdraw_cancel (cmd->details.reserve_withdraw.wsh);
|
||||
TALER_EXCHANGE_reserve_withdraw_cancel (cmd->details.reserve_withdraw.wsh);
|
||||
cmd->details.reserve_withdraw.wsh = NULL;
|
||||
}
|
||||
if (NULL != cmd->details.reserve_withdraw.sig.rsa_signature)
|
||||
@ -2071,7 +2071,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_deposit_cancel (cmd->details.deposit.dh);
|
||||
TALER_EXCHANGE_deposit_cancel (cmd->details.deposit.dh);
|
||||
cmd->details.deposit.dh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2082,7 +2082,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_refresh_melt_cancel (cmd->details.refresh_melt.rmh);
|
||||
TALER_EXCHANGE_refresh_melt_cancel (cmd->details.refresh_melt.rmh);
|
||||
cmd->details.refresh_melt.rmh = NULL;
|
||||
}
|
||||
GNUNET_free_non_null (cmd->details.refresh_melt.fresh_pks);
|
||||
@ -2098,7 +2098,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_refresh_reveal_cancel (cmd->details.refresh_reveal.rrh);
|
||||
TALER_EXCHANGE_refresh_reveal_cancel (cmd->details.refresh_reveal.rrh);
|
||||
cmd->details.refresh_reveal.rrh = NULL;
|
||||
}
|
||||
{
|
||||
@ -2120,7 +2120,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_refresh_link_cancel (cmd->details.refresh_link.rlh);
|
||||
TALER_EXCHANGE_refresh_link_cancel (cmd->details.refresh_link.rlh);
|
||||
cmd->details.refresh_link.rlh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2131,7 +2131,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_wire_cancel (cmd->details.wire.wh);
|
||||
TALER_EXCHANGE_wire_cancel (cmd->details.wire.wh);
|
||||
cmd->details.wire.wh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2142,7 +2142,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_wire_deposits_cancel (cmd->details.wire_deposits.wdh);
|
||||
TALER_EXCHANGE_wire_deposits_cancel (cmd->details.wire_deposits.wdh);
|
||||
cmd->details.wire_deposits.wdh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2153,7 +2153,7 @@ do_shutdown (void *cls,
|
||||
"Command %u (%s) did not complete\n",
|
||||
i,
|
||||
cmd->label);
|
||||
TALER_MINT_deposit_wtid_cancel (cmd->details.deposit_wtid.dwh);
|
||||
TALER_EXCHANGE_deposit_wtid_cancel (cmd->details.deposit_wtid.dwh);
|
||||
cmd->details.deposit_wtid.dwh = NULL;
|
||||
}
|
||||
break;
|
||||
@ -2177,14 +2177,14 @@ do_shutdown (void *cls,
|
||||
GNUNET_SCHEDULER_cancel (ctx_task);
|
||||
ctx_task = NULL;
|
||||
}
|
||||
if (NULL != mint)
|
||||
if (NULL != exchange)
|
||||
{
|
||||
TALER_MINT_disconnect (mint);
|
||||
mint = NULL;
|
||||
TALER_EXCHANGE_disconnect (exchange);
|
||||
exchange = NULL;
|
||||
}
|
||||
if (NULL != ctx)
|
||||
{
|
||||
TALER_MINT_fini (ctx);
|
||||
TALER_EXCHANGE_fini (ctx);
|
||||
ctx = NULL;
|
||||
}
|
||||
}
|
||||
@ -2192,15 +2192,15 @@ do_shutdown (void *cls,
|
||||
|
||||
/**
|
||||
* Functions of this type are called to provide the retrieved signing and
|
||||
* denomination keys of the mint. No TALER_MINT_*() functions should be called
|
||||
* denomination keys of the exchange. No TALER_EXCHANGE_*() functions should be called
|
||||
* in this callback.
|
||||
*
|
||||
* @param cls closure
|
||||
* @param keys information about keys of the mint
|
||||
* @param keys information about keys of the exchange
|
||||
*/
|
||||
static void
|
||||
cert_cb (void *cls,
|
||||
const struct TALER_MINT_Keys *keys)
|
||||
const struct TALER_EXCHANGE_Keys *keys)
|
||||
{
|
||||
struct InterpreterState *is = cls;
|
||||
|
||||
@ -2244,13 +2244,13 @@ context_task (void *cls,
|
||||
struct GNUNET_TIME_Relative delay;
|
||||
|
||||
ctx_task = NULL;
|
||||
TALER_MINT_perform (ctx);
|
||||
TALER_EXCHANGE_perform (ctx);
|
||||
max_fd = -1;
|
||||
timeout = -1;
|
||||
FD_ZERO (&read_fd_set);
|
||||
FD_ZERO (&write_fd_set);
|
||||
FD_ZERO (&except_fd_set);
|
||||
TALER_MINT_get_select_info (ctx,
|
||||
TALER_EXCHANGE_get_select_info (ctx,
|
||||
&read_fd_set,
|
||||
&write_fd_set,
|
||||
&except_fd_set,
|
||||
@ -2496,20 +2496,20 @@ run (void *cls,
|
||||
/* ************** Test tracking API ******************** */
|
||||
/* Try resolving a deposit's WTID, as we never triggered
|
||||
execution of transactions, the answer should be that
|
||||
the mint knows about the deposit, but has no WTID yet. */
|
||||
the exchange knows about the deposit, but has no WTID yet. */
|
||||
{ .oc = OC_DEPOSIT_WTID,
|
||||
.label = "deposit-wtid-found",
|
||||
.expected_response_code = MHD_HTTP_ACCEPTED,
|
||||
.details.deposit_wtid.deposit_ref = "deposit-simple" },
|
||||
/* Try resolving a deposit's WTID for a failed deposit.
|
||||
As the deposit failed, the answer should be that
|
||||
the mint does NOT know about the deposit. */
|
||||
the exchange does NOT know about the deposit. */
|
||||
{ .oc = OC_DEPOSIT_WTID,
|
||||
.label = "deposit-wtid-failing",
|
||||
.expected_response_code = MHD_HTTP_NOT_FOUND,
|
||||
.details.deposit_wtid.deposit_ref = "deposit-double-2" },
|
||||
/* Try resolving an undefined (all zeros) WTID; this
|
||||
should fail as obviously the mint didn't use that
|
||||
should fail as obviously the exchange didn't use that
|
||||
WTID value for any transaction. */
|
||||
{ .oc = OC_WIRE_DEPOSITS,
|
||||
.label = "wire-deposit-failing",
|
||||
@ -2529,15 +2529,15 @@ run (void *cls,
|
||||
is = GNUNET_new (struct InterpreterState);
|
||||
is->commands = commands;
|
||||
|
||||
ctx = TALER_MINT_init ();
|
||||
ctx = TALER_EXCHANGE_init ();
|
||||
GNUNET_assert (NULL != ctx);
|
||||
ctx_task = GNUNET_SCHEDULER_add_now (&context_task,
|
||||
ctx);
|
||||
mint = TALER_MINT_connect (ctx,
|
||||
exchange = TALER_EXCHANGE_connect (ctx,
|
||||
"http://localhost:8081",
|
||||
&cert_cb, is,
|
||||
TALER_MINT_OPTION_END);
|
||||
GNUNET_assert (NULL != mint);
|
||||
TALER_EXCHANGE_OPTION_END);
|
||||
GNUNET_assert (NULL != exchange);
|
||||
shutdown_task
|
||||
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
|
||||
(GNUNET_TIME_UNIT_SECONDS, 150),
|
||||
@ -2546,7 +2546,7 @@ run (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Main function for the testcase for the mint API.
|
||||
* Main function for the testcase for the exchange API.
|
||||
*
|
||||
* @param argc expected to be 1
|
||||
* @param argv expected to only contain the program name
|
||||
@ -2556,30 +2556,30 @@ main (int argc,
|
||||
char * const *argv)
|
||||
{
|
||||
struct GNUNET_OS_Process *proc;
|
||||
struct GNUNET_OS_Process *mintd;
|
||||
struct GNUNET_OS_Process *exchanged;
|
||||
|
||||
GNUNET_log_setup ("test-mint-api",
|
||||
GNUNET_log_setup ("test-exchange-api",
|
||||
"WARNING",
|
||||
NULL);
|
||||
proc = GNUNET_OS_start_process (GNUNET_NO,
|
||||
GNUNET_OS_INHERIT_STD_ALL,
|
||||
NULL, NULL, NULL,
|
||||
"taler-mint-keyup",
|
||||
"taler-mint-keyup",
|
||||
"-d", "test-mint-home",
|
||||
"-m", "test-mint-home/master.priv",
|
||||
"taler-exchange-keyup",
|
||||
"taler-exchange-keyup",
|
||||
"-d", "test-exchange-home",
|
||||
"-m", "test-exchange-home/master.priv",
|
||||
NULL);
|
||||
GNUNET_OS_process_wait (proc);
|
||||
GNUNET_OS_process_destroy (proc);
|
||||
mintd = GNUNET_OS_start_process (GNUNET_NO,
|
||||
exchanged = GNUNET_OS_start_process (GNUNET_NO,
|
||||
GNUNET_OS_INHERIT_STD_ALL,
|
||||
NULL, NULL, NULL,
|
||||
"taler-mint-httpd",
|
||||
"taler-mint-httpd",
|
||||
"-d", "test-mint-home",
|
||||
"taler-exchange-httpd",
|
||||
"taler-exchange-httpd",
|
||||
"-d", "test-exchange-home",
|
||||
NULL);
|
||||
/* give child time to start and bind against the socket */
|
||||
fprintf (stderr, "Waiting for taler-mint-httpd to be ready");
|
||||
fprintf (stderr, "Waiting for taler-exchange-httpd to be ready");
|
||||
do
|
||||
{
|
||||
fprintf (stderr, ".");
|
||||
@ -2589,11 +2589,11 @@ main (int argc,
|
||||
fprintf (stderr, "\n");
|
||||
result = GNUNET_SYSERR;
|
||||
GNUNET_SCHEDULER_run (&run, NULL);
|
||||
GNUNET_OS_process_kill (mintd,
|
||||
GNUNET_OS_process_kill (exchanged,
|
||||
SIGTERM);
|
||||
GNUNET_OS_process_wait (mintd);
|
||||
GNUNET_OS_process_destroy (mintd);
|
||||
GNUNET_OS_process_wait (exchanged);
|
||||
GNUNET_OS_process_destroy (exchanged);
|
||||
return (GNUNET_OK == result) ? 0 : 1;
|
||||
}
|
||||
|
||||
/* end of test_mint_api.c */
|
||||
/* end of test_exchange_api.c */
|
81
src/exchange-tools/Makefile.am
Normal file
81
src/exchange-tools/Makefile.am
Normal file
@ -0,0 +1,81 @@
|
||||
# This Makefile.am is in the public domain
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/include
|
||||
|
||||
if USE_COVERAGE
|
||||
AM_CFLAGS = --coverage -O0
|
||||
XLIB = -lgcov
|
||||
endif
|
||||
|
||||
bin_PROGRAMS = \
|
||||
taler-auditor-sign \
|
||||
taler-exchange-keyup \
|
||||
taler-exchange-keycheck \
|
||||
taler-exchange-reservemod \
|
||||
taler-exchange-sepa \
|
||||
taler-exchange-dbinit
|
||||
|
||||
taler_exchange_keyup_SOURCES = \
|
||||
taler-exchange-keyup.c
|
||||
taler_exchange_keyup_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/pq/libtalerpq.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lgnunetutil $(XLIB)
|
||||
taler_exchange_keyup_LDFLAGS = $(POSTGRESQL_LDFLAGS)
|
||||
|
||||
taler_auditor_sign_SOURCES = \
|
||||
taler-auditor-sign.c
|
||||
taler_auditor_sign_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lgnunetutil $(XLIB)
|
||||
|
||||
|
||||
taler_exchange_sepa_SOURCES = \
|
||||
taler-exchange-sepa.c
|
||||
taler_exchange_sepa_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
-lgnunetutil -ljansson $(XLIB)
|
||||
taler_exchange_sepa_LDFLAGS = $(POSTGRESQL_LDFLAGS)
|
||||
|
||||
taler_exchange_keycheck_SOURCES = \
|
||||
taler-exchange-keycheck.c
|
||||
taler_exchange_keycheck_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lgnunetutil $(XLIB)
|
||||
taler_exchange_keycheck_LDFLAGS = $(POSTGRESQL_LDFLAGS)
|
||||
|
||||
taler_exchange_reservemod_SOURCES = \
|
||||
taler-exchange-reservemod.c
|
||||
taler_exchange_reservemod_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/pq/libtalerpq.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lgnunetutil -ljansson $(XLIB)
|
||||
taler_exchange_reservemod_LDFLAGS = \
|
||||
$(POSTGRESQL_LDFLAGS)
|
||||
taler_exchange_reservemod_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/src/pq/ \
|
||||
$(POSTGRESQL_CPPFLAGS)
|
||||
|
||||
taler_exchange_dbinit_SOURCES = \
|
||||
taler-exchange-dbinit.c
|
||||
taler_exchange_dbinit_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/pq/libtalerpq.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lgnunetutil $(XLIB)
|
||||
taler_exchange_dbinit_LDFLAGS = \
|
||||
$(POSTGRESQL_LDFLAGS)
|
||||
taler_exchange_dbinit_CPPFLAGS = \
|
||||
-I$(top_srcdir)/src/include \
|
||||
-I$(top_srcdir)/src/pq/ \
|
||||
$(POSTGRESQL_CPPFLAGS)
|
@ -15,12 +15,12 @@
|
||||
*/
|
||||
/**
|
||||
* @file taler-auditor-sign.c
|
||||
* @brief Tool used by the auditor to sign the mint's master key and the
|
||||
* @brief Tool used by the auditor to sign the exchange's master key and the
|
||||
* denomination key(s).
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include "taler_mintdb_lib.h"
|
||||
#include "taler_exchangedb_lib.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -34,15 +34,15 @@ static int verbose;
|
||||
static char *auditor_key_file;
|
||||
|
||||
/**
|
||||
* Mint's public key (in Crockford base32 encoding).
|
||||
* Exchange's public key (in Crockford base32 encoding).
|
||||
*/
|
||||
static char *mint_public_key;
|
||||
static char *exchange_public_key;
|
||||
|
||||
/**
|
||||
* File with the Mint's denomination keys to sign, itself
|
||||
* signed by the Mint's public key.
|
||||
* File with the Exchange's denomination keys to sign, itself
|
||||
* signed by the Exchange's public key.
|
||||
*/
|
||||
static char *mint_request_file;
|
||||
static char *exchange_request_file;
|
||||
|
||||
/**
|
||||
* Where should we write the auditor's signature?
|
||||
@ -50,7 +50,7 @@ static char *mint_request_file;
|
||||
static char *output_file;
|
||||
|
||||
/**
|
||||
* Master public key of the mint.
|
||||
* Master public key of the exchange.
|
||||
*/
|
||||
static struct TALER_MasterPublicKeyP master_public_key;
|
||||
|
||||
@ -114,8 +114,8 @@ print_dk (const struct TALER_DenominationKeyValidityPS *dk)
|
||||
|
||||
/**
|
||||
* The main function of the taler-auditor-sign tool. This tool is used
|
||||
* to sign a mint's master and denomination keys, affirming that the
|
||||
* auditor is aware of them and will validate the mint's database with
|
||||
* to sign a exchange's master and denomination keys, affirming that the
|
||||
* auditor is aware of them and will validate the exchange's database with
|
||||
* respect to these keys.
|
||||
*
|
||||
* @param argc number of arguments from the command line
|
||||
@ -131,12 +131,12 @@ main (int argc,
|
||||
"file containing the private key of the auditor", 1,
|
||||
&GNUNET_GETOPT_set_filename, &auditor_key_file},
|
||||
TALER_GETOPT_OPTION_HELP ("Private key of the auditor to use for signing"),
|
||||
{'m', "mint-key", "KEY",
|
||||
"public key of the mint (Crockford base32 encoded)", 1,
|
||||
&GNUNET_GETOPT_set_filename, &mint_public_key},
|
||||
{'r', "mint-request", "FILE",
|
||||
"set of keys the mint requested the auditor to sign", 1,
|
||||
&GNUNET_GETOPT_set_string, &mint_request_file},
|
||||
{'m', "exchange-key", "KEY",
|
||||
"public key of the exchange (Crockford base32 encoded)", 1,
|
||||
&GNUNET_GETOPT_set_filename, &exchange_public_key},
|
||||
{'r', "exchange-request", "FILE",
|
||||
"set of keys the exchange requested the auditor to sign", 1,
|
||||
&GNUNET_GETOPT_set_string, &exchange_request_file},
|
||||
{'o', "output", "FILE",
|
||||
"where to write our signature", 1,
|
||||
&GNUNET_GETOPT_set_string, &output_file},
|
||||
@ -150,15 +150,15 @@ main (int argc,
|
||||
struct GNUNET_DISK_FileHandle *fh;
|
||||
struct TALER_DenominationKeyValidityPS *dks;
|
||||
unsigned int dks_len;
|
||||
struct TALER_MintKeyValidityPS kv;
|
||||
struct TALER_ExchangeKeyValidityPS kv;
|
||||
off_t in_size;
|
||||
unsigned int i;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-keyup",
|
||||
GNUNET_log_setup ("taler-exchange-keyup",
|
||||
"WARNING",
|
||||
NULL));
|
||||
if (GNUNET_GETOPT_run ("taler-mint-keyup",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-keyup",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
@ -178,40 +178,40 @@ main (int argc,
|
||||
}
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
|
||||
&apub.eddsa_pub);
|
||||
if (NULL == mint_public_key)
|
||||
if (NULL == exchange_public_key)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint public key not given\n");
|
||||
"Exchange public key not given\n");
|
||||
GNUNET_free (eddsa_priv);
|
||||
return 1;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_STRINGS_string_to_data (mint_public_key,
|
||||
strlen (mint_public_key),
|
||||
GNUNET_STRINGS_string_to_data (exchange_public_key,
|
||||
strlen (exchange_public_key),
|
||||
&master_public_key,
|
||||
sizeof (master_public_key)))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Public key `%s' malformed\n",
|
||||
mint_public_key);
|
||||
exchange_public_key);
|
||||
GNUNET_free (eddsa_priv);
|
||||
return 1;
|
||||
}
|
||||
if (NULL == mint_request_file)
|
||||
if (NULL == exchange_request_file)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint signing request not given\n");
|
||||
"Exchange signing request not given\n");
|
||||
GNUNET_free (eddsa_priv);
|
||||
return 1;
|
||||
}
|
||||
fh = GNUNET_DISK_file_open (mint_request_file,
|
||||
fh = GNUNET_DISK_file_open (exchange_request_file,
|
||||
GNUNET_DISK_OPEN_READ,
|
||||
GNUNET_DISK_PERM_NONE);
|
||||
if (NULL == fh)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to open file `%s': %s\n",
|
||||
mint_request_file,
|
||||
exchange_request_file,
|
||||
STRERROR (errno));
|
||||
GNUNET_free (eddsa_priv);
|
||||
return 1;
|
||||
@ -222,7 +222,7 @@ main (int argc,
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to obtain input file size `%s': %s\n",
|
||||
mint_request_file,
|
||||
exchange_request_file,
|
||||
STRERROR (errno));
|
||||
GNUNET_DISK_file_close (fh);
|
||||
GNUNET_free (eddsa_priv);
|
||||
@ -232,14 +232,14 @@ main (int argc,
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Input file size of file `%s' is invalid\n",
|
||||
mint_request_file);
|
||||
exchange_request_file);
|
||||
GNUNET_DISK_file_close (fh);
|
||||
GNUNET_free (eddsa_priv);
|
||||
return 1;
|
||||
}
|
||||
dks_len = in_size / sizeof (struct TALER_DenominationKeyValidityPS);
|
||||
kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_MINT_KEYS);
|
||||
kv.purpose.size = htonl (sizeof (struct TALER_MintKeyValidityPS));
|
||||
kv.purpose.purpose = htonl (TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS);
|
||||
kv.purpose.size = htonl (sizeof (struct TALER_ExchangeKeyValidityPS));
|
||||
kv.master = master_public_key;
|
||||
dks = GNUNET_new_array (dks_len,
|
||||
struct TALER_DenominationKeyValidityPS);
|
||||
@ -252,7 +252,7 @@ main (int argc,
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to read input file `%s': %s\n",
|
||||
mint_request_file,
|
||||
exchange_request_file,
|
||||
STRERROR (errno));
|
||||
GNUNET_DISK_file_close (fh);
|
||||
GNUNET_free (sigs);
|
||||
@ -297,7 +297,7 @@ main (int argc,
|
||||
|
||||
/* write result to disk */
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINTDB_auditor_write (output_file,
|
||||
TALER_EXCHANGEDB_auditor_write (output_file,
|
||||
&apub,
|
||||
sigs,
|
||||
&master_public_key,
|
@ -14,19 +14,19 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file mint-tools/taler-mint-dbinit.c
|
||||
* @brief Create tables for the mint database.
|
||||
* @file exchange-tools/taler-exchange-dbinit.c
|
||||
* @brief Create tables for the exchange database.
|
||||
* @author Florian Dold
|
||||
*/
|
||||
#include "platform.h"
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <libpq-fe.h>
|
||||
#include "taler_mintdb_plugin.h"
|
||||
#include "taler_exchangedb_plugin.h"
|
||||
|
||||
/**
|
||||
* Mint directory with the keys.
|
||||
* Exchange directory with the keys.
|
||||
*/
|
||||
static char *mint_base_dir;
|
||||
static char *exchange_base_dir;
|
||||
|
||||
/**
|
||||
* Our configuration.
|
||||
@ -36,12 +36,12 @@ static struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||
/**
|
||||
* Our DB plugin.
|
||||
*/
|
||||
static struct TALER_MINTDB_Plugin *plugin;
|
||||
static struct TALER_EXCHANGEDB_Plugin *plugin;
|
||||
|
||||
|
||||
/**
|
||||
* The main function of the database initialization tool.
|
||||
* Used to initialize the Taler Mint's database.
|
||||
* Used to initialize the Taler Exchange's database.
|
||||
*
|
||||
* @param argc number of arguments from the command line
|
||||
* @param argv command line arguments
|
||||
@ -52,38 +52,38 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
{'d', "mint-dir", "DIR",
|
||||
"mint directory", 1,
|
||||
&GNUNET_GETOPT_set_filename, &mint_base_dir},
|
||||
GNUNET_GETOPT_OPTION_HELP ("Initialize Taler Mint database"),
|
||||
{'d', "exchange-dir", "DIR",
|
||||
"exchange directory", 1,
|
||||
&GNUNET_GETOPT_set_filename, &exchange_base_dir},
|
||||
GNUNET_GETOPT_OPTION_HELP ("Initialize Taler Exchange database"),
|
||||
GNUNET_GETOPT_OPTION_VERSION (VERSION "-" VCS_VERSION),
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
};
|
||||
|
||||
if (GNUNET_GETOPT_run ("taler-mint-dbinit",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-dbinit",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-dbinit",
|
||||
GNUNET_log_setup ("taler-exchange-dbinit",
|
||||
"INFO",
|
||||
NULL));
|
||||
if (NULL == mint_base_dir)
|
||||
if (NULL == exchange_base_dir)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint base directory not given.\n");
|
||||
"Exchange base directory not given.\n");
|
||||
return 1;
|
||||
}
|
||||
cfg = TALER_config_load (mint_base_dir);
|
||||
cfg = TALER_config_load (exchange_base_dir);
|
||||
if (NULL == cfg)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to load mint configuration.\n");
|
||||
"Failed to load exchange configuration.\n");
|
||||
return 1;
|
||||
}
|
||||
if (NULL ==
|
||||
(plugin = TALER_MINTDB_plugin_load (cfg)))
|
||||
(plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize database plugin.\n");
|
||||
@ -95,11 +95,11 @@ main (int argc,
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize database.\n");
|
||||
TALER_MINTDB_plugin_unload (plugin);
|
||||
TALER_EXCHANGEDB_plugin_unload (plugin);
|
||||
return 1;
|
||||
}
|
||||
TALER_MINTDB_plugin_unload (plugin);
|
||||
TALER_EXCHANGEDB_plugin_unload (plugin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* end of taler-mint-dbinit.c */
|
||||
/* end of taler-exchange-dbinit.c */
|
@ -14,9 +14,9 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file taler-mint-keycheck.c
|
||||
* @brief Check mint keys for validity. Reads the signing and denomination
|
||||
* keys from the mint directory and checks to make sure they are
|
||||
* @file taler-exchange-keycheck.c
|
||||
* @brief Check exchange keys for validity. Reads the signing and denomination
|
||||
* keys from the exchange directory and checks to make sure they are
|
||||
* well-formed. This is purely a diagnostic tool.
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
@ -24,12 +24,12 @@
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include "taler_mintdb_lib.h"
|
||||
#include "taler_exchangedb_lib.h"
|
||||
|
||||
/**
|
||||
* Mint directory with the keys.
|
||||
* Exchange directory with the keys.
|
||||
*/
|
||||
static char *mint_directory;
|
||||
static char *exchange_directory;
|
||||
|
||||
/**
|
||||
* Our configuration.
|
||||
@ -50,7 +50,7 @@ static struct GNUNET_CONFIGURATION_Handle *kcfg;
|
||||
static int
|
||||
signkeys_iter (void *cls,
|
||||
const char *filename,
|
||||
const struct TALER_MINTDB_PrivateSigningKeyInformationP *ski)
|
||||
const struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *ski)
|
||||
{
|
||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
||||
"Iterating over key `%s' for start time %s\n",
|
||||
@ -59,8 +59,8 @@ signkeys_iter (void *cls,
|
||||
(GNUNET_TIME_absolute_ntoh (ski->issue.start)));
|
||||
|
||||
if (ntohl (ski->issue.purpose.size) !=
|
||||
(sizeof (struct TALER_MintSigningKeyValidityPS) -
|
||||
offsetof (struct TALER_MintSigningKeyValidityPS,
|
||||
(sizeof (struct TALER_ExchangeSigningKeyValidityPS) -
|
||||
offsetof (struct TALER_ExchangeSigningKeyValidityPS,
|
||||
purpose)))
|
||||
{
|
||||
fprintf (stderr,
|
||||
@ -101,9 +101,9 @@ signkeys_iter (void *cls,
|
||||
* #GNUNET_NO if not
|
||||
*/
|
||||
static int
|
||||
mint_signkeys_check ()
|
||||
exchange_signkeys_check ()
|
||||
{
|
||||
if (0 > TALER_MINTDB_signing_keys_iterate (mint_directory,
|
||||
if (0 > TALER_EXCHANGEDB_signing_keys_iterate (exchange_directory,
|
||||
&signkeys_iter,
|
||||
NULL))
|
||||
return GNUNET_NO;
|
||||
@ -124,7 +124,7 @@ mint_signkeys_check ()
|
||||
static int
|
||||
denomkeys_iter (void *cls,
|
||||
const char *alias,
|
||||
const struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
|
||||
const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
|
||||
{
|
||||
struct GNUNET_HashCode hc;
|
||||
|
||||
@ -183,9 +183,9 @@ denomkeys_iter (void *cls,
|
||||
* #GNUNET_NO if not
|
||||
*/
|
||||
static int
|
||||
mint_denomkeys_check ()
|
||||
exchange_denomkeys_check ()
|
||||
{
|
||||
if (0 > TALER_MINTDB_denomination_keys_iterate (mint_directory,
|
||||
if (0 > TALER_EXCHANGEDB_denomination_keys_iterate (exchange_directory,
|
||||
&denomkeys_iter,
|
||||
NULL))
|
||||
return GNUNET_NO;
|
||||
@ -204,38 +204,38 @@ int
|
||||
main (int argc, char *const *argv)
|
||||
{
|
||||
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
GNUNET_GETOPT_OPTION_HELP ("gnunet-mint-keycheck OPTIONS"),
|
||||
GNUNET_GETOPT_OPTION_HELP ("gnunet-exchange-keycheck OPTIONS"),
|
||||
{'d', "directory", "DIRECTORY",
|
||||
"mint directory with keys to check", 1,
|
||||
&GNUNET_GETOPT_set_filename, &mint_directory},
|
||||
"exchange directory with keys to check", 1,
|
||||
&GNUNET_GETOPT_set_filename, &exchange_directory},
|
||||
GNUNET_GETOPT_OPTION_END
|
||||
};
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-keycheck",
|
||||
GNUNET_log_setup ("taler-exchange-keycheck",
|
||||
"WARNING",
|
||||
NULL));
|
||||
|
||||
if (GNUNET_GETOPT_run ("taler-mint-keycheck",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-keycheck",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
if (NULL == mint_directory)
|
||||
if (NULL == exchange_directory)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint directory not given\n");
|
||||
"Exchange directory not given\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
kcfg = TALER_config_load (mint_directory);
|
||||
kcfg = TALER_config_load (exchange_directory);
|
||||
if (NULL == kcfg)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to load mint configuration\n");
|
||||
"Failed to load exchange configuration\n");
|
||||
return 1;
|
||||
}
|
||||
if ( (GNUNET_OK != mint_signkeys_check ()) ||
|
||||
(GNUNET_OK != mint_denomkeys_check ()) )
|
||||
if ( (GNUNET_OK != exchange_signkeys_check ()) ||
|
||||
(GNUNET_OK != exchange_denomkeys_check ()) )
|
||||
{
|
||||
GNUNET_CONFIGURATION_destroy (kcfg);
|
||||
return 1;
|
||||
@ -244,4 +244,4 @@ main (int argc, char *const *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* end of taler-mint-keycheck.c */
|
||||
/* end of taler-exchange-keycheck.c */
|
@ -14,15 +14,15 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file taler-mint-keyup.c
|
||||
* @brief Update the mint's keys for coins and signatures,
|
||||
* using the mint's offline master key.
|
||||
* @file taler-exchange-keyup.c
|
||||
* @brief Update the exchange's keys for coins and signatures,
|
||||
* using the exchange's offline master key.
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include "taler_mintdb_lib.h"
|
||||
#include "taler_exchangedb_lib.h"
|
||||
|
||||
/**
|
||||
* When generating filenames from a cryptographic hash, we do not use
|
||||
@ -169,9 +169,9 @@ static char *auditorrequestfile;
|
||||
static FILE *auditor_output_file;
|
||||
|
||||
/**
|
||||
* Director of the mint, containing the keys.
|
||||
* Director of the exchange, containing the keys.
|
||||
*/
|
||||
static char *mint_directory;
|
||||
static char *exchange_directory;
|
||||
|
||||
/**
|
||||
* Time to pretend when the key update is executed.
|
||||
@ -179,7 +179,7 @@ static char *mint_directory;
|
||||
static char *pretend_time_str;
|
||||
|
||||
/**
|
||||
* Handle to the mint's configuration
|
||||
* Handle to the exchange's configuration
|
||||
*/
|
||||
static struct GNUNET_CONFIGURATION_Handle *kcfg;
|
||||
|
||||
@ -190,12 +190,12 @@ static struct GNUNET_CONFIGURATION_Handle *kcfg;
|
||||
static struct GNUNET_TIME_Absolute now;
|
||||
|
||||
/**
|
||||
* Master private key of the mint.
|
||||
* Master private key of the exchange.
|
||||
*/
|
||||
static struct TALER_MasterPrivateKeyP master_priv;
|
||||
|
||||
/**
|
||||
* Master public key of the mint.
|
||||
* Master public key of the exchange.
|
||||
*/
|
||||
static struct TALER_MasterPublicKeyP master_public_key;
|
||||
|
||||
@ -210,7 +210,7 @@ static struct GNUNET_TIME_Absolute lookahead_sign_stamp;
|
||||
* keys created at time @a start.
|
||||
*
|
||||
* @param start time at which we create the signing key
|
||||
* @return name of the directory we should use, basically "$MINTDIR/$TIME/";
|
||||
* @return name of the directory we should use, basically "$EXCHANGEDIR/$TIME/";
|
||||
* (valid until next call to this function)
|
||||
*/
|
||||
static const char *
|
||||
@ -220,8 +220,8 @@ get_signkey_file (struct GNUNET_TIME_Absolute start)
|
||||
|
||||
GNUNET_snprintf (dir,
|
||||
sizeof (dir),
|
||||
"%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_SIGNING_KEYS DIR_SEPARATOR_STR "%llu",
|
||||
mint_directory,
|
||||
"%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS DIR_SEPARATOR_STR "%llu",
|
||||
exchange_directory,
|
||||
(unsigned long long) start.abs_value_us);
|
||||
return dir;
|
||||
}
|
||||
@ -265,7 +265,7 @@ hash_coin_type (const struct CoinTypeParams *p,
|
||||
/**
|
||||
* Obtain the name of the directory we should use to store coins of
|
||||
* the given type. The directory name has the format
|
||||
* "$MINTDIR/$VALUE/$HASH/" where "$VALUE" represents the value of the
|
||||
* "$EXCHANGEDIR/$VALUE/$HASH/" where "$VALUE" represents the value of the
|
||||
* coin and "$HASH" encodes all of the coin's parameters, generating a
|
||||
* unique string for each type of coin. Note that the "$HASH"
|
||||
* includes neither the absolute creation time nor the key of the
|
||||
@ -299,8 +299,8 @@ get_cointype_dir (const struct CoinTypeParams *p)
|
||||
|
||||
GNUNET_snprintf (dir,
|
||||
sizeof (dir),
|
||||
"%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_DENOMINATION_KEYS DIR_SEPARATOR_STR "%s-%s",
|
||||
mint_directory,
|
||||
"%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_DENOMINATION_KEYS DIR_SEPARATOR_STR "%s-%s",
|
||||
exchange_directory,
|
||||
val_str,
|
||||
hash_str);
|
||||
GNUNET_free (hash_str);
|
||||
@ -434,7 +434,7 @@ get_anchor (const char *dir,
|
||||
|
||||
|
||||
/**
|
||||
* Create a mint signing key (for signing mint messages, not for coins)
|
||||
* Create a exchange signing key (for signing exchange messages, not for coins)
|
||||
* and assert its correctness by signing it with the master key.
|
||||
*
|
||||
* @param start start time of the validity period for the key
|
||||
@ -446,10 +446,10 @@ static void
|
||||
create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
||||
struct GNUNET_TIME_Relative duration,
|
||||
struct GNUNET_TIME_Absolute end,
|
||||
struct TALER_MINTDB_PrivateSigningKeyInformationP *pi)
|
||||
struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP *pi)
|
||||
{
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
|
||||
struct TALER_MintSigningKeyValidityPS *issue = &pi->issue;
|
||||
struct TALER_ExchangeSigningKeyValidityPS *issue = &pi->issue;
|
||||
|
||||
priv = GNUNET_CRYPTO_eddsa_key_create ();
|
||||
pi->signkey_priv.eddsa_priv = *priv;
|
||||
@ -462,8 +462,8 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
||||
GNUNET_CRYPTO_eddsa_key_get_public (&pi->signkey_priv.eddsa_priv,
|
||||
&issue->signkey_pub.eddsa_pub);
|
||||
issue->purpose.purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY);
|
||||
issue->purpose.size = htonl (sizeof (struct TALER_MintSigningKeyValidityPS) -
|
||||
offsetof (struct TALER_MintSigningKeyValidityPS,
|
||||
issue->purpose.size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS) -
|
||||
offsetof (struct TALER_ExchangeSigningKeyValidityPS,
|
||||
purpose));
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
@ -480,7 +480,7 @@ create_signkey_issue_priv (struct GNUNET_TIME_Absolute start,
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||
*/
|
||||
static int
|
||||
mint_keys_update_signkeys ()
|
||||
exchange_keys_update_signkeys ()
|
||||
{
|
||||
struct GNUNET_TIME_Relative signkey_duration;
|
||||
struct GNUNET_TIME_Relative legal_duration;
|
||||
@ -489,23 +489,23 @@ mint_keys_update_signkeys ()
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_time (kcfg,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"signkey_duration",
|
||||
&signkey_duration))
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"signkey_duration");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_time (kcfg,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"legal_duration",
|
||||
&legal_duration))
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"legal_duration",
|
||||
"fails to specify valid timeframe");
|
||||
return GNUNET_SYSERR;
|
||||
@ -513,15 +513,15 @@ mint_keys_update_signkeys ()
|
||||
if (signkey_duration.rel_value_us > legal_duration.rel_value_us)
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"legal_duration",
|
||||
"must be longer than signkey_duration");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_round_rel_time (&signkey_duration);
|
||||
GNUNET_asprintf (&signkey_dir,
|
||||
"%s" DIR_SEPARATOR_STR TALER_MINTDB_DIR_SIGNING_KEYS,
|
||||
mint_directory);
|
||||
"%s" DIR_SEPARATOR_STR TALER_EXCHANGEDB_DIR_SIGNING_KEYS,
|
||||
exchange_directory);
|
||||
/* make sure the directory exists */
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_DISK_directory_create (signkey_dir))
|
||||
@ -539,7 +539,7 @@ mint_keys_update_signkeys ()
|
||||
while (anchor.abs_value_us < lookahead_sign_stamp.abs_value_us)
|
||||
{
|
||||
const char *skf;
|
||||
struct TALER_MINTDB_PrivateSigningKeyInformationP signkey_issue;
|
||||
struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP signkey_issue;
|
||||
ssize_t nwrite;
|
||||
struct GNUNET_TIME_Absolute end;
|
||||
|
||||
@ -557,9 +557,9 @@ mint_keys_update_signkeys ()
|
||||
&signkey_issue);
|
||||
nwrite = GNUNET_DISK_fn_write (skf,
|
||||
&signkey_issue,
|
||||
sizeof (struct TALER_MINTDB_PrivateSigningKeyInformationP),
|
||||
sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP),
|
||||
GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_USER_READ);
|
||||
if (sizeof (struct TALER_MINTDB_PrivateSigningKeyInformationP) != nwrite)
|
||||
if (sizeof (struct TALER_EXCHANGEDB_PrivateSigningKeyInformationP) != nwrite)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to write to file `%s': %s\n",
|
||||
@ -633,7 +633,7 @@ get_cointype_params (const char *ct,
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
ct,
|
||||
"mint_denom_duration_overlap");
|
||||
"exchange_denom_duration_overlap");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
TALER_round_rel_time (¶ms->duration_overlap);
|
||||
@ -722,7 +722,7 @@ get_cointype_params (const char *ct,
|
||||
*/
|
||||
static void
|
||||
create_denomkey_issue (const struct CoinTypeParams *params,
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation *dki)
|
||||
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki)
|
||||
{
|
||||
dki->denom_priv.rsa_private_key
|
||||
= GNUNET_CRYPTO_rsa_private_key_create (params->rsa_keysize);
|
||||
@ -769,13 +769,13 @@ create_denomkey_issue (const struct CoinTypeParams *params,
|
||||
* @param coin_alias name of the coin's section in the configuration
|
||||
*/
|
||||
static void
|
||||
mint_keys_update_cointype (void *cls,
|
||||
exchange_keys_update_cointype (void *cls,
|
||||
const char *coin_alias)
|
||||
{
|
||||
int *ret = cls;
|
||||
struct CoinTypeParams p;
|
||||
const char *dkf;
|
||||
struct TALER_MINTDB_DenominationKeyIssueInformation denomkey_issue;
|
||||
struct TALER_EXCHANGEDB_DenominationKeyIssueInformation denomkey_issue;
|
||||
|
||||
if (0 != strncasecmp (coin_alias,
|
||||
"coin_",
|
||||
@ -808,7 +808,7 @@ mint_keys_update_cointype (void *cls,
|
||||
create_denomkey_issue (&p,
|
||||
&denomkey_issue);
|
||||
if (GNUNET_OK !=
|
||||
TALER_MINTDB_denomination_key_write (dkf,
|
||||
TALER_EXCHANGEDB_denomination_key_write (dkf,
|
||||
&denomkey_issue))
|
||||
{
|
||||
fprintf (stderr,
|
||||
@ -842,28 +842,28 @@ mint_keys_update_cointype (void *cls,
|
||||
|
||||
|
||||
/**
|
||||
* Update all of the denomination keys of the mint.
|
||||
* Update all of the denomination keys of the exchange.
|
||||
*
|
||||
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
|
||||
*/
|
||||
static int
|
||||
mint_keys_update_denomkeys ()
|
||||
exchange_keys_update_denomkeys ()
|
||||
{
|
||||
int ok;
|
||||
|
||||
ok = GNUNET_OK;
|
||||
GNUNET_CONFIGURATION_iterate_sections (kcfg,
|
||||
&mint_keys_update_cointype,
|
||||
&exchange_keys_update_cointype,
|
||||
&ok);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main function of the taler-mint-keyup tool. This tool is used
|
||||
* to create the signing and denomination keys for the mint. It uses
|
||||
* The main function of the taler-exchange-keyup tool. This tool is used
|
||||
* to create the signing and denomination keys for the exchange. It uses
|
||||
* the long-term offline private key and writes the (additional) key
|
||||
* files to the respective mint directory (from where they can then be
|
||||
* files to the respective exchange directory (from where they can then be
|
||||
* copied to the online server). Note that we need (at least) the
|
||||
* most recent generated previous keys so as to align the validity
|
||||
* periods.
|
||||
@ -877,10 +877,10 @@ main (int argc,
|
||||
char *const *argv)
|
||||
{
|
||||
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
{'d', "mint-dir", "DIR",
|
||||
"mint directory with keys to update", 1,
|
||||
&GNUNET_GETOPT_set_filename, &mint_directory},
|
||||
TALER_GETOPT_OPTION_HELP ("Setup signing and denomination keys for a Taler mint"),
|
||||
{'d', "exchange-dir", "DIR",
|
||||
"exchange directory with keys to update", 1,
|
||||
&GNUNET_GETOPT_set_filename, &exchange_directory},
|
||||
TALER_GETOPT_OPTION_HELP ("Setup signing and denomination keys for a Taler exchange"),
|
||||
{'m', "master-key", "FILE",
|
||||
"master key file (private key)", 1,
|
||||
&GNUNET_GETOPT_set_filename, &masterkeyfile},
|
||||
@ -897,18 +897,18 @@ main (int argc,
|
||||
struct GNUNET_CRYPTO_EddsaPrivateKey *eddsa_priv;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-keyup",
|
||||
GNUNET_log_setup ("taler-exchange-keyup",
|
||||
"WARNING",
|
||||
NULL));
|
||||
|
||||
if (GNUNET_GETOPT_run ("taler-mint-keyup",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-keyup",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
if (NULL == mint_directory)
|
||||
if (NULL == exchange_directory)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint directory not given\n");
|
||||
"Exchange directory not given\n");
|
||||
return 1;
|
||||
}
|
||||
if (NULL != pretend_time_str)
|
||||
@ -929,11 +929,11 @@ main (int argc,
|
||||
}
|
||||
TALER_round_abs_time (&now);
|
||||
|
||||
kcfg = TALER_config_load (mint_directory);
|
||||
kcfg = TALER_config_load (exchange_directory);
|
||||
if (NULL == kcfg)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to load mint configuration\n");
|
||||
"Failed to load exchange configuration\n");
|
||||
return 1;
|
||||
}
|
||||
if (NULL == masterkeyfile)
|
||||
@ -975,13 +975,13 @@ main (int argc,
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_data (kcfg,
|
||||
"mint",
|
||||
"exchange",
|
||||
"master_public_key",
|
||||
&master_public_key_from_cfg,
|
||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint",
|
||||
"exchange",
|
||||
"master_public_key");
|
||||
return 1;
|
||||
}
|
||||
@ -991,7 +991,7 @@ main (int argc,
|
||||
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)))
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint",
|
||||
"exchange",
|
||||
"master_public_key",
|
||||
_("does not match with private key"));
|
||||
return 1;
|
||||
@ -1000,19 +1000,19 @@ main (int argc,
|
||||
|
||||
if (GNUNET_OK !=
|
||||
GNUNET_CONFIGURATION_get_value_time (kcfg,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"lookahead_sign",
|
||||
&lookahead_sign))
|
||||
{
|
||||
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"lookahead_sign");
|
||||
return GNUNET_SYSERR;
|
||||
}
|
||||
if (0 == lookahead_sign.rel_value_us)
|
||||
{
|
||||
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
|
||||
"mint_keys",
|
||||
"exchange_keys",
|
||||
"lookahead_sign",
|
||||
_("must not be zero"));
|
||||
return GNUNET_SYSERR;
|
||||
@ -1023,10 +1023,10 @@ main (int argc,
|
||||
|
||||
|
||||
/* finally, do actual work */
|
||||
if (GNUNET_OK != mint_keys_update_signkeys ())
|
||||
if (GNUNET_OK != exchange_keys_update_signkeys ())
|
||||
return 1;
|
||||
|
||||
if (GNUNET_OK != mint_keys_update_denomkeys ())
|
||||
if (GNUNET_OK != exchange_keys_update_denomkeys ())
|
||||
return 1;
|
||||
if (NULL != auditor_output_file)
|
||||
{
|
||||
@ -1036,4 +1036,4 @@ main (int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* end of taler-mint-keyup.c */
|
||||
/* end of taler-exchange-keyup.c */
|
@ -14,7 +14,7 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file taler-mint-reservemod.c
|
||||
* @file taler-exchange-reservemod.c
|
||||
* @brief Modify reserves. Allows manipulation of reserve balances.
|
||||
* @author Florian Dold
|
||||
* @author Benedikt Mueller
|
||||
@ -23,22 +23,22 @@
|
||||
#include <gnunet/gnunet_util_lib.h>
|
||||
#include <libpq-fe.h>
|
||||
#include <jansson.h>
|
||||
#include "taler_mintdb_plugin.h"
|
||||
#include "taler_exchangedb_plugin.h"
|
||||
|
||||
/**
|
||||
* Director of the mint, containing the keys.
|
||||
* Director of the exchange, containing the keys.
|
||||
*/
|
||||
static char *mint_directory;
|
||||
static char *exchange_directory;
|
||||
|
||||
/**
|
||||
* Handle to the mint's configuration
|
||||
* Handle to the exchange's configuration
|
||||
*/
|
||||
static struct GNUNET_CONFIGURATION_Handle *cfg;
|
||||
|
||||
/**
|
||||
* Our DB plugin.
|
||||
*/
|
||||
static struct TALER_MINTDB_Plugin *plugin;
|
||||
static struct TALER_EXCHANGEDB_Plugin *plugin;
|
||||
|
||||
|
||||
/**
|
||||
@ -58,14 +58,14 @@ main (int argc, char *const *argv)
|
||||
json_t *jdetails;
|
||||
json_error_t error;
|
||||
struct TALER_ReservePublicKeyP reserve_pub;
|
||||
struct TALER_MINTDB_Session *session;
|
||||
struct TALER_EXCHANGEDB_Session *session;
|
||||
const struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||
{'a', "add", "DENOM",
|
||||
"value to add", 1,
|
||||
&GNUNET_GETOPT_set_string, &add_str},
|
||||
{'d', "mint-dir", "DIR",
|
||||
"mint directory with keys to update", 1,
|
||||
&GNUNET_GETOPT_set_filename, &mint_directory},
|
||||
{'d', "exchange-dir", "DIR",
|
||||
"exchange directory with keys to update", 1,
|
||||
&GNUNET_GETOPT_set_filename, &exchange_directory},
|
||||
{'D', "details", "JSON",
|
||||
"details about the bank transaction which justify why we add this amount", 1,
|
||||
&GNUNET_GETOPT_set_string, &details},
|
||||
@ -79,18 +79,18 @@ main (int argc, char *const *argv)
|
||||
int ret;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-reservemod",
|
||||
GNUNET_log_setup ("taler-exchange-reservemod",
|
||||
"WARNING",
|
||||
NULL));
|
||||
|
||||
if (GNUNET_GETOPT_run ("taler-mint-reservemod",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-reservemod",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
if (NULL == mint_directory)
|
||||
if (NULL == exchange_directory)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Mint directory not given\n");
|
||||
"Exchange directory not given\n");
|
||||
GNUNET_free_non_null (add_str);
|
||||
GNUNET_free_non_null (details);
|
||||
GNUNET_free_non_null (reserve_pub_str);
|
||||
@ -133,11 +133,11 @@ main (int argc, char *const *argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
cfg = TALER_config_load (mint_directory);
|
||||
cfg = TALER_config_load (exchange_directory);
|
||||
if (NULL == cfg)
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to load mint configuration\n");
|
||||
"Failed to load exchange configuration\n");
|
||||
GNUNET_free_non_null (add_str);
|
||||
GNUNET_free_non_null (details);
|
||||
GNUNET_free_non_null (reserve_pub_str);
|
||||
@ -145,7 +145,7 @@ main (int argc, char *const *argv)
|
||||
}
|
||||
ret = 1;
|
||||
if (NULL ==
|
||||
(plugin = TALER_MINTDB_plugin_load (cfg)))
|
||||
(plugin = TALER_EXCHANGEDB_plugin_load (cfg)))
|
||||
{
|
||||
fprintf (stderr,
|
||||
"Failed to initialize database plugin.\n");
|
||||
@ -194,7 +194,7 @@ main (int argc, char *const *argv)
|
||||
ret = 0;
|
||||
cleanup:
|
||||
if (NULL != plugin)
|
||||
TALER_MINTDB_plugin_unload (plugin);
|
||||
TALER_EXCHANGEDB_plugin_unload (plugin);
|
||||
if (NULL != cfg)
|
||||
GNUNET_CONFIGURATION_destroy (cfg);
|
||||
GNUNET_free_non_null (add_str);
|
||||
@ -203,4 +203,4 @@ main (int argc, char *const *argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* end taler-mint-reservemod.c */
|
||||
/* end taler-exchange-reservemod.c */
|
@ -14,7 +14,7 @@
|
||||
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file taler-mint-sepa.c
|
||||
* @file taler-exchange-sepa.c
|
||||
* @brief Create signed response for /wire/sepa requests.
|
||||
* @author Christian Grothoff
|
||||
*/
|
||||
@ -51,7 +51,7 @@ static char *output_filename;
|
||||
|
||||
|
||||
/**
|
||||
* The main function of the taler-mint-sepa tool. This tool is used
|
||||
* The main function of the taler-exchange-sepa tool. This tool is used
|
||||
* to sign the SEPA bank account details using the master key.
|
||||
*
|
||||
* @param argc number of arguments from the command line
|
||||
@ -90,11 +90,11 @@ main (int argc,
|
||||
char *json_str;
|
||||
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
GNUNET_log_setup ("taler-mint-sepa",
|
||||
GNUNET_log_setup ("taler-exchange-sepa",
|
||||
"WARNING",
|
||||
NULL));
|
||||
|
||||
if (GNUNET_GETOPT_run ("taler-mint-sepa",
|
||||
if (GNUNET_GETOPT_run ("taler-exchange-sepa",
|
||||
options,
|
||||
argc, argv) < 0)
|
||||
return 1;
|
||||
@ -160,4 +160,4 @@ main (int argc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* end of taler-mint-sepa.c */
|
||||
/* end of taler-exchange-sepa.c */
|
6
src/exchange/.gitignore
vendored
Normal file
6
src/exchange/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
taler-exchange-dbinit
|
||||
taler-exchange-keycheck
|
||||
taler-exchange-keyup
|
||||
taler-exchange-pursemod
|
||||
taler-exchange-reservemod
|
||||
taler-exchange-httpd
|
59
src/exchange/Makefile.am
Normal file
59
src/exchange/Makefile.am
Normal file
@ -0,0 +1,59 @@
|
||||
# This Makefile.am is in the public domain
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src/include
|
||||
|
||||
if USE_COVERAGE
|
||||
AM_CFLAGS = --coverage -O0
|
||||
XLIB = -lgcov
|
||||
endif
|
||||
|
||||
bin_PROGRAMS = \
|
||||
taler-exchange-aggregator \
|
||||
taler-exchange-httpd
|
||||
|
||||
taler_exchange_aggregator_SOURCES = \
|
||||
taler-exchange-aggregator.c
|
||||
taler_exchange_aggregator_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/wire/libtalerwire.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-ljansson \
|
||||
-lgnunetutil
|
||||
|
||||
taler_exchange_httpd_SOURCES = \
|
||||
taler-exchange-httpd.c taler-exchange-httpd.h \
|
||||
taler-exchange-httpd_admin.c taler-exchange-httpd_admin.h \
|
||||
taler-exchange-httpd_db.c taler-exchange-httpd_db.h \
|
||||
taler-exchange-httpd_deposit.c taler-exchange-httpd_deposit.h \
|
||||
taler-exchange-httpd_keystate.c taler-exchange-httpd_keystate.h \
|
||||
taler-exchange-httpd_mhd.c taler-exchange-httpd_mhd.h \
|
||||
taler-exchange-httpd_parsing.c taler-exchange-httpd_parsing.h \
|
||||
taler-exchange-httpd_refresh.c taler-exchange-httpd_refresh.h \
|
||||
taler-exchange-httpd_reserve.c taler-exchange-httpd_reserve.h \
|
||||
taler-exchange-httpd_responses.c taler-exchange-httpd_responses.h \
|
||||
taler-exchange-httpd_tracking.c taler-exchange-httpd_tracking.h \
|
||||
taler-exchange-httpd_wire.c taler-exchange-httpd_wire.h \
|
||||
taler-exchange-httpd_validation.c taler-exchange-httpd_validation.h
|
||||
taler_exchange_httpd_LDADD = \
|
||||
$(LIBGCRYPT_LIBS) \
|
||||
$(top_builddir)/src/util/libtalerutil.la \
|
||||
$(top_builddir)/src/exchangedb/libtalerexchangedb.la \
|
||||
-lmicrohttpd \
|
||||
-ljansson \
|
||||
-lgnunetutil \
|
||||
-lpthread
|
||||
|
||||
if HAVE_DEVELOPER
|
||||
taler_exchange_httpd_SOURCES += \
|
||||
taler-exchange-httpd_test.c taler-exchange-httpd_test.h
|
||||
endif
|
||||
|
||||
check_SCRIPTS = \
|
||||
test_taler_exchange_httpd.sh
|
||||
|
||||
if HAVE_EXPENSIVE_TESTS
|
||||
check_SCRIPTS += \
|
||||
test_taler_exchange_httpd_afl.sh
|
||||
endif
|
||||
|
||||
TESTS = $(check_SCRIPTS)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user