challenge_set_address_and_pin.h (3214B)
1 /* 2 This file is part of Challenger 3 Copyright (C) 2023 Taler Systems SA 4 5 Challenger is free software; you can redistribute it and/or modify it under the 6 terms of the GNU 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. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file src/include/challenger-database/challenge_set_address_and_pin.h 18 * @brief implementation of the challenge_set_address_and_pin function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef CHALLENGER_DATABASE_CHALLENGE_SET_ADDRESS_AND_PIN_H 22 #define CHALLENGER_DATABASE_CHALLENGE_SET_ADDRESS_AND_PIN_H 23 24 #include <taler/taler_util.h> 25 #include <taler/taler_json_lib.h> 26 #include "challenger_util.h" 27 #include "challenger_database_lib.h" 28 29 30 /** 31 * Set the user-provided address in a validation process. Updates 32 * the address and decrements the "addresses left" counter. If the 33 * address did not change, the operation is successful even without 34 * the counter change. 35 * 36 * @param cls 37 * @param nonce unique nonce to use to identify the validation 38 * @param address the new address to validate 39 * @param retransmission_frequency minimum time that must have passed since the 40 * last transmission before the PIN is (re)transmitted to @a address again 41 * @param[in,out] tan set to the PIN/TAN last send to @a address, input should be random PIN/TAN to use if address did not change 42 * @param[out] state set to client's OAuth2 state if available 43 * @param[out] last_tx_time set to the last time when we (presumably) send a PIN to @a address 44 * @param[out] pin_transmit set to true if we should transmit the @a last_pin to the @a address 45 * @param[out] auth_attempts_left set to number of attempts the user has left on this pin 46 * @param[out] client_redirect_uri redirection URI of the client (for reporting failures) 47 * @param[out] address_refused set to true if the address was refused (address change attempts exhausted) 48 * @param[out] solved set to true if the challenge is already solved 49 * @return transaction status: 50 * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the validation @a nonce exists 51 * (inspect @a address_refused / @a solved / @a pin_transmit for the actual 52 * outcome) 53 * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the validation @a nonce is unknown 54 * #GNUNET_DB_STATUS_HARD_ERROR on failure 55 */ 56 enum GNUNET_DB_QueryStatus 57 CHALLENGERDB_challenge_set_address_and_pin ( 58 struct CHALLENGERDB_PostgresContext *ctx, 59 const struct CHALLENGER_ValidationNonceP *nonce, 60 const json_t *address, 61 struct GNUNET_TIME_Relative retransmission_frequency, 62 uint32_t *tan, 63 char **state, 64 struct GNUNET_TIME_Absolute *last_tx_time, 65 uint32_t *auth_attempts_left, 66 bool *pin_transmit, 67 char **client_redirect_uri, 68 bool *address_refused, 69 bool *solved); 70 71 #endif