]> git.bitcoin.ninja Git - satsto.me/commitdiff
Detect and warn on silent payments in the body of the URI
authorMatt Corallo <git@bluematt.me>
Sat, 13 Jul 2024 19:45:36 +0000 (19:45 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 13 Jul 2024 19:46:43 +0000 (19:46 +0000)
index.html

index 68665d68d16b95f06800d6d9039a33d76f2265af..03ac9558721a10beefed13c941730d65a197d18d 100644 (file)
                                                addr_idx += 1;
                                                addr_ty_table += "<div class='address-card'>" + value + "</div>";
                                        };
+                                       var res = "<h2>It works!</h2>" + name + " was successfully resolved to the following addresses.<br>Your wallet should have automatically opened to pay, but if not, <a href=\"" + bip353 + "\">click here to do so.</a>";
                                        if (base_and_params[0].length != 0) {
-                                               push_table_entry("On-Chain Non-Private Address", "", base_and_params[0]);
+                                               if (base_and_params[0].startsWith("sp1q")) {
+                                                       res += "<br>Note: the response included a Silent Payment address which was encoded in the \"body\" position in the URI (i.e. <span class='mono'>bitcoin:sp1q...</span>) rather than in the \"sp\" query parameter (i.e. <span class='mono'>bitcoin:?sp=sp1q...</span>). This is incorrect and may cause some wallets to fail to pay on-chain.";
+                                                       push_table_entry("On-Chain Silent Payment", "", base_and_params[0]);
+                                               } else {
+                                                       push_table_entry("On-Chain Non-Private Address", "", base_and_params[0]);
+                                               }
                                        }
                                        if (base_and_params.length > 1 && base_and_params[1].length > 0) {
                                                for (const param of base_and_params[1].split("&")) {
                                                        }
                                                }
                                        }
-                                       var res = "<h2>It works!</h2>" + name + " was successfully resolved to the following addresses.<br>Your wallet should have automatically opened to pay, but if not, <a href=\"" + bip353 + "\">click here to do so.</a>";
                                        if (addr_ty_table != "") {
                                                res += "<br>" + addr_ty_table;
                                        }