gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: Add abstraction: TALER_merchant_


From: gnunet
Subject: [taler-exchange] branch master updated: Add abstraction: TALER_merchant_contract_sign
Date: Mon, 18 Apr 2022 01:56:03 +0200

This is an automated email from the git hooks/post-receive script.

ttn pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 509657bf Add abstraction: TALER_merchant_contract_sign
509657bf is described below

commit 509657bfef59221a6a113c49330ee06ed66c9da9
Author: Thien-Thi Nguyen <ttn@gnuvola.org>
AuthorDate: Sun Apr 17 19:53:17 2022 -0400

    Add abstraction: TALER_merchant_contract_sign
    
    Additionally, this change removes ‘struct TALER_ProposalDataPS’
    from the public API.
    
    * src/include/taler_crypto_lib.h
      (TALER_merchant_contract_sign): New func decl.
    
    * src/include/taler_signatures.h
      (struct TALER_ProposalDataPS): Delete.
    
    * src/util/merchant_signatures.c
      (struct TALER_ProposalDataPS): Move here from taler_signatures.h.
      (TALER_merchant_contract_sign): New func.
---
 src/include/taler_crypto_lib.h | 14 ++++++++++++++
 src/include/taler_signatures.h | 19 -------------------
 src/util/merchant_signatures.c | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 6be9db9a..554cb1a2 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -4601,6 +4601,20 @@ TALER_merchant_pay_verify (
   const struct TALER_MerchantSignatureP *merchant_sig);
 
 
+/**
+ * Sign contract sent by the merchant to the wallet.
+ *
+ * @param h_contract_terms hash of the contract terms
+ * @param merch_priv private key to sign with
+ * @param[out] merch_sig where to write the signature
+ */
+void
+TALER_merchant_contract_sign (
+  const struct TALER_PrivateContractHashP *h_contract_terms,
+  const struct TALER_MerchantPrivateKeyP *merch_priv,
+  struct GNUNET_CRYPTO_EddsaSignature *merch_sig);
+
+
 /* **************** /management/extensions offline signing **************** */
 
 /**
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 249c01b6..0137ff65 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -422,25 +422,6 @@ struct TALER_DepositTrackPS
 };
 
 
-/**
- * The contract sent by the merchant to the wallet.
- */
-struct TALER_ProposalDataPS
-{
-  /**
-   * Purpose header for the signature over the proposal data
-   * with purpose #TALER_SIGNATURE_MERCHANT_CONTRACT.
-   */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
-  /**
-   * Hash of the JSON contract in UTF-8 including 0-termination,
-   * using JSON_COMPACT | JSON_SORT_KEYS
-   */
-  struct TALER_PrivateContractHashP hash;
-};
-
-
 GNUNET_NETWORK_STRUCT_END
 
 #endif
diff --git a/src/util/merchant_signatures.c b/src/util/merchant_signatures.c
index 0a7489f7..84daca2c 100644
--- a/src/util/merchant_signatures.c
+++ b/src/util/merchant_signatures.c
@@ -229,4 +229,42 @@ TALER_merchant_pay_verify (
                                 &merchant_pub->eddsa_pub);
 }
 
+
+/**
+ * The contract sent by the merchant to the wallet.
+ */
+struct TALER_ProposalDataPS
+{
+  /**
+   * Purpose header for the signature over the proposal data
+   * with purpose #TALER_SIGNATURE_MERCHANT_CONTRACT.
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Hash of the JSON contract in UTF-8 including 0-termination,
+   * using JSON_COMPACT | JSON_SORT_KEYS
+   */
+  struct TALER_PrivateContractHashP hash;
+};
+
+void
+TALER_merchant_contract_sign (
+  const struct TALER_PrivateContractHashP *h_contract_terms,
+  const struct TALER_MerchantPrivateKeyP *merch_priv,
+  struct GNUNET_CRYPTO_EddsaSignature *merch_sig)
+{
+  struct TALER_ProposalDataPS pdps = {
+    .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_CONTRACT),
+    .purpose.size = htonl (sizeof (pdps)),
+    .hash = *h_contract_terms
+  };
+
+  GNUNET_CRYPTO_eddsa_sign (&merch_priv->eddsa_priv,
+                            &pdps,
+                            merch_sig);
+}
+
+// NB: "TALER_merchant_contract_verify" not (yet?) needed / not defined.
+
 /* end of merchant_signatures.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]