Hacker News new | past | comments | ask | show | jobs | submit login
Pure JavaScript WiFi QR Code Generator (qifi.org)
217 points by cow9 89 days ago | hide | past | web | favorite | 73 comments



On the topic of generating QR codes with JavaScript, I have a project that requires generating QR codes and the various libraries I could find all seemed to be rather... poor. A lot of them were simply made for another era of JavaScript, where the only way to generate the image was to set up a table, or even implement its own png encoder(?). There were a few more modern ones, with active development, but the changelogs weren't terrible re-assuring as they were mostly fixing bugs that really shouldn't happen in a standards compliant code generator.

In the end I settled on Project Nayuki's QR code library[0]. The JavaScript is targeting ECMAScript 5, but is commented really well so it's not too difficult to refactor it into ES6+. I'm hoping to publish my efforts soon, but it still needs some more work.

[0] https://www.nayuki.io/page/qr-code-generator-library


Thanks for the compliments! So actually, the ES5 targeting is my conscious choice for supporting Internet Explorer 11.

Otherwise, you can see the use of the latest and greatest features in the TypeScript version: https://github.com/nayuki/QR-Code-generator/blob/master/type...

I began this project in 2016 because I got disappointed by code quality when browsing online for C/C++ QR libs. The JavaScript versions were even worse, especially ones that ported C code poorly and verbosely. On my web page, the bottom section titled "Compared to competitors" contains a detailed commentary.

On a related note, here you can learn about how QR Codes work at a low level: https://www.nayuki.io/page/creating-a-qr-code-step-by-step


Just wanted to compliment you, this is a seriously impressive amount of work.

I deal with QR codes at work (we use them for stock tracking) and the libraries previous Dev used aren't a patch on yours :).


> High-quality QR Code generator library in Java, JavaScript, Python, C++, C, Rust, TypeScript

Excellent work! Really appreciate you open-sourcing this.

In addition to its usefulness for QR code generation, having the same library in these different languages is educational for further study.


One good thing about ES5 code is that it is ES6 code. ES6 is essentially a superset. Why refactor it when it works already and will always be more compatible as it is?


Are you saying you don't like qifi's implementation?


qrcode on npm is pretty good. Very simple to use if you just need to convert a string to a QR code, and it has some advanced options if you want to get fancy.

https://www.npmjs.com/package/qrcode


Anyone from Google know what the deal is with barcode scanners on Android, zxing is in "maintenance mode" we have recently added QR scanning to our app and the experience on iOS is far superior (integrated, faster etc). Or do you have to mothball zxing for a period of time before launching a new "scanner product" to get that team promoted before abandoning it as part of the Google SDLC (Build, Promote, Abandon)


ZXing isn't an official Google product, although it was created by an ex-Googler (perhaps still at Google at the time).

Google itself has a "Barcode API", but they seem to recommend "ML Kit" these days.


Yeah that API was a no-go for me, as I don't really want to share all that data with Google. So I was stuck with ZXing.


ML Kit runs on-device if sending to Cloud is your worry.


Thanks, I didn't know ML Kit had barcode scanning


I believe you can use the Google Goggles app to read QR codes, but I no longer have an Android phone to try it out.


Thanks, looks like that's in the abandon phase, "Final Release 1.9.4 / August 20, 2018; 10 months ago" [1]

[1]https://en.wikipedia.org/wiki/Google_Goggles


Ah another team (Google Lens) must be in the dev / promote phase, also looks like android 9+ has integrated scanner, so sweet, I can use that in 6 years time when I can get the min SDK to that... https://medium.com/turunen/scan-qr-codes-by-google-lens-907d...


> also looks like android 9+ has integrated scanner

I made the decision of not installing play services or emulation layers on my phone, and I can confirm a bunch of low-key apps do not work because of this. That functionality is now considered part of the base system, and only a few applications come with they'd reimplementation of barcode scanning. WhatsApp, for example, has its own, probably for evil reasons :) AOSP is progressively becoming less useful, and there is no open alternative. Alarming.


Interesting, at least zxing was open source and kinda embeddable [1] Goggles / Lens certainly aren't :-( I share your alarm, would be nice if barcode scanning (amongst others) were part of AOSP. Alas this would detract from Googles ability to track what you scan

[1]https://github.com/journeyapps/zxing-android-embedded


Yeah, hopefully Plasma Mobile, UBPorts, PureOS or some other project catches up before the proprietary parts of Android eats AOSP too much. Anyway, I'm looking forward this in any case.


Coincidentally, as of this week, Plasma (KDE) adds a feature to see the QR code of a network "for easy sharing with others"

- https://pointieststick.com/2019/07/21/kde-usability-producti...

- https://phabricator.kde.org/D22457

