store exchange public key with signature on denomination
This commit is contained in:
parent
7d15ce3d88
commit
af2ad00d84
@ -513,6 +513,12 @@ export interface DenominationRecord {
|
|||||||
* Base URL of the exchange.
|
* Base URL of the exchange.
|
||||||
*/
|
*/
|
||||||
exchangeBaseUrl: string;
|
exchangeBaseUrl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Master public key of the exchange that made the signature
|
||||||
|
* on the denomination.
|
||||||
|
*/
|
||||||
|
exchangeMasterPub: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExchangeBankAccount {
|
export interface ExchangeBankAccount {
|
||||||
|
@ -337,6 +337,7 @@ export async function importBackup(
|
|||||||
denomPub: backupDenomination.denom_pub,
|
denomPub: backupDenomination.denom_pub,
|
||||||
denomPubHash: denomPubHash,
|
denomPubHash: denomPubHash,
|
||||||
exchangeBaseUrl: backupExchangeDetails.base_url,
|
exchangeBaseUrl: backupExchangeDetails.base_url,
|
||||||
|
exchangeMasterPub: backupExchangeDetails.master_public_key,
|
||||||
feeDeposit: Amounts.parseOrThrow(backupDenomination.fee_deposit),
|
feeDeposit: Amounts.parseOrThrow(backupDenomination.fee_deposit),
|
||||||
feeRefresh: Amounts.parseOrThrow(backupDenomination.fee_refresh),
|
feeRefresh: Amounts.parseOrThrow(backupDenomination.fee_refresh),
|
||||||
feeRefund: Amounts.parseOrThrow(backupDenomination.fee_refund),
|
feeRefund: Amounts.parseOrThrow(backupDenomination.fee_refund),
|
||||||
|
@ -77,6 +77,7 @@ const logger = new Logger("exchanges.ts");
|
|||||||
|
|
||||||
function denominationRecordFromKeys(
|
function denominationRecordFromKeys(
|
||||||
exchangeBaseUrl: string,
|
exchangeBaseUrl: string,
|
||||||
|
exchangeMasterPub: string,
|
||||||
denomIn: Denomination,
|
denomIn: Denomination,
|
||||||
): DenominationRecord {
|
): DenominationRecord {
|
||||||
const denomPubHash = encodeCrock(hash(decodeCrock(denomIn.denom_pub)));
|
const denomPubHash = encodeCrock(hash(decodeCrock(denomIn.denom_pub)));
|
||||||
@ -84,6 +85,7 @@ function denominationRecordFromKeys(
|
|||||||
denomPub: denomIn.denom_pub,
|
denomPub: denomIn.denom_pub,
|
||||||
denomPubHash,
|
denomPubHash,
|
||||||
exchangeBaseUrl,
|
exchangeBaseUrl,
|
||||||
|
exchangeMasterPub,
|
||||||
feeDeposit: Amounts.parseOrThrow(denomIn.fee_deposit),
|
feeDeposit: Amounts.parseOrThrow(denomIn.fee_deposit),
|
||||||
feeRefresh: Amounts.parseOrThrow(denomIn.fee_refresh),
|
feeRefresh: Amounts.parseOrThrow(denomIn.fee_refresh),
|
||||||
feeRefund: Amounts.parseOrThrow(denomIn.fee_refund),
|
feeRefund: Amounts.parseOrThrow(denomIn.fee_refund),
|
||||||
@ -378,7 +380,11 @@ async function downloadKeysInfo(
|
|||||||
currency,
|
currency,
|
||||||
auditors: exchangeKeysJson.auditors,
|
auditors: exchangeKeysJson.auditors,
|
||||||
currentDenominations: exchangeKeysJson.denoms.map((d) =>
|
currentDenominations: exchangeKeysJson.denoms.map((d) =>
|
||||||
denominationRecordFromKeys(baseUrl, d),
|
denominationRecordFromKeys(
|
||||||
|
baseUrl,
|
||||||
|
exchangeKeysJson.master_public_key,
|
||||||
|
d,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
protocolVersion: exchangeKeysJson.version,
|
protocolVersion: exchangeKeysJson.version,
|
||||||
signingKeys: exchangeKeysJson.signkeys,
|
signingKeys: exchangeKeysJson.signkeys,
|
||||||
@ -410,10 +416,12 @@ async function updateExchangeFromUrlImpl(
|
|||||||
const r = await provideExchangeRecord(ws, baseUrl, now);
|
const r = await provideExchangeRecord(ws, baseUrl, now);
|
||||||
|
|
||||||
if (!forceNow && r && !isTimestampExpired(r.nextUpdate)) {
|
if (!forceNow && r && !isTimestampExpired(r.nextUpdate)) {
|
||||||
const res = await ws.db.mktx((x) => ({
|
const res = await ws.db
|
||||||
|
.mktx((x) => ({
|
||||||
exchanges: x.exchanges,
|
exchanges: x.exchanges,
|
||||||
exchangeDetails: x.exchangeDetails,
|
exchangeDetails: x.exchangeDetails,
|
||||||
})).runReadOnly(async (tx) => {
|
}))
|
||||||
|
.runReadOnly(async (tx) => {
|
||||||
const exchange = await tx.exchanges.get(baseUrl);
|
const exchange = await tx.exchanges.get(baseUrl);
|
||||||
if (!exchange) {
|
if (!exchange) {
|
||||||
return;
|
return;
|
||||||
@ -493,9 +501,9 @@ async function updateExchangeFromUrlImpl(
|
|||||||
r.lastError = undefined;
|
r.lastError = undefined;
|
||||||
r.retryInfo = initRetryInfo(false);
|
r.retryInfo = initRetryInfo(false);
|
||||||
r.lastUpdate = getTimestampNow();
|
r.lastUpdate = getTimestampNow();
|
||||||
r.nextUpdate = keysInfo.expiry,
|
(r.nextUpdate = keysInfo.expiry),
|
||||||
// New denominations might be available.
|
// New denominations might be available.
|
||||||
r.nextRefreshCheck = getTimestampNow();
|
(r.nextRefreshCheck = getTimestampNow());
|
||||||
r.detailsPointer = {
|
r.detailsPointer = {
|
||||||
currency: details.currency,
|
currency: details.currency,
|
||||||
masterPublicKey: details.masterPublicKey,
|
masterPublicKey: details.masterPublicKey,
|
||||||
|
@ -33,6 +33,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"Q21FQSSG4FXNT96Z14CHXM8N1RZAG9GPHAV8PRWS0PZAAVWH7PBW6R97M2CH19KKP65NNSWXY7B6S53PT3CBM342E357ZXDDJ8RDVW8",
|
"Q21FQSSG4FXNT96Z14CHXM8N1RZAG9GPHAV8PRWS0PZAAVWH7PBW6R97M2CH19KKP65NNSWXY7B6S53PT3CBM342E357ZXDDJ8RDVW8",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
@ -82,6 +83,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"447WA23SCBATMABHA0793F92MYTBYVPYMMQHCPKMKVY5P7RZRFMQ6VRW0Y8HRA7177GTBT0TBT08R21DZD129AJ995H9G09XBFE55G8",
|
"447WA23SCBATMABHA0793F92MYTBYVPYMMQHCPKMKVY5P7RZRFMQ6VRW0Y8HRA7177GTBT0TBT08R21DZD129AJ995H9G09XBFE55G8",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
@ -131,6 +133,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"JS61DTKAFM0BX8Q4XV3ZSKB921SM8QK745Z2AFXTKFMBHHFNBD8TQ5ETJHFNDGBGX22FFN2A2ERNYG1SGSDQWNQHQQ2B14DBVJYJG8R",
|
"JS61DTKAFM0BX8Q4XV3ZSKB921SM8QK745Z2AFXTKFMBHHFNBD8TQ5ETJHFNDGBGX22FFN2A2ERNYG1SGSDQWNQHQQ2B14DBVJYJG8R",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
@ -180,6 +183,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"8T51NEY81VMPQ180EQ5WR0YH7GMNNT90W55Q0514KZM18AZT71FHJGJHQXGK0WTA7ACN1X2SD0S53XPBQ1A9KH960R48VCVVM6E3TH8",
|
"8T51NEY81VMPQ180EQ5WR0YH7GMNNT90W55Q0514KZM18AZT71FHJGJHQXGK0WTA7ACN1X2SD0S53XPBQ1A9KH960R48VCVVM6E3TH8",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
@ -229,6 +233,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"A41HW0Q2H9PCNMEWW0C0N45QAYVXZ8SBVRRAHE4W6X24SV1TH38ANTWDT80JXEBW9Z8PVPGT9GFV2EYZWJ5JW5W1N34NFNKHQSZ1PFR",
|
"A41HW0Q2H9PCNMEWW0C0N45QAYVXZ8SBVRRAHE4W6X24SV1TH38ANTWDT80JXEBW9Z8PVPGT9GFV2EYZWJ5JW5W1N34NFNKHQSZ1PFR",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
@ -278,6 +283,7 @@ test("withdrawal selection bug repro", (t) => {
|
|||||||
denomPubHash:
|
denomPubHash:
|
||||||
"F5NGBX33DTV4595XZZVK0S2MA1VMXFEJQERE5EBP5DS4QQ9EFRANN7YHWC1TKSHT2K6CQWDBRES8D3DWR0KZF5RET40B4AZXZ0RW1ZG",
|
"F5NGBX33DTV4595XZZVK0S2MA1VMXFEJQERE5EBP5DS4QQ9EFRANN7YHWC1TKSHT2K6CQWDBRES8D3DWR0KZF5RET40B4AZXZ0RW1ZG",
|
||||||
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
exchangeBaseUrl: "https://exchange.demo.taler.net/",
|
||||||
|
exchangeMasterPub: "",
|
||||||
feeDeposit: {
|
feeDeposit: {
|
||||||
currency: "KUDOS",
|
currency: "KUDOS",
|
||||||
fraction: 1000000,
|
fraction: 1000000,
|
||||||
|
Loading…
Reference in New Issue
Block a user