challenge_set_address_and_pin.h (3138B)
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 validation_duration minimum time between transmissions 40 * @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 41 * @param[out] state set to client's OAuth2 state if available 42 * @param[out] last_tx_time set to the last time when we (presumably) send a PIN to @a address, input should be current time to use if the existing value for tx_time is past @a next_tx_time 43 * @param[out] pin_transmit set to true if we should transmit the @a last_pin to the @a address 44 * @param[out] auth_attempts_left set to number of attempts the user has left on this pin 45 * @param[out] client_redirect_uri redirection URI of the client (for reporting failures) 46 * @param[out] address_refused set to true if the address was refused (address change attempts exhausted) 47 * @param[out] solved set to true if the challenge is already solved 48 * @return transaction status: 49 * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the address was changed 50 * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if we do not permit further changes to the address (attempts exhausted) 51 * #GNUNET_DB_STATUS_HARD_ERROR on failure 52 */ 53 enum GNUNET_DB_QueryStatus 54 CHALLENGERDB_challenge_set_address_and_pin ( 55 struct CHALLENGERDB_PostgresContext *ctx, 56 const struct CHALLENGER_ValidationNonceP *nonce, 57 const json_t *address, 58 struct GNUNET_TIME_Relative validation_duration, 59 uint32_t *tan, 60 char **state, 61 struct GNUNET_TIME_Absolute *last_tx_time, 62 uint32_t *auth_attempts_left, 63 bool *pin_transmit, 64 char **client_redirect_uri, 65 bool *address_refused, 66 bool *solved); 67 68 #endif