aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-11-16 18:52:41 -0300
committerSebastian <sebasjm@gmail.com>2023-11-16 18:52:41 -0300
commitd26743cabc0d629c225b7367b17aab871daf768b (patch)
tree0192357cc6da3220544a54b6edbf132d767b477e /packages/taler-util
parent860e4216cdaf3e3bfb50ec1d9d285d34b6af5470 (diff)
downloadwallet-core-d26743cabc0d629c225b7367b17aab871daf768b.tar.xz
send signature in request body
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/http-client/exchange.ts16
1 files 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