challenger

OAuth 2.0-based authentication service that validates user can receive messages at a certain address
Log | Files | Refs | Submodules | README | LICENSE

authorize_start.h (3155B)


      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/authorize_start.h
     18  * @brief implementation of the authorize_start function for Postgres
     19  * @author Christian Grothoff
     20  * @author Bohdan Potuzhnyi
     21  * @author Vlada Svirsh
     22  */
     23 #ifndef CHALLENGER_DATABASE_AUTHORIZE_START_H
     24 #define CHALLENGER_DATABASE_AUTHORIZE_START_H
     25 
     26 #include <taler/taler_util.h>
     27 #include <taler/taler_json_lib.h>
     28 #include "challenger_util.h"
     29 #include "challenger_database_lib.h"
     30 
     31 
     32 /**
     33  * Set the user-provided address in a validation process. Updates
     34  * the address and decrements the "addresses left" counter.  If the
     35  * address did not change, the operation is successful even without
     36  * the counter change.
     37  *
     38  * @param cls
     39  * @param nonce unique nonce to use to identify the validation
     40  * @param client_id client that initiated the validation
     41  * @param client_scope scope of the validation
     42  * @param client_state state of the client
     43  * @param client_redirect_uri where to redirect at the end, NULL to use a unique one registered for the client
     44  * @param code_challenge PKCE code challenge
     45  * @param code_challenge_method PKCE code challenge method enum
     46  * @param[out] last_address set to the last address used
     47  * @param[out] address_attempts_left set to number of address changing attempts left for this address
     48  * @param[out] pin_transmissions_left set to number of times the PIN can still be re-requested
     49  * @param[out] auth_attempts_left set to number of authentication attempts remaining
     50  * @param[out] solved set to true if the challenge is already solved
     51  * @param[out] last_tx_time set to the last time when we (presumably) send a PIN to @a last_address; 0 if never sent
     52  * @return transaction status:
     53  *   #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the address was changed
     54  *   #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if we do not permit further changes to the address (attempts exhausted)
     55  *   #GNUNET_DB_STATUS_HARD_ERROR on failure
     56  */
     57 enum GNUNET_DB_QueryStatus
     58 CHALLENGERDB_authorize_start (
     59   struct CHALLENGERDB_PostgresContext *ctx,
     60   const struct CHALLENGER_ValidationNonceP *nonce,
     61   uint64_t client_id,
     62   const char *client_scope,
     63   const char *client_state,
     64   const char *client_redirect_uri,
     65   const char *code_challenge,
     66   uint32_t code_challenge_method,
     67   json_t **last_address,
     68   uint32_t *address_attempts_left,
     69   uint32_t *pin_transmissions_left,
     70   uint32_t *auth_attempts_left,
     71   bool *solved,
     72   struct GNUNET_TIME_Absolute *last_tx_time);
     73 
     74 
     75 #endif