From 72923a49085b50e63dd47d747d7dea6880e8c6d0 Mon Sep 17 00:00:00 2001 From: "daniel.pal" Date: Tue, 19 Dec 2023 20:25:26 +0100 Subject: [PATCH 1/2] Fixed locations key in the pass.json . --- passbook/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passbook/models.py b/passbook/models.py index eecd43b..bd6e0e7 100755 --- a/passbook/models.py +++ b/passbook/models.py @@ -405,7 +405,7 @@ def json_dict(self): if self.logoText: d.update({'logoText': self.logoText}) if self.locations: - d.update({'locations': self.locations}) + d['locations'] = self.locations if self.ibeacons: d.update({'beacons': self.ibeacons}) if self.userInfo: From 972d0f99ae779c27fa08806e3fa61f3438a505a8 Mon Sep 17 00:00:00 2001 From: "daniel.pal" Date: Tue, 19 Dec 2023 20:27:12 +0100 Subject: [PATCH 2/2] Added nfc, sharingProhibited, and requiresAuthenticaiton functionalities for passes. --- passbook/models.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/passbook/models.py b/passbook/models.py index bd6e0e7..a538c4c 100755 --- a/passbook/models.py +++ b/passbook/models.py @@ -235,7 +235,11 @@ def __init__(self): class Pass(object): def __init__(self, passInformation, json='', passTypeIdentifier='', - organizationName='', teamIdentifier=''): + organizationName='', teamIdentifier='', + nfc_message=None, + encryption_public_key=None, + sharingProhibited=None, + requiresAuthentication=False): self._files = {} # Holds the files to include in the .pkpass self._hashes = {} # Holds the SHAs of the files array @@ -298,6 +302,17 @@ def __init__(self, passInformation, json='', passTypeIdentifier='', self.passInformation = passInformation + # Create an NFC pass + self.nfc_message = nfc_message + # Public encryption key + self.encryption_public_key = encryption_public_key + + # This one prevents users from sharing passes with older iOS versions and bypassing the authentication requirement. + self.sharingProhibited = sharingProhibited + + # It's a Boolean value that indicates whether the NFC pass requires authentication. + self.requiresAuthentication = requiresAuthentication + # Adds file to the file array def addFile(self, name, fd): self._files[name] = fd.read() @@ -423,6 +438,15 @@ def json_dict(self): if self.webServiceURL: d.update({'webServiceURL': self.webServiceURL, 'authenticationToken': self.authenticationToken}) + if self.nfc_message: + d['nfc'] = { + 'message': self.nfc_message, + "encryptionPublicKey": self.encryption_public_key, + "requiresAuthentication": self.requiresAuthentication + } + if self.sharingProhibited: + d.update({"sharingProhibited": self.sharingProhibited}) + return d