frosix.h (3556B)
1 /* 2 This file is part of Frosix 3 Copyright (C) 2020, 2021 Anastasis SARL 4 5 Frosix 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 Frosix 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 Frosix; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file include/frosix.h 18 * @brief frosix client api 19 * @author Christian Grothoff 20 * @author Dominik Meister 21 * @author Dennis Neufeld 22 * @author Joel Urech 23 */ 24 #ifndef FROSIX_H 25 #define FROSIX_H 26 27 #include <jansson.h> 28 #include "frosix_backend.h" 29 #include "frosix_service.h" 30 #include <taler/taler_mhd_lib.h> 31 #include <regex.h> 32 33 34 /** 35 * Initialize reducer subsystem. 36 * 37 * @param ctx context to use for CURL requests. 38 */ 39 void 40 FROSIX_redux_init (struct GNUNET_CURL_Context *ctx); 41 42 43 /** 44 * Signature of the callback passed to #FROSIX_redux_action() 45 * 46 * @param cls closure 47 * @param error error code, #TALER_EC_NONE if @a new_bs is the new successful state 48 * @param new_state the new state of the operation (client should json_incref() to keep an alias) 49 */ 50 typedef void 51 (*FROSIX_ActionCallback)(void *cls, 52 enum TALER_ErrorCode error, 53 json_t *new_state); 54 55 56 /** 57 * Generic container for an action with asynchronous activities. 58 * Handle to an ongoing action. Only valid until the #FROSIX_ActionCallback is invoked. 59 */ 60 struct FROSIX_ReduxAction 61 { 62 /** 63 * Function to call to clean up. 64 */ 65 void (*cleanup)(void *cls); 66 67 /** 68 * Action-specific state, closure for @e cleanup. 69 */ 70 void *cleanup_cls; 71 }; 72 73 74 75 /** 76 * Cancel ongoing redux action. 77 * 78 * @param ra action to cancel 79 */ 80 void 81 FROSIX_redux_action_cancel (struct FROSIX_ReduxAction *ra); 82 83 84 /** 85 * FIXME 86 */ 87 struct FROSIX_ReduxAction * 88 FROSIX_redux_keygen_start (const json_t *arguments, 89 FROSIX_ActionCallback cb, 90 void *cb_cls); 91 92 93 /** 94 * FIXME 95 */ 96 struct FROSIX_ReduxAction * 97 FROSIX_redux_challenge_request_start (const json_t *arguments, 98 const json_t *input, 99 const char *message, 100 FROSIX_ActionCallback cb, 101 void *cb_cls); 102 103 104 /** 105 * FIXME 106 */ 107 struct FROSIX_ReduxAction * 108 FROSIX_redux_sign_start (const json_t *arguments, 109 json_t *input, 110 const char *message, 111 FROSIX_ActionCallback cb, 112 void *cb_cls); 113 114 115 /** 116 * FIXME 117 */ 118 struct FROSIX_ReduxAction * 119 FROSIX_redux_key_delete_start (json_t *input, 120 FROSIX_ActionCallback cb, 121 void *cb_cls); 122 123 124 /** 125 * FIXME 126 */ 127 enum GNUNET_GenericReturnValue 128 FROSIX_verify_signature (const char *message, 129 const json_t *arguments); 130 131 132 /** 133 * FIXME 134 */ 135 void 136 FROSIX_export_public_key (const json_t *arguments, 137 FROSIX_ActionCallback cb, 138 void *cb_cls); 139 140 141 /** 142 * FIXME 143 */ 144 enum GNUNET_GenericReturnValue 145 FROSIX_verify_public_key (const json_t *arguments); 146 147 #endif /* _FROSIX_REDUX_H */