summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-02-01 23:20:18 +0100
committerChristian Grothoff <christian@grothoff.org>2024-02-01 23:20:18 +0100
commita867291ea863948c604ebeeb1f6ffd3e684bb75b (patch)
tree37bffa0d6ab7d7d358deae6d25a4eb1c7a848ee5 /src
parentc3fece4a3b521dc9694ca09b89fd20370f57b8bf (diff)
downloadmerchant-a867291ea863948c604ebeeb1f6ffd3e684bb75b.tar.gz
merchant-a867291ea863948c604ebeeb1f6ffd3e684bb75b.tar.bz2
merchant-a867291ea863948c604ebeeb1f6ffd3e684bb75b.zip
add TOTP key and method validation, allow strings to be specified in the TOTP method, bump protocol to v7
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd_config.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c9
-rw-r--r--src/backend/taler-merchant-httpd_private-post-otp-devices.c8
3 files changed, 7 insertions, 12 deletions
diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c
index 87278116..b4906787 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -42,7 +42,7 @@
* #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
* merchant_api_config.c!
*/
-#define MERCHANT_PROTOCOL_VERSION "6:1:2"
+#define MERCHANT_PROTOCOL_VERSION "7:0:3"
/**
diff --git a/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c b/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
index aff85d8f..cb784b8d 100644
--- a/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c
@@ -37,17 +37,16 @@ TMH_private_patch_otp_devices_ID (const struct TMH_RequestHandler *rh,
const char *device_id = hc->infix;
struct TALER_MERCHANTDB_OtpDeviceDetails tp = {0};
enum GNUNET_DB_QueryStatus qs;
- uint32_t otp_algorithm;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("otp_device_description",
(const char **) &tp.otp_description),
- GNUNET_JSON_spec_uint32 ("otp_algorithm",
- &otp_algorithm),
+ TALER_JSON_spec_otp_type ("otp_algorithm",
+ &tp.otp_algorithm),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint64 ("otp_ctr",
&tp.otp_ctr),
NULL),
- GNUNET_JSON_spec_string ("otp_key",
+ TALER_JSON_spec_otp_key ("otp_key",
(const char **) &tp.otp_key),
GNUNET_JSON_spec_end ()
};
@@ -66,8 +65,6 @@ TMH_private_patch_otp_devices_ID (const struct TMH_RequestHandler *rh,
: MHD_NO;
}
- tp.otp_algorithm = (enum TALER_MerchantConfirmationAlgorithm) otp_algorithm;
-
qs = TMH_db->update_otp (TMH_db->cls,
mi->settings.id,
device_id,
diff --git a/src/backend/taler-merchant-httpd_private-post-otp-devices.c b/src/backend/taler-merchant-httpd_private-post-otp-devices.c
index 5521ce97..ff70fb58 100644
--- a/src/backend/taler-merchant-httpd_private-post-otp-devices.c
+++ b/src/backend/taler-merchant-httpd_private-post-otp-devices.c
@@ -63,19 +63,18 @@ TMH_private_post_otp_devices (const struct TMH_RequestHandler *rh,
struct TALER_MERCHANTDB_OtpDeviceDetails tp = { 0 };
const char *device_id;
enum GNUNET_DB_QueryStatus qs;
- uint32_t otp_algorithm;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("otp_device_id",
&device_id),
GNUNET_JSON_spec_string ("otp_device_description",
(const char **) &tp.otp_description),
- GNUNET_JSON_spec_uint32 ("otp_algorithm",
- &otp_algorithm),
+ TALER_JSON_spec_otp_type ("otp_algorithm",
+ &tp.otp_algorithm),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint64 ("otp_ctr",
&tp.otp_ctr),
NULL),
- GNUNET_JSON_spec_string ("otp_key",
+ TALER_JSON_spec_otp_key ("otp_key",
(const char **) &tp.otp_key),
GNUNET_JSON_spec_end ()
};
@@ -95,7 +94,6 @@ TMH_private_post_otp_devices (const struct TMH_RequestHandler *rh,
: MHD_NO;
}
}
- tp.otp_algorithm = (enum TALER_MerchantConfirmationAlgorithm) otp_algorithm;
/* finally, interact with DB until no serialization error */
for (unsigned int i = 0; i<MAX_RETRIES; i++)