alexandercerutti / passkit-generator

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

Beacon minor/major validation is stricter than needed #157

Closed AbdelrahmanHafez closed 1 year ago

AbdelrahmanHafez commented 1 year ago

Running OS

macOS Ventura 13.4

Running Node Version

Node v18.16.0

Description

In the Proximity Beacon Specification and the Getting Started with iBeacon guide from Apple, it's mentioned that major/minor are used purely as ways to divide beacons into categories, and the numbers themselves have no special meaning. So that if I own Starbucks, I can go ahead and give all the beacons in Starbucks uuid: 'Starbucks' and then give each country a major number, and each city a minor number.

Currently, there is Joi validation on beacons that is unnecessarily too strict, asserting that:

Expected behavior

I expect the following to work without any errors:

pass.setBeacons({
  uuid: 'Starbucks',
  major: 0,
  minor: 1
});
alexandercerutti commented 1 year ago

Hey @AbdelrahmanHafez, I've been looking into your issue. First of all, thank you very much for using passkit-generator!

That's interesting: I've never used beacons, so I probably made some assumptions over time. I set min(0) on minor, of course, due to the fact that major should always be higher than minor, but I'm not sure anymore about this.

So, I can guess you are right. I will look into your PR soon. Thank you!