taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit a226c5d6ee827b4f01b97e042d6672ea7af0f183
parent 32696be0ca0a83a60918418c20b9c94a38c702c7
Author: Florian Dold <florian@dold.me>
Date:   Wed, 28 May 2025 02:06:46 +0200

wallet-core: send Account-Owner-Pub along with signature

Diffstat:
Mpackages/taler-util/src/http-client/exchange-client.ts | 11++++++-----
Mpackages/taler-util/src/http-client/exchange.ts | 11++++++-----
Mpackages/taler-wallet-core/src/deposits.ts | 3+++
Mpackages/taler-wallet-core/src/exchanges.ts | 2++
Mpackages/taler-wallet-core/src/withdraw.ts | 2++
5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/packages/taler-util/src/http-client/exchange-client.ts b/packages/taler-util/src/http-client/exchange-client.ts @@ -37,7 +37,7 @@ import { opSuccessFromHttp, opUnknownHttpFailure, } from "../operation.js"; -import { EddsaPrivP, encodeCrock } from "../taler-crypto.js"; +import { EddsaPrivP, decodeCrock, encodeCrock } from "../taler-crypto.js"; import { AccessToken, AmountString, @@ -633,16 +633,17 @@ export class TalerExchangeHttpClient2 { url.searchParams.set("await_auth", params.awaitAuth ? "YES" : "NO"); } - const signature = - typeof signingKey === "string" - ? signingKey - : encodeCrock(signKycAuth(signingKey)); + const sigKeyPacked = + typeof signingKey === "string" ? decodeCrock(signingKey) : signingKey; + + const signature = encodeCrock(signKycAuth(sigKeyPacked)); const resp = await this.fetch( url, { headers: { "Account-Owner-Signature": signature, + "Account-Owner-Pub": encodeCrock(sigKeyPacked), }, }, longpoll, diff --git a/packages/taler-util/src/http-client/exchange.ts b/packages/taler-util/src/http-client/exchange.ts @@ -35,7 +35,7 @@ import { opSuccessFromHttp, opUnknownHttpFailure, } from "../operation.js"; -import { EddsaPrivP, encodeCrock } from "../taler-crypto.js"; +import { EddsaPrivP, decodeCrock, encodeCrock } from "../taler-crypto.js"; import { AccessToken, EddsaPublicKeyString, @@ -528,14 +528,15 @@ export class TalerExchangeHttpClient { url.searchParams.set("await_auth", params.awaitAuth ? "YES" : "NO"); } - const signature = - typeof signingKey === "string" - ? signingKey - : encodeCrock(signKycAuth(signingKey)); + const sigKeyPacked = + typeof signingKey === "string" ? decodeCrock(signingKey) : signingKey; + + const signature = encodeCrock(signKycAuth(sigKeyPacked)); const resp = await this.httpLib.fetch(url.href, { headers: { "Account-Owner-Signature": signature, + "Account-Owner-Pub": encodeCrock(sigKeyPacked), }, }); diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts @@ -1068,6 +1068,7 @@ async function processDepositGroupPendingKyc( const kycStatusRes = await cancelableLongPoll(wex, url, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: depositGroup.merchantPub, }, }); @@ -1150,6 +1151,7 @@ async function processDepositGroupPendingKycAuth( const kycStatusRes = await cancelableLongPoll(wex, url, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: depositGroup.merchantPub, }, }); @@ -1271,6 +1273,7 @@ async function transitionToKycRequired( const kycStatusResp = await cancelableFetch(wex, url, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: depositGroup.merchantPub, }, }); logger.trace(`response status of initial kyc-check: ${kycStatusResp.status}`); diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts @@ -3686,6 +3686,7 @@ async function handleExchangeKycRespLegi( method: "GET", headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: reserve.reservePub, }, }); @@ -3797,6 +3798,7 @@ async function handleExchangeKycPendingLegitimization( const resp = await cancelableLongPoll(wex, reqUrl, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: reserve.reservePub, }, }); diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts @@ -1465,6 +1465,7 @@ async function handleKycRequired( const kycStatusRes = await cancelableFetch(wex, url, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: withdrawalGroup.reservePub, }, }); let kycStatus: AccountKycStatus; @@ -2328,6 +2329,7 @@ async function processWithdrawalGroupPendingKyc( const kycStatusRes = await cancelableLongPoll(wex, url, { headers: { ["Account-Owner-Signature"]: sigResp.sig, + ["Account-Owner-Pub"]: withdrawalGroup.reservePub, }, });