commit 4db6e08fb7d73e6d19acda7e695d0304d5462849
parent 8fbc813afb14807dbc62c4c95402f282a8165f07
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Fri, 7 Nov 2025 11:23:25 +0100
display add-contact URIs
Diffstat:
4 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/locales/de-DE/taldir.yml b/locales/de-DE/taldir.yml
@@ -8,7 +8,7 @@ registerOrModify: "Verbinden oder Anpassen"
validationInitiated: "Alias-Validierung gestartet"
pleaseCompleteValidation: "Bitte vervollständige die Alias-Validierung wie in der versendeten Nachricht beschrieben damit wir sicher sein können dass Du es wirklich bist!"
notYetLinked: "`%s` ist noch nicht mit einer Bezahlsystemadresse verlinkt. Du kannst eine IBAN oder Taler wallet Adresse verlinken:"
-isLinked: "`%s` ist bereits mit einer Bezahlsystemadresse verlinkt"
+isLinked: "`%s` ist bereits mit einer Bezahlsystemadresse verlinkt."
paymentSystemAddress: "Bezahlsystemadresse"
paymentSystemAddressExample: "z.B. payto://iban/DE07123412341234123412"
linkIt: "Verlinken"
@@ -30,4 +30,6 @@ productDisclaimerShort: 'Dieser Dienst ist eine Funktionsdemonstration. <a href=
productDisclaimer: 'Dies ist eine Demo-Instanz des <b>Tal</b>er <b>Dir</b>ectory (TalDir) Dienstes. Der Dienst implementiert die <a href="https://docs.taler.net/core/api-taldir.html">Taler TalDir API-Spezifikation</a>. TalDir erlaubt es Dir dein Identitäts-Alias (wie z.B. Email-Adresse oder Telefonnummer) mit einer Bezahlsystemadresse (z.B. einer <a href="https://en.wikipedia.org/wiki/International_Bank_Account_Number">IBAN</a> oder <a href="https://www.rfc-editor.org/rfc/rfc8905">Taler Wallet-Adresse</a>) zu verlinken. TalDir bzw. die TalDIR API können in einer digitalen Geldbörse integriert werden um sogenannte Peer-to-Peer-Transaktionen zu unterstützen. Diese Weboberfläche dient lediglich als Demonstration der Funktionalitäten der API.<p><b>ACHTUNG:</b> Dieser Dienst ist eine Demo. Es ist kein fertiges Produkt. Die Entwicklung dieses Dienstes dauert an and wird von <a href="https://nlnet.nl/project/TALER-LookupService/">NLnet and NGI TALER</a> gefördert.</p>'
taldirRegTopic: "Taldir Alias Validierung"
taldirRegMessage: "Hi,\\n\\nWillkommen bei TalDir. Please folge diesem Link um dein Alias zu bestätigen und deine Anfrage abzuschliessen: %s\\n\\nViele Grüße,\\nTalDir"
-
+importContactLink: "Nutze diesen Link um den Kontakt in deine Taler wallet aufzunehmen:"
+importContactLinkText: "Kontakt importieren."
+importContactQr: "Oder scanne diesen QR code um den Kontakt in deine Taler wallet aufzunehmen:"
diff --git a/locales/en-US/taldir.yml b/locales/en-US/taldir.yml
@@ -8,7 +8,7 @@ registerOrModify: "Register or Modify"
validationInitiated: "Alias validation initiated"
pleaseCompleteValidation: "Please complete your alias validation according to the instructions sent to you so that we can be sure it is really you!"
notYetLinked: "`%s' is not yet linked with any Payment System Address. You may use an IBAN or a Taler wallet address:"
-isLinked: "`%s' is linked with a Payment System Address"
+isLinked: "`%s' is linked with a Payment System Address."
paymentSystemAddress: "Payment System Address"
paymentSystemAddressExample: "i.e. payto://iban/DE07123412341234123412"
linkIt: "Link it"
@@ -30,3 +30,6 @@ productDisclaimerShort: 'This service is for demonstration purposes only. <a hre
productDisclaimer: 'This is a demo instance of the <b>Tal</b>er <b>Dir</b>ectory (TalDir) service. It implements the <a href="https://docs.taler.net/core/api-taldir.html">Taler TalDir API specification</a>. TalDir allows you to link your identity aliases (such as email addresses or phone numbers) with a payment system address (e.g. an <a href="https://en.wikipedia.org/wiki/International_Bank_Account_Number">IBAN</a> or a <a href="https://www.rfc-editor.org/rfc/rfc8905">Taler wallet address</a>). Note that in practice, we expect that this service and its API would be used through a digital payment wallet to facilitate peer-to-peer transactions. The lookup and registration functionality on this web page is for demonstration purposes only. <p><b>IMPORTANT:</b> This is a demo service. It is not production-ready. The development of this service is ongoing and is funded by <a href="https://nlnet.nl/project/TALER-LookupService/">NLnet and NGI TALER</a>.</p>'
taldirRegTopic: "Taldir Alias Validation"
taldirRegMessage: "Hi,\\n\\nwelcome to TalDir. Please follow this link validate your alias and complete your request: %s\\n\\nBest,\\nTalDir"
+importContactLink: "Use this link to import the contact into your Taler wallet:"
+importContactLinkText: "Import contact."
+importContactQr: "Or scan this QR code to import the contact into your Taler wallet:"
diff --git a/pkg/taldir/taldir.go b/pkg/taldir/taldir.go
@@ -801,7 +801,7 @@ func (t *Taldir) typeLookupResultPage(w http.ResponseWriter, r *http.Request) {
// Check if this alias type is supported or not.
val, ok := t.Validators[vars["alias_type"]]
if !ok {
- w.WriteHeader(404)
+ w.WriteHeader(http.StatusNotFound)
return
}
@@ -826,8 +826,27 @@ func (t *Taldir) typeLookupResultPage(w http.ResponseWriter, r *http.Request) {
found = true
}
}
+ encodedPng := ""
+ talerAddContactURI := "";
+ if found && strings.HasPrefix(entry.TargetUri, "https://") {
+ // This could be a mailbox URI and we can create a helper QR code for import
+ hostDomain := strings.TrimPrefix(entry.TargetUri, "https://") + "?sourceBaseUri=" + t.BaseUrl
+ talerAddContactURI, err = url.JoinPath("taler://add-contact", val.Name(), r.URL.Query().Get("alias"), hostDomain)
+ if nil == err {
+ qrPng, qrErr := qrcode.Encode(talerAddContactURI, qrcode.Medium, 256)
+ if qrErr != nil {
+ t.Logger.Logf(LogError, "Failed to create QR code")
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+ encodedPng = base64.StdEncoding.EncodeToString(qrPng)
+ }
+ }
+
fullData := map[string]any{
"version": t.Cfg.Version,
+ "qrCode": template.URL("data:image/png;base64," + encodedPng),
+ "talerAddContactURI": template.URL(talerAddContactURI),
"available": !found,
"alias_type": val.Name(),
"alias": r.URL.Query().Get("alias"),
diff --git a/web/templates/lookup_result.html b/web/templates/lookup_result.html
@@ -60,14 +60,25 @@
<div class="card-body" role="alert">
<h4 class="card-title">{{ call .tr "lookupResultFound" }}</h4>
<hr>
- <p class="card-text">{{ call .tr "isLinked" .alias }}</p>
+ <p class="card-text">
+ {{ call .tr "isLinked" .alias }}<br/>
+ {{ call .tr "importContactLink" }}
+ <a class="link-dark" href="{{.talerAddContactURI}}" class="btn btn-success mb-3">
+ {{ call .tr "importContactLinkText" }}
+ </a>
+ <br/>
+ {{ call .tr "importContactQr" }}
+ <div class="qr">
+ <img class="qr" src="{{.qrCode}}"/>
+ </div>
+ </p>
</div>
<form id="regform">
<input id="atypeInput" type="hidden" name="alias_type" value="{{.alias_type}}">
<input id="addrInput" type="hidden" name="alias" value="{{.alias}}">
<input id="uriInput" type="hidden" name="target_uri" value="">
<div class="row">
- <div class="col-lg-6 offset-lg-3 text-center">
+ <div class="col-lg-8 offset-lg-2 text-center">
<div class="input-group mb-3">
<input disabled="disabled" type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" value="{{.result}}">
<input class="input-group-text btn btn-outline-danger" type="submit" value="{{ call .tr "deleteIt" }}">