All Projects → aydenp → PassEncoder

aydenp / PassEncoder

Licence: MIT license
Simple PassKit (Apple Wallet) encoding and signing in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to PassEncoder

Redis
Vapor provider for RediStack
Stars: ✭ 434 (+1450%)
Mutual labels:  server-side-swift, swift-linux
Core
🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
Stars: ✭ 62 (+121.43%)
Mutual labels:  server-side-swift, swift-linux
Sockets
🔌 Non-blocking TCP socket layer, with event-driven server and client.
Stars: ✭ 559 (+1896.43%)
Mutual labels:  server-side-swift, swift-linux
routing-kit
🚍 High-performance trie-node router.
Stars: ✭ 95 (+239.29%)
Mutual labels:  server-side-swift, swift-linux
Mysql Kit
🐬 Pure Swift MySQL client built on non-blocking, event-driven sockets.
Stars: ✭ 159 (+467.86%)
Mutual labels:  server-side-swift, swift-linux
Jwt
Vapor JWT provider
Stars: ✭ 266 (+850%)
Mutual labels:  server-side-swift, swift-linux
Fluent
Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
Stars: ✭ 1,071 (+3725%)
Mutual labels:  server-side-swift, swift-linux
fluent-mysql-driver
🖋🐬 Swift ORM (queries, models, relations, etc) built on MySQL.
Stars: ✭ 69 (+146.43%)
Mutual labels:  server-side-swift, swift-linux
Api Template
💧 A starting point for Vapor APIs.
Stars: ✭ 130 (+364.29%)
Mutual labels:  server-side-swift, swift-linux
Open Crypto
🔑 Hashing (BCrypt, SHA2, HMAC), encryption (AES), public-key (RSA), and random data generation.
Stars: ✭ 115 (+310.71%)
Mutual labels:  server-side-swift, swift-linux
auth
👤 Authentication and Authorization framework for Fluent.
Stars: ✭ 51 (+82.14%)
Mutual labels:  server-side-swift, swift-linux
Htmlkit
A type-safe DSL that renders dynamic HTML templates in Swift
Stars: ✭ 229 (+717.86%)
Mutual labels:  server-side-swift, swift-linux
async
⏱ Promises and reactive-streams in Swift built for high-performance and scalability.
Stars: ✭ 35 (+25%)
Mutual labels:  server-side-swift, swift-linux
Leaf
🍃 An expressive, performant, and extensible templating language built for Swift.
Stars: ✭ 310 (+1007.14%)
Mutual labels:  server-side-swift, swift-linux
fluent-postgres-driver
🐘 PostgreSQL driver for Fluent.
Stars: ✭ 120 (+328.57%)
Mutual labels:  server-side-swift, swift-linux
Fluent Sqlite Driver
Fluent driver for SQLite
Stars: ✭ 51 (+82.14%)
Mutual labels:  server-side-swift, swift-linux
nodejs-passdock
PassDock API methods for iOS Wallet (PassBook)
Stars: ✭ 13 (-53.57%)
Mutual labels:  wallet, passbook
sqlite-kit
Non-blocking SQLite client library with SQL builder built on SwiftNIO
Stars: ✭ 51 (+82.14%)
Mutual labels:  server-side-swift, swift-linux
Vapor Clean
A Vapor 3 template with no additional cruft.
Stars: ✭ 80 (+185.71%)
Mutual labels:  server-side-swift, swift-linux
Http
🚀 Non-blocking, event-driven HTTP built on Swift NIO.
Stars: ✭ 220 (+685.71%)
Mutual labels:  server-side-swift, swift-linux

PassEncoder

Apple Wallet (formerly Passbook) pass encoding and signing in Swift.

Features

  • Modern Swift API
  • Allows you to specify custom pass data
  • Add other files (images, JSON, etc)
  • Manifest generation
  • Signing support
  • File system managed seamlessly
  • Get pass Data easily

Requirements

  • macOS 10.12+ or Linux (with zlib development package)
  • Xcode 9.0+
  • Swift 5.2+
  • OpenSSL

Installation

Swift Package Manager

Add the following line to your dependencies section of Package.swift:

.package(url: "https://github.com/aydenp/PassEncoder.git", .upToNextMajor(from: "1.0.0"))

and add "PassEncoder" to your target's dependencies.

Usage

// Create our encoder
if let encoder = PassEncoder(passDataURL: directory.appendingPathComponent("pass.json")) {
    // Add a nice icon
    encoder.addFile(from: directory.appendingPathComponent("icon.png"))
    let passData = encoder.encode(signingInfo: (certificate: URL_TO_CERT.PEM, password: CERT_PASSWORD))
    // Your archived .pkpass file is in passData as Data
}

Before using the library, you'll also need to set the Apple WWDR certificate URL, which you can read about below.

Heads up! Operations in this library are all synchronous, so it is advisable to run them on a separate OperationQueue so that they do not block your thread.

Creating and preparing your certificate

You need to repeat this step for each different passTypeId you have in your pass.json.

  1. Go to the Apple Developer Pass Type IDs page and create your pass type.
  2. Go to the certificate section and follow the instructions to create a certificate for your pass.
  3. Download the certificate, and ensure it is named Certificates.p12.
  4. Run the following command: openssl pkcs12 -in Certificates.p12 -out PassCert.pem.
  5. Your pass certificate is now stored in PassCert.pem!

You'll also need to download the Apple Worldwide Developer Relations Root Certificate Authority file to sign passes.

  1. Download the certificate from here.

  2. Import it into Keychain Access (double click it).

  3. Find it in Keychain Access, and export it as a .pem file.

  4. Set the PassSigner's WWDR URL to it in your code.

     PassSigner.shared.appleWWDRCertURL = URL(fileURLWithPath: PATH_TO_WWDR_CERT.PEM)
    

Documentation

To take full advantage of the package, check out the documentation and see all of the methods and variables that are made available to you.

Contributing

Feel free to contribute to the source code of PassEncoder to make it something even better! Just try to adhere to the general coding style throughout, to make it as readable as possible.

If you find an issue in the code or while using it, create an issue. If you can, you're encouraged to contribute and make a pull request.

License

This project is licensed under the MIT license. Please make sure you comply with its terms while using it in any way.

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].