merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

update_token_family_key_expiration.h (2423B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2026 Taler Systems SA
      4 
      5    TALER 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    TALER 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    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15  */
     16 /**
     17  * @file src/include/merchant-database/update_token_family_key_expiration.h
     18  * @brief implementation of the update_token_family_key_expiration function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef MERCHANT_DATABASE_UPDATE_TOKEN_FAMILY_KEY_EXPIRATION_H
     22 #define MERCHANT_DATABASE_UPDATE_TOKEN_FAMILY_KEY_EXPIRATION_H
     23 
     24 #include <gnunet/gnunet_common.h>
     25 #include <taler/taler_util.h>
     26 #include <taler/taler_json_lib.h>
     27 #include "merchantdb_lib.h"
     28 
     29 
     30 /**
     31  * Extend the lifetime of the private key(s) of the token family
     32  * @a token_family_slug that cover the validity period @a valid_at, so that
     33  * they can still be used to sign tokens until @a sign_until.  Keys whose
     34  * private key already lives at least that long (and keys whose private key
     35  * was already deleted) are left alone.
     36  *
     37  * This is what keeps the backend from minting a second key for a validity
     38  * period that is already covered, just because a later order has a pay
     39  * deadline beyond the retention deadline of the existing key.
     40  *
     41  * @param pg database context
     42  * @param instance_id instance to update the token family key for
     43  * @param token_family_slug slug of the token family to update
     44  * @param valid_at only extend keys with a validity period that includes this time
     45  * @param sign_until the private key must be usable for signing until this time
     46  * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if no
     47  *         key needed extending
     48  */
     49 enum GNUNET_DB_QueryStatus
     50 TALER_MERCHANTDB_update_token_family_key_expiration (
     51   struct TALER_MERCHANTDB_PostgresContext *pg,
     52   const char *instance_id,
     53   const char *token_family_slug,
     54   struct GNUNET_TIME_Timestamp valid_at,
     55   struct GNUNET_TIME_Timestamp sign_until);
     56 
     57 
     58 #endif