@kindgi/types 0.1.6 → 0.1.7-rc.0

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/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type * from './refs.js';
6
6
  export type * from './result.js';
7
7
  export type * from './temporal.js';
8
8
  export type * from './version.js';
9
+ export type * from './webhook.js';
9
10
  export { makeEnvName } from './ids.js';
10
11
  export { bearerValueProblem, headerValueProblem } from './header-value.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,cAAc,CAAC;AAKlC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,WAAW,CAAC;AAC/B,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,cAAc,CAAC;AAClC,mBAAmB,cAAc,CAAC;AAKlC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAWjC,uEAAuE;AACvE,qEAAqE;AACrE,+DAA+D;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,yEAAyE;AACzE,8DAA8D;AAC9D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAYjC,uEAAuE;AACvE,qEAAqE;AACrE,+DAA+D;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,yEAAyE;AACzE,8DAA8D;AAC9D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * How a sender signs the requests a webhook trigger receives.
3
+ *
4
+ * - `hmac-sha256`: HMAC-SHA256 of the raw request body under the shared
5
+ * secret's UTF-8 bytes, in one header, `hex` or `base64`, after an
6
+ * optional `prefix` (GitHub and Drupal's Webhooks module send
7
+ * `X-Hub-Signature-256: sha256=<hex>`; WooCommerce sends
8
+ * `X-WC-Webhook-Signature: <base64>`; Shopify `X-Shopify-Hmac-Sha256:
9
+ * <base64>`). No timestamp is signed, so a replay is caught only by the
10
+ * trigger's delivery-id dedupe.
11
+ * - `standard-webhooks`: the Standard Webhooks format
12
+ * (https://www.standardwebhooks.com): `webhook-id`, `webhook-timestamp`
13
+ * and `webhook-signature: v1,<base64>` over `{id}.{timestamp}.{body}`,
14
+ * with a `whsec_` secret. A timestamp further than `toleranceSeconds`
15
+ * from the receiver's clock is refused (default 300).
16
+ */
17
+ export type WebhookSignatureScheme = {
18
+ readonly kind: 'hmac-sha256';
19
+ readonly encoding: 'hex' | 'base64';
20
+ /** The header that carries the signature; matched case-insensitively. */
21
+ readonly header: string;
22
+ /** Stripped from the header's value before decoding (e.g. `sha256=`). */
23
+ readonly prefix?: string;
24
+ } | {
25
+ readonly kind: 'standard-webhooks';
26
+ readonly toleranceSeconds?: number;
27
+ };
28
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,sBAAsB,GAC9B;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC"}
@@ -0,0 +1,4 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ export {};
4
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../src/webhook.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/types",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-rc.0",
4
4
  "description": "Foundational TypeScript types shared across Kindgi. Branded IDs, timestamps, hashes, refs, Result, list filter / page shapes. Zero runtime dependencies; the only runtime export is the makeEnvName validator.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ export type * from './refs.js';
9
9
  export type * from './result.js';
10
10
  export type * from './temporal.js';
11
11
  export type * from './version.js';
12
+ export type * from './webhook.js';
12
13
 
13
14
  // Runtime factories on branded IDs (validated construction). Kept as a
14
15
  // separate value re-export so the `export type *` barrels above stay
package/src/webhook.ts ADDED
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+
4
+ /**
5
+ * How a sender signs the requests a webhook trigger receives.
6
+ *
7
+ * - `hmac-sha256`: HMAC-SHA256 of the raw request body under the shared
8
+ * secret's UTF-8 bytes, in one header, `hex` or `base64`, after an
9
+ * optional `prefix` (GitHub and Drupal's Webhooks module send
10
+ * `X-Hub-Signature-256: sha256=<hex>`; WooCommerce sends
11
+ * `X-WC-Webhook-Signature: <base64>`; Shopify `X-Shopify-Hmac-Sha256:
12
+ * <base64>`). No timestamp is signed, so a replay is caught only by the
13
+ * trigger's delivery-id dedupe.
14
+ * - `standard-webhooks`: the Standard Webhooks format
15
+ * (https://www.standardwebhooks.com): `webhook-id`, `webhook-timestamp`
16
+ * and `webhook-signature: v1,<base64>` over `{id}.{timestamp}.{body}`,
17
+ * with a `whsec_` secret. A timestamp further than `toleranceSeconds`
18
+ * from the receiver's clock is refused (default 300).
19
+ */
20
+ export type WebhookSignatureScheme =
21
+ | {
22
+ readonly kind: 'hmac-sha256';
23
+ readonly encoding: 'hex' | 'base64';
24
+ /** The header that carries the signature; matched case-insensitively. */
25
+ readonly header: string;
26
+ /** Stripped from the header's value before decoding (e.g. `sha256=`). */
27
+ readonly prefix?: string;
28
+ }
29
+ | {
30
+ readonly kind: 'standard-webhooks';
31
+ readonly toleranceSeconds?: number;
32
+ };