aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/talerCrypto.ts115
-rw-r--r--packages/taler-util/src/talerTypes.ts174
-rw-r--r--packages/taler-util/src/walletTypes.ts313
3 files changed, 333 insertions, 269 deletions
diff --git a/packages/taler-util/src/talerCrypto.ts b/packages/taler-util/src/talerCrypto.ts
index c2640317a..40d2e55da 100644
--- a/packages/taler-util/src/talerCrypto.ts
+++ b/packages/taler-util/src/talerCrypto.ts
@@ -22,10 +22,15 @@
* Imports.
*/
import * as nacl from "./nacl-fast.js";
-import { kdf } from "./kdf.js";
+import { kdf, kdfKw } from "./kdf.js";
import bigint from "big-integer";
-import { DenominationPubKey, DenomKeyType } from "./talerTypes.js";
-import { AssertionError, equal } from "assert";
+import {
+ CoinEnvelope,
+ DenominationPubKey,
+ DenomKeyType,
+ HashCodeString,
+} from "./talerTypes.js";
+import { Logger } from "./logging.js";
export function getRandomBytes(n: number): Uint8Array {
return nacl.randomBytes(n);
@@ -365,7 +370,7 @@ export type CsBlindingSecrets = {
beta: [Uint8Array, Uint8Array];
};
-function typedArrayConcat(chunks: Uint8Array[]): Uint8Array {
+export function typedArrayConcat(chunks: Uint8Array[]): Uint8Array {
let payloadLen = 0;
for (const c of chunks) {
payloadLen += c.byteLength;
@@ -490,9 +495,7 @@ export function deriveBSeed(
* @param coinPriv coin private key
* @returns nonce
*/
-export function deriveWithdrawNonce(
- coinPriv: Uint8Array,
-): Uint8Array {
+export function deriveWithdrawNonce(coinPriv: Uint8Array): Uint8Array {
const outLen = 32;
const salt = stringToBytes("n");
return kdf(outLen, coinPriv, salt);
@@ -539,7 +542,7 @@ export async function csUnblind(
csSig: CsBlindSignature,
): Promise<CsSignature> {
if (b != 0 && b != 1) {
- throw new AssertionError();
+ throw new Error();
}
const secrets = deriveSecrets(bseed);
const rPubDash = (await calcRBlind(csPub, secrets, rPub))[b];
@@ -595,9 +598,38 @@ export function hash(d: Uint8Array): Uint8Array {
return nacl.hash(d);
}
+export function hashCoinEv(
+ coinEv: CoinEnvelope,
+ denomPubHash: HashCodeString,
+): Uint8Array {
+ const hashContext = createHashContext();
+ hashContext.update(decodeCrock(denomPubHash));
+ hashCoinEvInner(coinEv, hashContext);
+ return hashContext.finish();
+}
+
+const logger = new Logger("talerCrypto.ts");
+
+export function hashCoinEvInner(
+ coinEv: CoinEnvelope,
+ hashState: nacl.HashState,
+): void {
+ const hashInputBuf = new ArrayBuffer(4);
+ const uint8ArrayBuf = new Uint8Array(hashInputBuf);
+ const dv = new DataView(hashInputBuf);
+ dv.setUint32(0, DenomKeyType.toIntTag(coinEv.cipher));
+ hashState.update(uint8ArrayBuf);
+ switch (coinEv.cipher) {
+ case DenomKeyType.Rsa:
+ hashState.update(decodeCrock(coinEv.rsa_blinded_planchet));
+ return;
+ default:
+ throw new Error();
+ }
+}
+
/**
- * Hash a denomination public key according to the
- * algorithm of exchange protocol v10.
+ * Hash a denomination public key.
*/
export function hashDenomPub(pub: DenominationPubKey): Uint8Array {
if (pub.cipher === DenomKeyType.Rsa) {
@@ -606,18 +638,16 @@ export function hashDenomPub(pub: DenominationPubKey): Uint8Array {
const uint8ArrayBuf = new Uint8Array(hashInputBuf);
const dv = new DataView(hashInputBuf);
dv.setUint32(0, pub.age_mask ?? 0);
- dv.setUint32(4, pub.cipher);
+ dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));
uint8ArrayBuf.set(pubBuf, 8);
return nacl.hash(uint8ArrayBuf);
- } else if (pub.cipher === DenomKeyType.LegacyRsa) {
- return hash(decodeCrock(pub.rsa_public_key));
} else if (pub.cipher === DenomKeyType.ClauseSchnorr) {
const pubBuf = decodeCrock(pub.cs_public_key);
const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4);
const uint8ArrayBuf = new Uint8Array(hashInputBuf);
const dv = new DataView(hashInputBuf);
dv.setUint32(0, pub.age_mask ?? 0);
- dv.setUint32(4, pub.cipher);
+ dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher));
uint8ArrayBuf.set(pubBuf, 8);
return nacl.hash(uint8ArrayBuf);
} else {
@@ -652,18 +682,57 @@ export interface FreshCoin {
bks: Uint8Array;
}
+// export function setupRefreshPlanchet(
+// secretSeed: Uint8Array,
+// coinNumber: number,
+// ): FreshCoin {
+// const info = stringToBytes("taler-coin-derivation");
+// const saltArrBuf = new ArrayBuffer(4);
+// const salt = new Uint8Array(saltArrBuf);
+// const saltDataView = new DataView(saltArrBuf);
+// saltDataView.setUint32(0, coinNumber);
+// const out = kdf(64, secretSeed, salt, info);
+// const coinPriv = out.slice(0, 32);
+// const bks = out.slice(32, 64);
+// return {
+// bks,
+// coinPriv,
+// coinPub: eddsaGetPublic(coinPriv),
+// };
+// }
+
+function bufferForUint32(n: number): Uint8Array {
+ const arrBuf = new ArrayBuffer(4);
+ const buf = new Uint8Array(arrBuf);
+ const dv = new DataView(arrBuf);
+ dv.setUint32(0, n);
+ return buf;
+}
+
export function setupRefreshPlanchet(
- secretSeed: Uint8Array,
+ transferSecret: Uint8Array,
coinNumber: number,
): FreshCoin {
- const info = stringToBytes("taler-coin-derivation");
- const saltArrBuf = new ArrayBuffer(4);
- const salt = new Uint8Array(saltArrBuf);
- const saltDataView = new DataView(saltArrBuf);
- saltDataView.setUint32(0, coinNumber);
- const out = kdf(64, secretSeed, salt, info);
- const coinPriv = out.slice(0, 32);
- const bks = out.slice(32, 64);
+ // See TALER_transfer_secret_to_planchet_secret in C impl
+ const planchetMasterSecret = kdfKw({
+ ikm: transferSecret,
+ outputLength: 32,
+ salt: bufferForUint32(coinNumber),
+ info: stringToBytes("taler-coin-derivation"),
+ });
+
+ const coinPriv = kdfKw({
+ ikm: planchetMasterSecret,
+ outputLength: 32,
+ salt: stringToBytes("coin"),
+ });
+
+ const bks = kdfKw({
+ ikm: planchetMasterSecret,
+ outputLength: 32,
+ salt: stringToBytes("bks"),
+ });
+
return {
bks,
coinPriv,
diff --git a/packages/taler-util/src/talerTypes.ts b/packages/taler-util/src/talerTypes.ts
index 7305122bd..59d37dece 100644
--- a/packages/taler-util/src/talerTypes.ts
+++ b/packages/taler-util/src/talerTypes.ts
@@ -60,11 +60,8 @@ export class ExchangeDenomination {
/**
* Public signing key of the denomination.
- *
- * The "string" alternative is for the old exchange protocol (v9) that
- * only supports RSA keys.
*/
- denom_pub: DenominationPubKey | string;
+ denom_pub: DenominationPubKey;
/**
* Fee for withdrawing.
@@ -162,7 +159,7 @@ export interface RecoupRequest {
*
* The string variant is for the legacy exchange protocol.
*/
- denom_sig: UnblindedSignature | string;
+ denom_sig: UnblindedSignature;
/**
* Blinding key that was used during withdraw,
@@ -188,7 +185,7 @@ export interface RecoupRefreshRequest {
*
* The string variant is for the legacy exchange protocol.
*/
- denom_sig: UnblindedSignature | string;
+ denom_sig: UnblindedSignature;
/**
* Coin's blinding factor.
@@ -218,20 +215,13 @@ export interface RecoupConfirmation {
old_coin_pub?: string;
}
-export type UnblindedSignature =
- | RsaUnblindedSignature
- | LegacyRsaUnblindedSignature;
+export type UnblindedSignature = RsaUnblindedSignature;
export interface RsaUnblindedSignature {
cipher: DenomKeyType.Rsa;
rsa_signature: string;
}
-export interface LegacyRsaUnblindedSignature {
- cipher: DenomKeyType.LegacyRsa;
- rsa_signature: string;
-}
-
/**
* Deposit permission for a single coin.
*/
@@ -252,7 +242,7 @@ export interface CoinDepositPermission {
* The string variant is for legacy protocol support.
*/
- ub_sig: UnblindedSignature | string;
+ ub_sig: UnblindedSignature;
/**
* The denomination public key associated with this coin.
@@ -841,18 +831,23 @@ export class TipPickupGetResponse {
}
export enum DenomKeyType {
- Rsa = 1,
- ClauseSchnorr = 2,
- LegacyRsa = 3,
+ Rsa = "RSA",
+ ClauseSchnorr = "CS",
}
-export interface RsaBlindedDenominationSignature {
- cipher: DenomKeyType.Rsa;
- blinded_rsa_signature: string;
+export namespace DenomKeyType {
+ export function toIntTag(t: DenomKeyType): number {
+ switch (t) {
+ case DenomKeyType.Rsa:
+ return 1;
+ case DenomKeyType.ClauseSchnorr:
+ return 2;
+ }
+ }
}
-export interface LegacyRsaBlindedDenominationSignature {
- cipher: DenomKeyType.LegacyRsa;
+export interface RsaBlindedDenominationSignature {
+ cipher: DenomKeyType.Rsa;
blinded_rsa_signature: string;
}
@@ -862,33 +857,22 @@ export interface CSBlindedDenominationSignature {
export type BlindedDenominationSignature =
| RsaBlindedDenominationSignature
- | CSBlindedDenominationSignature
- | LegacyRsaBlindedDenominationSignature;
+ | CSBlindedDenominationSignature;
export const codecForBlindedDenominationSignature = () =>
buildCodecForUnion<BlindedDenominationSignature>()
.discriminateOn("cipher")
- .alternative(1, codecForRsaBlindedDenominationSignature())
- .alternative(3, codecForLegacyRsaBlindedDenominationSignature())
+ .alternative(DenomKeyType.Rsa, codecForRsaBlindedDenominationSignature())
.build("BlindedDenominationSignature");
export const codecForRsaBlindedDenominationSignature = () =>
buildCodecForObject<RsaBlindedDenominationSignature>()
- .property("cipher", codecForConstNumber(1))
+ .property("cipher", codecForConstString(DenomKeyType.Rsa))
.property("blinded_rsa_signature", codecForString())
.build("RsaBlindedDenominationSignature");
-export const codecForLegacyRsaBlindedDenominationSignature = () =>
- buildCodecForObject<LegacyRsaBlindedDenominationSignature>()
- .property("cipher", codecForConstNumber(1))
- .property("blinded_rsa_signature", codecForString())
- .build("LegacyRsaBlindedDenominationSignature");
-
export class WithdrawResponse {
- /**
- * The string variant is for legacy protocol support.
- */
- ev_sig: BlindedDenominationSignature | string;
+ ev_sig: BlindedDenominationSignature;
}
/**
@@ -983,10 +967,7 @@ export interface ExchangeMeltResponse {
}
export interface ExchangeRevealItem {
- /**
- * The string variant is for the legacy v9 protocol.
- */
- ev_sig: BlindedDenominationSignature | string;
+ ev_sig: BlindedDenominationSignature;
}
export interface ExchangeRevealResponse {
@@ -1105,26 +1086,18 @@ export interface BankWithdrawalOperationPostResponse {
transfer_done: boolean;
}
-export type DenominationPubKey =
- | RsaDenominationPubKey
- | CsDenominationPubKey
- | LegacyRsaDenominationPubKey;
-
-export interface LegacyRsaDenominationPubKey {
- cipher: DenomKeyType.LegacyRsa;
- rsa_public_key: string;
-}
+export type DenominationPubKey = RsaDenominationPubKey | CsDenominationPubKey;
export interface RsaDenominationPubKey {
- cipher: DenomKeyType.Rsa;
- rsa_public_key: string;
- age_mask?: number;
+ readonly cipher: DenomKeyType.Rsa;
+ readonly rsa_public_key: string;
+ readonly age_mask?: number;
}
export interface CsDenominationPubKey {
- cipher: DenomKeyType.ClauseSchnorr;
- age_mask: number;
- cs_public_key: string;
+ readonly cipher: DenomKeyType.ClauseSchnorr;
+ readonly age_mask: number;
+ readonly cs_public_key: string;
}
export namespace DenominationPubKey {
@@ -1136,12 +1109,6 @@ export namespace DenominationPubKey {
return -1;
} else if (p1.cipher > p2.cipher) {
return +1;
- }
- if (
- p1.cipher === DenomKeyType.LegacyRsa &&
- p2.cipher === DenomKeyType.LegacyRsa
- ) {
- return strcmp(p1.rsa_public_key, p2.rsa_public_key);
} else if (
p1.cipher === DenomKeyType.Rsa &&
p2.cipher === DenomKeyType.Rsa
@@ -1166,41 +1133,24 @@ export namespace DenominationPubKey {
throw Error("unsupported cipher");
}
}
-
- export function lift(p1: DenominationPubKey | string): DenominationPubKey {
- if (typeof p1 === "string") {
- return {
- cipher: DenomKeyType.LegacyRsa,
- rsa_public_key: p1,
- };
- }
- return p1;
- }
}
export const codecForDenominationPubKey = () =>
buildCodecForUnion<DenominationPubKey>()
.discriminateOn("cipher")
- .alternative(1, codecForRsaDenominationPubKey())
- .alternative(2, codecForCsDenominationPubKey())
- .alternative(3, codecForLegacyRsaDenominationPubKey())
+ .alternative(DenomKeyType.Rsa, codecForRsaDenominationPubKey())
+ .alternative(DenomKeyType.ClauseSchnorr, codecForCsDenominationPubKey())
.build("DenominationPubKey");
export const codecForRsaDenominationPubKey = () =>
buildCodecForObject<RsaDenominationPubKey>()
- .property("cipher", codecForConstNumber(1))
+ .property("cipher", codecForConstString(DenomKeyType.Rsa))
.property("rsa_public_key", codecForString())
.build("DenominationPubKey");
-export const codecForLegacyRsaDenominationPubKey = () =>
- buildCodecForObject<LegacyRsaDenominationPubKey>()
- .property("cipher", codecForConstNumber(3))
- .property("rsa_public_key", codecForString())
- .build("LegacyRsaDenominationPubKey");
-
export const codecForCsDenominationPubKey = () =>
buildCodecForObject<CsDenominationPubKey>()
- .property("cipher", codecForConstNumber(2))
+ .property("cipher", codecForConstString(DenomKeyType.ClauseSchnorr))
.property("cs_public_key", codecForString())
.build("CsDenominationPubKey");
@@ -1219,10 +1169,7 @@ export type CoinPublicKeyString = string;
export const codecForDenomination = (): Codec<ExchangeDenomination> =>
buildCodecForObject<ExchangeDenomination>()
.property("value", codecForString())
- .property(
- "denom_pub",
- codecForEither(codecForDenominationPubKey(), codecForString()),
- )
+ .property("denom_pub", codecForDenominationPubKey())
.property("fee_withdraw", codecForString())
.property("fee_deposit", codecForString())
.property("fee_refresh", codecForString())
@@ -1470,10 +1417,7 @@ export const codecForRecoupConfirmation = (): Codec<RecoupConfirmation> =>
export const codecForWithdrawResponse = (): Codec<WithdrawResponse> =>
buildCodecForObject<WithdrawResponse>()
- .property(
- "ev_sig",
- codecForEither(codecForBlindedDenominationSignature(), codecForString()),
- )
+ .property("ev_sig", codecForBlindedDenominationSignature())
.build("WithdrawResponse");
export const codecForMerchantPayResponse = (): Codec<MerchantPayResponse> =>
@@ -1491,10 +1435,7 @@ export const codecForExchangeMeltResponse = (): Codec<ExchangeMeltResponse> =>
export const codecForExchangeRevealItem = (): Codec<ExchangeRevealItem> =>
buildCodecForObject<ExchangeRevealItem>()
- .property(
- "ev_sig",
- codecForEither(codecForBlindedDenominationSignature(), codecForString()),
- )
+ .property("ev_sig", codecForBlindedDenominationSignature())
.build("ExchangeRevealItem");
export const codecForExchangeRevealResponse =
@@ -1711,17 +1652,48 @@ export const codecForMerchantConfigResponse =
.build("MerchantConfigResponse");
export enum ExchangeProtocolVersion {
- V9 = 9,
+ /**
+ * Current version supported by the wallet.
+ */
V12 = 12,
}
export enum MerchantProtocolVersion {
/**
- * Legacy version that is still supported.
- */
- V1 = 1,
- /**
* Current version supported by the wallet.
*/
V3 = 3,
}
+
+export type CoinEnvelope = CoinEnvelopeRsa | CoinEnvelopeCs;
+
+export interface CoinEnvelopeRsa {
+ cipher: DenomKeyType.Rsa;
+ rsa_blinded_planchet: string;
+}
+
+export interface CoinEnvelopeCs {
+ cipher: DenomKeyType.ClauseSchnorr;
+ // FIXME: add remaining fields
+}
+
+export type HashCodeString = string;
+
+export interface ExchangeWithdrawRequest {
+ denom_pub_hash: HashCodeString;
+ reserve_sig: EddsaSignatureString;
+ coin_ev: CoinEnvelope;
+}
+
+export interface ExchangeRefreshRevealRequest {
+ new_denoms_h: HashCodeString[];
+ coin_evs: CoinEnvelope[];
+ /**
+ * kappa - 1 transfer private keys (ephemeral ECDHE keys).
+ */
+ transfer_privs: string[];
+
+ transfer_pub: EddsaPublicKeyString;
+
+ link_sigs: EddsaSignatureString[];
+}
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts
index 4a871e743..2219316b3 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -47,6 +47,7 @@ import {
import {
AmountString,
codecForContractTerms,
+ CoinEnvelope,
ContractTerms,
DenominationPubKey,
DenomKeyType,
@@ -136,11 +137,12 @@ export interface ConfirmPayResultPending {
export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending;
-export const codecForConfirmPayResultPending = (): Codec<ConfirmPayResultPending> =>
- buildCodecForObject<ConfirmPayResultPending>()
- .property("lastError", codecForAny())
- .property("type", codecForConstString(ConfirmPayResultType.Pending))
- .build("ConfirmPayResultPending");
+export const codecForConfirmPayResultPending =
+ (): Codec<ConfirmPayResultPending> =>
+ buildCodecForObject<ConfirmPayResultPending>()
+ .property("lastError", codecForAny())
+ .property("type", codecForConstString(ConfirmPayResultType.Pending))
+ .build("ConfirmPayResultPending");
export const codecForConfirmPayResultDone = (): Codec<ConfirmPayResultDone> =>
buildCodecForObject<ConfirmPayResultDone>()
@@ -322,45 +324,48 @@ export enum PreparePayResultType {
AlreadyConfirmed = "already-confirmed",
}
-export const codecForPreparePayResultPaymentPossible = (): Codec<PreparePayResultPaymentPossible> =>
- buildCodecForObject<PreparePayResultPaymentPossible>()
- .property("amountEffective", codecForAmountString())
- .property("amountRaw", codecForAmountString())
- .property("contractTerms", codecForContractTerms())
- .property("proposalId", codecForString())
- .property("contractTermsHash", codecForString())
- .property("noncePriv", codecForString())
- .property(
- "status",
- codecForConstString(PreparePayResultType.PaymentPossible),
- )
- .build("PreparePayResultPaymentPossible");
-
-export const codecForPreparePayResultInsufficientBalance = (): Codec<PreparePayResultInsufficientBalance> =>
- buildCodecForObject<PreparePayResultInsufficientBalance>()
- .property("amountRaw", codecForAmountString())
- .property("contractTerms", codecForAny())
- .property("proposalId", codecForString())
- .property("noncePriv", codecForString())
- .property(
- "status",
- codecForConstString(PreparePayResultType.InsufficientBalance),
- )
- .build("PreparePayResultInsufficientBalance");
-
-export const codecForPreparePayResultAlreadyConfirmed = (): Codec<PreparePayResultAlreadyConfirmed> =>
- buildCodecForObject<PreparePayResultAlreadyConfirmed>()
- .property(
- "status",
- codecForConstString(PreparePayResultType.AlreadyConfirmed),
- )
- .property("amountEffective", codecForAmountString())
- .property("amountRaw", codecForAmountString())
- .property("paid", codecForBoolean())
- .property("contractTerms", codecForAny())
- .property("contractTermsHash", codecForString())
- .property("proposalId", codecForString())
- .build("PreparePayResultAlreadyConfirmed");
+export const codecForPreparePayResultPaymentPossible =
+ (): Codec<PreparePayResultPaymentPossible> =>
+ buildCodecForObject<PreparePayResultPaymentPossible>()
+ .property("amountEffective", codecForAmountString())
+ .property("amountRaw", codecForAmountString())
+ .property("contractTerms", codecForContractTerms())
+ .property("proposalId", codecForString())
+ .property("contractTermsHash", codecForString())
+ .property("noncePriv", codecForString())
+ .property(
+ "status",
+ codecForConstString(PreparePayResultType.PaymentPossible),
+ )
+ .build("PreparePayResultPaymentPossible");
+
+export const codecForPreparePayResultInsufficientBalance =
+ (): Codec<PreparePayResultInsufficientBalance> =>
+ buildCodecForObject<PreparePayResultInsufficientBalance>()
+ .property("amountRaw", codecForAmountString())
+ .property("contractTerms", codecForAny())
+ .property("proposalId", codecForString())
+ .property("noncePriv", codecForString())
+ .property(
+ "status",
+ codecForConstString(PreparePayResultType.InsufficientBalance),
+ )
+ .build("PreparePayResultInsufficientBalance");
+
+export const codecForPreparePayResultAlreadyConfirmed =
+ (): Codec<PreparePayResultAlreadyConfirmed> =>
+ buildCodecForObject<PreparePayResultAlreadyConfirmed>()
+ .property(
+ "status",
+ codecForConstString(PreparePayResultType.AlreadyConfirmed),
+ )
+ .property("amountEffective", codecForAmountString())
+ .property("amountRaw", codecForAmountString())
+ .property("paid", codecForBoolean())
+ .property("contractTerms", codecForAny())
+ .property("contractTermsHash", codecForString())
+ .property("proposalId", codecForString())
+ .build("PreparePayResultAlreadyConfirmed");
export const codecForPreparePayResult = (): Codec<PreparePayResult> =>
buildCodecForUnion<PreparePayResult>()
@@ -461,7 +466,7 @@ export interface PlanchetCreationResult {
denomPub: DenominationPubKey;
blindingKey: string;
withdrawSig: string;
- coinEv: string;
+ coinEv: CoinEnvelope;
coinValue: AmountJson;
coinEvHash: string;
}
@@ -543,12 +548,13 @@ export interface ExchangeListItem {
tos: ExchangeTos;
}
-const codecForExchangeTos = (): Codec<ExchangeTos> => buildCodecForObject<ExchangeTos>()
- .property("acceptedVersion", codecOptional(codecForString()))
- .property("currentVersion", codecOptional(codecForString()))
- .property("contentType", codecOptional(codecForString()))
- .property("content", codecOptional(codecForString()))
- .build("ExchangeTos")
+const codecForExchangeTos = (): Codec<ExchangeTos> =>
+ buildCodecForObject<ExchangeTos>()
+ .property("acceptedVersion", codecOptional(codecForString()))
+ .property("currentVersion", codecOptional(codecForString()))
+ .property("contentType", codecOptional(codecForString()))
+ .property("content", codecOptional(codecForString()))
+ .build("ExchangeTos");
export const codecForExchangeListItem = (): Codec<ExchangeListItem> =>
buildCodecForObject<ExchangeListItem>()
@@ -670,10 +676,11 @@ export interface ForceExchangeUpdateRequest {
exchangeBaseUrl: string;
}
-export const codecForForceExchangeUpdateRequest = (): Codec<AddExchangeRequest> =>
- buildCodecForObject<AddExchangeRequest>()
- .property("exchangeBaseUrl", codecForString())
- .build("AddExchangeRequest");
+export const codecForForceExchangeUpdateRequest =
+ (): Codec<AddExchangeRequest> =>
+ buildCodecForObject<AddExchangeRequest>()
+ .property("exchangeBaseUrl", codecForString())
+ .build("AddExchangeRequest");
export interface GetExchangeTosRequest {
exchangeBaseUrl: string;
@@ -691,11 +698,12 @@ export interface AcceptManualWithdrawalRequest {
amount: string;
}
-export const codecForAcceptManualWithdrawalRequet = (): Codec<AcceptManualWithdrawalRequest> =>
- buildCodecForObject<AcceptManualWithdrawalRequest>()
- .property("exchangeBaseUrl", codecForString())
- .property("amount", codecForString())
- .build("AcceptManualWithdrawalRequest");
+export const codecForAcceptManualWithdrawalRequet =
+ (): Codec<AcceptManualWithdrawalRequest> =>
+ buildCodecForObject<AcceptManualWithdrawalRequest>()
+ .property("exchangeBaseUrl", codecForString())
+ .property("amount", codecForString())
+ .build("AcceptManualWithdrawalRequest");
export interface GetWithdrawalDetailsForAmountRequest {
exchangeBaseUrl: string;
@@ -707,28 +715,31 @@ export interface AcceptBankIntegratedWithdrawalRequest {
exchangeBaseUrl: string;
}
-export const codecForAcceptBankIntegratedWithdrawalRequest = (): Codec<AcceptBankIntegratedWithdrawalRequest> =>
- buildCodecForObject<AcceptBankIntegratedWithdrawalRequest>()
- .property("exchangeBaseUrl", codecForString())
- .property("talerWithdrawUri", codecForString())
- .build("AcceptBankIntegratedWithdrawalRequest");
+export const codecForAcceptBankIntegratedWithdrawalRequest =
+ (): Codec<AcceptBankIntegratedWithdrawalRequest> =>
+ buildCodecForObject<AcceptBankIntegratedWithdrawalRequest>()
+ .property("exchangeBaseUrl", codecForString())
+ .property("talerWithdrawUri", codecForString())
+ .build("AcceptBankIntegratedWithdrawalRequest");
-export const codecForGetWithdrawalDetailsForAmountRequest = (): Codec<GetWithdrawalDetailsForAmountRequest> =>
- buildCodecForObject<GetWithdrawalDetailsForAmountRequest>()
- .property("exchangeBaseUrl", codecForString())
- .property("amount", codecForString())
- .build("GetWithdrawalDetailsForAmountRequest");
+export const codecForGetWithdrawalDetailsForAmountRequest =
+ (): Codec<GetWithdrawalDetailsForAmountRequest> =>
+ buildCodecForObject<GetWithdrawalDetailsForAmountRequest>()
+ .property("exchangeBaseUrl", codecForString())
+ .property("amount", codecForString())
+ .build("GetWithdrawalDetailsForAmountRequest");
export interface AcceptExchangeTosRequest {
exchangeBaseUrl: string;
etag: string;
}
-export const codecForAcceptExchangeTosRequest = (): Codec<AcceptExchangeTosRequest> =>
- buildCodecForObject<AcceptExchangeTosRequest>()
- .property("exchangeBaseUrl", codecForString())
- .property("etag", codecForString())
- .build("AcceptExchangeTosRequest");
+export const codecForAcceptExchangeTosRequest =
+ (): Codec<AcceptExchangeTosRequest> =>
+ buildCodecForObject<AcceptExchangeTosRequest>()
+ .property("exchangeBaseUrl", codecForString())
+ .property("etag", codecForString())
+ .build("AcceptExchangeTosRequest");
export interface ApplyRefundRequest {
talerRefundUri: string;
@@ -742,18 +753,20 @@ export const codecForApplyRefundRequest = (): Codec<ApplyRefundRequest> =>
export interface GetWithdrawalDetailsForUriRequest {
talerWithdrawUri: string;
}
-export const codecForGetWithdrawalDetailsForUri = (): Codec<GetWithdrawalDetailsForUriRequest> =>
- buildCodecForObject<GetWithdrawalDetailsForUriRequest>()
- .property("talerWithdrawUri", codecForString())
- .build("GetWithdrawalDetailsForUriRequest");
+export const codecForGetWithdrawalDetailsForUri =
+ (): Codec<GetWithdrawalDetailsForUriRequest> =>
+ buildCodecForObject<GetWithdrawalDetailsForUriRequest>()
+ .property("talerWithdrawUri", codecForString())
+ .build("GetWithdrawalDetailsForUriRequest");
export interface ListKnownBankAccountsRequest {
currency?: string;
}
-export const codecForListKnownBankAccounts = (): Codec<ListKnownBankAccountsRequest> =>
- buildCodecForObject<ListKnownBankAccountsRequest>()
- .property("currency", codecOptional(codecForString()))
- .build("ListKnownBankAccountsRequest");
+export const codecForListKnownBankAccounts =
+ (): Codec<ListKnownBankAccountsRequest> =>
+ buildCodecForObject<ListKnownBankAccountsRequest>()
+ .property("currency", codecOptional(codecForString()))
+ .build("ListKnownBankAccountsRequest");
export interface GetExchangeWithdrawalInfo {
exchangeBaseUrl: string;
@@ -761,15 +774,16 @@ export interface GetExchangeWithdrawalInfo {
tosAcceptedFormat?: string[];
}
-export const codecForGetExchangeWithdrawalInfo = (): Codec<GetExchangeWithdrawalInfo> =>
- buildCodecForObject<GetExchangeWithdrawalInfo>()
- .property("exchangeBaseUrl", codecForString())
- .property("amount", codecForAmountJson())
- .property(
- "tosAcceptedFormat",
- codecOptional(codecForList(codecForString())),
- )
- .build("GetExchangeWithdrawalInfo");
+export const codecForGetExchangeWithdrawalInfo =
+ (): Codec<GetExchangeWithdrawalInfo> =>
+ buildCodecForObject<GetExchangeWithdrawalInfo>()
+ .property("exchangeBaseUrl", codecForString())
+ .property("amount", codecForAmountJson())
+ .property(
+ "tosAcceptedFormat",
+ codecOptional(codecForList(codecForString())),
+ )
+ .build("GetExchangeWithdrawalInfo");
export interface AbortProposalRequest {
proposalId: string;
@@ -853,17 +867,17 @@ export interface RefreshPlanchetInfo {
/**
* Public key for the coin.
*/
- publicKey: string;
+ coinPub: string;
/**
* Private key for the coin.
*/
- privateKey: string;
+ coinPriv: string;
/**
* Blinded public key.
*/
- coinEv: string;
+ coinEv: CoinEnvelope;
coinEvHash: string;
@@ -896,12 +910,13 @@ export interface RecoveryLoadRequest {
strategy?: RecoveryMergeStrategy;
}
-export const codecForWithdrawTestBalance = (): Codec<WithdrawTestBalanceRequest> =>
- buildCodecForObject<WithdrawTestBalanceRequest>()
- .property("amount", codecForString())
- .property("bankBaseUrl", codecForString())
- .property("exchangeBaseUrl", codecForString())
- .build("WithdrawTestBalanceRequest");
+export const codecForWithdrawTestBalance =
+ (): Codec<WithdrawTestBalanceRequest> =>
+ buildCodecForObject<WithdrawTestBalanceRequest>()
+ .property("amount", codecForString())
+ .property("bankBaseUrl", codecForString())
+ .property("exchangeBaseUrl", codecForString())
+ .build("WithdrawTestBalanceRequest");
export interface ApplyRefundResponse {
contractTermsHash: string;
@@ -935,11 +950,12 @@ export interface SetCoinSuspendedRequest {
suspended: boolean;
}
-export const codecForSetCoinSuspendedRequest = (): Codec<SetCoinSuspendedRequest> =>
- buildCodecForObject<SetCoinSuspendedRequest>()
- .property("coinPub", codecForString())
- .property("suspended", codecForBoolean())
- .build("SetCoinSuspendedRequest");
+export const codecForSetCoinSuspendedRequest =
+ (): Codec<SetCoinSuspendedRequest> =>
+ buildCodecForObject<SetCoinSuspendedRequest>()
+ .property("coinPub", codecForString())
+ .property("suspended", codecForBoolean())
+ .build("SetCoinSuspendedRequest");
export interface ForceRefreshRequest {
coinPubList: string[];
@@ -972,10 +988,11 @@ export interface AbortPayWithRefundRequest {
proposalId: string;
}
-export const codecForAbortPayWithRefundRequest = (): Codec<AbortPayWithRefundRequest> =>
- buildCodecForObject<AbortPayWithRefundRequest>()
- .property("proposalId", codecForString())
- .build("AbortPayWithRefundRequest");
+export const codecForAbortPayWithRefundRequest =
+ (): Codec<AbortPayWithRefundRequest> =>
+ buildCodecForObject<AbortPayWithRefundRequest>()
+ .property("proposalId", codecForString())
+ .build("AbortPayWithRefundRequest");
export interface GetFeeForDepositRequest {
depositPaytoUri: string;
@@ -987,18 +1004,18 @@ export interface CreateDepositGroupRequest {
amount: AmountString;
}
-
export const codecForGetFeeForDeposit = (): Codec<GetFeeForDepositRequest> =>
buildCodecForObject<GetFeeForDepositRequest>()
.property("amount", codecForAmountString())
.property("depositPaytoUri", codecForString())
.build("GetFeeForDepositRequest");
-export const codecForCreateDepositGroupRequest = (): Codec<CreateDepositGroupRequest> =>
- buildCodecForObject<CreateDepositGroupRequest>()
- .property("amount", codecForAmountString())
- .property("depositPaytoUri", codecForString())
- .build("CreateDepositGroupRequest");
+export const codecForCreateDepositGroupRequest =
+ (): Codec<CreateDepositGroupRequest> =>
+ buildCodecForObject<CreateDepositGroupRequest>()
+ .property("amount", codecForAmountString())
+ .property("depositPaytoUri", codecForString())
+ .build("CreateDepositGroupRequest");
export interface CreateDepositGroupResponse {
depositGroupId: string;
@@ -1015,10 +1032,11 @@ export interface TrackDepositGroupResponse {
}[];
}
-export const codecForTrackDepositGroupRequest = (): Codec<TrackDepositGroupRequest> =>
- buildCodecForObject<TrackDepositGroupRequest>()
- .property("depositGroupId", codecForAmountString())
- .build("TrackDepositGroupRequest");
+export const codecForTrackDepositGroupRequest =
+ (): Codec<TrackDepositGroupRequest> =>
+ buildCodecForObject<TrackDepositGroupRequest>()
+ .property("depositGroupId", codecForAmountString())
+ .build("TrackDepositGroupRequest");
export interface WithdrawUriInfoResponse {
amount: AmountString;
@@ -1026,12 +1044,13 @@ export interface WithdrawUriInfoResponse {
possibleExchanges: ExchangeListItem[];
}
-export const codecForWithdrawUriInfoResponse = (): Codec<WithdrawUriInfoResponse> =>
- buildCodecForObject<WithdrawUriInfoResponse>()
- .property("amount", codecForAmountString())
- .property("defaultExchangeBaseUrl", codecOptional(codecForString()))
- .property("possibleExchanges", codecForList(codecForExchangeListItem()))
- .build("WithdrawUriInfoResponse");
+export const codecForWithdrawUriInfoResponse =
+ (): Codec<WithdrawUriInfoResponse> =>
+ buildCodecForObject<WithdrawUriInfoResponse>()
+ .property("amount", codecForAmountString())
+ .property("defaultExchangeBaseUrl", codecOptional(codecForString()))
+ .property("possibleExchanges", codecForList(codecForExchangeListItem()))
+ .build("WithdrawUriInfoResponse");
export interface WalletCurrencyInfo {
trustedAuditors: {
@@ -1054,15 +1073,17 @@ export interface RetryTransactionRequest {
transactionId: string;
}
-export const codecForDeleteTransactionRequest = (): Codec<DeleteTransactionRequest> =>
- buildCodecForObject<DeleteTransactionRequest>()
- .property("transactionId", codecForString())
- .build("DeleteTransactionRequest");
+export const codecForDeleteTransactionRequest =
+ (): Codec<DeleteTransactionRequest> =>
+ buildCodecForObject<DeleteTransactionRequest>()
+ .property("transactionId", codecForString())
+ .build("DeleteTransactionRequest");
-export const codecForRetryTransactionRequest = (): Codec<RetryTransactionRequest> =>
- buildCodecForObject<RetryTransactionRequest>()
- .property("transactionId", codecForString())
- .build("RetryTransactionRequest");
+export const codecForRetryTransactionRequest =
+ (): Codec<RetryTransactionRequest> =>
+ buildCodecForObject<RetryTransactionRequest>()
+ .property("transactionId", codecForString())
+ .build("RetryTransactionRequest");
export interface SetWalletDeviceIdRequest {
/**
@@ -1071,10 +1092,11 @@ export interface SetWalletDeviceIdRequest {
walletDeviceId: string;
}
-export const codecForSetWalletDeviceIdRequest = (): Codec<SetWalletDeviceIdRequest> =>
- buildCodecForObject<SetWalletDeviceIdRequest>()
- .property("walletDeviceId", codecForString())
- .build("SetWalletDeviceIdRequest");
+export const codecForSetWalletDeviceIdRequest =
+ (): Codec<SetWalletDeviceIdRequest> =>
+ buildCodecForObject<SetWalletDeviceIdRequest>()
+ .property("walletDeviceId", codecForString())
+ .build("SetWalletDeviceIdRequest");
export interface WithdrawFakebankRequest {
amount: AmountString;
@@ -1082,12 +1104,13 @@ export interface WithdrawFakebankRequest {
bank: string;
}
-export const codecForWithdrawFakebankRequest = (): Codec<WithdrawFakebankRequest> =>
- buildCodecForObject<WithdrawFakebankRequest>()
- .property("amount", codecForAmountString())
- .property("bank", codecForString())
- .property("exchange", codecForString())
- .build("WithdrawFakebankRequest");
+export const codecForWithdrawFakebankRequest =
+ (): Codec<WithdrawFakebankRequest> =>
+ buildCodecForObject<WithdrawFakebankRequest>()
+ .property("amount", codecForAmountString())
+ .property("bank", codecForString())
+ .property("exchange", codecForString())
+ .build("WithdrawFakebankRequest");
export interface ImportDb {
dump: any;
@@ -1095,4 +1118,4 @@ export interface ImportDb {
export const codecForImportDbRequest = (): Codec<ImportDb> =>
buildCodecForObject<ImportDb>()
.property("dump", codecForAny())
- .build("ImportDbRequest")
+ .build("ImportDbRequest");