Also, I really like KDE clipboard's manager feature that turns what you copied into a QR code, making it easy to pass data from the computer to a phone. KDE Connect goes further by allowing sharing the clipboard between a phone and a computer but:

- at times, KDE connect is unavailable without tweaking because you are on a WiFi connection that does not allow communication between devices

- you might not want to share the clipboard between the computer and the phone for privacy reasons

- you may want to share something to somebody else's phone


Neat!

You could update/simplify your Android instructions: the stock camera app will detect QR codes and present a button to connect to the network in the link (tested using Pixel 3 running Android Pie)

edit: per the below comment, this is the app, which may or may not be installable on your phone: https://play.google.com/store/apps/details?id=com.google.and...


Oh this is great. I first tried it with Google Lens, which supports normal QR codes, but unfortunately didn't do anything at all with these.


>the stock camera app

Unfortunately this isn't helpful because each manufacturer has their "stock" camera app.


I love that this is supported on iOS. I was curious to know about more supported shortcuts, and found this list:

https://9to5mac.com/2017/06/12/top-10-qr-codes-supported-by-...


Its been so nice since iOS has had a QR code reader natively in the camera for a few years

Mobile devices having this natively was a dream back in the beginning of the decade

Android OS doesnt have this natively so the devices dont reliably have that still

Reason 25 to just stay away since there a fundamental limitations to android getting better that have nothing to do with overpowered hardware and customization


Native QR code reader integrated into the camera was just added to my Galaxy S8+ with the July update.


could you please share screen record on implementation ?


I am kinda pissed that after all this time, Android doesn't natively support that and instead still rely on third-party apps. IMO it should be mandatory that all camera apps that comes with a device on Android be able to read all sorts of QR codes.


How is this 2019 and Android doesn’t natively scab QR codes?


I believe you can use the Google Goggles app to read QR codes, but I no longer have an Android phone to try it out. It’s not a default app for whatever reason.


Could be a variety of factors ranging from apathy to intellectual property, very unlikely to be the OEM hardware or software variances, but it also could be

At this point just bet on winners


Last I checked, the Pixel phones did this with the Camera app, but the One Plus did not.

Why can't Google add this to the "Android certification" to force everyone to read QR codes on the default Camera application


To make the usual Google joke, because nobody thinks they can get a promotion out of improving QR support?


yup, android is delaying QR mass adoption with its fragmentation. Google Lens / Assistant / Google ?

iOS implementation is on the contrast pure joy to use.

- founder of web platform


So funny that it used to be the other way around, with nfc and a few other features

After iPhone 6 Apple took all the features that worked on android, adding them to iOS and got a lot of converts who never looked back


Inspite of captive portal being everywhere this is a very good tool for SME's/hotels which doesn't afford to have portal. Good job mate.


I've got a wifi QR code printed and hung on the wall of my apartment. It's nice to be able to tell guests to just scan the QR code instead of giving them my very long wifi password.


I can crash Settings on my up to date Galaxy Note 9 by entering enough 'a's as SSID and password. Wonder if it's more than a crash?


That's Samsung in general. I have a TV that can't handle long passwords.


This is fantastic. I'm going to 3d print the code and make a placard for the guest WiFi at my place :)


Ok, so someone already did this...

https://www.thingiverse.com/thing:3181601


Is that thing even scannable? Or do they paint the embossed parts for extra contrast?


From the description on the page:

> You need to print this with a light color on the bottom and a darker color on the top layers, otherwise it will not scan correctly.


You would have to paint it or print two-color. You can print simple things like signage using a technique called a filament change.


Here is one based on jquery-qrcode [1]. http://qrtrack.com/

[1] https://larsjung.de/jquery-qrcode/


Looks like Android Q has support for reading WiFi QR codes.

To scan a code, tap the button on the far right of the "Add network" line in the WiFi settings.

https://www.androidpolice.com/2019/03/13/android-q-lets-you-...


Does anyone know why none of the popular banking and alt-banking apps support SEPA payments vi QR code?


Banks are some of the most conservative institutions on earth. They also have a lot to lose if they do it wrong, so progress is usually slow. There are some who go against the grain, though, like for instance Revolut.


Neither Revolut nor Monese do that. Not sure Revolut supports SEPA payments at all.


Im not really familiar with how qr codes actually work, ive wondered before if its possible to add multiple networks/passowrds from a single qr code, or does it not work that way?


