gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 01/02: send signature in request body


From: gnunet
Subject: [taler-wallet-core] 01/02: send signature in request body
Date: Thu, 16 Nov 2023 22:53:28 +0100

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

sebasjm pushed a commit to branch master
in repository wallet-core.

commit d26743cabc0d629c225b7367b17aab871daf768b
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Thu Nov 16 18:52:41 2023 -0300

    send signature in request body
---
 packages/taler-util/src/http-client/exchange.ts | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/packages/taler-util/src/http-client/exchange.ts 
b/packages/taler-util/src/http-client/exchange.ts
index 2d3e40863..f55be0043 100644
--- a/packages/taler-util/src/http-client/exchange.ts
+++ b/packages/taler-util/src/http-client/exchange.ts
@@ -104,15 +104,13 @@ export class TalerExchangeHttpClient {
    * 
https://docs.taler.net/core/api-exchange.html#post--aml-$OFFICER_PUB-decision
    * 
    */
-  async addDecisionDetails(auth: OfficerAccount, body: 
TalerExchangeApi.AmlDecision) {
+  async addDecisionDetails(auth: OfficerAccount, decision: 
Omit<TalerExchangeApi.AmlDecision, "officer_sig">) {
     const url = new URL(`aml/${auth.id}/decision`, this.baseUrl);
 
+    const body = buildDecisionSignature(auth.signingKey, decision)
     const resp = await this.httpLib.fetch(url.href, {
       method: "POST",
       body,
-      headers: {
-        "Taler-AML-Officer-Signature": buildDecisionSignature(auth.signingKey, 
body)
-      },
     });
 
     switch (resp.status) {
@@ -140,8 +138,8 @@ function buildQuerySignature(key: SigningKey): string {
 
 function buildDecisionSignature(
   key: SigningKey,
-  decision: TalerExchangeApi.AmlDecision,
-): string {
+  decision: Omit<TalerExchangeApi.AmlDecision, "officer_sig">,
+): TalerExchangeApi.AmlDecision {
   const zero = new Uint8Array(new ArrayBuffer(64))
 
   const sigBlob = 
buildSigPS(TalerSignaturePurpose.TALER_SIGNATURE_AML_DECISION)
@@ -154,5 +152,9 @@ function buildDecisionSignature(
     .put(bufferForUint32(decision.new_state))
     .build();
 
-  return encodeCrock(eddsaSign(sigBlob, key));
+  const officer_sig = encodeCrock(eddsaSign(sigBlob, key));
+  return {
+    ...decision,
+    officer_sig
+  }
 }
\ No newline at end of file

-- 
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]