challenger-httpd_config.c (2435B)
1 /* 2 This file is part of Challenger 3 Copyright (C) 2023, 2024 Taler Systems SA 4 5 Challenger is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Lesser General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 Challenger is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 Challenger; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file challenger/challenger-httpd_config.c 18 * @brief headers for /config handler 19 * @author Christian Grothoff 20 */ 21 #include "platform.h" 22 #include "challenger-httpd_config.h" 23 #include <taler/taler_json_lib.h> 24 25 26 /* 27 * Protocol version history: 28 * 29 * 0: original design 30 * 1: revision to support SPA 31 * 2: add support to restrict addresses by REGEX and a few other SPA enhancements 32 * 3: added support for RFC7636 33 * 4: added support to pre-initialize address during /setup. 34 * 5: added support for GET /authorize to have a link in challenge messages to the form 35 * 6: added ``address_type`` field in ``/config`` 36 */ 37 38 39 enum MHD_Result 40 CH_handler_config (struct CH_HandlerContext *hc, 41 const char *upload_data, 42 size_t *upload_data_size) 43 { 44 static struct MHD_Response *response; 45 46 (void) upload_data; 47 (void) upload_data_size; 48 if (NULL == response) 49 { 50 response = TALER_MHD_MAKE_JSON_PACK ( 51 GNUNET_JSON_pack_string ("implementation", 52 "urn:net:taler:specs:challenger:c-reference"), 53 GNUNET_JSON_pack_string ("name", 54 "challenger"), 55 GNUNET_JSON_pack_string ("address_type", 56 CH_address_type), 57 GNUNET_JSON_pack_string ("address_hint", 58 CH_address_hint), 59 GNUNET_JSON_pack_object_incref ("restrictions", 60 CH_restrictions), 61 GNUNET_JSON_pack_string ("version", 62 "6:0:4")); 63 } 64 return MHD_queue_response (hc->connection, 65 MHD_HTTP_OK, 66 response); 67 } 68 69 70 /* end of challenger-httpd_config.c */