From 4491118494c332c9ce0a0c4533804744d63701f2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 May 2022 16:11:12 -0300 Subject: add restricted option to manual withdraw --- packages/taler-util/src/talerCrypto.ts | 6 ++---- packages/taler-util/src/talerTypes.ts | 7 ++++++- packages/taler-util/src/walletTypes.ts | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'packages/taler-util') diff --git a/packages/taler-util/src/talerCrypto.ts b/packages/taler-util/src/talerCrypto.ts index 228dc3269..e27e329a9 100644 --- a/packages/taler-util/src/talerCrypto.ts +++ b/packages/taler-util/src/talerCrypto.ts @@ -664,7 +664,6 @@ export function hashDenomPub(pub: DenominationPubKey): Uint8Array { const hashInputBuf = new ArrayBuffer(pubBuf.length + 4 + 4); const uint8ArrayBuf = new Uint8Array(hashInputBuf); const dv = new DataView(hashInputBuf); - logger.info("age_mask", pub.age_mask); dv.setUint32(0, pub.age_mask ?? 0); dv.setUint32(4, DenomKeyType.toIntTag(pub.cipher)); uint8ArrayBuf.set(pubBuf, 8); @@ -680,8 +679,7 @@ export function hashDenomPub(pub: DenominationPubKey): Uint8Array { return nacl.hash(uint8ArrayBuf); } else { throw Error( - `unsupported cipher (${ - (pub as DenominationPubKey).cipher + `unsupported cipher (${(pub as DenominationPubKey).cipher }), unable to hash`, ); } @@ -785,7 +783,7 @@ export enum TalerSignaturePurpose { export class SignaturePurposeBuilder { private chunks: Uint8Array[] = []; - constructor(private purposeNum: number) {} + constructor(private purposeNum: number) { } put(bytes: Uint8Array): SignaturePurposeBuilder { this.chunks.push(Uint8Array.from(bytes)); diff --git a/packages/taler-util/src/talerTypes.ts b/packages/taler-util/src/talerTypes.ts index ffc1f5160..b21c6caec 100644 --- a/packages/taler-util/src/talerTypes.ts +++ b/packages/taler-util/src/talerTypes.ts @@ -47,7 +47,7 @@ import { } from "./time.js"; import { codecForAmountString } from "./amounts.js"; import { strcmp } from "./helpers.js"; -import { Edx25519PublicKey } from "./talerCrypto.js"; +import { AgeCommitmentProof, Edx25519PublicKey } from "./talerCrypto.js"; /** * Denomination as found in the /keys response from the exchange. @@ -954,6 +954,11 @@ export interface CoinDumpJson { * Suspended coins are not considered for payments. */ coin_suspended: boolean; + + /** + * Information about the age restriction + */ + ageCommitmentProof: AgeCommitmentProof | undefined; }>; } diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index d8696377a..a8946fbbb 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -738,6 +738,7 @@ export const codecForGetExchangeTosRequest = (): Codec => export interface AcceptManualWithdrawalRequest { exchangeBaseUrl: string; amount: string; + restrictAge?: number, } export const codecForAcceptManualWithdrawalRequet = @@ -745,6 +746,7 @@ export const codecForAcceptManualWithdrawalRequet = buildCodecForObject() .property("exchangeBaseUrl", codecForString()) .property("amount", codecForString()) + .property("restrictAge", codecOptional(codecForNumber())) .build("AcceptManualWithdrawalRequest"); export interface GetWithdrawalDetailsForAmountRequest { -- cgit v1.2.3