alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js
MIT License
897 stars 109 forks source link

setExpirationDate: Defaulted to 9 Dec 2011 #211

Closed nagringapp closed 4 months ago

nagringapp commented 4 months ago

Running OS

iOS 17.4

Running Node Version

v20.11.1

Description

My Pass wasn't showing in the Wallet. I noticed it was added to the expired section.

I wasn't set the expiration date, so it supposed to be null. Once I noticed, I tried to use the setExpirationDate method and it didn't fix.

I have added the expirationDate in the Backfields to ensure it was setting to the right date (3 years later) and got it right, however the pass was still being added to the Expired Section.

Expected behavior

Does not set the expiration date by default, or set by the date defined.

alexandercerutti commented 4 months ago

Hi @nagringapp, thanks for using passkit-generator!

Expiration date is not set by default. Something else must be happening.

1) Between a test and another, are you deleting your pass? 2) Would you mind sharing your model, code and pkpass output?

Let me know!

nagringapp commented 4 months ago

Hi @alexandercerutti , thanks for the prompt response.

I noticed that my localhost NodeJS is running right, however it happens when I send it to AWS with the same code, and same certificates.

Yes, I'm always deleting the Pass.

How do I export the PkPass output?

alexandercerutti commented 4 months ago

@nagringapp

You can export by sharing the pass in Apple Wallet or you can invoke your endpoint from a desktop and get a pass downloaded.

By the way, if you say that it happens on AWS, probably it is something related to the region where the code is running. That's why I'm asking you to share your code, your model (pass.json) and the output.

nagringapp commented 4 months ago

Thanks @alexandercerutti , I've found one issue - the relevant date was in the Default .Pass file as I was following the demo and have forgotten to remove, my bad! However, I have now removed both expirationDate and relevantDate and the pass is still sitting on expiration section. Find attached the file. event-e93782f0-70e7-4cc3-93cb-1c489d5479e8-1722166409714.pkpass.zip

alexandercerutti commented 4 months ago

I wasn't able to open the unzipped pkpass file. Luckly, it was still conserving among the metadata the full URL where it got downloaded from, so I was able to download it again.

I see nothing wrong with the pass.json file itself. I think Wallet might be applying some sort of cache on the serialNumber property, but I'm not sure it is. You can try to generate a new file with all the same data but with a different serialNumber and see if it still happens.

Let me know!

nagringapp commented 4 months ago

Spot on! I've just renames the SerialNumber and it works as expected! Thanks for the guidance, that was my first adventure with Apple Pass and your Package it's pretty seamless to make it working!

May I take this opportunity to ask you two adivce?

  1. I noticed when I opened the pkpass the JSON file was readable. Is there a way to obfuscate it?

  2. I'm doing it for a web page. I'm creating the file and uploading it to a web server (Cloudinary) and making the link accessible through the Tag. Would you have any recommendation to handle it? (I noticed in iOS with Safari it works fine when clicking on the a link, however I tested on Chrome on an iPhone and it actually downloaded the file instead opening the Wallet).

alexandercerutti commented 4 months ago

I noticed when I opened the pkpass the JSON file was readable. Is there a way to obfuscate it?

All the data are readable except, I think, the private key. If you have the signature you can access to the certificates that have been used to generate it.

In general, I wouldn't consider this fact an issue. There is no sensible information in the pass.json theoretically.

All the information is open unless you add the property sharingProhibited - in that case it is more difficult to access to the pass itself.

I'm doing it for a web page. I'm creating the file and uploading it to a web server (Cloudinary) and making the link accessible through the Tag. Would you have any recommendation to handle it? (I noticed in iOS with Safari it works fine when clicking on the a link, however I tested on Chrome on an iPhone and it actually downloaded the file instead opening the Wallet).

Not exactly sure what to recommend here. I never had an issue with Chrome on iOS...

alexandercerutti commented 4 months ago

P.s. I forgot to thank you for your donation on OpenCollective ❤️

nagringapp commented 4 months ago

Thank you @alexandercerutti , your library is not just helpful and you provided a great and prompt support when I was navigating through challenges.

By the way kudos to https://www.youtube.com/watch?v=rJZdPoXHtzI&t=3s , it was the video that introduced to the library and helped me to go through all the certs steps.

Keep up the good work!

alexandercerutti commented 4 months ago

Thank you! You too!

The video is not mine btw, but it helped a lot.

May I ask you to leave a star to the project, if possible? :)

nagringapp commented 3 months ago

for sure, where about do I add a star?

alexandercerutti commented 3 months ago

Star button on top right of a repo page:

immagine