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:

https://github.com/SAP/cloud-passkit-demo

Oh, and before I call it a day… here’s the result:

/wp-content/uploads/2014/03/saphcp_devedition_coupon_420260.jpg

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!

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Vladimir Pavlov

    Hey Matthias, it’s truly fun! I don’t see why you bothered to add that disclaimer 🙂

    And what a nice and nifty pass 😎

    Do you intend to have part 2 running on HCP – perhaps for sending notifications for pass updates? I think I already have an idea what the updates could be 😉

    (0) 
  2. Robin van het Hof

    This is actually quite interesting!

    To be honest, my biggest takeaway of your blog is that I was totally unaware I could get my airline ticket presented on my iPhone as I approach the airport… this is so much more convenient!

    Thinking of it, there are so many possibilities — libraries, retail, airmiles, etc.

    And although I certainly like the highly visible — sometimes even Cherokee-style ornated 😉 — SAP TechEd/d-code ID badges, having a pass in your phone may be an environmentally-friendly alternative as well

    (0) 

Leave a Reply