sbcwallet 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/package.json +24 -6
- package/.env.example +0 -10
- package/.github/workflows/build.yml +0 -66
- package/.github/workflows/release.yml +0 -57
- package/APPLE_WALLET_SETUP.md +0 -318
- package/GOOGLE_WALLET_SETUP.md +0 -473
- package/examples/.loyalty-fixed-state.json +0 -10
- package/examples/claim-flow.ts +0 -163
- package/examples/loyalty-admin-server.js +0 -207
- package/examples/loyalty-admin.html +0 -260
- package/examples/loyalty-fixed-card-server.js +0 -288
- package/examples/loyalty-flow.ts +0 -78
- package/examples/loyalty-google-issue.js +0 -115
- package/scripts/copy-assets.js +0 -35
- package/scripts/smoke-dist-import.js +0 -39
- package/setup-google-class.js +0 -97
- package/setup-google-class.ts +0 -105
- package/src/adapters/apple.ts +0 -193
- package/src/adapters/google.ts +0 -521
- package/src/api/unified.ts +0 -487
- package/src/index.ts +0 -74
- package/src/profiles/healthcare/index.ts +0 -157
- package/src/profiles/logistics/index.ts +0 -158
- package/src/profiles/loyalty/index.ts +0 -87
- package/src/templates/apple/child.json +0 -59
- package/src/templates/apple/parent.json +0 -54
- package/src/templates/google/child_object.json +0 -38
- package/src/templates/google/loyalty_class.json +0 -7
- package/src/templates/google/loyalty_object.json +0 -29
- package/src/templates/google/parent_class.json +0 -10
- package/src/templates/google/parent_object.json +0 -33
- package/src/types.ts +0 -324
- package/src/utils/progress-image.ts +0 -130
- package/test-google-wallet.js +0 -78
- package/test-google-wallet.ts +0 -94
- package/tests/adapters.test.ts +0 -244
- package/tests/loyalty.test.ts +0 -39
- package/tests/unified.test.ts +0 -388
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -12
package/README.md
CHANGED
|
@@ -16,7 +16,11 @@ It standardizes claim flows (like PES → TO) and status pipelines (ISSUED → P
|
|
|
16
16
|
|
|
17
17
|
## 🚀 Quickstart
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```sh
|
|
20
|
+
npm install sbcwallet
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```js
|
|
20
24
|
|
|
21
25
|
import { createParentSchedule, createChildTicket, getPkpassBuffer } from 'sbcwallet'
|
|
22
26
|
|
|
@@ -55,7 +59,7 @@ import {
|
|
|
55
59
|
getGoogleObject
|
|
56
60
|
} from 'sbcwallet'
|
|
57
61
|
|
|
58
|
-
const biz = createBusiness({ name: 'SBC
|
|
62
|
+
const biz = createBusiness({ name: 'SBC', pointsLabel: 'points' })
|
|
59
63
|
await createLoyaltyProgram({ businessId: biz.id })
|
|
60
64
|
|
|
61
65
|
const customer = createCustomerAccount({ businessId: biz.id, fullName: 'Alice' })
|
package/package.json
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbcwallet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Unified Wallet-Pass SDK for Real-World Credentials",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
8
18
|
"scripts": {
|
|
19
|
+
"clean": "node scripts/clean-dist.js",
|
|
9
20
|
"build": "tsc",
|
|
10
21
|
"postbuild": "node scripts/copy-assets.js",
|
|
11
22
|
"test": "vitest run",
|
|
12
23
|
"test:watch": "vitest",
|
|
13
|
-
"
|
|
24
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
+
"lint": "npm run typecheck",
|
|
26
|
+
"prepack": "npm run clean && npm run build",
|
|
27
|
+
"preversion": "npm run test && npm run typecheck",
|
|
28
|
+
"bump:patch": "npm version patch",
|
|
29
|
+
"bump:minor": "npm version minor",
|
|
30
|
+
"bump:major": "npm version major",
|
|
31
|
+
"publish:npm": "npm publish",
|
|
14
32
|
"loyalty:issue": "npm run build && node examples/loyalty-google-issue.js",
|
|
15
33
|
"loyalty:server": "npm run build && node examples/loyalty-admin-server.js",
|
|
16
34
|
"loyalty:server:fixed": "npm run build && node examples/loyalty-fixed-card-server.js"
|
|
@@ -24,9 +42,7 @@
|
|
|
24
42
|
"verifiable"
|
|
25
43
|
],
|
|
26
44
|
"dependencies": {
|
|
27
|
-
"@types/jsonwebtoken": "^9.0.10",
|
|
28
45
|
"canvas": "^3.2.0",
|
|
29
|
-
"dotenv": "^17.2.3",
|
|
30
46
|
"google-auth-library": "^10.4.1",
|
|
31
47
|
"jsonwebtoken": "^9.0.2",
|
|
32
48
|
"passkit-generator": "^3.5.0",
|
|
@@ -34,8 +50,10 @@
|
|
|
34
50
|
"zod": "^3.23.8"
|
|
35
51
|
},
|
|
36
52
|
"devDependencies": {
|
|
53
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
37
54
|
"@types/node": "^20.10.0",
|
|
38
55
|
"@types/qrcode": "^1.5.5",
|
|
56
|
+
"dotenv": "^17.2.3",
|
|
39
57
|
"typescript": "^5.6.3",
|
|
40
58
|
"vitest": "^1.6.0"
|
|
41
59
|
},
|
package/.env.example
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Google Wallet
|
|
2
|
-
GOOGLE_ISSUER_ID=3388000000000000000
|
|
3
|
-
GOOGLE_SA_JSON=./certs/google-credentials.json
|
|
4
|
-
|
|
5
|
-
# Apple Wallet (requires Apple Developer setup)
|
|
6
|
-
APPLE_TEAM_ID=ABCD123456
|
|
7
|
-
APPLE_PASS_TYPE_ID=pass.com.sbcwallet.logistics
|
|
8
|
-
APPLE_CERT_PATH=./certs/pass.p12
|
|
9
|
-
APPLE_CERT_PASSWORD=yourpassword
|
|
10
|
-
APPLE_WWDR_PATH=./certs/wwdr.pem
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
name: Build and Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
- main
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
name: Build, Test and Release
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
permissions:
|
|
15
|
-
contents: write
|
|
16
|
-
|
|
17
|
-
env:
|
|
18
|
-
PROJECT_NAME: 'sbcwallet'
|
|
19
|
-
RUN_TESTS: 'false'
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
|
|
23
|
-
- uses: actions/checkout@v4
|
|
24
|
-
name: Checkout
|
|
25
|
-
|
|
26
|
-
- uses: actions/setup-node@v4
|
|
27
|
-
with:
|
|
28
|
-
node-version: 18
|
|
29
|
-
registry-url: 'https://registry.npmjs.org'
|
|
30
|
-
always-auth: true
|
|
31
|
-
|
|
32
|
-
- name: Variables
|
|
33
|
-
run: |
|
|
34
|
-
echo VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV
|
|
35
|
-
shell: bash
|
|
36
|
-
|
|
37
|
-
- name: Install and Build
|
|
38
|
-
run: |
|
|
39
|
-
npm install
|
|
40
|
-
npm run build
|
|
41
|
-
env:
|
|
42
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.NOM }}
|
|
43
|
-
|
|
44
|
-
- name: Run Tests
|
|
45
|
-
if: ${{ env.RUN_TESTS == 'true' }}
|
|
46
|
-
run: |
|
|
47
|
-
npm run test
|
|
48
|
-
|
|
49
|
-
- name: Package
|
|
50
|
-
run: |
|
|
51
|
-
echo RELEASE_NAME=$(npm pack) >> $GITHUB_ENV
|
|
52
|
-
|
|
53
|
-
- uses: actions/upload-artifact@v4
|
|
54
|
-
with:
|
|
55
|
-
name: ${{env.PROJECT_NAME}}-preview-${{env.VERSION}}
|
|
56
|
-
path: "${{env.RELEASE_NAME}}"
|
|
57
|
-
|
|
58
|
-
- name: Release
|
|
59
|
-
uses: sondreb/action-release@main
|
|
60
|
-
with:
|
|
61
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
62
|
-
files: "${{env.RELEASE_NAME}}"
|
|
63
|
-
draft: true
|
|
64
|
-
prerelease: false
|
|
65
|
-
name: "${{ env.PROJECT_NAME }} (${{env.VERSION}})"
|
|
66
|
-
tag: ${{env.VERSION}}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
name: Publish Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
name: Download and Push Package
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
|
|
16
|
-
env:
|
|
17
|
-
PROJECT_NAME: 'sbcwallet'
|
|
18
|
-
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v4
|
|
21
|
-
name: Checkout
|
|
22
|
-
|
|
23
|
-
- uses: actions/setup-node@v4
|
|
24
|
-
with:
|
|
25
|
-
node-version: 18
|
|
26
|
-
registry-url: 'https://registry.npmjs.org'
|
|
27
|
-
always-auth: true
|
|
28
|
-
|
|
29
|
-
- name: Package Name
|
|
30
|
-
run: |
|
|
31
|
-
echo RELEASE_NAME=${{ env.PROJECT_NAME }}-${{ github.event.release.tag_name }}.tgz >> $GITHUB_ENV
|
|
32
|
-
shell: bash
|
|
33
|
-
|
|
34
|
-
- name: Log Variables
|
|
35
|
-
run: |
|
|
36
|
-
echo "action - ${{ github.event.action }}"
|
|
37
|
-
echo "url - ${{ github.event.release.url }}"
|
|
38
|
-
echo "assets_url - ${{ github.event.release.assets_url }}"
|
|
39
|
-
echo "id - ${{ github.event.release.id }}"
|
|
40
|
-
echo "tag_name - ${{ github.event.release.tag_name }}"
|
|
41
|
-
echo "assets - ${{ github.event.release.assets }}"
|
|
42
|
-
echo "assets[0] - ${{ github.event.release.assets[0] }}"
|
|
43
|
-
|
|
44
|
-
- name: Download release
|
|
45
|
-
uses: sondreb/action-release-download@master
|
|
46
|
-
with:
|
|
47
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
-
url: ${{ github.event.release.assets_url }}
|
|
49
|
-
folder: "./"
|
|
50
|
-
|
|
51
|
-
- name: Display structure of downloaded files
|
|
52
|
-
run: ls -R
|
|
53
|
-
|
|
54
|
-
- name: NPM Publish
|
|
55
|
-
run: npm publish ${{env.RELEASE_NAME}} --access public
|
|
56
|
-
env:
|
|
57
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || secrets.NOM }}
|
package/APPLE_WALLET_SETUP.md
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
# Apple Wallet Setup Guide
|
|
2
|
-
|
|
3
|
-
Complete guide for setting up Apple Wallet pass generation with sbcwallet.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- ✅ Apple Developer Account ($99/year) - [developer.apple.com/programs](https://developer.apple.com/programs/)
|
|
8
|
-
- ✅ Mac computer (required for certificate signing)
|
|
9
|
-
- ✅ sbcwallet package (already built)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Step 1: Create Pass Type Identifier
|
|
14
|
-
|
|
15
|
-
1. Go to [developer.apple.com/account](https://developer.apple.com/account)
|
|
16
|
-
2. Navigate to **Certificates, Identifiers & Profiles**
|
|
17
|
-
3. Click **Identifiers** → **+** button
|
|
18
|
-
4. Select **Pass Type IDs** → Continue
|
|
19
|
-
|
|
20
|
-
### Create Two Pass Type IDs:
|
|
21
|
-
|
|
22
|
-
#### For Logistics (Transport Orders)
|
|
23
|
-
- **Description**: sbcwallet Logistics Pass
|
|
24
|
-
- **Identifier**: `pass.com.sbcwallet.logistics`
|
|
25
|
-
- Click **Continue** → **Register**
|
|
26
|
-
|
|
27
|
-
#### For Healthcare (Patient Visits) - Optional
|
|
28
|
-
- **Description**: sbcwallet Healthcare Pass
|
|
29
|
-
- **Identifier**: `pass.com.sbcwallet.healthcare`
|
|
30
|
-
- Click **Continue** → **Register**
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Step 2: Generate Pass Type ID Certificate
|
|
35
|
-
|
|
36
|
-
### A. Create Certificate Signing Request (CSR)
|
|
37
|
-
|
|
38
|
-
1. Open **Keychain Access** on your Mac
|
|
39
|
-
2. Menu: **Keychain Access** → **Certificate Assistant** → **Request a Certificate from a Certificate Authority**
|
|
40
|
-
3. Fill in:
|
|
41
|
-
- **User Email**: your@email.com
|
|
42
|
-
- **Common Name**: sbcwallet Pass Certificate
|
|
43
|
-
- **Request is**: Saved to disk
|
|
44
|
-
4. Save as `PassCertificate.certSigningRequest`
|
|
45
|
-
|
|
46
|
-
### B. Create Certificate in Apple Developer Portal
|
|
47
|
-
|
|
48
|
-
1. Go to **Certificates** → **+** button
|
|
49
|
-
2. Select **Pass Type ID Certificate** → Continue
|
|
50
|
-
3. Choose your Pass Type ID: `pass.com.sbcwallet.logistics`
|
|
51
|
-
4. Upload the `.certSigningRequest` file
|
|
52
|
-
5. Download the certificate: `pass.cer`
|
|
53
|
-
|
|
54
|
-
### C. Install Certificate
|
|
55
|
-
|
|
56
|
-
1. Double-click `pass.cer` to install in Keychain Access
|
|
57
|
-
2. Find the certificate in **My Certificates**
|
|
58
|
-
3. Right-click → **Export "Pass Type ID..."**
|
|
59
|
-
4. Save as: `sbcwallet-pass.p12`
|
|
60
|
-
5. **Set a password** (you'll need this later)
|
|
61
|
-
6. Save to: `/Users/przpgo/code/sbcwallet/pass/certs/`
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Step 3: Get Apple WWDR Certificate
|
|
66
|
-
|
|
67
|
-
### Download Worldwide Developer Relations Certificate
|
|
68
|
-
|
|
69
|
-
1. Go to [Apple PKI](https://www.apple.com/certificateauthority/)
|
|
70
|
-
2. Download **Worldwide Developer Relations - G4** certificate
|
|
71
|
-
3. Or use direct link: [WWDR G4 Certificate](https://www.apple.com/certificateauthority/AppleWWDRCAG4.cer)
|
|
72
|
-
4. Double-click to install in Keychain Access
|
|
73
|
-
|
|
74
|
-
### Export WWDR as PEM
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Create certs directory
|
|
78
|
-
mkdir -p /Users/przpgo/code/sbcwallet/pass/certs
|
|
79
|
-
|
|
80
|
-
# Export from Keychain (or download and convert)
|
|
81
|
-
# If you have the .cer file:
|
|
82
|
-
openssl x509 -inform DER -in AppleWWDRCAG4.cer -out certs/wwdr.pem
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Alternative**: Export from Keychain Access
|
|
86
|
-
1. Find "Apple Worldwide Developer Relations Certification Authority" in System keychain
|
|
87
|
-
2. Right-click → Export
|
|
88
|
-
3. Save as `wwdr.pem` (format: Privacy Enhanced Mail (.pem))
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Step 4: Configure Environment Variables
|
|
93
|
-
|
|
94
|
-
Create a `.env` file in the project root:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
cd /Users/przpgo/code/sbcwallet/pass
|
|
98
|
-
|
|
99
|
-
cat > .env << 'EOF'
|
|
100
|
-
# Apple Wallet Configuration
|
|
101
|
-
APPLE_TEAM_ID=YOUR_TEAM_ID
|
|
102
|
-
APPLE_PASS_TYPE_ID=pass.com.sbcwallet.logistics
|
|
103
|
-
APPLE_CERT_PATH=./certs/sbcwallet-pass.p12
|
|
104
|
-
APPLE_CERT_PASSWORD=your_p12_password
|
|
105
|
-
APPLE_WWDR_PATH=./certs/wwdr.pem
|
|
106
|
-
EOF
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Find Your Team ID
|
|
110
|
-
|
|
111
|
-
1. Go to [developer.apple.com/account](https://developer.apple.com/account)
|
|
112
|
-
2. Click on **Membership** in sidebar
|
|
113
|
-
3. Your Team ID is shown (e.g., `ABCD123456`)
|
|
114
|
-
4. Update `.env` with your Team ID
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## Step 5: Verify Certificate Setup
|
|
119
|
-
|
|
120
|
-
Create a test script:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
cat > test-apple-wallet.ts << 'EOF'
|
|
124
|
-
import { createParentSchedule, createChildTicket, getPkpassBuffer } from './dist/index.js'
|
|
125
|
-
import { writeFile } from 'fs/promises'
|
|
126
|
-
import 'dotenv/config'
|
|
127
|
-
|
|
128
|
-
async function testAppleWallet() {
|
|
129
|
-
console.log('🧪 Testing Apple Wallet Pass Generation\n')
|
|
130
|
-
|
|
131
|
-
// Create parent
|
|
132
|
-
const parent = await createParentSchedule({
|
|
133
|
-
profile: 'logistics',
|
|
134
|
-
programName: 'Test Yard Veracruz',
|
|
135
|
-
site: 'Patio Gate 3',
|
|
136
|
-
window: {
|
|
137
|
-
from: '2025-10-20T08:00:00-06:00',
|
|
138
|
-
to: '2025-10-20T12:00:00-06:00',
|
|
139
|
-
tz: 'America/Mexico_City'
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
console.log('✅ Parent created:', parent.id)
|
|
144
|
-
|
|
145
|
-
// Create child
|
|
146
|
-
const child = await createChildTicket({
|
|
147
|
-
profile: 'logistics',
|
|
148
|
-
parentId: parent.id,
|
|
149
|
-
plate: 'TEST123',
|
|
150
|
-
carrier: 'Test Transport',
|
|
151
|
-
client: 'Test Client'
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
console.log('✅ Child created:', child.id)
|
|
155
|
-
|
|
156
|
-
// Generate pkpass
|
|
157
|
-
try {
|
|
158
|
-
const pkpass = await getPkpassBuffer('child', child)
|
|
159
|
-
await writeFile('test-transport-order.pkpass', pkpass)
|
|
160
|
-
console.log('\n✅ SUCCESS! Generated: test-transport-order.pkpass')
|
|
161
|
-
console.log('📱 AirDrop this file to your iPhone to test!')
|
|
162
|
-
} catch (error) {
|
|
163
|
-
console.error('❌ Error generating pass:', error)
|
|
164
|
-
throw error
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
testAppleWallet()
|
|
169
|
-
EOF
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Install dotenv and run:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
npm install dotenv
|
|
176
|
-
npx tsc test-apple-wallet.ts --module ESNext --target ES2022 --moduleResolution node --esModuleInterop
|
|
177
|
-
node test-apple-wallet.js
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Expected output:
|
|
181
|
-
```
|
|
182
|
-
🧪 Testing Apple Wallet Pass Generation
|
|
183
|
-
|
|
184
|
-
✅ Parent created: PES-2025-10-20-XXXX
|
|
185
|
-
✅ Child created: TO-2025-10-20-XXXX-YYYY
|
|
186
|
-
|
|
187
|
-
✅ SUCCESS! Generated: test-transport-order.pkpass
|
|
188
|
-
📱 AirDrop this file to your iPhone to test!
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## Step 6: Install Pass on iPhone
|
|
194
|
-
|
|
195
|
-
### Option 1: AirDrop
|
|
196
|
-
1. Right-click `test-transport-order.pkpass` on Mac
|
|
197
|
-
2. Share → AirDrop → Your iPhone
|
|
198
|
-
3. Tap on iPhone to open
|
|
199
|
-
4. Click **Add** to add to Wallet
|
|
200
|
-
|
|
201
|
-
### Option 2: Email
|
|
202
|
-
1. Email the `.pkpass` file to yourself
|
|
203
|
-
2. Open on iPhone
|
|
204
|
-
3. Tap attachment → Add to Wallet
|
|
205
|
-
|
|
206
|
-
### Option 3: Web Server
|
|
207
|
-
```bash
|
|
208
|
-
# Serve the file locally
|
|
209
|
-
python3 -m http.server 8080
|
|
210
|
-
```
|
|
211
|
-
Navigate to `http://your-mac-ip:8080/test-transport-order.pkpass` from iPhone
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## Step 7: Test Pass Updates
|
|
216
|
-
|
|
217
|
-
Create an update script:
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
import { updatePassStatus, getPass } from './dist/index.js'
|
|
221
|
-
|
|
222
|
-
const passId = 'TO-2025-10-20-XXXX-YYYY' // Use your actual ID
|
|
223
|
-
|
|
224
|
-
// Simulate status transitions
|
|
225
|
-
await updatePassStatus(passId, 'PRESENCE')
|
|
226
|
-
console.log('✅ Status: PRESENCE')
|
|
227
|
-
|
|
228
|
-
await updatePassStatus(passId, 'SCALE')
|
|
229
|
-
console.log('✅ Status: SCALE')
|
|
230
|
-
|
|
231
|
-
// In production, you'd regenerate and push the updated pass
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
## Troubleshooting
|
|
237
|
-
|
|
238
|
-
### Common Issues
|
|
239
|
-
|
|
240
|
-
#### 1. "teamIdentifier" is not allowed to be empty
|
|
241
|
-
- **Solution**: Set `APPLE_TEAM_ID` in `.env` file
|
|
242
|
-
- Find it at developer.apple.com/account → Membership
|
|
243
|
-
|
|
244
|
-
#### 2. Certificate verification failed
|
|
245
|
-
- **Solution**: Ensure WWDR certificate is in PEM format
|
|
246
|
-
- Verify with: `openssl x509 -in certs/wwdr.pem -text -noout`
|
|
247
|
-
|
|
248
|
-
#### 3. Invalid password for p12 file
|
|
249
|
-
- **Solution**: Re-export certificate from Keychain Access with correct password
|
|
250
|
-
- Update `APPLE_CERT_PASSWORD` in `.env`
|
|
251
|
-
|
|
252
|
-
#### 4. Pass not appearing on iPhone
|
|
253
|
-
- **Solution**: Check that:
|
|
254
|
-
- Pass Type ID matches in code and certificate
|
|
255
|
-
- Certificate is not expired
|
|
256
|
-
- iPhone has internet connection (for first-time verification)
|
|
257
|
-
|
|
258
|
-
#### 5. Permission denied on certs directory
|
|
259
|
-
```bash
|
|
260
|
-
chmod 600 certs/*.p12
|
|
261
|
-
chmod 644 certs/*.pem
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
|
|
266
|
-
## Directory Structure
|
|
267
|
-
|
|
268
|
-
Your final setup should look like:
|
|
269
|
-
|
|
270
|
-
```
|
|
271
|
-
sbcwallet/pass/
|
|
272
|
-
├── .env # Environment variables
|
|
273
|
-
├── certs/
|
|
274
|
-
│ ├── sbcwallet-pass.p12 # Your pass certificate (private)
|
|
275
|
-
│ └── wwdr.pem # Apple WWDR cert (public)
|
|
276
|
-
├── test-transport-order.pkpass # Generated pass file
|
|
277
|
-
└── test-apple-wallet.ts # Test script
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## Next Steps
|
|
283
|
-
|
|
284
|
-
### 1. Production Setup
|
|
285
|
-
- Store certificates securely (not in git)
|
|
286
|
-
- Use environment-specific configs
|
|
287
|
-
- Implement pass update notifications
|
|
288
|
-
- Set up web service for pass distribution
|
|
289
|
-
|
|
290
|
-
### 2. Add Logo Images
|
|
291
|
-
```bash
|
|
292
|
-
mkdir -p certs/images
|
|
293
|
-
# Add these images:
|
|
294
|
-
# - icon.png (29×29, 58×58, 87×87)
|
|
295
|
-
# - icon@2x.png (58×58)
|
|
296
|
-
# - icon@3x.png (87×87)
|
|
297
|
-
# - logo.png (160×50)
|
|
298
|
-
# - logo@2x.png (320×100)
|
|
299
|
-
# - logo@3x.png (480×150)
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### 3. Enable Pass Updates
|
|
303
|
-
- Implement web service endpoints
|
|
304
|
-
- Set up push notifications
|
|
305
|
-
- Add pass registration/update logic
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## Resources
|
|
310
|
-
|
|
311
|
-
- [Apple Wallet Developer Guide](https://developer.apple.com/documentation/walletpasses)
|
|
312
|
-
- [Pass Design Guidelines](https://developer.apple.com/design/human-interface-guidelines/wallet)
|
|
313
|
-
- [passkit-generator Documentation](https://github.com/alexandercerutti/passkit-generator)
|
|
314
|
-
- [sbcwallet Pass README](./README.md)
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
**Ready to generate your first pass?** Follow Steps 1-6 above after purchasing your Apple Developer account!
|