3. What is a Pass? ii
• Barcode (2D formats)
• SerialNumber is the unique Id
* not same as the barcode data
• 5 Types : Coupon, Generic, StoreCard,
BoardingPass, EventTicket
4. What is a Pass? iii
{
• ZIP file "passTypeIdentifier":"com.xamarin.passkitdoc.banana",
"formatVersion":1,
"organizationName":"Xamarin",
"serialNumber":"12345436XYZ",
• Pass.json "teamIdentifier":"XXXAAA1234",
"description":"Xamarin Demo",
"foregroundColor":"rgb(54,80,255)",
"backgroundColor":"rgb(209,255,247)",
• Images "labelColor":"rgb(255,15,15)",
"logoText":"Banana ",
"barcode":{
"altText":"FREE-BANANA",
"format":"PKBarcodeFormatQR",
"message":"123456",
"messageEncoding":"iso-8859-1"
},
/* The following fields are specific to which type of pass. The name of this object specifie
boardingPass below implies this is a boarding pass. Other options include storeCard, generic,
eventTicket */
"boardingPass":{
/*headerFields, primaryFields, secondaryFields, and auxiliaryFields are arrays of field object
key, label, and value*/
"headerFields":[ //Header fields appear next to logoText
{
"key":"h1-label", //Must be unique. Used by iOS apps to get the data.
"label":"H1-label", //Label of the field
"value":"H1" //The actual data in the field
},
5. (extra bits)
What is a Pass? iv
• Relevance : locations (<10) & datetime (1)
"relevantDate" : "2012-10-17T09:00-05:00",
"locations" : [
{
"longitude" : -122.3748889,
"latitude" : 37.6189722
},{
"longitude" : -122.03118,
"latitude" : 37.33182
•
}],
Related App Store apps
"associatedStoreIdentifiers" : [562123362],
• Custom text
"backFields" : [ {
"key" : "terms",
"label" : "TERMS AND CONDITIONS",
"value" : "Generico offers this pass......"
• Web Service URL : register/delete/APNS pull updates
"webServiceURL" : "https://example.com/passes/",
"authenticationToken" : "qwerty123567890asdfpoiuyt",
6. (manifest & sign)
Make a Pass
• Must be an “Apple Developer”
• Provisioning Portal : Pass Type ID
• Requires various root certificates
• signpass
7. Make a Pass ii
• Edit JSON
• Edit images
• (manifest & sign)
DEMO(?)
• ZIP
Apple’s sample (you have to build yourself)
https://developer.apple.com/downloads/index.action?name=Passbook
8. (testing)
Make a Pass iii
• Watch Console (Xcode)
• Log should tell you what
went wrong
• HTTP (non-secure) can be used
only while testing APNS+updates
9. Scan Pass
push update notification
Add Pass
Apple
APNS servers
Passbook Update
database
Scanner
register request notification
pass changed of change
data P.O.S.
generate & sign pass
web
Your
make changes to pass service
Add Pass certificate for signing passes
server
sign-pass images and JSON resources
used to generate passes
Companion
Apps pass & device
Your app database
email attachments
web links
Conduit Mail
Safari
Apps (others)
10. Passbook
• Stores & manages Passes
• Renders barcode for scanning
(Apple: your app should not perform this function)
• Receives notifications and makes web-service calls
11. (Pass pass-thru)
Conduit Apps
• Summary display and Add
• Mail
• Safari
• <your app>?
(probably not)
12. Companion Apps
• YOUR APP
• Configure App ID in Provisioning Portal
• Generate Provisioning Profiles in Portal
(after configuring the App ID)
• Configure app Entitlements.plist
plus Team ID!
13. Companion Apps ii
• Access YOUR Passes
Team ID, certificates
• Read from a standard set of
properties (text, icon)
• Access custom properties
by JSON “key”
14. Companion Apps iii
• Companion apps can appear to “generate” Passes
• eg. Starbucks app : adds and updates Passes
• eg. Collect user data (or payment) in your app,
then add a Pass
• DO NOT GENERATE PASSES IN APP
• It requires your certificates to sign; they should be kept secure
• Create your own webservice to deliver the Pass file
15. Scanning Apps
• YOUR APP or a Point of Sale system or ???
• Only chance to “implement security”
(a duplicate Pass is as easy as a screenshot)
• Update server in real-time
• Can trigger APNS > Pass update (eg. store card balance)
16. (MonkeyScan & Azure)
Scanning Apps ii
MonkeyScan sample
• Microsoft Azure Mobile Services
• Xamarin Client Library
public static readonly MobileServiceClient MobileService = new MobileServiceClient (Constants.AzureUrl, Constants.AzureKey);
public static readonly IMobileServiceTable<ConfScan> scanTable = MobileService.GetTable<ConfScan>();
// then...
public TaskScheduler scheduler = TaskScheduler.FromCurrentSynchronizationContext();
// and then...
AzureManager.scanTable.InsertAsync (scan)
.ContinueWith (t => {
if (t.Status == TaskStatus.RanToCompletion)
Console.WriteLine ("Updated scan in cloud " + t.Status + " " + t.Id);
else
; // error handling or store and retry...
} , scheduler);
17. (MonkeyScan)
Scanning Apps iii
• Configure account
• Create tables
• Columns will be
dynamically created
18. (MonkeyScan)
Scanning Apps iv
• MonkeySpace attendees
are on-time!
• App has real-time count
•
19. Updates with APNS
"webServiceURL" : "https://example.com/passes/",
"authenticationToken" : "vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc",
Apple Scanner
push update notification
APNS servers
Update
database
P.O.S.
notification
of change
register pass : pushToken
dissociate pass web
register pass : pushToken
service
Your certificate for signing passes
server
sign-pass images and JSON resources
used to generate passes
Passbook
20. Updates with APNS ii
• REST web service : Apple’s defined format
• Register : when pass is added
POST webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber
•
pushToken
Delete : shredder!
DELETE webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier/serialNumber
• Update : build and send new data (same serial #)
GET webServiceURL/version/passes/passTypeIdentifier/serialNumber
• Get Serial Numbers for Device
GET webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier?passesUpdatedSince=tag
• Error Logging (optional)
POST webServiceURL/version/log
21. Scan Pass
push update notification
Add Pass
Apple
APNS servers
Passbook Update
database
Scanner
register request notification
pass changed of change
data P.O.S.
generate & sign pass
web
Your
make changes to pass service
Add Pass certificate for signing passes
server
sign-pass images and JSON resources
used to generate passes
Companion
Apps pass & device
Your app database
email attachments
web links
Conduit Mail
Safari
Apps (others)