From 3da1e82a245851c384c22293c928fcef1c4c2f34 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 12 Oct 2022 21:19:09 +0200 Subject: wallet-core: skeleton for dev-experiments --- packages/taler-util/src/taleruri.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'packages/taler-util/src/taleruri.ts') diff --git a/packages/taler-util/src/taleruri.ts b/packages/taler-util/src/taleruri.ts index e7d66d7d5..baca3efac 100644 --- a/packages/taler-util/src/taleruri.ts +++ b/packages/taler-util/src/taleruri.ts @@ -50,6 +50,10 @@ export interface PayPullUriResult { contractPriv: string; } +export interface DevExperimentUri { + devExperimentId: string; +} + /** * Parse a taler[+http]://withdraw URI. * Return undefined if not passed a valid URI. @@ -91,6 +95,7 @@ export enum TalerUriType { TalerNotifyReserve = "taler-notify-reserve", TalerPayPush = "taler-pay-push", TalerPayPull = "taler-pay-pull", + TalerDevExperiment = "taler-dev-experiment", Unknown = "unknown", } @@ -141,6 +146,9 @@ export function classifyTalerUri(s: string): TalerUriType { if (sl.startsWith("taler://notify-reserve/")) { return TalerUriType.TalerNotifyReserve; } + if (sl.startsWith("taler://dev-experiment/")) { + return TalerUriType.TalerDevExperiment; + } return TalerUriType.Unknown; } @@ -300,6 +308,19 @@ export function parseRefundUri(s: string): RefundUriResult | undefined { }; } +export function parseDevExperimentUri(s: string): DevExperimentUri | undefined { + const pi = parseProtoInfo(s, "dev-experiment"); + const c = pi?.rest.split("?"); + if (!c) { + return undefined; + } + // const q = new URLSearchParams(c[1] ?? ""); + const parts = c[0].split("/"); + return { + devExperimentId: parts[0], + }; +} + export function constructPayPushUri(args: { exchangeBaseUrl: string; contractPriv: string; -- cgit v1.2.3