diff --git a/include/dune b/include/dune index b24da6fc..df2b6ee1 100644 --- a/include/dune +++ b/include/dune @@ -4,36 +4,14 @@ (modules taler_signatures) (libraries)) -(rule - (targets taler_signatures.ml) - (deps ./gen_taler_signatures.exe) - (action - (with-stdout-to - %{targets} - (run ./gen_taler_signatures.exe)))) - (executable (name gen_taler_signatures) - (modules gen_taler_signatures data) + (modules gen_taler_signatures) (libraries fmt angstrom)) -(rule - (targets taler_signatures.h) - (action - (run - wget - -q - -O - %{targets} - "https://git.taler.net/exchange.git/plain/src/include/taler/taler_signatures.h"))) - -(rule - (targets data.ml) - (deps taler_signatures.h) - (action - (with-stdout-to - %{targets} - (progn - (echo "let content = {|") - (cat taler_signatures.h) - (echo "|}"))))) +; we prefer to generate taler_signatures.ml once, +; and commit it, for versionning: +; +; wget -q -O taler_signatures.h "https://git.taler.net/exchange.git/plain/src/include/taler/taler_signatures.h" +; dune exec ./include/gen_taler_signatures.exe > ./include/taler_signatures.ml +; rm taler_signatures.h diff --git a/include/gen_taler_signatures.ml b/include/gen_taler_signatures.ml index 27472b3a..da401ea2 100644 --- a/include/gen_taler_signatures.ml +++ b/include/gen_taler_signatures.ml @@ -38,13 +38,16 @@ let parse input = | Ok defs -> defs | Error msg -> failwith msg +let read_file file = In_channel.with_open_bin file In_channel.input_all + let () = - let l = parse Data.content in + let content = read_file "taler_signatures.h" in + let l = parse content in assert (List.length l = 74); let pp ppf { name; value } = Fmt.pf ppf "let %s : int32 = %d_l@." name value in - Fmt.pr "%a" (Fmt.list pp) l; + Fmt.pr "%a" (Fmt.list ~sep:Fmt.nop pp) l; () diff --git a/include/taler_signatures.ml b/include/taler_signatures.ml new file mode 100644 index 00000000..41332b28 --- /dev/null +++ b/include/taler_signatures.ml @@ -0,0 +1,74 @@ +let master_aml_key : int32 = 1017_l +let master_drain_profit : int32 = 1018_l +let master_partner_details : int32 = 1019_l +let master_signing_key_revoked : int32 = 1020_l +let master_add_wire : int32 = 1021_l +let master_global_fees : int32 = 1022_l +let master_del_wire : int32 = 1023_l +let master_signing_key_validity : int32 = 1024_l +let master_denomination_key_validity : int32 = 1025_l +let master_add_auditor : int32 = 1026_l +let master_del_auditor : int32 = 1027_l +let master_wire_fees : int32 = 1028_l +let master_denomination_key_revoked : int32 = 1029_l +let master_wire_details : int32 = 1030_l +let master_extension : int32 = 1031_l +let exchange_reserve_status : int32 = 1032_l +let exchange_confirm_deposit : int32 = 1033_l +let exchange_confirm_melt : int32 = 1034_l +let exchange_key_set : int32 = 1035_l +let exchange_confirm_wire : int32 = 1036_l +let exchange_confirm_wire_deposit : int32 = 1037_l +let exchange_confirm_refund : int32 = 1038_l +let exchange_confirm_recoup : int32 = 1039_l +let exchange_reserve_closed : int32 = 1040_l +let exchange_confirm_recoup_refresh : int32 = 1041_l +let exchange_affirm_denom_unknown : int32 = 1042_l +let exchange_affirm_denom_expired : int32 = 1043_l +let exchange_confirm_purse_creation : int32 = 1045_l +let exchange_confirm_purse_merged : int32 = 1046_l +let exchange_purse_status : int32 = 1047_l +let exchange_reserve_attest_details : int32 = 1048_l +let exchange_confirm_purse_refund : int32 = 1049_l +let exchange_confirm_withdraw : int32 = 1050_l +let auditor_exchange_keys : int32 = 1064_l +let merchant_contract : int32 = 1101_l +let merchant_refund : int32 = 1102_l +let merchant_track_transaction : int32 = 1103_l +let merchant_payment_ok : int32 = 1104_l +let merchant_wire_details : int32 = 1107_l +let merchant_token_issue : int32 = 1108_l +let wallet_reserve_withdraw : int32 = 1200_l +let wallet_coin_deposit : int32 = 1201_l +let wallet_coin_melt : int32 = 1202_l +let wallet_coin_recoup : int32 = 1203_l +let wallet_coin_link : int32 = 1204_l +let wallet_account_setup : int32 = 1205_l +let wallet_coin_recoup_refresh : int32 = 1206_l +let wallet_age_attestation : int32 = 1207_l +let wallet_reserve_history : int32 = 1208_l +let wallet_coin_history : int32 = 1209_l +let wallet_purse_create : int32 = 1210_l +let wallet_purse_deposit : int32 = 1211_l +let wallet_purse_status : int32 = 1212_l +let wallet_purse_merge : int32 = 1213_l +let wallet_account_merge : int32 = 1214_l +let wallet_reserve_close : int32 = 1215_l +let wallet_purse_econtract : int32 = 1216_l +let wallet_reserve_open : int32 = 1217_l +let wallet_reserve_open_deposit : int32 = 1218_l +let wallet_reserve_attest_details : int32 = 1219_l +let wallet_purse_delete : int32 = 1220_l +let wallet_reserve_age_withdraw : int32 = 1221_l +let wallet_token_use : int32 = 1222_l +let mailbox_messages_delete : int32 = 1223_l +let sm_rsa_denomination_key : int32 = 1250_l +let sm_signing_key : int32 = 1251_l +let sm_cs_denomination_key : int32 = 1252_l +let client_test_eddsa : int32 = 1302_l +let exchange_test_eddsa : int32 = 1303_l +let aml_decision : int32 = 1350_l +let aml_query : int32 = 1351_l +let kyc_auth : int32 = 1360_l +let anastasis_policy_upload : int32 = 1400_l +let sync_backup_upload : int32 = 1450_l diff --git a/taler_signatures.h b/taler_signatures.h new file mode 100644 index 00000000..bf751c9b --- /dev/null +++ b/taler_signatures.h @@ -0,0 +1,475 @@ +/* + This file is part of TALER + Copyright (C) 2014-2022 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 taler_signatures.h + * @brief message formats and signature constants used to define + * the binary formats of signatures in Taler + * @author Florian Dold + * @author Benedikt Mueller + * + * This file should define the constants and C structs that one needs + * to know to implement Taler clients (wallets or merchants or + * auditor) that need to produce or verify Taler signatures. + */ +#ifndef TALER_SIGNATURES_H +#define TALER_SIGNATURES_H + + +/** + * Initialize or update the status of an AML key for an AML officer + */ +#define TALER_SIGNATURE_MASTER_AML_KEY 1017 + + +/** + * Affirm wiring of exchange profits to operator account. + */ +#define TALER_SIGNATURE_MASTER_DRAIN_PROFIT 1018 + + +/** + * Signature affirming a partner configuration for wads. + */ +#define TALER_SIGNATURE_MASTER_PARTNER_DETAILS 1019 + + +/** + * The given revocation key was revoked and must no longer be used. + */ +#define TALER_SIGNATURE_MASTER_SIGNING_KEY_REVOKED 1020 + + +/** + * Add payto URI to the list of our wire methods. + */ +#define TALER_SIGNATURE_MASTER_ADD_WIRE 1021 + + +/** + * Signature over global set of fees charged by the exchange. + */ +#define TALER_SIGNATURE_MASTER_GLOBAL_FEES 1022 + + +/** + * Remove payto URI from the list of our wire methods. + */ +#define TALER_SIGNATURE_MASTER_DEL_WIRE 1023 + + +/** + * Purpose for signing public keys signed by the exchange master key. + */ +#define TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY 1024 + + +/** + * Purpose for denomination keys signed by the exchange master key. + */ +#define TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY 1025 + + +/** + * Add an auditor to the list of our auditors. + */ +#define TALER_SIGNATURE_MASTER_ADD_AUDITOR 1026 + + +/** + * Remove an auditor from the list of our auditors. + */ +#define TALER_SIGNATURE_MASTER_DEL_AUDITOR 1027 + + +/** + * Fees charged per (aggregate) wire transfer to the merchant. + */ +#define TALER_SIGNATURE_MASTER_WIRE_FEES 1028 + + +/** + * The given revocation key was revoked and must no longer be used. + */ +#define TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED 1029 + + +/** + * Signature where the Exchange confirms its IBAN details in the /wire response. + */ +#define TALER_SIGNATURE_MASTER_WIRE_DETAILS 1030 + + +/** + * Set the configuration of an extension (age-restriction or peer2peer) + */ +#define TALER_SIGNATURE_MASTER_EXTENSION 1031 + + +/** + * Purpose for the state of a reserve, signed by the exchange's signing key. + */ +#define TALER_SIGNATURE_EXCHANGE_RESERVE_STATUS 1032 + + +/** + * Signature where the Exchange confirms a deposit request. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT 1033 + + +/** + * Signature where the exchange (current signing key) confirms the no-reveal index for cut-and-choose and the validity of the melted coins. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_MELT 1034 + + +/** + * Signature where the Exchange confirms the full /keys response set. + */ +#define TALER_SIGNATURE_EXCHANGE_KEY_SET 1035 + + +/** + * Signature where the Exchange confirms the /track/transaction response. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE 1036 + + +/** + * Signature where the Exchange confirms the /wire/deposit response. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT 1037 + + +/** + * Signature where the Exchange confirms a refund request. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND 1038 + + +/** + * Signature where the Exchange confirms a recoup. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP 1039 + + +/** + * Signature where the Exchange confirms it closed a reserve. + */ +#define TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED 1040 + + +/** + * Signature where the Exchange confirms a recoup-refresh operation. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH 1041 + + +/** + * Signature where the Exchange confirms that it does not know a denomination (hash). + */ +#define TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN 1042 + + +/** + * Signature where the Exchange confirms that it does not consider a denomination valid for the given operation at this time. + */ +#define TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED 1043 + + +/** + * Signature by which the exchange affirms that a purse was created with a certain amount deposited into it. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_CREATION 1045 + + +/** + * Signature by which the exchange affirms that a purse was merged into a reserve with a certain amount in it. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_MERGED 1046 + + +/** + * Purpose for the state of a purse, signed by the exchange's signing key. + */ +#define TALER_SIGNATURE_EXCHANGE_PURSE_STATUS 1047 + + +/** + * Signature by which the exchange attests identity attributes of a particular reserve owner. + */ +#define TALER_SIGNATURE_EXCHANGE_RESERVE_ATTEST_DETAILS 1048 + + +/** + * Signature by which the exchange confirms that a purse expired and a coin was refunded. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND 1049 + + +/** + * Signature where the Exchange confirms an (age-)withdraw. + */ +#define TALER_SIGNATURE_EXCHANGE_CONFIRM_WITHDRAW 1050 + + +/** + * Signature where the auditor confirms that he is aware of certain denomination keys from the exchange. + */ +#define TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS 1064 + + +/** + * Signature where the merchant confirms a contract (to the customer). + */ +#define TALER_SIGNATURE_MERCHANT_CONTRACT 1101 + + +/** + * Signature where the merchant confirms a refund (of a coin). + */ +#define TALER_SIGNATURE_MERCHANT_REFUND 1102 + + +/** + * Signature where the merchant confirms that he needs the wire transfer identifier for a deposit operation. + */ +#define TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION 1103 + + +/** + * Signature where the merchant confirms that the payment was successful + */ +#define TALER_SIGNATURE_MERCHANT_PAYMENT_OK 1104 + + +/** + * Signature where the merchant confirms its own (salted) wire details (not yet really used). + */ +#define TALER_SIGNATURE_MERCHANT_WIRE_DETAILS 1107 + + +/** + * Signature where the merchant issues a token by blindly signing it. Signed with the token issue private key. + */ +#define TALER_SIGNATURE_MERCHANT_TOKEN_ISSUE 1108 + + +/** + * Signature where the reserve key confirms a withdraw request. Signed with the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW 1200 + + +/** + * Signature made by the wallet of a user to confirm a deposit of a coin. + */ +#define TALER_SIGNATURE_WALLET_COIN_DEPOSIT 1201 + + +/** + * Signature using a coin key confirming the melting of a coin. Signed with the coin's private key. + */ +#define TALER_SIGNATURE_WALLET_COIN_MELT 1202 + + +/** + * Signature using a coin key requesting recoup. Signed with the coin's private key. + */ +#define TALER_SIGNATURE_WALLET_COIN_RECOUP 1203 + + +/** + * Signature using a coin key authenticating link data. Signed with the old coin's private key. + */ +#define TALER_SIGNATURE_WALLET_COIN_LINK 1204 + + +/** + * Signature using a reserve key by which a wallet requests a payment target UUID for itself. Signs over just a purpose (no body), as the signature only serves to demonstrate that the request comes from the wallet controlling the private key, and not some third party. + */ +#define TALER_SIGNATURE_WALLET_ACCOUNT_SETUP 1205 + + +/** + * Signature using a coin key requesting recoup-refresh. Signed with the coin private key. + */ +#define TALER_SIGNATURE_WALLET_COIN_RECOUP_REFRESH 1206 + + +/** + * Signature using a age restriction key for attestation of a particular age/age-group. + */ +#define TALER_SIGNATURE_WALLET_AGE_ATTESTATION 1207 + + +/** + * Request full or partial reserve history. Signed with the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_HISTORY 1208 + + +/** + * Request full or partial coin history. Signed with the coin private key. + */ +#define TALER_SIGNATURE_WALLET_COIN_HISTORY 1209 + + +/** + * Request purse creation (without reserve). Signed by the purse private key. + */ +#define TALER_SIGNATURE_WALLET_PURSE_CREATE 1210 + + +/** + * Request coin to be deposited into a purse. Signed with the coin private key. + */ +#define TALER_SIGNATURE_WALLET_PURSE_DEPOSIT 1211 + + +/** + * Request purse status. Signed with the purse private key. + */ +#define TALER_SIGNATURE_WALLET_PURSE_STATUS 1212 + + +/** + * Request purse to be merged with a reserve. Signed with the purse private key. + */ +#define TALER_SIGNATURE_WALLET_PURSE_MERGE 1213 + + +/** + * Request purse to be merged with a reserve. Signed by the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_ACCOUNT_MERGE 1214 + + +/** + * Request account to be closed. Signed with the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_CLOSE 1215 + + +/** + * Associates encrypted contract with a purse. Signed with the purse private key. + */ +#define TALER_SIGNATURE_WALLET_PURSE_ECONTRACT 1216 + + +/** + * Request reserve to be kept open. Signed with the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_OPEN 1217 + + +/** + * Request coin to be used to pay for reserve to be kept open. Signed with the coin private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_OPEN_DEPOSIT 1218 + + +/** + * Request attestation about reserve owner. Signed by the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_ATTEST_DETAILS 1219 + + +/** + * Signature by which a wallet requests a purse to be deleted. + */ +#define TALER_SIGNATURE_WALLET_PURSE_DELETE 1220 + + +/** + * Signature where the reserve key confirms an age-withdraw request. Signed with the reserve private key. + */ +#define TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW 1221 + + +/** + * Signature where the token use key confirms the usage of a token on a pay request. Signed with the token use private key. + */ +#define TALER_SIGNATURE_WALLET_TOKEN_USE 1222 + + +/** + * Signature over messages to delete in the mailbox service + */ +#define TALER_SIGNATURE_MAILBOX_MESSAGES_DELETE 1223 + + +/** + * Signature on a denomination key announcement. + */ +#define TALER_SIGNATURE_SM_RSA_DENOMINATION_KEY 1250 + + +/** + * Signature on an exchange message signing key announcement. + */ +#define TALER_SIGNATURE_SM_SIGNING_KEY 1251 + + +/** + * Signature on a denomination key announcement. + */ +#define TALER_SIGNATURE_SM_CS_DENOMINATION_KEY 1252 + + +/** + * EdDSA test signature. + */ +#define TALER_SIGNATURE_CLIENT_TEST_EDDSA 1302 + + +/** + * EdDSA test signature. + */ +#define TALER_SIGNATURE_EXCHANGE_TEST_EDDSA 1303 + + +/** + * Signature by which an AML officer signs an AML decision. + */ +#define TALER_SIGNATURE_AML_DECISION 1350 + + +/** + * Signature by which an AML officer requests AML data. + */ +#define TALER_SIGNATURE_AML_QUERY 1351 + + +/** + * Signature by which an account owner authorizes access to a KYC operation. + */ +#define TALER_SIGNATURE_KYC_AUTH 1360 + + +/** + * EdDSA signature for a policy upload. + */ +#define TALER_SIGNATURE_ANASTASIS_POLICY_UPLOAD 1400 + + +/** + * EdDSA signature for a backup upload. + */ +#define TALER_SIGNATURE_SYNC_BACKUP_UPLOAD 1450 + + +#endif