taler-merchant-httpd_mfa.h (3176B)
1 /* 2 This file is part of TALER 3 (C) 2025 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify 6 it under the terms of the GNU Affero General Public License as 7 published by the Free Software Foundation; either version 3, 8 or (at your option) any later version. 9 10 TALER is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public 16 License along with TALER; see the file COPYING. If not, 17 see <http://www.gnu.org/licenses/> 18 */ 19 20 /** 21 * @file taler-merchant-httpd_mfa.h 22 * @brief internal APIs for multi-factor authentication (MFA) 23 * @author Christian Grothoff 24 */ 25 #ifndef TALER_MERCHANT_HTTPD_MFA_H 26 #define TALER_MERCHANT_HTTPD_MFA_H 27 28 #include "taler-merchant-httpd.h" 29 #include "taler_merchant_util.h" 30 31 32 /** 33 * Parse the given @a challenge_id into its parts. 34 * 35 * @param[in,out] hc handler context with the connection to the client 36 * @param challenge_id challenge of "$NUMBER-$H_BODY" 37 * @param[out] challenge_serial set to $NUMBER 38 * @param[out] h_body set to $H_BODY (decoded) 39 * @return #GNUNET_OK on success, 40 * #GNUNET_NO if an error message was returned to the client 41 * #GNUNET_SYSERR to just close the connection 42 */ 43 enum GNUNET_GenericReturnValue 44 TMH_mfa_parse_challenge_id (struct TMH_HandlerContext *hc, 45 const char *challenge_id, 46 uint64_t *challenge_serial, 47 struct TALER_MERCHANT_MFA_BodyHash *h_body); 48 49 50 /** 51 * Check that a set of MFA challenges has been satisfied by the 52 * client for the request in @a hc. 53 * 54 * @param[in,out] hc handler context with the connection to the client 55 * @param op operation for which we should check challenges for 56 * @param combi_and true to tell the client to solve all challenges (AND), 57 * false means that any of the challenges will do (OR) 58 * @param ... pairs of channel and address, terminated by 59 * #TALER_MERCHANT_MFA_CHANNEL_NONE 60 * @return #GNUNET_OK on success (challenges satisfied) 61 * #GNUNET_NO if an error message was returned to the client 62 * #GNUNET_SYSERR to just close the connection 63 */ 64 enum GNUNET_GenericReturnValue 65 TMH_mfa_challenges_do ( 66 struct TMH_HandlerContext *hc, 67 enum TALER_MERCHANT_MFA_CriticalOperation op, 68 bool combi_and, 69 ...); 70 71 72 /** 73 * Check MFA for a simple operation that simply requires 74 * a single additional factor (if any are configured). 75 * 76 * @param[in,out] hc handler context with the connection to the client 77 * @param op operation for which we should check challenges for 78 * @param mi instance to check authentication for 79 * @return #GNUNET_OK on success (challenges satisfied) 80 * #GNUNET_NO if an error message was returned to the client 81 * #GNUNET_SYSERR to just close the connection 82 */ 83 enum GNUNET_GenericReturnValue 84 TMH_mfa_check_simple ( 85 struct TMH_HandlerContext *hc, 86 enum TALER_MERCHANT_MFA_CriticalOperation op, 87 struct TMH_MerchantInstance *mi); 88 89 90 #endif