From 87bc48f5138e65f900d581e902c8f6f07cdd0a6c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 25 Nov 2020 20:26:08 +0100 Subject: extended exchange APIs for #6175 --- src/lib/exchange_api_auditor_add_denomination.c | 65 +++++++++++++++++++++ src/lib/exchange_api_management_auditor_disable.c | 66 +++++++++++++++++++++ src/lib/exchange_api_management_auditor_enable.c | 67 ++++++++++++++++++++++ src/lib/exchange_api_management_get_keys.c | 59 +++++++++++++++++++ src/lib/exchange_api_management_post_keys.c | 60 +++++++++++++++++++ ...change_api_management_revoke_denomination_key.c | 63 ++++++++++++++++++++ .../exchange_api_management_revoke_signing_key.c | 63 ++++++++++++++++++++ src/lib/exchange_api_management_wire_disable.c | 65 +++++++++++++++++++++ src/lib/exchange_api_management_wire_enable.c | 65 +++++++++++++++++++++ 9 files changed, 573 insertions(+) create mode 100644 src/lib/exchange_api_auditor_add_denomination.c create mode 100644 src/lib/exchange_api_management_auditor_disable.c create mode 100644 src/lib/exchange_api_management_auditor_enable.c create mode 100644 src/lib/exchange_api_management_get_keys.c create mode 100644 src/lib/exchange_api_management_post_keys.c create mode 100644 src/lib/exchange_api_management_revoke_denomination_key.c create mode 100644 src/lib/exchange_api_management_revoke_signing_key.c create mode 100644 src/lib/exchange_api_management_wire_disable.c create mode 100644 src/lib/exchange_api_management_wire_enable.c (limited to 'src/lib') diff --git a/src/lib/exchange_api_auditor_add_denomination.c b/src/lib/exchange_api_auditor_add_denomination.c new file mode 100644 index 000000000..a4d85f8f3 --- /dev/null +++ b/src/lib/exchange_api_auditor_add_denomination.c @@ -0,0 +1,65 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_auditor_add_denomination.c + * @brief functions for the auditor to add its signature for denomination at the exchange + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /auditor/$AUDITOR_PUB/$H_DENOM_PUB request. + */ +struct TALER_EXCHANGE_AuditorAddDenominationHandle; + + +/** + * Provide auditor signatures for a denomination to the exchange. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param h_denom_pub hash of the public key of the denomination + * @param auditor_pub public key of the auditor + * @param auditor_sig signature of the auditor + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_AuditorAddDenominationHandle * +TALER_EXCHANGE_add_auditor_denomination ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct GNUNET_HashCode *h_denom_pub, + const struct TALER_AuditorPublicKeyP *auditor_pub, + const struct TALER_AuditorSignatureP *auditor_sig, + TALER_EXCHANGE_AuditorAddDenominationCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_add_auditor_denomination() operation. + * + * @param gh handle of the operation to cancel + */ +void +TALER_EXCHANGE_add_auditor_denomination_cancel ( + struct TALER_EXCHANGE_AuditorAddDenominationHandle *ah); diff --git a/src/lib/exchange_api_management_auditor_disable.c b/src/lib/exchange_api_management_auditor_disable.c new file mode 100644 index 000000000..1744179e8 --- /dev/null +++ b/src/lib/exchange_api_management_auditor_disable.c @@ -0,0 +1,66 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_auditor_disable.c + * @brief functions to disable an auditor + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + +/** + * @brief Handle for a POST /management/auditors/disable request. + */ +struct TALER_EXCHANGE_ManagementAuditorDisableHandle; + + +/** + * Inform the exchange that an auditor should be disabled. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param auditor_pub the public signing key of the auditor + * @param auditor_url base URL of the auditor + * @param validity_start when was this decided? + * @param master_sig signature affirming the auditor addition + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementAuditorDisableHandle * +TALER_EXCHANGE_management_disable_auditor ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_AuditorPublicKeyP *auditor_pub, + const char *auditor_url, + struct GNUNET_TIME_Absolute validity_start, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementAuditorDisableCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_disable_auditor() operation. + * + * @param ah handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_disable_auditor_cancel ( + struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah); diff --git a/src/lib/exchange_api_management_auditor_enable.c b/src/lib/exchange_api_management_auditor_enable.c new file mode 100644 index 000000000..954b678b6 --- /dev/null +++ b/src/lib/exchange_api_management_auditor_enable.c @@ -0,0 +1,67 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_auditor_enable.c + * @brief functions to enable an auditor + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /management/auditors request. + */ +struct TALER_EXCHANGE_ManagementAuditorEnableHandle; + + +/** + * Inform the exchange that an auditor should be enable or enabled. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param auditor_pub the public signing key of the auditor + * @param auditor_url base URL of the auditor + * @param validity_start when was this decided? + * @param master_sig signature affirming the auditor addition + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementAuditorEnableHandle * +TALER_EXCHANGE_management_enable_auditor ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_AuditorPublicKeyP *auditor_pub, + const char *auditor_url, + struct GNUNET_TIME_Absolute validity_start, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementAuditorEnableCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_enable_auditor() operation. + * + * @param ah handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_enable_auditor_cancel ( + struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah); diff --git a/src/lib/exchange_api_management_get_keys.c b/src/lib/exchange_api_management_get_keys.c new file mode 100644 index 000000000..46a107106 --- /dev/null +++ b/src/lib/exchange_api_management_get_keys.c @@ -0,0 +1,59 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_get_keys.c + * @brief functions to obtain future online keys of the exchange + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a GET /management/keys request. + */ +struct TALER_EXCHANGE_ManagementGetKeysHandle; + + +/** + * Request future keys from the exchange. The obtained information will be + * passed to the @a cb. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param cb function to call with the exchange's future keys result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementGetKeysHandle * +TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx, + const char *url, + TALER_EXCHANGE_ManagementGetKeysCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_get_management_keys() operation. + * + * @param gh handle of the operation to cancel + */ +void +TALER_EXCHANGE_get_management_keys_cancel ( + struct TALER_EXCHANGE_ManagementGetKeysHandle *gh); diff --git a/src/lib/exchange_api_management_post_keys.c b/src/lib/exchange_api_management_post_keys.c new file mode 100644 index 000000000..fe8131b1d --- /dev/null +++ b/src/lib/exchange_api_management_post_keys.c @@ -0,0 +1,60 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_post_keys.c + * @brief functions to affirm the validity of exchange keys using the master private key + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /management/keys request. + */ +struct TALER_EXCHANGE_ManagementPostKeysHandle; + + +/** + * Provide master-key signatures to the exchange. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementPostKeysHandle * +TALER_EXCHANGE_post_management_keys ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_EXCHANGE_ManagementPostKeysData *pkd, + TALER_EXCHANGE_ManagementGetKeysCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_post_management_keys() operation. + * + * @param gh handle of the operation to cancel + */ +void +TALER_EXCHANGE_post_management_keys_cancel ( + struct TALER_EXCHANGE_ManagementPostKeysHandle *ph); diff --git a/src/lib/exchange_api_management_revoke_denomination_key.c b/src/lib/exchange_api_management_revoke_denomination_key.c new file mode 100644 index 000000000..8eb3a05e0 --- /dev/null +++ b/src/lib/exchange_api_management_revoke_denomination_key.c @@ -0,0 +1,63 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_revoke_denomination_key.c + * @brief functions to revoke an exchange denomination key + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /management/denominations/$H_DENOM_PUB/revoke request. + */ +struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle; + + +/** + * Inform the exchange that a denomination key was revoked. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param h_denom_pub hash of the denomination public key that was revoked + * @param master_sig signature affirming the revocation + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle * +TALER_EXCHANGE_management_revoke_denomination_key ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct GNUNET_HashCode *h_denom_pub, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_revoke_denomination_key() operation. + * + * @param rh handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_revoke_denomination_key_cancel ( + struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *rh); diff --git a/src/lib/exchange_api_management_revoke_signing_key.c b/src/lib/exchange_api_management_revoke_signing_key.c new file mode 100644 index 000000000..cebc8e324 --- /dev/null +++ b/src/lib/exchange_api_management_revoke_signing_key.c @@ -0,0 +1,63 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_revoke_signing_key.c + * @brief functions to revoke an exchange online signing key + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /management/signkeys/$H_DENOM_PUB/revoke request. + */ +struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle; + + +/** + * Inform the exchange that a signing key was revoked. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param exchange_pub the public signing key that was revoked + * @param master_sig signature affirming the revocation + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle * +TALER_EXCHANGE_management_revoke_signing_key ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const struct TALER_ExchangePublicKeyP *exchange_pub, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementRevokeSigningKeyCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_revoke_signing_key() operation. + * + * @param rh handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_revoke_signing_key_cancel ( + struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh); diff --git a/src/lib/exchange_api_management_wire_disable.c b/src/lib/exchange_api_management_wire_disable.c new file mode 100644 index 000000000..c51b350e3 --- /dev/null +++ b/src/lib/exchange_api_management_wire_disable.c @@ -0,0 +1,65 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_wire_disable.c + * @brief functions to disable an exchange wire method / bank account + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" + + +/** + * @brief Handle for a POST /management/wire/disable request. + */ +struct TALER_EXCHANGE_ManagementWireDisableHandle; + + +/** + * Inform the exchange that a wire account should be disabled. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param payto_uri RFC 8905 URI of the exchange's bank account + * @param validity_end when was this decided? + * @param master_sig signature affirming the wire addition + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementWireDisableHandle * +TALER_EXCHANGE_management_disable_wire ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *payto_uri, + struct GNUNET_TIME_Absolute validity_end, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementWireDisableCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_disable_wire() operation. + * + * @param wh handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_disable_wire_cancel ( + struct TALER_EXCHANGE_ManagementWireDisableHandle *wh); diff --git a/src/lib/exchange_api_management_wire_enable.c b/src/lib/exchange_api_management_wire_enable.c new file mode 100644 index 000000000..a6ed1cdbb --- /dev/null +++ b/src/lib/exchange_api_management_wire_enable.c @@ -0,0 +1,65 @@ +/* + This file is part of TALER + Copyright (C) 2015-2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see + +*/ +/** + * @file lib/exchange_api_management_wire_enable.c + * @brief functions to enable an exchange wire method / bank account + * @author Christian Grothoff + */ +#include "platform.h" +#include "taler_json_lib.h" +#include +#include "taler_exchange_service.h" +#include "taler_signatures.h" +/** + * @brief Handle for a POST /management/wire request. + */ +struct TALER_EXCHANGE_ManagementWireEnableHandle; + + +/** + * Inform the exchange that a wire account should be enabled. + * + * @param ctx the context + * @param url HTTP base URL for the exchange + * @param salt salt to use when hashing the account for the signature + * @param payto_uri RFC 8905 URI of the exchange's bank account + * @param validity_start when was this decided? + * @param master_sig signature affirming the wire addition + * @param cb function to call with the exchange's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_EXCHANGE_ManagementWireEnableHandle * +TALER_EXCHANGE_management_enable_wire ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const char *salt, + const char *payto_uri, + struct GNUNET_TIME_Absolute validity_start, + const struct TALER_MasterSignatureP *master_sig, + TALER_EXCHANGE_ManagementWireEnableCallback cb, + void *cb_cls); + + +/** + * Cancel #TALER_EXCHANGE_management_enable_wire() operation. + * + * @param wh handle of the operation to cancel + */ +void +TALER_EXCHANGE_management_enable_wire_cancel ( + struct TALER_EXCHANGE_ManagementWireEnableHandle *wh); -- cgit v1.2.3