@particle-academy/fancy-connector-core 0.8.0 → 0.8.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/CHANGELOG.md +13 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2333,6 +2333,15 @@ type WebhookVerification = {
|
|
|
2333
2333
|
reason: string;
|
|
2334
2334
|
};
|
|
2335
2335
|
type HmacScheme = {
|
|
2336
|
+
/**
|
|
2337
|
+
* Optional and always `"hmac"`: every scheme written before 0.8.0 omits it
|
|
2338
|
+
* and still means HMAC. It exists so `verifyDelivery` dispatches on a NAMED
|
|
2339
|
+
* kind — `"shared-token"`, `"hmac"` or absent — and refuses any other value
|
|
2340
|
+
* by name, rather than treating "has no kind" as HMAC forever. (Fancy's
|
|
2341
|
+
* alignment review of 0.8.0: a third scheme that forgot its kind would
|
|
2342
|
+
* otherwise be verified as HMAC, silently.)
|
|
2343
|
+
*/
|
|
2344
|
+
kind?: "hmac";
|
|
2336
2345
|
/** Hash to use. */
|
|
2337
2346
|
algorithm: "SHA-256" | "SHA-1" | "SHA-512";
|
|
2338
2347
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2333,6 +2333,15 @@ type WebhookVerification = {
|
|
|
2333
2333
|
reason: string;
|
|
2334
2334
|
};
|
|
2335
2335
|
type HmacScheme = {
|
|
2336
|
+
/**
|
|
2337
|
+
* Optional and always `"hmac"`: every scheme written before 0.8.0 omits it
|
|
2338
|
+
* and still means HMAC. It exists so `verifyDelivery` dispatches on a NAMED
|
|
2339
|
+
* kind — `"shared-token"`, `"hmac"` or absent — and refuses any other value
|
|
2340
|
+
* by name, rather than treating "has no kind" as HMAC forever. (Fancy's
|
|
2341
|
+
* alignment review of 0.8.0: a third scheme that forgot its kind would
|
|
2342
|
+
* otherwise be verified as HMAC, silently.)
|
|
2343
|
+
*/
|
|
2344
|
+
kind?: "hmac";
|
|
2336
2345
|
/** Hash to use. */
|
|
2337
2346
|
algorithm: "SHA-256" | "SHA-1" | "SHA-512";
|
|
2338
2347
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1676,6 +1676,13 @@ async function verifyDelivery(trigger, delivery, secret, now) {
|
|
|
1676
1676
|
if (isSharedTokenSpec(spec)) {
|
|
1677
1677
|
return verifySharedToken({ raw: delivery.raw, headers: delivery.headers, secret, scheme: spec.scheme });
|
|
1678
1678
|
}
|
|
1679
|
+
const kind = spec.scheme.kind ?? "hmac";
|
|
1680
|
+
if (kind !== "hmac") {
|
|
1681
|
+
return {
|
|
1682
|
+
ok: false,
|
|
1683
|
+
reason: `${trigger.service}.${trigger.operation} declares a verification scheme "${kind}" this runtime does not know \u2014 refusing rather than guessing.`
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1679
1686
|
const rawHeader = header2(delivery.headers, spec.signatureHeader);
|
|
1680
1687
|
const parsed = spec.parse && rawHeader ? spec.parse(rawHeader) : { signature: rawHeader };
|
|
1681
1688
|
const timestamp = parsed.timestamp ?? (spec.timestampHeader ? header2(delivery.headers, spec.timestampHeader) : void 0);
|