Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve QR code scanning for cable_tunnel example #296

Open
Tracked by #259
micolous opened this issue Mar 30, 2023 · 1 comment
Open
Tracked by #259

Improve QR code scanning for cable_tunnel example #296

micolous opened this issue Mar 30, 2023 · 1 comment
Labels
cable Issues relating to caBLE (Cloud-assisted Bluetooth Low Energy authenticators)

Comments

@micolous
Copy link
Collaborator

This issue is free to pick up if you're interested; this is mainly a brain dump to track things. This work is part of #259.

The caBLE authenticator implementation example currently needs a may to get FIDO:/ URLs from caBLE QR codes into it. It currently has two mechanisms to supply this:

  1. inputting the URL directly
  2. scanning an image for a QR code (using bardecoder)

I like having the scanning feature available, because it made things pretty convenient during testing and development. My workflow there was to:

  1. start the authentication flow on the device
  2. take a screenshot of the QR code, either using developer tools (for a mobile device) or local screenshot tools
  3. save the screenshot to a file
  4. open the screenshot with cable_tunnel

This is currently about 80% reliable after manual cropping (which I ideally don't want to do!). There's currently a hack in it to make it accept QR codes from iOS initiators more reliably:

// Optimised for screenshots from the device.
let img = img.adjust_contrast(9000.0);

Some observations:

  • iOS caBLE QR codes have a small logo over the centre of the QR code, and no custom pixel styling; the colours are not black and white either so needs the contrast tweak.
  • Chrome (on desktop) caBLE QR codes have a large logo over the centre of the QR code, circular pixel styling, but black and white colours. The contrast tweak seems to have no effect: Decoding Chrome's caBLE QR codes fails about 20% of the time piderman314/bardecoder#46

I'm able to reliably scan these QR codes with zxing and Google Camera on Android, and with iOS camera ~100% reliably; and that's taking a picture of the screen, rather than the pixel-perfect conditions of a screenshot. They can cheat a little by using multiple frames in the case of a scan failure, but the process feels very responsive.

Work ideas here include:

  • working with bardecoder to figure out if there's ways that algorithm can be improved
  • investigating alternative libraries (eg: rxing, zbar / zbar-rust) to see if they work better

I'd like to be able to use a device's webcam to scan QR codes in this demo, but this can't really happen until the QR code scanning is more reliable and faster.

@micolous micolous added the cable Issues relating to caBLE (Cloud-assisted Bluetooth Low Energy authenticators) label Mar 30, 2023
@micolous
Copy link
Collaborator Author

micolous commented Jan 7, 2024

Windows 11's built-in caBLE support uses a QR code with square pixels and a logo over the centre (white square with black logo, similar to Chrome). These are also unreliable to scan from screenshots (well, a HDMI capture device), and the only way around it is to re-roll the QR code (by aborting the caBLE transaction).

The logos on Chrome, iOS and Windows are all of a similar size.

I suspect the design of the logo itself is triggering the issue, but as before, using other scanners has been reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cable Issues relating to caBLE (Cloud-assisted Bluetooth Low Energy authenticators)
Projects
None yet
Development

No branches or pull requests

1 participant