Skip to content

Repository files navigation

BoardingPassKit

Monorepo for parsing airline boarding pass barcodes and QR codes that conform to the IATA Bar Coded Boarding Pass (BCBP) standard (Resolution 792, Version 8).

Package Path Install / notes
Swift packages/swift Swift Package Manager / CocoaPods
Node.js packages/node npm install boarding-pass-kit
Rust packages/rust Canonical core crate (boarding-pass-kit)
Python packages/python PyO3 bindings via maturin
Go packages/go cgo bindings over the C FFI
PHP packages/php PHP FFI bindings (ext-ffi)
C FFI packages/ffi Shared C ABI used by Go and PHP

Python, Go, and PHP share the Rust core. Swift and Node remain independent ports with the same public field names and demo fixtures.

Features

  • Parse IATA BCBP v8 ASCII payloads (single and multi-leg)
  • Extract bag tags, frequent flyer info, and security data
  • Convert Julian day-of-year to calendar dates (with year inference)
  • Configurable trimming and empty-string handling
  • Built-in demo data for testing
  • Shared golden fixtures under testdata/

Repository Layout

BoardingPassKit/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ rust/           # Canonical Rust decoder
β”‚   β”œβ”€β”€ ffi/            # C ABI (JSON decode results)
β”‚   β”œβ”€β”€ python/         # PyO3 / maturin package
β”‚   β”œβ”€β”€ go/             # Go cgo package
β”‚   β”œβ”€β”€ php/            # PHP FFI package
β”‚   β”œβ”€β”€ swift/          # BoardingPassKit Swift library
β”‚   └── node/           # boarding-pass-kit npm package
β”œβ”€β”€ testdata/           # Shared barcodes + expected JSON
β”œβ”€β”€ apps/
β”‚   └── BoardingPassKitDemo/
β”œβ”€β”€ Cargo.toml          # Rust workspace
β”œβ”€β”€ Package.swift       # Root SPM manifest (backward compatible)
└── IATA_COMPLIANCE.md

Swift

Requirements

  • iOS 15.0+ / macOS 10.15+
  • Swift 5.7+

Installation

Swift Package Manager β€” add the repository URL in Xcode or Package.swift:

dependencies: [
    .package(url: "https://github.com/anomaddev/BoardingPassKit.git", from: "2.1.2")
]

CocoaPods:

pod 'BoardingPassParser'

Quick Start

import BoardingPassKit

let decoder = BoardingPassDecoder()
decoder.debug = false

let pass = try decoder.decode(code: barcodeString)
print(pass.passengerName)
print(pass.boardingPassLegs.first?.origin ?? "")

// Julian day-of-year β†’ calendar date
if let flightDate = pass.boardingPassLegs.first?.flightDate() {
    print(flightDate)
}

Julian Date Conversion

BCBP stores flight date as a 3-digit day-of-year (001–366). Use JulianDateConverter or BoardingPassLeg.flightDate():

// Explicit year
let date = try JulianDateConverter.toCalendarDate(dayOfYear: 14, year: 2025)

// Infer year from scan date (handles year-boundary flights)
let date = try JulianDateConverter.toCalendarDate(dayOfYear: 14, relativeTo: Date())

Node.js

See packages/node/README.md for full documentation.

import { BoardingPassDecoder, DemoData, julianToCalendarDate } from 'boarding-pass-kit';

const decoder = new BoardingPassDecoder();
decoder.debug = false;

const pass = decoder.decode(DemoData.Simple);
console.log(pass.passengerName);

const flightDate = pass.boardingPassLegs[0]!.flightDate();
// or: julianToCalendarDate(14, 2025)

Rust / Python / Go / PHP

Build the Rust workspace and FFI library from the repo root:

cargo test -p boarding-pass-kit
cargo build -p boarding-pass-kit-ffi --release

Then follow each package README:

Development

# Node.js
npm install
npm run build
npm test

# Rust core + FFI
cargo test -p boarding-pass-kit
cargo build -p boarding-pass-kit-ffi --release

# Python
python3 -m venv .venv && . .venv/bin/activate
pip install maturin pytest
cd packages/python && maturin develop && pytest

# Go
cd packages/go && go test ./...

# PHP
cd packages/php && composer install && composer test

# Swift (macOS)
swift build
swift test

Demo Data

All language packages include the same fixtures: Simple, Historical, MultiLeg, and International. Canonical golden expectations live in testdata/.

License

MIT β€” see LICENSE.

Author

Justin Ackermann

About

A Swift & Node library to parse an IATA 2D Boarding Pass using a string representation of the pass barcode 🎫 πŸ›«

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages