aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-04-13 15:04:08 +0200
committerFlorian Dold <florian@dold.me>2023-04-13 15:04:08 +0200
commitb96464fe09605e829dcd5715c69668e64c5454b3 (patch)
treeb4d65012c2a75feccd7819008ceb9aec6600f9af
parent7944a36e30182638b35da6e113b29de8b5f16305 (diff)
Revert "wallet-core: check master public key in /wire response"
This reverts commit 7944a36e30182638b35da6e113b29de8b5f16305.
-rw-r--r--packages/taler-harness/src/index.ts11
-rw-r--r--packages/taler-util/src/taler-types.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts30
3 files changed, 7 insertions, 36 deletions
diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts
index b185e151d..ada573698 100644
--- a/packages/taler-harness/src/index.ts
+++ b/packages/taler-harness/src/index.ts
@@ -24,7 +24,6 @@ import path from "path";
import {
addPaytoQueryParams,
Amounts,
- codecForExchangeWireJson,
Configuration,
decodeCrock,
j2s,
@@ -48,7 +47,7 @@ import { lintExchangeDeployment } from "./lint.js";
import { runEnvFull } from "./env-full.js";
import { clk } from "@gnu-taler/taler-util/clk";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
-import { BankAccessApiClient, validateWireInfo } from "@gnu-taler/taler-wallet-core";
+import { BankAccessApiClient } from "@gnu-taler/taler-wallet-core";
const logger = new Logger("taler-harness:index.ts");
@@ -86,14 +85,6 @@ const advancedCli = testingCli.subcommand("advancedArgs", "advanced", {
});
advancedCli
- .subcommand("validateWireResponse", "validate-wire-response")
- .action((args) => {
- const wireResp = fs.readFileSync(0, "utf8");
- const respJson = JSON.parse(wireResp);
- const wireInfo = codecForExchangeWireJson().decode(respJson);
- });
-
-advancedCli
.subcommand("decode", "decode", {
help: "Decode base32-crockford.",
})
diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts
index f9e39e77e..48eb49d22 100644
--- a/packages/taler-util/src/taler-types.ts
+++ b/packages/taler-util/src/taler-types.ts
@@ -843,7 +843,6 @@ export interface AccountInfo {
}
export interface ExchangeWireJson {
- master_public_key: string;
accounts: AccountInfo[];
fees: { [methodName: string]: WireFeesJson[] };
}
@@ -1433,7 +1432,6 @@ export const codecForExchangeWireJson = (): Codec<ExchangeWireJson> =>
buildCodecForObject<ExchangeWireJson>()
.property("accounts", codecForList(codecForAccountInfo()))
.property("fees", codecForMap(codecForList(codecForWireFeesJson())))
- .property("master_public_key", codecForString())
.build("ExchangeWireJson");
export const codecForProposal = (): Codec<Proposal> =>
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index 1fce92caf..d9051b32f 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -63,7 +63,7 @@ import {
ExchangeRecord,
WalletStoresV1,
} from "../db.js";
-import { isWithdrawableDenom, TalerCryptoInterface } from "../index.js";
+import { isWithdrawableDenom } from "../index.js";
import { InternalWalletState, TrustInfo } from "../internal-wallet-state.js";
import { checkDbInvariant } from "../util/invariants.js";
import {
@@ -236,25 +236,12 @@ export async function acceptExchangeTermsOfService(
});
}
-export interface ValidateWireInfoArgs {
- cryptoApi: TalerCryptoInterface;
-
- /**
- * Exchange major protocol version.
- */
- versionCurrent?: number;
-
- wireInfo: ExchangeWireJson;
-
- insecureTrustExchange?: boolean;
-
- masterPublicKey: string;
-}
-
-export async function validateWireInfo(
- args: ValidateWireInfoArgs,
+async function validateWireInfo(
+ ws: InternalWalletState,
+ versionCurrent: number,
+ wireInfo: ExchangeWireJson,
+ masterPublicKey: string,
): Promise<WireInfo> {
- const { wireInfo, masterPublicKey, insecureTrustExchange } = args;
for (const a of wireInfo.accounts) {
logger.trace("validating exchange acct");
let isValid = false;
@@ -645,11 +632,6 @@ export async function updateExchangeFromUrlHandler(
throw Error("unexpected invalid version");
}
- if (wireInfoDownload.master_public_key != keysInfo.masterPublicKey) {
- // FIXME: introduce error code
- throw Error("inconsistent master public key between /keys and /wire");
- }
-
const wireInfo = await validateWireInfo(
ws,
version.current,