passkit-wallet 0.1.1 → 0.2.1
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 +105 -0
- package/dist/handlers/apple-order.d.ts +39 -0
- package/dist/handlers/apple-order.d.ts.map +1 -0
- package/dist/handlers/apple-order.js +110 -0
- package/dist/handlers/apple-order.js.map +1 -0
- package/dist/handlers/apple-pass.d.ts +39 -0
- package/dist/handlers/apple-pass.d.ts.map +1 -0
- package/dist/handlers/apple-pass.js +114 -0
- package/dist/handlers/apple-pass.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/types.d.ts +133 -0
- package/dist/handlers/types.d.ts.map +1 -0
- package/dist/handlers/types.js +2 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +20 -1
package/README.md
CHANGED
|
@@ -12,6 +12,14 @@ npm install passkit-wallet
|
|
|
12
12
|
|
|
13
13
|
React components are optional — if you only use the backend helpers, React is not required.
|
|
14
14
|
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
The [`examples/`](./examples) directory has full, runnable examples:
|
|
18
|
+
|
|
19
|
+
- **Pass & Order Creation** — [Apple Pass](./examples/apple-pass-creation.ts) · [Apple Order](./examples/apple-order-creation.ts) · [Google Wallet](./examples/google-wallet.ts)
|
|
20
|
+
- **Web Service Handlers** — [Express](./examples/express.ts) · [Hono](./examples/hono.ts) · [Elysia](./examples/elysia.ts)
|
|
21
|
+
- **Store Adapters** — [Drizzle ORM](./examples/store-drizzle.ts) · [In-Memory](./examples/store-in-memory.ts)
|
|
22
|
+
|
|
15
23
|
## Quick Start
|
|
16
24
|
|
|
17
25
|
### Apple Wallet
|
|
@@ -139,6 +147,98 @@ function WalletButtons({ pkpassUrl, googleSaveUrl }) {
|
|
|
139
147
|
}
|
|
140
148
|
```
|
|
141
149
|
|
|
150
|
+
## Handlers (Web Service Protocol)
|
|
151
|
+
|
|
152
|
+
The `handlers` module implements Apple's web service protocol so you don't have to. Provide a "store" object with async callbacks for your DB, and get back plain `{ status, headers, body }` handler functions you can wire into any framework.
|
|
153
|
+
|
|
154
|
+
### Apple Pass Handlers
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { createApplePassHandlers } from 'passkit-wallet/handlers'
|
|
158
|
+
|
|
159
|
+
const handlers = createApplePassHandlers({
|
|
160
|
+
authenticationToken: 'your-auth-token',
|
|
161
|
+
store: {
|
|
162
|
+
getPass: async (serialNumber) => {
|
|
163
|
+
const pass = await db.findPass(serialNumber)
|
|
164
|
+
return pass ? { updatedAt: pass.updatedAt } : null
|
|
165
|
+
},
|
|
166
|
+
registerDevice: async (deviceLibId, pushToken, serialNumber) => {
|
|
167
|
+
const existed = await db.upsertRegistration(deviceLibId, pushToken, serialNumber)
|
|
168
|
+
return existed ? 'already_registered' : 'created'
|
|
169
|
+
},
|
|
170
|
+
unregisterDevice: async (deviceLibId, serialNumber) => {
|
|
171
|
+
await db.deleteRegistration(deviceLibId, serialNumber)
|
|
172
|
+
},
|
|
173
|
+
getRegistrations: async (passTypeId, deviceLibId, updatedSince) => {
|
|
174
|
+
return db.findRegistrations(passTypeId, deviceLibId, updatedSince)
|
|
175
|
+
},
|
|
176
|
+
getPassData: async (serialNumber) => {
|
|
177
|
+
return db.getPassFields(serialNumber)
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
buildPass: async (passData) => {
|
|
181
|
+
// Use your template to build the .pkpass buffer
|
|
182
|
+
const template = await apple.loadPassTemplate()
|
|
183
|
+
const pass = template.createPass()
|
|
184
|
+
// ... set fields from passData
|
|
185
|
+
return pass.getAsBuffer()
|
|
186
|
+
},
|
|
187
|
+
onLog: (logs) => console.log('Apple Wallet logs:', logs),
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// Wire into any framework (Express example):
|
|
191
|
+
app.post('/v1/devices/:did/registrations/:ptid/:sn', async (req, res) => {
|
|
192
|
+
const result = await handlers.registerDevice({
|
|
193
|
+
deviceLibraryIdentifier: req.params.did,
|
|
194
|
+
passTypeIdentifier: req.params.ptid,
|
|
195
|
+
serialNumber: req.params.sn,
|
|
196
|
+
pushToken: req.body.pushToken,
|
|
197
|
+
authorization: req.headers.authorization,
|
|
198
|
+
})
|
|
199
|
+
res.status(result.status).json(result.body)
|
|
200
|
+
})
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Apple Order Handlers
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { createAppleOrderHandlers } from 'passkit-wallet/handlers'
|
|
207
|
+
|
|
208
|
+
const orderHandlers = createAppleOrderHandlers({
|
|
209
|
+
authenticationToken: 'your-order-auth-token',
|
|
210
|
+
store: {
|
|
211
|
+
getOrder: async (orderIdentifier) => {
|
|
212
|
+
const order = await db.findOrder(orderIdentifier)
|
|
213
|
+
return order ? { updatedAt: order.updatedAt } : null
|
|
214
|
+
},
|
|
215
|
+
registerDevice: async (deviceId, pushToken, orderIdentifier) => {
|
|
216
|
+
const existed = await db.upsertOrderRegistration(deviceId, pushToken, orderIdentifier)
|
|
217
|
+
return existed ? 'already_registered' : 'created'
|
|
218
|
+
},
|
|
219
|
+
unregisterDevice: async (deviceId, orderIdentifier) => {
|
|
220
|
+
await db.deleteOrderRegistration(deviceId, orderIdentifier)
|
|
221
|
+
},
|
|
222
|
+
getRegistrations: async (orderTypeId, deviceId, modifiedSince) => {
|
|
223
|
+
return db.findOrderRegistrations(orderTypeId, deviceId, modifiedSince)
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
buildOrder: async (orderIdentifier) => {
|
|
227
|
+
// Build and sign the .order buffer
|
|
228
|
+
const orderBody = apple.mountOrderInstance({ /* ... */ })
|
|
229
|
+
return apple.generateOrder(orderBody)
|
|
230
|
+
},
|
|
231
|
+
})
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Handler Methods
|
|
235
|
+
|
|
236
|
+
**Pass handlers:** `registerDevice`, `unregisterDevice`, `getSerialNumbers`, `getLatestPass`, `log`
|
|
237
|
+
|
|
238
|
+
**Order handlers:** `registerDevice`, `unregisterDevice`, `getOrderIdentifiers`, `getLatestOrder`, `log`
|
|
239
|
+
|
|
240
|
+
All handlers return `{ status: number, headers?: Record<string, string>, body?: unknown }`.
|
|
241
|
+
|
|
142
242
|
## Apple Certificate Setup
|
|
143
243
|
|
|
144
244
|
1. Create a Pass Type ID and Order Type ID in the [Apple Developer Portal](https://developer.apple.com/account/resources/identifiers/list/passTypeId).
|
|
@@ -180,6 +280,11 @@ function WalletButtons({ pkpassUrl, googleSaveUrl }) {
|
|
|
180
280
|
- `getClass` / `createClass` / `updateClass` / `updateObject` — CRUD operations on wallet classes and objects.
|
|
181
281
|
- `sendObjectMessage(client, type, resourceId, message)` — attach a message to a wallet object.
|
|
182
282
|
|
|
283
|
+
### Handlers
|
|
284
|
+
|
|
285
|
+
- `createApplePassHandlers(config)` — returns handler functions for Apple Pass web service endpoints.
|
|
286
|
+
- `createAppleOrderHandlers(config)` — returns handler functions for Apple Order web service endpoints.
|
|
287
|
+
|
|
183
288
|
### React
|
|
184
289
|
|
|
185
290
|
- `<AddToAppleWallet url={string} />` — Apple Wallet badge link.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HandlerResponse, AppleOrderHandlersConfig, AppleOrderDeviceRequest, AppleOrderIdentifiersRequest, AppleOrderLatestRequest, AppleLogRequest } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create framework-agnostic handler functions for the Apple Order web service
|
|
4
|
+
* protocol. Each handler accepts a plain request object and returns a plain
|
|
5
|
+
* `{ status, headers, body }` response.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createAppleOrderHandlers: (config: AppleOrderHandlersConfig) => {
|
|
8
|
+
/**
|
|
9
|
+
* `POST /v1/devices/:did/registrations/:otid/:oid`
|
|
10
|
+
*
|
|
11
|
+
* Register a device to receive push notifications for an order.
|
|
12
|
+
*/
|
|
13
|
+
registerDevice(req: AppleOrderDeviceRequest): Promise<HandlerResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* `DELETE /v1/devices/:did/registrations/:otid/:oid`
|
|
16
|
+
*
|
|
17
|
+
* Unregister a device from an order.
|
|
18
|
+
*/
|
|
19
|
+
unregisterDevice(req: AppleOrderDeviceRequest): Promise<HandlerResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* `GET /v1/devices/:did/registrations/:otid`
|
|
22
|
+
*
|
|
23
|
+
* Return order identifiers registered to a device.
|
|
24
|
+
*/
|
|
25
|
+
getOrderIdentifiers(req: AppleOrderIdentifiersRequest): Promise<HandlerResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* `GET /v1/orders/:otid/:oid`
|
|
28
|
+
*
|
|
29
|
+
* Return the latest version of an order as a signed `.order` buffer.
|
|
30
|
+
*/
|
|
31
|
+
getLatestOrder(req: AppleOrderLatestRequest): Promise<HandlerResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* `POST /v1/log`
|
|
34
|
+
*
|
|
35
|
+
* Accept log messages from Apple Wallet.
|
|
36
|
+
*/
|
|
37
|
+
log(req: AppleLogRequest): Promise<HandlerResponse>;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=apple-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-order.d.ts","sourceRoot":"","sources":["../../src/handlers/apple-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,eAAe,EAChB,MAAM,YAAY,CAAA;AAWnB;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,wBAAwB;IAIrE;;;;OAIG;wBACuB,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;IAuB5E;;;;OAIG;0BACyB,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa9E;;;;OAIG;6BAC4B,4BAA4B,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BtF;;;;OAIG;wBACuB,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;IA+B5E;;;;OAIG;aACY,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAO5D,CAAA"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function validateAuth(authorization, expectedToken) {
|
|
2
|
+
if (!authorization)
|
|
3
|
+
return false;
|
|
4
|
+
const token = authorization.replace(/^AppleOrder\s+/i, "").trim();
|
|
5
|
+
return token === expectedToken;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create framework-agnostic handler functions for the Apple Order web service
|
|
9
|
+
* protocol. Each handler accepts a plain request object and returns a plain
|
|
10
|
+
* `{ status, headers, body }` response.
|
|
11
|
+
*/
|
|
12
|
+
export const createAppleOrderHandlers = (config) => {
|
|
13
|
+
const { authenticationToken, store } = config;
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* `POST /v1/devices/:did/registrations/:otid/:oid`
|
|
17
|
+
*
|
|
18
|
+
* Register a device to receive push notifications for an order.
|
|
19
|
+
*/
|
|
20
|
+
async registerDevice(req) {
|
|
21
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
22
|
+
return { status: 401 };
|
|
23
|
+
}
|
|
24
|
+
if (!req.pushToken) {
|
|
25
|
+
return { status: 400, body: { message: "pushToken is required" } };
|
|
26
|
+
}
|
|
27
|
+
const order = await store.getOrder(req.orderIdentifier);
|
|
28
|
+
if (!order) {
|
|
29
|
+
return { status: 404 };
|
|
30
|
+
}
|
|
31
|
+
const result = await store.registerDevice(req.deviceIdentifier, req.pushToken, req.orderIdentifier);
|
|
32
|
+
return { status: result === "created" ? 201 : 200 };
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* `DELETE /v1/devices/:did/registrations/:otid/:oid`
|
|
36
|
+
*
|
|
37
|
+
* Unregister a device from an order.
|
|
38
|
+
*/
|
|
39
|
+
async unregisterDevice(req) {
|
|
40
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
41
|
+
return { status: 401 };
|
|
42
|
+
}
|
|
43
|
+
await store.unregisterDevice(req.deviceIdentifier, req.orderIdentifier);
|
|
44
|
+
return { status: 200 };
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* `GET /v1/devices/:did/registrations/:otid`
|
|
48
|
+
*
|
|
49
|
+
* Return order identifiers registered to a device.
|
|
50
|
+
*/
|
|
51
|
+
async getOrderIdentifiers(req) {
|
|
52
|
+
const registrations = await store.getRegistrations(req.orderTypeIdentifier, req.deviceIdentifier, req.ordersModifiedSince);
|
|
53
|
+
if (registrations.length === 0) {
|
|
54
|
+
return { status: 204 };
|
|
55
|
+
}
|
|
56
|
+
const sorted = registrations.sort((a, b) => a.updatedAt.getTime() - b.updatedAt.getTime());
|
|
57
|
+
const lastModified = sorted[sorted.length - 1].updatedAt.toISOString();
|
|
58
|
+
return {
|
|
59
|
+
status: 200,
|
|
60
|
+
body: {
|
|
61
|
+
orderIdentifiers: sorted.map((r) => r.orderIdentifier),
|
|
62
|
+
lastModified,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* `GET /v1/orders/:otid/:oid`
|
|
68
|
+
*
|
|
69
|
+
* Return the latest version of an order as a signed `.order` buffer.
|
|
70
|
+
*/
|
|
71
|
+
async getLatestOrder(req) {
|
|
72
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
73
|
+
return { status: 401 };
|
|
74
|
+
}
|
|
75
|
+
const order = await store.getOrder(req.orderIdentifier);
|
|
76
|
+
if (!order) {
|
|
77
|
+
return { status: 404 };
|
|
78
|
+
}
|
|
79
|
+
// Return 304 if the order hasn't been modified since the client's copy
|
|
80
|
+
if (req.ifModifiedSince) {
|
|
81
|
+
const clientDate = new Date(req.ifModifiedSince);
|
|
82
|
+
if (order.updatedAt <= clientDate) {
|
|
83
|
+
return { status: 304 };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const orderBuffer = await config.buildOrder(req.orderIdentifier);
|
|
87
|
+
return {
|
|
88
|
+
status: 200,
|
|
89
|
+
headers: {
|
|
90
|
+
"Content-Type": "application/vnd.apple.order",
|
|
91
|
+
"Content-Disposition": `attachment; filename="${req.orderIdentifier}.order"`,
|
|
92
|
+
"Last-Modified": order.updatedAt.toUTCString(),
|
|
93
|
+
},
|
|
94
|
+
body: orderBuffer,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* `POST /v1/log`
|
|
99
|
+
*
|
|
100
|
+
* Accept log messages from Apple Wallet.
|
|
101
|
+
*/
|
|
102
|
+
async log(req) {
|
|
103
|
+
if (config.onLog) {
|
|
104
|
+
await config.onLog(req.logs);
|
|
105
|
+
}
|
|
106
|
+
return { status: 200 };
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=apple-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-order.js","sourceRoot":"","sources":["../../src/handlers/apple-order.ts"],"names":[],"mappings":"AASA,SAAS,YAAY,CACnB,aAAiC,EACjC,aAAqB;IAErB,IAAI,CAAC,aAAa;QAAE,OAAO,KAAK,CAAA;IAChC,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACjE,OAAO,KAAK,KAAK,aAAa,CAAA;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAgC,EAAE,EAAE;IAC3E,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;I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,CAAC,SAAS,IAAI,UAAU,EAAE,CAAC;oBAClC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;gBACxB,CAAC;YACH,CAAC;YAED,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;YAEhE,OAAO;gBACL,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE;oBACP,cAAc,EAAE,6BAA6B;oBAC7C,qBAAqB,EAAE,yBAAyB,GAAG,CAAC,eAAe,SAAS;oBAC5E,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;iBAC/C;gBACD,IAAI,EAAE,WAAW;aAClB,CAAA;QACH,CAAC;QAED;;;;WAIG;QACH,KAAK,CAAC,GAAG,CAAC,GAAoB;YAC5B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjB,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAC9B,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HandlerResponse, ApplePassHandlersConfig, ApplePassDeviceRequest, ApplePassSerialNumbersRequest, ApplePassLatestRequest, AppleLogRequest } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create framework-agnostic handler functions for the Apple Pass web service
|
|
4
|
+
* protocol. Each handler accepts a plain request object and returns a plain
|
|
5
|
+
* `{ status, headers, body }` response.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createApplePassHandlers: (config: ApplePassHandlersConfig) => {
|
|
8
|
+
/**
|
|
9
|
+
* `POST /v1/devices/:did/registrations/:ptid/:sn`
|
|
10
|
+
*
|
|
11
|
+
* Register a device to receive push notifications for a pass.
|
|
12
|
+
*/
|
|
13
|
+
registerDevice(req: ApplePassDeviceRequest): Promise<HandlerResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* `DELETE /v1/devices/:did/registrations/:ptid/:sn`
|
|
16
|
+
*
|
|
17
|
+
* Unregister a device from a pass.
|
|
18
|
+
*/
|
|
19
|
+
unregisterDevice(req: ApplePassDeviceRequest): Promise<HandlerResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* `GET /v1/devices/:did/registrations/:ptid`
|
|
22
|
+
*
|
|
23
|
+
* Return serial numbers of passes registered to a device.
|
|
24
|
+
*/
|
|
25
|
+
getSerialNumbers(req: ApplePassSerialNumbersRequest): Promise<HandlerResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* `GET /v1/passes/:ptid/:sn`
|
|
28
|
+
*
|
|
29
|
+
* Return the latest version of a pass as a `.pkpass` buffer.
|
|
30
|
+
*/
|
|
31
|
+
getLatestPass(req: ApplePassLatestRequest): Promise<HandlerResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* `POST /v1/log`
|
|
34
|
+
*
|
|
35
|
+
* Accept log messages from Apple Wallet.
|
|
36
|
+
*/
|
|
37
|
+
log(req: AppleLogRequest): Promise<HandlerResponse>;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=apple-pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-pass.d.ts","sourceRoot":"","sources":["../../src/handlers/apple-pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAWnB;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,uBAAuB;IAInE;;;;OAIG;wBACuB,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;IAuB3E;;;;OAIG;0BACyB,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;IAa7E;;;;OAIG;0BACyB,6BAA6B,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BpF;;;;OAIG;uBACsB,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC;IAoC1E;;;;OAIG;aACY,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAO5D,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
function validateAuth(authorization, expectedToken) {
|
|
2
|
+
if (!authorization)
|
|
3
|
+
return false;
|
|
4
|
+
const token = authorization.replace(/^ApplePass\s+/i, "").trim();
|
|
5
|
+
return token === expectedToken;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create framework-agnostic handler functions for the Apple Pass web service
|
|
9
|
+
* protocol. Each handler accepts a plain request object and returns a plain
|
|
10
|
+
* `{ status, headers, body }` response.
|
|
11
|
+
*/
|
|
12
|
+
export const createApplePassHandlers = (config) => {
|
|
13
|
+
const { authenticationToken, store } = config;
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* `POST /v1/devices/:did/registrations/:ptid/:sn`
|
|
17
|
+
*
|
|
18
|
+
* Register a device to receive push notifications for a pass.
|
|
19
|
+
*/
|
|
20
|
+
async registerDevice(req) {
|
|
21
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
22
|
+
return { status: 401 };
|
|
23
|
+
}
|
|
24
|
+
if (!req.pushToken) {
|
|
25
|
+
return { status: 400, body: { message: "pushToken is required" } };
|
|
26
|
+
}
|
|
27
|
+
const pass = await store.getPass(req.serialNumber);
|
|
28
|
+
if (!pass) {
|
|
29
|
+
return { status: 404 };
|
|
30
|
+
}
|
|
31
|
+
const result = await store.registerDevice(req.deviceLibraryIdentifier, req.pushToken, req.serialNumber);
|
|
32
|
+
return { status: result === "created" ? 201 : 200 };
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* `DELETE /v1/devices/:did/registrations/:ptid/:sn`
|
|
36
|
+
*
|
|
37
|
+
* Unregister a device from a pass.
|
|
38
|
+
*/
|
|
39
|
+
async unregisterDevice(req) {
|
|
40
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
41
|
+
return { status: 401 };
|
|
42
|
+
}
|
|
43
|
+
await store.unregisterDevice(req.deviceLibraryIdentifier, req.serialNumber);
|
|
44
|
+
return { status: 200 };
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* `GET /v1/devices/:did/registrations/:ptid`
|
|
48
|
+
*
|
|
49
|
+
* Return serial numbers of passes registered to a device.
|
|
50
|
+
*/
|
|
51
|
+
async getSerialNumbers(req) {
|
|
52
|
+
const registrations = await store.getRegistrations(req.passTypeIdentifier, req.deviceLibraryIdentifier, req.passesUpdatedSince);
|
|
53
|
+
if (registrations.length === 0) {
|
|
54
|
+
return { status: 204 };
|
|
55
|
+
}
|
|
56
|
+
const sorted = registrations.sort((a, b) => a.updatedAt.getTime() - b.updatedAt.getTime());
|
|
57
|
+
const lastUpdated = sorted[sorted.length - 1].updatedAt.toISOString();
|
|
58
|
+
return {
|
|
59
|
+
status: 200,
|
|
60
|
+
body: {
|
|
61
|
+
serialNumbers: sorted.map((r) => r.serialNumber),
|
|
62
|
+
lastUpdated,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* `GET /v1/passes/:ptid/:sn`
|
|
68
|
+
*
|
|
69
|
+
* Return the latest version of a pass as a `.pkpass` buffer.
|
|
70
|
+
*/
|
|
71
|
+
async getLatestPass(req) {
|
|
72
|
+
if (!validateAuth(req.authorization, authenticationToken)) {
|
|
73
|
+
return { status: 401 };
|
|
74
|
+
}
|
|
75
|
+
const pass = await store.getPass(req.serialNumber);
|
|
76
|
+
if (!pass) {
|
|
77
|
+
return { status: 404 };
|
|
78
|
+
}
|
|
79
|
+
// Return 304 if the pass hasn't been modified since the client's copy
|
|
80
|
+
if (req.ifModifiedSince) {
|
|
81
|
+
const clientDate = new Date(req.ifModifiedSince);
|
|
82
|
+
if (pass.updatedAt <= clientDate) {
|
|
83
|
+
return { status: 304 };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const passData = await store.getPassData(req.serialNumber);
|
|
87
|
+
if (!passData) {
|
|
88
|
+
return { status: 404 };
|
|
89
|
+
}
|
|
90
|
+
const pkpassBuffer = await config.buildPass(passData);
|
|
91
|
+
return {
|
|
92
|
+
status: 200,
|
|
93
|
+
headers: {
|
|
94
|
+
"Content-Type": "application/vnd.apple.pkpass",
|
|
95
|
+
"Content-Disposition": `attachment; filename="${req.serialNumber}.pkpass"`,
|
|
96
|
+
"Last-Modified": pass.updatedAt.toUTCString(),
|
|
97
|
+
},
|
|
98
|
+
body: pkpassBuffer,
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* `POST /v1/log`
|
|
103
|
+
*
|
|
104
|
+
* Accept log messages from Apple Wallet.
|
|
105
|
+
*/
|
|
106
|
+
async log(req) {
|
|
107
|
+
if (config.onLog) {
|
|
108
|
+
await config.onLog(req.logs);
|
|
109
|
+
}
|
|
110
|
+
return { status: 200 };
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=apple-pass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-pass.js","sourceRoot":"","sources":["../../src/handlers/apple-pass.ts"],"names":[],"mappings":"AASA,SAAS,YAAY,CACnB,aAAiC,EACjC,aAAqB;IAErB,IAAI,CAAC,aAAa;QAAE,OAAO,KAAK,CAAA;IAChC,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IAChE,OAAO,KAAK,KAAK,aAAa,CAAA;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAA+B,EAAE,EAAE;IACzE,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IAE7C,OAAO;QACL;;;;WAIG;QACH,KAAK,CAAC,cAAc,CAAC,GAA2B;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AAE,GAAG,EAAE,CAAA;gBACxB,CAAC;YACH,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;YAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;YACxB,CAAC;YAED,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAErD,OAAO;gBACL,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE;oBACP,cAAc,EAAE,8BAA8B;oBAC9C,qBAAqB,EAAE,yBAAyB,GAAG,CAAC,YAAY,UAAU;oBAC1E,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;iBAC9C;gBACD,IAAI,EAAE,YAAY;aACnB,CAAA;QACH,CAAC;QAED;;;;WAIG;QACH,KAAK,CAAC,GAAG,CAAC,GAAoB;YAC5B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjB,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAC9B,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createApplePassHandlers } from "./apple-pass.js";
|
|
2
|
+
export { createAppleOrderHandlers } from "./apple-order.js";
|
|
3
|
+
export type { HandlerResponse, ApplePassStore, ApplePassDeviceRequest, ApplePassSerialNumbersRequest, ApplePassLatestRequest, ApplePassHandlersConfig, AppleOrderStore, AppleOrderDeviceRequest, AppleOrderIdentifiersRequest, AppleOrderLatestRequest, AppleOrderHandlersConfig, AppleLogRequest, } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,YAAY,EACV,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,GAChB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/** Plain HTTP response object — framework-agnostic. */
|
|
2
|
+
export interface HandlerResponse {
|
|
3
|
+
status: number;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
body?: unknown;
|
|
6
|
+
}
|
|
7
|
+
/** Async callbacks for Apple Pass database operations. */
|
|
8
|
+
export interface ApplePassStore {
|
|
9
|
+
/** Look up a pass by serial number. Return null if not found. */
|
|
10
|
+
getPass(serialNumber: string): Promise<{
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
} | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Register a device to receive push updates for a pass.
|
|
15
|
+
* Return `"created"` for new registrations or `"already_registered"` if the
|
|
16
|
+
* device was already registered for this pass.
|
|
17
|
+
*/
|
|
18
|
+
registerDevice(deviceLibraryIdentifier: string, pushToken: string, serialNumber: string): Promise<"created" | "already_registered">;
|
|
19
|
+
/** Unregister a device from a pass. */
|
|
20
|
+
unregisterDevice(deviceLibraryIdentifier: string, serialNumber: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Return all passes registered to a device, optionally filtered by
|
|
23
|
+
* modification date.
|
|
24
|
+
*/
|
|
25
|
+
getRegistrations(passTypeIdentifier: string, deviceLibraryIdentifier: string, updatedSince?: string): Promise<{
|
|
26
|
+
serialNumber: string;
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
}[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Return the data needed to build a `.pkpass` file for the given serial
|
|
31
|
+
* number. The shape of the returned object is up to you — the handler will
|
|
32
|
+
* pass it through to your `buildPass` callback.
|
|
33
|
+
*/
|
|
34
|
+
getPassData(serialNumber: string): Promise<Record<string, unknown> | null>;
|
|
35
|
+
}
|
|
36
|
+
/** Request data for pass device registration / unregistration. */
|
|
37
|
+
export interface ApplePassDeviceRequest {
|
|
38
|
+
deviceLibraryIdentifier: string;
|
|
39
|
+
passTypeIdentifier: string;
|
|
40
|
+
serialNumber: string;
|
|
41
|
+
authorization?: string;
|
|
42
|
+
pushToken?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Request data for fetching serial numbers. */
|
|
45
|
+
export interface ApplePassSerialNumbersRequest {
|
|
46
|
+
deviceLibraryIdentifier: string;
|
|
47
|
+
passTypeIdentifier: string;
|
|
48
|
+
passesUpdatedSince?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Request data for fetching the latest pass. */
|
|
51
|
+
export interface ApplePassLatestRequest {
|
|
52
|
+
passTypeIdentifier: string;
|
|
53
|
+
serialNumber: string;
|
|
54
|
+
authorization?: string;
|
|
55
|
+
ifModifiedSince?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Request data for the log endpoint. */
|
|
58
|
+
export interface AppleLogRequest {
|
|
59
|
+
logs: string[];
|
|
60
|
+
}
|
|
61
|
+
/** Options for `createApplePassHandlers`. */
|
|
62
|
+
export interface ApplePassHandlersConfig {
|
|
63
|
+
/** The authentication token configured in pass.json. */
|
|
64
|
+
authenticationToken: string;
|
|
65
|
+
/** Store adapter with async callbacks for DB operations. */
|
|
66
|
+
store: ApplePassStore;
|
|
67
|
+
/**
|
|
68
|
+
* Build a signed `.pkpass` buffer from the pass data returned by
|
|
69
|
+
* `store.getPassData`. This is where you call your template logic.
|
|
70
|
+
*/
|
|
71
|
+
buildPass(passData: Record<string, unknown>): Promise<Buffer>;
|
|
72
|
+
/** Optional log callback. */
|
|
73
|
+
onLog?(logs: string[]): void | Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/** Async callbacks for Apple Order database operations. */
|
|
76
|
+
export interface AppleOrderStore {
|
|
77
|
+
/** Look up an order by identifier. Return null if not found. */
|
|
78
|
+
getOrder(orderIdentifier: string): Promise<{
|
|
79
|
+
updatedAt: Date;
|
|
80
|
+
} | null>;
|
|
81
|
+
/**
|
|
82
|
+
* Register a device to receive push updates for an order.
|
|
83
|
+
* Return `"created"` for new registrations or `"already_registered"` if the
|
|
84
|
+
* device was already registered for this order.
|
|
85
|
+
*/
|
|
86
|
+
registerDevice(deviceIdentifier: string, pushToken: string, orderIdentifier: string): Promise<"created" | "already_registered">;
|
|
87
|
+
/** Unregister a device from an order. */
|
|
88
|
+
unregisterDevice(deviceIdentifier: string, orderIdentifier: string): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Return all orders registered to a device, optionally filtered by
|
|
91
|
+
* modification date.
|
|
92
|
+
*/
|
|
93
|
+
getRegistrations(orderTypeIdentifier: string, deviceIdentifier: string, modifiedSince?: string): Promise<{
|
|
94
|
+
orderIdentifier: string;
|
|
95
|
+
updatedAt: Date;
|
|
96
|
+
}[]>;
|
|
97
|
+
}
|
|
98
|
+
/** Request data for order device registration / unregistration. */
|
|
99
|
+
export interface AppleOrderDeviceRequest {
|
|
100
|
+
deviceIdentifier: string;
|
|
101
|
+
orderTypeIdentifier: string;
|
|
102
|
+
orderIdentifier: string;
|
|
103
|
+
authorization?: string;
|
|
104
|
+
pushToken?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Request data for fetching order identifiers. */
|
|
107
|
+
export interface AppleOrderIdentifiersRequest {
|
|
108
|
+
deviceIdentifier: string;
|
|
109
|
+
orderTypeIdentifier: string;
|
|
110
|
+
ordersModifiedSince?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Request data for fetching the latest order. */
|
|
113
|
+
export interface AppleOrderLatestRequest {
|
|
114
|
+
orderTypeIdentifier: string;
|
|
115
|
+
orderIdentifier: string;
|
|
116
|
+
authorization?: string;
|
|
117
|
+
ifModifiedSince?: string;
|
|
118
|
+
}
|
|
119
|
+
/** Options for `createAppleOrderHandlers`. */
|
|
120
|
+
export interface AppleOrderHandlersConfig {
|
|
121
|
+
/** The authentication token configured for orders. */
|
|
122
|
+
authenticationToken: string;
|
|
123
|
+
/** Store adapter with async callbacks for DB operations. */
|
|
124
|
+
store: AppleOrderStore;
|
|
125
|
+
/**
|
|
126
|
+
* Build a signed `.order` buffer for the given order identifier.
|
|
127
|
+
* This is where you call your order generation logic.
|
|
128
|
+
*/
|
|
129
|
+
buildOrder(orderIdentifier: string): Promise<Buffer>;
|
|
130
|
+
/** Optional log callback. */
|
|
131
|
+
onLog?(logs: string[]): void | Promise<void>;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/handlers/types.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAID,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAElE;;;;OAIG;IACH,cAAc,CACZ,uBAAuB,EAAE,MAAM,EAC/B,SAAS,EAAE,MAAM,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C,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,8CAA8C;AAC9C,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,mBAAmB,EAAE,MAAM,CAAA;IAC3B,4DAA4D;IAC5D,KAAK,EAAE,eAAe,CAAA;IACtB;;;OAGG;IACH,UAAU,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACpD,6BAA6B;IAC7B,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/handlers/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { translateOrderStatus } from "./common/types.js";
|
|
|
6
6
|
export type { OrderStatus, CouponPassData, OrderData } from "./common/types.js";
|
|
7
7
|
export type { OrderInstance, Merchant, Payment, MoneyAmount, SummaryItem, LineItem, Fulfillment, AppleCouponPassOptions, AppleOrderOptions, ApplePushOptions, } from "./apple/types.js";
|
|
8
8
|
export type { GoogleReviewStatus, GoogleObjectState, GoogleClassType, GoogleObjectType, GoogleSaveType, GoogleOfferClassOptions, GoogleOfferObjectOptions, GoogleOrderClassOptions, GoogleOrderObjectOptions, } from "./google/types.js";
|
|
9
|
+
export { createApplePassHandlers, createAppleOrderHandlers } from "./handlers/index.js";
|
|
10
|
+
export type { HandlerResponse, ApplePassStore, ApplePassDeviceRequest, ApplePassSerialNumbersRequest, ApplePassLatestRequest, ApplePassHandlersConfig, AppleOrderStore, AppleOrderDeviceRequest, AppleOrderIdentifiersRequest, AppleOrderLatestRequest, AppleOrderHandlersConfig, AppleLogRequest, } from "./handlers/index.js";
|
|
9
11
|
import type { ApplePassConfig, AppleOrderConfig, GoogleClientConfig } from "./common/config.js";
|
|
10
12
|
/**
|
|
11
13
|
* Create a configured Apple Wallet client with convenience methods.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAG/E,YAAY,EACV,aAAa,EACb,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAG/E,YAAY,EACV,aAAa,EACb,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AACvF,YAAY,EACV,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAM/F;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ;IAC9C,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACzB;IAKG,uDAAuD;;IAKvD,sDAAsD;;IAKtD,sEAAsE;mCACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,MAAM,EAAE;IAIzE,8DAA8D;kCAChC,OAAO,kBAAkB,EAAE,iBAAiB;IAI1E,qCAAqC;uCACF,MAAM,GAAG,MAAM,EAAE,SAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;CAYtE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,kBAAkB;;;;;;;;;;;;IAO/D,8CAA8C;yBAEtC,OAAO,mBAAmB,EAAE,cAAc,gBAClC,MAAM,eACP,MAAM;CAGxB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export { loadClient, getClass, createClass, updateClass, updateObject, getSigned
|
|
|
6
6
|
export { applePassConfigSchema, appleOrderConfigSchema, appleClientConfigSchema, googleClientConfigSchema, } from "./common/config.js";
|
|
7
7
|
// ── Common Types ────────────────────────────────────────────────────────
|
|
8
8
|
export { translateOrderStatus } from "./common/types.js";
|
|
9
|
+
// ── Handlers ─────────────────────────────────────────────────────────────
|
|
10
|
+
export { createApplePassHandlers, createAppleOrderHandlers } from "./handlers/index.js";
|
|
9
11
|
// ── Factory helpers ─────────────────────────────────────────────────────
|
|
10
12
|
import { applePassConfigSchema, appleOrderConfigSchema, googleClientConfigSchema } from "./common/config.js";
|
|
11
13
|
import { loadPassTemplate as _loadPassTemplate } from "./apple/pass.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AAEzB,2EAA2E;AAC3E,OAAO,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAA;AAE1B,2EAA2E;AAC3E,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,oBAAoB,CAAA;AAQ3B,2EAA2E;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AA8BxD,2EAA2E;AAE3E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAE5G,OAAO,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,aAAa,IAAI,cAAc,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAChJ,OAAO,EAAE,oBAAoB,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAA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MAAM,wBAAwB,GAAG,CAAC,MAA0B,EAAE,EAAE;IACrE,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACrD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAElC,OAAO;QACL,MAAM;QACN,MAAM,EAAE,MAAM;QACd,8CAA8C;QAC9C,YAAY,EAAE,CACZ,IAAgD,EAChD,YAAoB,EACpB,WAAmB,EACnB,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,CAAC;KAC5D,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkit-wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Apple Wallet + Google Wallet pass generation made easy",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,6 +11,21 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/dmvvilela/passkit-wallet/issues"
|
|
13
13
|
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"apple-wallet",
|
|
16
|
+
"google-wallet",
|
|
17
|
+
"passkit",
|
|
18
|
+
"pkpass",
|
|
19
|
+
"wallet-pass",
|
|
20
|
+
"coupon",
|
|
21
|
+
"order",
|
|
22
|
+
"passbook",
|
|
23
|
+
"apple-pay",
|
|
24
|
+
"google-pay",
|
|
25
|
+
"wallet",
|
|
26
|
+
"pass",
|
|
27
|
+
"typescript"
|
|
28
|
+
],
|
|
14
29
|
"type": "module",
|
|
15
30
|
"main": "./dist/index.js",
|
|
16
31
|
"types": "./dist/index.d.ts",
|
|
@@ -27,6 +42,10 @@
|
|
|
27
42
|
"types": "./dist/google/index.d.ts",
|
|
28
43
|
"import": "./dist/google/index.js"
|
|
29
44
|
},
|
|
45
|
+
"./handlers": {
|
|
46
|
+
"types": "./dist/handlers/index.d.ts",
|
|
47
|
+
"import": "./dist/handlers/index.js"
|
|
48
|
+
},
|
|
30
49
|
"./react": {
|
|
31
50
|
"types": "./dist/react/index.d.ts",
|
|
32
51
|
"import": "./dist/react/index.js"
|