Revert "wallet-core: check master public key in /wire response"

This reverts commit 7944a36e30.
This commit is contained in:
Florian Dold 2023-04-13 15:04:08 +02:00
parent 7944a36e30
commit b96464fe09
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 7 additions and 36 deletions

View File

@ -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");
@ -85,14 +84,6 @@ const advancedCli = testingCli.subcommand("advancedArgs", "advanced", {
help: "Subcommands for advanced operations (only use if you know what you're doing!).",
});
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.",

View File

@ -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> =>

View File

@ -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,