diff --git a/benchmarks/amount-ladder/run.sh b/benchmarks/amount-ladder/run.sh index b8e337d..be3cc6b 100755 --- a/benchmarks/amount-ladder/run.sh +++ b/benchmarks/amount-ladder/run.sh @@ -155,12 +155,17 @@ python3 - <<'PY' import json d=json.load(open("/tmp/wd.json")) print("wd_keys", list(d.keys())[:20]) +import re uri=d.get("taler_withdraw_uri") or d.get("withdrawal_uri") or "" wid=d.get("withdrawal_id") or d.get("id") or "" if not uri: for v in d.values(): if isinstance(v, str) and v.startswith("taler"): uri=v +uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", uri or "", flags=re.I) +uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", uri or "", flags=re.I) +for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")): + uri=uri.replace(a,b) open("/tmp/bench-wuri.txt","w").write(uri) open("/tmp/bench-wid.txt","w").write(wid) print("WURI", uri) diff --git a/scripts/taler-bank/demo-withdraw-api.py b/scripts/taler-bank/demo-withdraw-api.py index d8a21de..f31243e 100755 --- a/scripts/taler-bank/demo-withdraw-api.py +++ b/scripts/taler-bank/demo-withdraw-api.py @@ -43,24 +43,36 @@ def public_webui_url() -> str: def normalize_taler_withdraw_uri(uri: str) -> str: - """Strip default :443/:80 from taler://withdraw host (wallet base-URL fix). + """Strip default :443/:80 from any taler:// authority (wallet base-URL fix). libeufin builds authority from https BASE_URL and includes port 443; Android / iOS wallets then fail host parsing or TLS. Path and id stay unchanged. + Applies to withdraw, pay, pay-template, etc. """ if not uri: return uri - # taler://withdraw/bank.example:443/taler-integration/UUID + # taler://SCHEME/host:443/... or :80 uri = re.sub( - r"(taler://withdraw/)([^/?#]+):443(?=/|$)", + r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", uri, + flags=re.I, ) uri = re.sub( - r"(taler://withdraw/)([^/?#]+):80(?=/|$)", + r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", uri, + flags=re.I, ) + for a, b in ( + (":443/", "/"), + (":443?", "?"), + (":443#", "#"), + (":80/", "/"), + (":80?", "?"), + (":80#", "#"), + ): + uri = uri.replace(a, b) return uri def load_pass() -> str: diff --git a/scripts/taler-bank/goa-withdraw-ladder.sh b/scripts/taler-bank/goa-withdraw-ladder.sh index f66925c..27b828b 100755 --- a/scripts/taler-bank/goa-withdraw-ladder.sh +++ b/scripts/taler-bank/goa-withdraw-ladder.sh @@ -7,9 +7,10 @@ # 3) wallet-cli: ToS + accept-uri + run-until-done each rung # 4) amounts from atomic-GOA up until bank/wallet fails # -# Prefer the monitoring phase (random increasing ranges + timings + report): -# ../taler-monitoring/taler-monitoring.sh ladder -# LADDER_MAX_RUNGS=10 ../taler-monitoring/check_goa_ladder.sh +# Prefer the monitoring amount ladder (modular wd + pay): +# cd ~/src/taler-monitoring && ./taler-monitoring.sh -d hacktivism.ch ladder +# ./taler-monitoring.sh max-ladder # highest withdrawable + payable +# LADDER_STEPS=10 LADDER_PAY=0 ./taler-monitoring.sh ladder # # Usage (standalone, fixed ladder): # ./goa-withdraw-ladder.sh @@ -53,7 +54,7 @@ wcli() { } # Default ladder via Python: fixed 0 + random low picks + random high ranges + fixed max. -# Prefer taler-monitoring check_goa_ladder.sh for full control (LADDER_* env). +# Prefer taler-monitoring check_amount_ladder.sh (+ ladder/lib_pay.sh) for LADDER_* env. default_amounts() { python3 - <<'PY' import math, random @@ -235,7 +236,15 @@ for amt in "${LADDER[@]}"; do break fi WID=$(echo "$WD" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("withdrawal_id",""))') - URI=$(echo "$WD" | python3 -c 'import json,sys; u=json.load(sys.stdin).get("taler_withdraw_uri",""); print(u.replace(":443/","/"))') + URI=$(echo "$WD" | python3 -c ' +import json, re, sys +u = json.load(sys.stdin).get("taler_withdraw_uri") or "" +u = re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", u, flags=re.I) +u = re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", u, flags=re.I) +for a, b in ((":443/", "/"), (":443?", "?"), (":80/", "/"), (":80?", "?")): + u = u.replace(a, b) +print(u) +') [ -n "$WID" ] && [ -n "$URI" ] || { log "FAIL parse mint: $WD" echo -e "${n}\t${amt}\tFAIL_PARSE\t-\t" >>"$RESULTS" diff --git a/scripts/taler-bank/refresh-demo-withdraw.sh b/scripts/taler-bank/refresh-demo-withdraw.sh index 901c368..d00bb74 100755 --- a/scripts/taler-bank/refresh-demo-withdraw.sh +++ b/scripts/taler-bank/refresh-demo-withdraw.sh @@ -38,8 +38,16 @@ URI=$(printf '%s' "$WD" | sed -n 's/.*"taler_withdraw_uri"[[:space:]]*:[[:space: WID=$(printf '%s' "$WD" | sed -n 's/.*"withdrawal_id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p') [ -n "$URI" ] || { echo "no URI from: $WD" >&2; exit 1; } [ -n "$WID" ] || WID=$(basename "$URI") -# libeufin emits host:443 — strip default HTTPS port for wallet apps -URI=$(printf '%s' "$URI" | sed -E 's|(taler://withdraw/[^/:]+):443(/)|\1\2|; s|(taler://withdraw/[^/:]+):443$|\1|') +# libeufin emits host:443 — strip default HTTPS/HTTP ports for wallet apps +URI=$(printf '%s' "$URI" | python3 -c ' +import re,sys +u=sys.stdin.read().strip() +u=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", u, flags=re.I) +u=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", u, flags=re.I) +for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")): + u=u.replace(a,b) +print(u) +') mkdir -p "$LANDING_DIR" printf '%s\n' "$URI" >"$LANDING_DIR/withdraw.uri" diff --git a/scripts/taler-wallet-cli/run-extreme-amount-tests.sh b/scripts/taler-wallet-cli/run-extreme-amount-tests.sh index 1774304..6f4c095 100755 --- a/scripts/taler-wallet-cli/run-extreme-amount-tests.sh +++ b/scripts/taler-wallet-cli/run-extreme-amount-tests.sh @@ -188,7 +188,12 @@ python3 - <<'PY' import json d=json.load(open("/tmp/wd-create.json")) wid=d.get("withdrawal_id") or d.get("id") -uri=d.get("taler_withdraw_uri") +uri=d.get("taler_withdraw_uri") or "" +import re +uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):443(?=/|$|\?|#)", r"\1\2", uri, flags=re.I) +uri=re.sub(r"(taler://[A-Za-z0-9._-]+/)([^/?#:]+):80(?=/|$|\?|#)", r"\1\2", uri, flags=re.I) +for a,b in ((":443/","/"),(":443?","?"),(":80/","/"),(":80?","?")): + uri=uri.replace(a,b) print("WID", wid) print("WURI", uri) open("/tmp/wid.txt","w").write(wid or "")