diff options
author | Florian Dold <florian@dold.me> | 2023-08-29 09:45:45 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-08-29 09:46:43 +0200 |
commit | 55bdc161b58ddf4f24e32dff9acd8011a4364327 (patch) | |
tree | 1506387802bff37c376cd50bc42c444344afe928 /packages/taler-util | |
parent | b13bd85215ad64e7a2764ac7e7fee5945ffa1c07 (diff) | |
download | wallet-core-55bdc161b58ddf4f24e32dff9acd8011a4364327.tar.xz |
taler-harness: add exchange-purse test
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/payto.ts | 22 | ||||
-rw-r--r-- | packages/taler-util/src/taler-crypto.ts | 5 |
2 files changed, 25 insertions, 2 deletions
diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts index dd35b44be..2b0af4cc2 100644 --- a/packages/taler-util/src/payto.ts +++ b/packages/taler-util/src/payto.ts @@ -239,3 +239,25 @@ export function parsePaytoUri(s: string): PaytoUri | undefined { isKnown: false, }; } + +export function talerPaytoFromExchangeReserve( + exchangeBaseUrl: string, + reservePub: string, +): string { + const url = new URL(exchangeBaseUrl); + let proto: string; + if (url.protocol === "http:") { + proto = "taler-reserve-http"; + } else if (url.protocol === "https:") { + proto = "taler-reserve"; + } else { + throw Error(`unsupported exchange base URL protocol (${url.protocol})`); + } + + let path = url.pathname; + if (!path.endsWith("/")) { + path = path + "/"; + } + + return `payto://${proto}/${url.host}${url.pathname}${reservePub}`; +} diff --git a/packages/taler-util/src/taler-crypto.ts b/packages/taler-util/src/taler-crypto.ts index d52edc1e5..9425a9320 100644 --- a/packages/taler-util/src/taler-crypto.ts +++ b/packages/taler-util/src/taler-crypto.ts @@ -1004,7 +1004,7 @@ export enum TalerSignaturePurpose { SYNC_BACKUP_UPLOAD = 1450, } -export const enum WalletAccountMergeFlags { +export enum WalletAccountMergeFlags { /** * Not a legal mode! */ @@ -1281,7 +1281,8 @@ export namespace AgeRestriction { } const PublishedAgeRestrictionBaseKey: Edx25519PublicKey = decodeCrock( - "CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG"); + "CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG", + ); export async function restrictionCommitSeeded( ageMask: number, |