Perhaps this will make entering fingerprints easier for some people. Perhaps someday Orbot will support scanning them. Users have been reporting a lot of problems when they have to type in fingerprints by hand.
I want some sort of feedback that this is a useful thing to add, and that there is currently a known use-case where displaying these is going to make sense to a user, before I add a new library requirement to BridgeDB.
Trac: Keywords: N/Adeleted, bridgedb-https added Type: defect to enhancement Status: new to needs_information
Ticket #12639 (moved) was a duplicate of this one and perhaps contains a bit of relevant information. This ticket should be considered the canonical bug for this feature request, however.
So… here is what the new BridgeDB API for this currently looks like, after you've clicked a little Show QRCode button (if you have JS enabled):
(It's prettier with JS enabled, as you get the little popuppish modal thing. If JS is disabled, it's still functional, of course, you just get a data: URI which just shows the QR code. No screenshot for that one.)
This is what is looks like before clicking the button:
Problems:
I looked at Orbot's code, and it seems like, for some reason, it's not registering the intent.ACTION_VIEW mentioned on L590 of Orbot.java in the current master branch (09bdd8fd29a7c4086f9f95ab214e0bc77166a6f7):
else if (action.equals(Intent.ACTION_VIEW)) { String urlString = intent.getDataString(); if (urlString != null) { if (urlString.toLowerCase().startsWith("bridge://")) { String newBridgeValue = urlString.substring(9); //remove the bridge protocol piece newBridgeValue = URLDecoder.decode(newBridgeValue); //decode the value here showAlert("Bridges Updated","Restart Orbot to use this bridge: " + newBridgeValue,false);
So Problem !#1 is that the above code doesn't work for some reason. I had three friends with Android devices (though I believe they all had the same QRCode reader app) test the above QRCode, and Orbot never picked up on the intent.
The other thing I tried was to just encode the plain bridge lines into a QRCode (i.e. without the 'bridge://' scheme), and ask them to copy+paste it. This worked, but was obviously very painful because it took like 10 rather complicated UI steps (and is probably different for each QRCode app).
Another problem is that I'm not sure how Orbot intends to receive multiple bridge lines, because the above code doesn't handle that case.
Perhaps I should make the modal movable/draggable, so that users can print their textual bridge lines and the QR without wasting an extra sheet of paper.
Okay, this is merged to develop for 0.2.4. The code lives in my fix/11345-qrcodes_r2branch. Currently, there is a boolean flag to pass to the bridgedb.qrcodes.generateQR() function which will decide whether or not to make "Orbot-style" QRCodes which have the "bridge://" schema prefix:
diff --git a/lib/bridgedb/qrcodes.py b/lib/bridgedb/qrcodes.pyindex a76cf8f..8016262 100644--- a/lib/bridgedb/qrcodes.py+++ b/lib/bridgedb/qrcodes.py@@ -25,13 +25,15 @@ except ImportError: "work. On Debian-based systems, this should be in the " "python-qrcode package."))-def generateQR(bridgelines, imageFormat=u'JPEG'):++def generateQR(bridgelines, imageFormat=u'JPEG', bridgeSchema=False): """Generate a QRCode for the client's bridge lines. :param str bridgelines: The Bridge Lines which we are distributing to the client.+ :param bool bridgeSchema: If ``True``, prepend ``'bridge://'`` to the+ beginning of each bridge line before QR encoding. :rtype: str or ``None``- :returns: The generated QRCode, as a string. """ logging.debug("Attempting to encode bridge lines into a QRCode...")@@ -43,16 +45,26 @@ def generateQR(bridgelines, imageFormat=u'JPEG'): logging.info("Not creating QRCode for bridgelines; no qrcode module.") try:+ if bridgeSchema:+ # See https://bugs.torproject.org/12639 for why bridge:// is used.+ # (Hopefully, Orbot will pick up the ACTION_VIEW intent.)+ schema = 'bridge://'+ prefixed = []+ for line in bridgelines.strip().split('\n'):+ prefixed.append(schema + line)+ bridgelines = '\n'.join(prefixed)++ logging.debug("QR encoding bridge lines: %s" % bridgelines) qr = qrcode.QRCode()
(See commit 66ef631c51176777da212ab02f7a0d47dff00579.) However, the current default is to not add the prefix because it doesn't seem to help Orbot pick up the intent.ACTION_VIEW, and it definitely makes copy+pasting the text from the QRCode much harder to do manually. Also, having the schema prefix would mean that TorLauncher in Tails would have to do extra processing to get rid of it (if, in the future, we were to support holding up QRCodes to the webcam for TorLauncher to extract bridge lines).
Trac: Resolution: N/Ato fixed Status: needs_review to closed
Glad to see this was implemented and release. I know it was a lot of work!
Orbot does indeed support ACTION_VIEW and bridge:// encoded URLs. I am not sure why it wasn't working for you. Perhaps because you are generating three bridge:// lines and not just one long link? Android only except one URI in a QRCode.
Most systems provide parsers that make it trivial to get the pieces of URI, for example android.net.Uri or java.net.URI. So maybe for bridges it would be something like:
So user is user, password is password, host is the IP addres, port is the port, path is the bridge type, and everything else is in the query string as key/value pairs.