applepassgenerator


Nameapplepassgenerator JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://primedigitalglobal.github.io/applepassgenerator
SummaryPython package to create passes compatible with Apple Wallet.
upload_time2023-01-04 09:22:05
maintainerVikalp Jain
docs_urlNone
authorPrimedigital Global
requires_python>=3.9,<4.0
licenseMIT
keywords apple pass apple wallet passbook applepassgenerator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Apple Pass Generator

Python library to generate passes i.e (.pkpass) files compatible with Apple Wallet (former Passbook).

## Table of Contents

- [💾 Installation](#-installation)
- [🍎 Apple docs](#-apple-docs)
- [📝 Configuration](#-configuration)
- [🚀 Usage](#-usage)
- [📜 Code Of Conduct](#code-of-conduct)

### 💾 Installation

To easily install or upgrade to the latest release, use pip.

```
$ pip install applepassgenerator
```

### 🍎 Apple docs

From now on, some stuff is much better explained on the Apple docs, so when in doubt just check (if you haven't done so) the following documents:

- [Wallet Portal](https://developer.apple.com/wallet/)
- [Wallet Developer Guide](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/index.html#//apple_ref/doc/uid/TP40012195)
- [Crypto Signatures](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW55)
- [PassKit Package Format Reference](https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/Introduction.html#//apple_ref/doc/uid/TP40012026)

### 📝 Configuration

To start using the lib, some Apple files are needed, as well as some action in order to convert them to more friendly formats:

- Get Pass Type ID
    - Go to the [Apple Developer page ➵ Identifiers ➵ Pass Type IDs](https://developer.apple.com/account/ios/identifiers/passTypeId/passTypeIdList.action).
    - Next, you need to create a pass type ID. This is similar to the bundle ID for apps. It will uniquely identify a specific kind of pass. It should be of the form of a reverse-domain name style string (i.e., pass.com.example.appname).

- Generate the necessary certificate
    - After creating the pass type ID, click on Edit and follow the instructions to create a new Certificate.
    - Once the process is finished, the pass certificate can be downloaded. That's not it though, the certificate is downloaded as `.cer` file, which need to be converted to `.p12` in order to work. If you are using a Mac you can import it into Keychain Access and export it as `.p12`from there.
    - if now you have `certificate.p12` file follow the steps below to convert it to `certifictate.pem`

        ```markdown
        $ openssl pkcs12 -in certificate.p12 -clcerts -nokeys -out certificate.pem
        ```

- Generate the key.pem

    ```markdown
    >$ openssl pkcs12 -in certificate.p12 -nocerts -out private.key
    ```

    Note: While generating this `private.key` file you will be asked for a PEM pass phrase which will be used as the `CERTIFICATE_PASSWORD` attribute throughout the Package.

- Getting WWDR Certificate

    - If you have made iOS development, you probably have already the Apple Worldwide Developer Relations Intermediate Certificate in your Mac’s keychain.
    - If not, it can be downloaded from the [Apple Website](https://www.apple.com/certificateauthority/) (on `.cer` format). This one needs to be exported as `.pem`, It can be exported from KeyChain into a `.pem` (e.g. wwdr.pem).

### 🚀 Usage

```python
from applepassgenerator import ApplePassGeneratorClient
from applepassgenerator.models import EventTicket

card_info = EventTicket()
card_info.add_primary_field('name', 'Tony Stark', 'Name')
card_info.add_secondary_field('loc', 'USA', 'Country')

team_identifier = "1234ABCDEF"
pass_type_identifier = "pass.com.project.example"
organization_name = "Primedigital Global"

applepassgenerator_client = ApplePassGeneratorClient(team_identifier, pass_type_identifier, organization_name)
apple_pass = applepassgenerator_client.get_pass(card_info)

# Add logo/icon/strip image to file
apple_pass.add_file("logo.png", open("<path>/logo.png", "rb"))
apple_pass.add_file("icon.png", open("<path>/icon.png", "rb"))

CERTIFICATE_PATH = "<path-to-file>/certificate.pem"
PASSWORD_KEY = "<path-to-file>/password.key"
WWDR_CERTIFICATE_PATH = "<path-to-file>/wwdr.pem"
CERTIFICATE_PASSWORD = "<password>"
OUTPUT_PASS_NAME = "mypass.pkpass"

apple_pass.create(CERTIFICATE_PATH, PASSWORD_KEY, WWDR_CERTIFICATE_PATH, CERTIFICATE_PASSWORD, OUTPUT_PASS_NAME)
```

### Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, we have a code of conduct, which can be found [here](CODE_OF_CONDUCT.md). We ask you to treat everyone as a smart human programmer that shares an interest in Python and Apple Pass Generator with you.

            

Raw data

            {
    "_id": null,
    "home_page": "https://primedigitalglobal.github.io/applepassgenerator",
    "name": "applepassgenerator",
    "maintainer": "Vikalp Jain",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "vikalp@primedigital.tech",
    "keywords": "apple pass,apple wallet,passbook,applepassgenerator",
    "author": "Primedigital Global",
    "author_email": "oss@primedigital.tech",
    "download_url": "https://files.pythonhosted.org/packages/5a/f7/f3cce51ef9fe5af39cec319e687d298c10b8d1a4b0945884ef31d84037e9/applepassgenerator-0.0.1.tar.gz",
    "platform": null,
    "description": "# Apple Pass Generator\n\nPython library to generate passes i.e (.pkpass) files compatible with Apple Wallet (former Passbook).\n\n## Table of Contents\n\n- [\ud83d\udcbe Installation](#-installation)\n- [\ud83c\udf4e Apple docs](#-apple-docs)\n- [\ud83d\udcdd Configuration](#-configuration)\n- [\ud83d\ude80 Usage](#-usage)\n- [\ud83d\udcdc Code Of Conduct](#code-of-conduct)\n\n### \ud83d\udcbe Installation\n\nTo easily install or upgrade to the latest release, use pip.\n\n```\n$ pip install applepassgenerator\n```\n\n### \ud83c\udf4e Apple docs\n\nFrom now on, some stuff is much better explained on the Apple docs, so when in doubt just check (if you haven't done so) the following documents:\n\n- [Wallet Portal](https://developer.apple.com/wallet/)\n- [Wallet Developer Guide](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/index.html#//apple_ref/doc/uid/TP40012195)\n- [Crypto Signatures](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW55)\n- [PassKit Package Format Reference](https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/Introduction.html#//apple_ref/doc/uid/TP40012026)\n\n### \ud83d\udcdd Configuration\n\nTo start using the lib, some Apple files are needed, as well as some action in order to convert them to more friendly formats:\n\n- Get Pass Type ID\n    - Go to the [Apple Developer page \u27b5 Identifiers \u27b5 Pass Type IDs](https://developer.apple.com/account/ios/identifiers/passTypeId/passTypeIdList.action).\n    - Next, you need to create a pass type ID. This is similar to the bundle ID for apps. It will uniquely identify a specific kind of pass. It should be of the form of a reverse-domain name style string (i.e., pass.com.example.appname).\n\n- Generate the necessary certificate\n    - After creating the pass type ID, click on Edit and follow the instructions to create a new Certificate.\n    - Once the process is finished, the pass certificate can be downloaded. That's not it though, the certificate is downloaded as `.cer` file, which need to be converted to `.p12` in order to work. If you are using a Mac you can import it into Keychain Access and export it as `.p12`from there.\n    - if now you have `certificate.p12` file follow the steps below to convert it to `certifictate.pem`\n\n        ```markdown\n        $ openssl pkcs12 -in certificate.p12 -clcerts -nokeys -out certificate.pem\n        ```\n\n- Generate the key.pem\n\n    ```markdown\n    >$ openssl pkcs12 -in certificate.p12 -nocerts -out private.key\n    ```\n\n    Note: While generating this `private.key` file you will be asked for a PEM pass phrase which will be used as the `CERTIFICATE_PASSWORD` attribute throughout the Package.\n\n- Getting WWDR Certificate\n\n    - If you have made iOS development, you probably have already the Apple Worldwide Developer Relations Intermediate Certificate in your Mac\u2019s keychain.\n    - If not, it can be downloaded from the [Apple Website](https://www.apple.com/certificateauthority/) (on `.cer` format). This one needs to be exported as `.pem`, It can be exported from KeyChain into a `.pem` (e.g. wwdr.pem).\n\n### \ud83d\ude80 Usage\n\n```python\nfrom applepassgenerator import ApplePassGeneratorClient\nfrom applepassgenerator.models import EventTicket\n\ncard_info = EventTicket()\ncard_info.add_primary_field('name', 'Tony Stark', 'Name')\ncard_info.add_secondary_field('loc', 'USA', 'Country')\n\nteam_identifier = \"1234ABCDEF\"\npass_type_identifier = \"pass.com.project.example\"\norganization_name = \"Primedigital Global\"\n\napplepassgenerator_client = ApplePassGeneratorClient(team_identifier, pass_type_identifier, organization_name)\napple_pass = applepassgenerator_client.get_pass(card_info)\n\n# Add logo/icon/strip image to file\napple_pass.add_file(\"logo.png\", open(\"<path>/logo.png\", \"rb\"))\napple_pass.add_file(\"icon.png\", open(\"<path>/icon.png\", \"rb\"))\n\nCERTIFICATE_PATH = \"<path-to-file>/certificate.pem\"\nPASSWORD_KEY = \"<path-to-file>/password.key\"\nWWDR_CERTIFICATE_PATH = \"<path-to-file>/wwdr.pem\"\nCERTIFICATE_PASSWORD = \"<password>\"\nOUTPUT_PASS_NAME = \"mypass.pkpass\"\n\napple_pass.create(CERTIFICATE_PATH, PASSWORD_KEY, WWDR_CERTIFICATE_PATH, CERTIFICATE_PASSWORD, OUTPUT_PASS_NAME)\n```\n\n### Code of Conduct\n\nIn order to foster a kind, inclusive, and harassment-free community, we have a code of conduct, which can be found [here](CODE_OF_CONDUCT.md). We ask you to treat everyone as a smart human programmer that shares an interest in Python and Apple Pass Generator with you.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package to create passes compatible with Apple Wallet.",
    "version": "0.0.1",
    "split_keywords": [
        "apple pass",
        "apple wallet",
        "passbook",
        "applepassgenerator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2233a2558266b502ef62a23d436bafc8ccf12c67162e9c3cd9ef8f8633c16882",
                "md5": "d02a2b0e93636881a98046297cf19e1a",
                "sha256": "e072e60f8f05a7a9aaaea8cae8561a05dbc571f200e6e1a7274c6319b43067ab"
            },
            "downloads": -1,
            "filename": "applepassgenerator-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d02a2b0e93636881a98046297cf19e1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 8758,
            "upload_time": "2023-01-04T09:22:04",
            "upload_time_iso_8601": "2023-01-04T09:22:04.256545Z",
            "url": "https://files.pythonhosted.org/packages/22/33/a2558266b502ef62a23d436bafc8ccf12c67162e9c3cd9ef8f8633c16882/applepassgenerator-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5af7f3cce51ef9fe5af39cec319e687d298c10b8d1a4b0945884ef31d84037e9",
                "md5": "1dc7fb27563787298b615a1157d3a6eb",
                "sha256": "0bcc59ca34337fe6be6ffee3cf7b2a648226d81fc00176fa898b2c3b9246edc4"
            },
            "downloads": -1,
            "filename": "applepassgenerator-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1dc7fb27563787298b615a1157d3a6eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 8830,
            "upload_time": "2023-01-04T09:22:05",
            "upload_time_iso_8601": "2023-01-04T09:22:05.481093Z",
            "url": "https://files.pythonhosted.org/packages/5a/f7/f3cce51ef9fe5af39cec319e687d298c10b8d1a4b0945884ef31d84037e9/applepassgenerator-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-04 09:22:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "applepassgenerator"
}
        
Elapsed time: 0.05927s