If I remember correctly, no. The encoded string has a format like `WIFI:T:WPA;S:mynetwork;P:mypass;;` (see https://cweiske.de/tagebuch/wifi-config-qrcode.htm).

It's up to the qr code scanner to share the string with the appropriate app.


On a similar note, I created a very small and convenient service for client-side generation of QR codes

http://qrgen.xyz/


>Maemo

Oh the memories! Makes me wonder how Neo900 is doing...


Do regular people (outside the tech bubble) even use QR codes anymore?

Using them involves installing a reader app, and even when embedded in phone camera apps, the functionality is hidden or implicit.

QR codes look cool and feel like the future, but they seem like something that never really materialized in becoming widespread to the general populace.

Not arguing against this product per se, but QR codes in general...


QR Codes for payment are absolutely _huge_ in China & a few other countries. So is QR Codes for authentication (WeChat & WhatsApp use them) and a few other uses.


I feel like both Google and Apple has just want QR codes to go away. Some of their apps use QR codes for very specific purposes, like setups, but neither of them provide a generic QR code scanning app.

The Twitter app on Android actually has a built in generic QR scanner for whatever reason, but for most purposes I use ZXing team's Barcode Scanner app. I've been looking towards using a QR code keyboard to semi-safely let me input complex passwords in apps.

[EDIT] Another reply notes that the Apple camera app actually does scan QR codes out of the box. I haven't used an iPhone / iPod in years so made an incorrect guess.

[EDIT] Apparently some Google made Android phones do actually have some QR code support in the default camera app, but the Nexus 6P (Huawei, but under the now defunct Nexus program) certainly doesn't.


The Google Assistant/Lens stuff on Android phones has QR scanning integrated.


iOS 12 Camera app can scan QR codes.


iOS also 13 has built in qr-code scanner accessible from the control center.


I took this image [1] yesterday in a fairly nice italian restaurant in Vientiane, Laos.

It stood out to me because of all the qrcodes and because they are all Chinese payment providers. China is building dams, roads and railways all across Laos. The workers bring their families. The families need to eat. Apparently, they like italian food.

I could go on and talk about thoughts on Libra related to this, but I would probably get downvoted. =)

[1] https://imgur.com/a/SFuqTkM


It looks like there are two Laotian payment providers -- BCEL OnePay and LDB Trust -- and two Chinese payment providers -- WeChat (which has two signs there) and AliPay.

Here in Southeast Asia, many payment providers are springing up and they all use the same QR-code approach that the original WeChat and AliPay use, so it makes sense that BCEL and LDB Trust are doing the same.


The only non-tech legit use I've seen is coffee shops loyalty points. Although you could go in and scan the code every day without buying a coffee.


Could you just take a picture of it and reuse it later?


You could! Unless they are changing the code every day but I doubt it.


I'm just surprised that it hasn't taken off in the West. It's super useful for a lot of things. I suspect that a lack of QR code implementation in apps for Facebook and Twitter has a lot to do with it. Kinda prevents mass adoptions when they haven't found a usecase for it, though all those Asian sites clearly have.


More used in places where the local alphabet isn't latin characters and remembering/typing latin-based URLs, usernames and email addresses is more difficult. (although even there they rely more on "do a web search on this phrase")


Scanning a venmo code is a daily occurence for younger people these days. Same with the snapchat codes. Its quick and easy, especially for drunk people. QR codes rock, but yeah, they need to be adopted as standard by google and apple.


TPAs (credit card readers) in Portugal use QR Codes to let you pay your meals via phone. It’s pretty seamless.


iOS camera reads QR codes by default. Just point your phone with the default camera app ON. No special mode required. I have a qr code printed on my living room (made to look like andy warhold art, with multiple colored panels etc) so that guests can use the wifi. Pretty convenient.


Sounds great.

But I explicitly asked "outside the tech bubble".

Do real end users even know that these features exist? I've barely seen anyone use QR codes in the wild.

I feel my question was misinterpreted - it's not that I don't find QR codes useful or that technical people don't use them, but I believe the widespread populace aren't aware of the features that allow their use.


Well, the fact that one of the biggest phone OS supports QR codes natively in the camera, severely reduces the friction that comes from "what's that weird thing, oh it's called a QR code, here's download this app on the appstore. No, not that one, it has a bitcoin miner in it. Yes the free one". Just point your phone to it and it works! Now whether the world outside caught on, or not... where I am from definitely not, however the biggest barrier was the problem I described above.


Last year, my entire track team had to sign up by QR code.

Personally, I think that QR codes will only ever become more ubiquitous- there's plenty of easy QR code generators out there- as people move towards mobile devices and things that have always-accessible cameras.

Not many people like typing in long URL's to get somewhere.


Argh, no support for WPA Enterprise??? We're literally stuck with open unencrypted networks with captive portal sign on because the configuration process for WPA Enterprise is so convoluted. This would have been far more helpful if it supported the networks that actually have a bunch of configuration data rather than just an SSID and a password.


Perhaps you could offer some help with the project? :)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: