anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

anastasis_util_lib.h (2021B)


      1 /*
      2   This file is part of Anastasis
      3   Copyright (C) 2020 Anastasis SARL
      4 
      5   Anastasis 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   Anastasis 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   Anastasis; see the file COPYING.GPL.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file include/anastasis_util_lib.h
     18  * @brief anastasis client api
     19  * @author Christian Grothoff
     20  * @author Dominik Meister
     21  * @author Dennis Neufeld
     22  */
     23 #ifndef ANASTASIS_UTIL_LIB_H
     24 #define ANASTASIS_UTIL_LIB_H
     25 
     26 #include "anastasis_error_codes.h"
     27 #define GNU_TALER_ERROR_CODES_H 1
     28 #include <gnunet/gnunet_util_lib.h>
     29 #include <taler/taler_util.h>
     30 
     31 
     32 /**
     33  * Maximum value allowed for PINs. Limited to 10^15 < 2^52 to ensure the
     34  * numeric value survives a conversion to float by JavaScript.
     35  *
     36  * NOTE: Do not change this value, we map it to a string like
     37  * 42353-256-6521-241 and that mapping fails if the number
     38  * does not have exactly 15 digits!
     39  */
     40 #define ANASTASIS_PIN_MAX_VALUE 1000000000000000
     41 
     42 
     43 /**
     44  * Return default project data used by Anastasis.
     45  */
     46 const struct GNUNET_OS_ProjectData *
     47 ANASTASIS_project_data (void);
     48 
     49 
     50 /**
     51  * Convert input string @a as into @a pin.
     52  *
     53  * @param as input of the form 42355-256-2262-265
     54  * @param[out] pin set to numeric pin
     55  * @return false if @as is malformed
     56  */
     57 bool
     58 ANASTASIS_scan_pin (const char *as,
     59                     unsigned long long *pin);
     60 
     61 
     62 /**
     63  * Convert numeric pin to human-readable number for display.
     64  *
     65  * @param pin number to convert
     66  * @return static (!) buffer with the text to show
     67  */
     68 const char *
     69 ANASTASIS_pin2s (uint64_t pin);
     70 
     71 
     72 #endif