A Swift library and command-line tool for creating, validating, and signing Apple Wallet passes.
Pass Builder provides a type-safe API for constructing .pkpass bundles programmatically, with full support for all pass styles — boarding passes, event tickets, coupons, store cards, and more. It builds the pass.json, manages images, generates manifests, and cryptographically signs the bundle for distribution.
Pass Builder can also import .pkpasstemplate bundles created with Pass Designer for Mac, so you can visually design your pass and then use Pass Builder to personalize, build, and sign passes for distribution.
Early preview: This package is in an early preview state. APIs may change without notice between releases. The package offers no stability guarantees at this time.
Add Pass Builder to your Package.swift:
dependencies: [
.package(url: "https://github.com/apple/PassBuilder.git", from: "0.1.0")
]
Then add the library to your target's dependencies:
.target(
name: "MyApp",
dependencies: [
.product(name: "PassBuilder", package: "PassBuilder")
]
)
Load a .pkpasstemplate bundle created in Pass Designer:
import PassBuilder
let templateURL = URL(filePath: "/path/to/MyPass.pkpasstemplate")
let myPass = try PassPackage(url: templateURL)
// Customize the imported pass as needed
myPass.pass.serialNumber = "unique-serial-number"
Sign a pass directory with your certificates to produce a distributable .pkpass file:
let passCertificate = try PassCertificate(
url: URL(filePath: "/path/to/pass-certificate.p12"),
password: "certificate-password"
)
let wwdrCertificate = try PassCertificate(
url: URL(filePath: "/path/to/wwdr-certificate.cer")
)
let signer = PassSigner(
passCertificate: passCertificate,
wwdrCertificate: wwdrCertificate
)
try await signer.signPass(
myPass,
destination: URL(filePath: "/path/to/MyPass.pkpass")
)
let validator = PassValidator()
let result = validator.validate(myPass)
for issue in result.issues {
print(issue)
}
Pass Builder includes buildpass, a command-line tool for working with passes.
Apply a protobuf personalization payload to a pass template:
buildpass personalize /path/to/template.pkpasstemplate \
--protobuf /path/to/personalization.pb \
--output /path/to/PersonalizedPass.pass
buildpass sign /path/to/MyPass.pass \
--pass-certificate /path/to/certificate.p12 \
--wwdr-certificate /path/to/wwdr.cer
Provide the certificate password through the BUILDPASS_PASS_CERTIFICATE_PASSWORD environment variable. If you don't set it, buildpass prompts you interactively.
buildpass validate /path/to/MyPass.pass
To sign passes, you need:
.p12 certificate registered in Apple Developer Portal under Certificates, Identifiers & Profiles. This certificate must match the passTypeIdentifier in your pass.Your contributions help shape the future of Pass Builder! We welcome contributors of all backgrounds and experience levels, recognizing that diverse perspectives drive better outcomes for everyone.
How you can help
We are not accepting pull requests for new enhancements and tests at launch while we learn how the community uses this project.
Swift
99.7%
A Swift library and command-line tool for creating, validating, and signing Apple Wallet passes.
Pass Builder provides a type-safe API for constructing .pkpass bundles programmatically, with full support for all pass styles — boarding passes, event tickets, coupons, store cards, and more. It builds the pass.json, manages images, generates manifests, and cryptographically signs the bundle for distribution.
Pass Builder can also import .pkpasstemplate bundles created with Pass Designer for Mac, so you can visually design your pass and then use Pass Builder to personalize, build, and sign passes for distribution.
Early preview: This package is in an early preview state. APIs may change without notice between releases. The package offers no stability guarantees at this time.
Add Pass Builder to your Package.swift:
dependencies: [
.package(url: "https://github.com/apple/PassBuilder.git", from: "0.1.0")
]
Then add the library to your target's dependencies:
.target(
name: "MyApp",
dependencies: [
.product(name: "PassBuilder", package: "PassBuilder")
]
)
Load a .pkpasstemplate bundle created in Pass Designer:
import PassBuilder
let templateURL = URL(filePath: "/path/to/MyPass.pkpasstemplate")
let myPass = try PassPackage(url: templateURL)
// Customize the imported pass as needed
myPass.pass.serialNumber = "unique-serial-number"
Sign a pass directory with your certificates to produce a distributable .pkpass file:
let passCertificate = try PassCertificate(
url: URL(filePath: "/path/to/pass-certificate.p12"),
password: "certificate-password"
)
let wwdrCertificate = try PassCertificate(
url: URL(filePath: "/path/to/wwdr-certificate.cer")
)
let signer = PassSigner(
passCertificate: passCertificate,
wwdrCertificate: wwdrCertificate
)
try await signer.signPass(
myPass,
destination: URL(filePath: "/path/to/MyPass.pkpass")
)
let validator = PassValidator()
let result = validator.validate(myPass)
for issue in result.issues {
print(issue)
}
Pass Builder includes buildpass, a command-line tool for working with passes.
Apply a protobuf personalization payload to a pass template:
buildpass personalize /path/to/template.pkpasstemplate \
--protobuf /path/to/personalization.pb \
--output /path/to/PersonalizedPass.pass
buildpass sign /path/to/MyPass.pass \
--pass-certificate /path/to/certificate.p12 \
--wwdr-certificate /path/to/wwdr.cer
Provide the certificate password through the BUILDPASS_PASS_CERTIFICATE_PASSWORD environment variable. If you don't set it, buildpass prompts you interactively.
buildpass validate /path/to/MyPass.pass
To sign passes, you need:
.p12 certificate registered in Apple Developer Portal under Certificates, Identifiers & Profiles. This certificate must match the passTypeIdentifier in your pass.Your contributions help shape the future of Pass Builder! We welcome contributors of all backgrounds and experience levels, recognizing that diverse perspectives drive better outcomes for everyone.
How you can help
We are not accepting pull requests for new enhancements and tests at launch while we learn how the community uses this project.
Swift
99.7%