@peektravel/app-utilities 0.7.0 → 0.7.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/docs/webhooks.md CHANGED
@@ -195,10 +195,12 @@ App Store config. There is no GraphQL selection to paste.
195
195
 
196
196
  ## Step 2 — verify and parse the delivery
197
197
 
198
- Extract the JWT from the delivery (the request token, or the `Authorization`
199
- header with the `Bearer ` prefix stripped) and pass it — along with the JSON body
200
- and your app's signing secret (the same `jwtSecret` you construct
201
- `PeekAccessService` with) — to `parseInstallWebhook`:
198
+ Peek delivers the signed token in the **`x-peek-auth` request header**. Pass that
199
+ header value as-is, along with the JSON body and your app's signing secret (the
200
+ same `jwtSecret` you construct `PeekAccessService` with — conventionally
201
+ `PEEK_INTERNAL_SECRET`), to `parseInstallWebhook`. You do **not** need to strip a
202
+ `Bearer ` prefix: `parseInstallWebhook` tolerates the header value with or
203
+ without it.
202
204
 
203
205
  ```ts
204
206
  import { parseInstallWebhook, type InstallWebhook } from "@peektravel/app-utilities";
@@ -206,7 +208,9 @@ import { parseInstallWebhook, type InstallWebhook } from "@peektravel/app-utilit
206
208
  app.post("/webhooks/install", async (req, res) => {
207
209
  let event: InstallWebhook;
208
210
  try {
209
- event = parseInstallWebhook(req.token, req.body, process.env.PEEK_INTERNAL_SECRET!);
211
+ // `x-peek-auth` carries the token (a `Bearer ` prefix, if any, is stripped for you):
212
+ const token = req.header("x-peek-auth") ?? "";
213
+ event = parseInstallWebhook(token, req.body, process.env.PEEK_INTERNAL_SECRET!);
210
214
  } catch {
211
215
  return res.sendStatus(401); // signature/issuer/audience/expiry failed
212
216
  }
package/llms.txt CHANGED
@@ -196,9 +196,11 @@ an external system** (App Store config), not from code.
196
196
  are **nullable**: a value this version does not recognise maps to `null` (wire
197
197
  value kept on `rawStatus`) rather than being coerced, because Peek does not
198
198
  redeliver a 2xx and a coerced status silently drops a lifecycle transition. Give
199
- both a `default:` branch that fails loudly. `secret` is the app's `jwtSecret`,
200
- app-wide, so it verifies fine on a brand-new install before any record exists.
201
- No query to register; just subscribe to the event.
199
+ both a `default:` branch that fails loudly. `token` is Peek's `x-peek-auth`
200
+ request header value — pass it as-is, a `Bearer ` prefix is stripped for you.
201
+ `secret` is the app's `jwtSecret`, app-wide, so it verifies fine on a brand-new
202
+ install before any record exists. No query to register; just subscribe to the
203
+ event.
202
204
  - **Deprecated / removed:** `verifyInstallWebhook(token, secret):
203
205
  InstallWebhookClaims` still verifies the token but is `@deprecated` — it reads
204
206
  only the token, missing the account name/platform/test flag. `parseInstallEvent`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peektravel/app-utilities",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "GraphQL JS mapping utilities extracted from the Peek Pro Autopilot connector.",
5
5
  "license": "MIT",
6
6
  "repository": {