As today’s post title suggest I’ve been having some fun with Apple PassKit passes and I wanted to share my findings with you.
Disclaimer: As fellow developers know we have our own understanding of ‘having fun‘ and in this particular case it involves messing around with certificates, digital signatures and SHA1 hashes, well-formed JSON syntax and firing up a precise chain of console commands…
Having spent a lot of time on the road the last couple of years I came to appreciate Apple’s PassKit technology and the convenience it brings. Fortunately my favorite airline has been supporting it from early-on and so I enjoyed the ease of using a digital boarding pass & getting all relevant information auto-magically displayed on the lock-screen of my mobile phone as soon as I got close to the airport. Ever since I’ve been interested in being able to create my own passes in order to extend this convenience factor to other scenarios.
During my research I stumbled upon a great tutorial that explains the entire process of creating a Passkit pass by hand in great detail. Instead of repeating it all here I’d recommend everyone interested to read the following blog posts:
Once you’ve gone through it step-by-step you’ll understand that it surely is no rocket science, yet the whole process of creating SHA1 hashes and obtaining certificates and signing them is … well, tedious to say the least.
Being the lazy developer that I am I was of course quick to search for libraries that would ease the pain and I didn’t have to search for to long until I stumbled upon the jPasskit project on github. It’s a small library, but given that it gets the trick done that’s a great thing!
By looking at the provide jUnit tests I was able to get the heck of it quite fast and in no time I had created a utility class that wraps the signing and packaging aspect into a single method – voilà.
I’ve compiled a little sample project on our github page, so if you’re interested in giving it a try – please head over there:
Oh, and before I call it a day… here’s the result:
You can download the pass here 😉
In part 2 I’ll dig a bit deeper and look into advanced topics such as relevance information (e.g. geo-fencing) and updating of passes. Until then… cheers & have fun coding!