alexandercerutti / passkit-generator

The easiest way to generate custom Apple Wallet passes in Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beacon minor/major validation is stricter than needed

AbdelrahmanHafez opened this issue · comments

commented

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:

  • major has to be a positive number, which means that we can not set it to 0.
  • major has to be greater than minor, making major: 1, minor: 1000 an invalid scenario according to passkit-generator, even though it's perfectly fine by the spec.

Expected behavior

I expect the following to work without any errors:

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

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!