@openwop/openwop 1.8.0 → 2.0.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.
Files changed (60) hide show
  1. package/README.md +64 -117
  2. package/dist/client.d.ts +131 -245
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +233 -440
  5. package/dist/client.js.map +1 -1
  6. package/dist/cost-attribution.d.ts +2 -2
  7. package/dist/cost-attribution.js +2 -2
  8. package/dist/envelope-directive.d.ts +1 -1
  9. package/dist/envelope-directive.js +1 -1
  10. package/dist/event-helpers.js +1 -1
  11. package/dist/event-helpers.js.map +1 -1
  12. package/dist/generated.d.ts +17 -0
  13. package/dist/generated.d.ts.map +1 -0
  14. package/dist/generated.js +311 -0
  15. package/dist/generated.js.map +1 -0
  16. package/dist/index.d.ts +16 -16
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +26 -53
  19. package/dist/index.js.map +1 -1
  20. package/dist/run-helpers.d.ts +20 -21
  21. package/dist/run-helpers.d.ts.map +1 -1
  22. package/dist/run-helpers.js +23 -72
  23. package/dist/run-helpers.js.map +1 -1
  24. package/dist/sse.d.ts +33 -15
  25. package/dist/sse.d.ts.map +1 -1
  26. package/dist/sse.js +28 -30
  27. package/dist/sse.js.map +1 -1
  28. package/dist/types.d.ts +253 -559
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/types.js.map +1 -1
  31. package/dist/webhook-header-families.d.ts +42 -0
  32. package/dist/webhook-header-families.d.ts.map +1 -0
  33. package/dist/webhook-header-families.js +58 -0
  34. package/dist/webhook-header-families.js.map +1 -0
  35. package/dist/webhook-helpers.browser.d.ts +15 -28
  36. package/dist/webhook-helpers.browser.d.ts.map +1 -1
  37. package/dist/webhook-helpers.browser.js +16 -27
  38. package/dist/webhook-helpers.browser.js.map +1 -1
  39. package/dist/webhook-helpers.d.ts +48 -32
  40. package/dist/webhook-helpers.d.ts.map +1 -1
  41. package/dist/webhook-helpers.js +52 -37
  42. package/dist/webhook-helpers.js.map +1 -1
  43. package/package.json +6 -4
  44. package/src/client.ts +255 -454
  45. package/src/cost-attribution.ts +2 -2
  46. package/src/envelope-directive.ts +1 -1
  47. package/src/event-helpers.ts +1 -1
  48. package/src/generated.ts +322 -0
  49. package/src/index.ts +78 -105
  50. package/src/run-helpers.ts +27 -85
  51. package/src/sse.ts +63 -42
  52. package/src/types.ts +268 -603
  53. package/src/webhook-header-families.ts +78 -0
  54. package/src/webhook-helpers.browser.ts +24 -28
  55. package/src/webhook-helpers.ts +87 -39
  56. package/dist/registry-helpers.d.ts +0 -118
  57. package/dist/registry-helpers.d.ts.map +0 -1
  58. package/dist/registry-helpers.js +0 -82
  59. package/dist/registry-helpers.js.map +0 -1
  60. package/src/registry-helpers.ts +0 -173
@@ -1,72 +1,79 @@
1
1
  /**
2
- * Webhook delivery-verification helpers per `spec/v1/webhooks.md`
3
- * §"Signature recipe". Receivers MUST verify both the HMAC AND the
4
- * timestamp freshness before accepting a delivery — verifying HMAC
5
- * alone leaves the receiver open to replay attacks.
2
+ * Webhook delivery-verification helpers per `spec/v2/core/webhooks.md`
3
+ * §Verification. Receivers MUST verify both the HMAC AND the timestamp
4
+ * freshness before accepting a delivery — verifying HMAC alone leaves the
5
+ * receiver open to replay attacks.
6
6
  *
7
- * The canonical signing recipe:
7
+ * The signing recipe (webhooks.md §Headers):
8
8
  *
9
9
  * hmac = HMAC-SHA256(secret, `${timestamp}.${rawBody}`)
10
- * header `openwop-Webhook-Signature: v1=<hmac-hex>`
11
- * header `openwop-Webhook-Timestamp: <unix-seconds>`
10
+ * header `OpenWOP-Signature: sha256=<hmac-hex>`
11
+ * header `OpenWOP-Timestamp: <unix-seconds>`
12
+ * header `OpenWOP-Signature-Algorithm: v1`
13
+ *
14
+ * A host advertising both majors sends the `X-openwop-*` family beside it
15
+ * with identical values through the overlap; `readWebhookHeaders` accepts
16
+ * either family. The SDK-only `openwop-Webhook-*` names and the `v1=<hex>`
17
+ * value form were removed in v2 (headers.md §Removed).
12
18
  *
13
19
  * Verification:
14
20
  *
15
- * 1. Parse the `v1=<hex>` value from the signature header.
16
- * 2. Recompute `expected = HMAC-SHA256(secret, `${timestamp}.${rawBody}`)`.
17
- * 3. Compare using **constant-time** equality (timing-safe).
18
- * 4. Reject when `|now - timestamp|` exceeds the freshness window
19
- * (default 5 minutes per `webhooks.md`'s recommendation).
21
+ * 1. Parse the `sha256=<hex>` value from the signature header.
22
+ * 2. Reject an unrecognized `OpenWOP-Signature-Algorithm` value (MUST).
23
+ * 3. Reject a timestamp more than ±window from the clock (default 5 min).
24
+ * 4. Recompute `HMAC-SHA256(`${timestamp}.${rawBody}`, secret)` and compare
25
+ * in constant time.
20
26
  *
21
- * Implementation note: this helper uses `node:crypto`'s `timingSafeEqual`
22
- * for the comparison. The browser-side equivalent (Web Crypto's
23
- * `subtle.verify`) is not wrapped here — the SDK's runtime is Node.
27
+ * Implementation note: this helper uses `node:crypto`'s `timingSafeEqual`.
28
+ * The browser build substitutes a stub that throws (see
29
+ * `webhook-helpers.browser.ts`).
24
30
  *
25
31
  * @module @openwop/openwop/webhook-helpers
26
32
  */
27
33
  import { createHmac, timingSafeEqual } from 'node:crypto';
28
- /** Default freshness window per `spec/v1/webhooks.md` §"Replay attack resistance". */
34
+ import { parseSignatureValue, WEBHOOK_SIGNATURE_ALGORITHMS } from './webhook-header-families.js';
35
+ /** Default freshness window per webhooks.md §Verification (±5 minutes). */
29
36
  export const DEFAULT_WEBHOOK_FRESHNESS_WINDOW_SECONDS = 300;
30
37
  /**
31
- * Verify a webhook delivery per `spec/v1/webhooks.md` §"Signature
32
- * recipe". Returns `{ valid: true }` on success; otherwise
38
+ * Verify a webhook delivery. Returns `{ valid: true }` on success; otherwise
33
39
  * `{ valid: false, reason }` so callers can log + alert appropriately.
34
40
  *
35
- * Callers MUST pass the **raw** body bytes — JSON-parsed-then-
36
- * re-serialized bodies will fail verification because the host
37
- * signs the exact bytes it delivered.
41
+ * Callers MUST pass the **raw** body bytes — JSON-parsed-then-re-serialized
42
+ * bodies fail verification because the host signs the exact bytes it
43
+ * delivered.
38
44
  *
39
- * @param secret The pre-shared secret returned from `webhooks.register`.
40
- * @param signatureHeader The value of the `openwop-Webhook-Signature` header (e.g., `"v1=abc123…"`).
41
- * @param timestampHeader The value of the `openwop-Webhook-Timestamp` header (unix seconds as string).
45
+ * @param secret The subscription secret.
46
+ * @param signatureHeader `OpenWOP-Signature` / `X-openwop-Signature` (`"sha256=abc123…"`); see `readWebhookHeaders`.
47
+ * @param timestampHeader The matching timestamp header (unix seconds as string).
42
48
  * @param rawBody The exact request body bytes the host POSTed.
43
49
  */
44
50
  export function verifyWebhookSignature(secret, signatureHeader, timestampHeader, rawBody, options = {}) {
45
- // 1. Parse the signature header.
46
- if (!signatureHeader.startsWith('v1=')) {
51
+ // 1. Parse the signature header — `sha256=<hex>` only.
52
+ const providedHex = parseSignatureValue(signatureHeader);
53
+ if (providedHex === null) {
47
54
  return { valid: false, reason: 'malformed_signature_header' };
48
55
  }
49
- const providedHex = signatureHeader.slice(3);
50
- if (!/^[0-9a-f]+$/i.test(providedHex)) {
51
- return { valid: false, reason: 'malformed_signature_header' };
56
+ // 2. Reject an unrecognized scheme.
57
+ if (options.algorithmHeader !== undefined &&
58
+ !WEBHOOK_SIGNATURE_ALGORITHMS.includes(options.algorithmHeader)) {
59
+ return { valid: false, reason: 'unsupported_signature_algorithm' };
52
60
  }
53
- // 2. Parse the timestamp.
61
+ // 3. Parse the timestamp.
54
62
  const timestamp = Number(timestampHeader);
55
63
  if (!Number.isInteger(timestamp) || timestamp <= 0) {
56
64
  return { valid: false, reason: 'malformed_timestamp_header' };
57
65
  }
58
- // 3. Freshness check.
66
+ // 4. Freshness check.
59
67
  const window = options.freshnessWindowSeconds ?? DEFAULT_WEBHOOK_FRESHNESS_WINDOW_SECONDS;
60
68
  if (window > 0) {
61
69
  const now = options.nowSeconds ?? Math.floor(Date.now() / 1000);
62
70
  const delta = now - timestamp;
63
71
  if (delta > window)
64
72
  return { valid: false, reason: 'timestamp_expired' };
65
- // Allow small future skew (within the window) but reject far-future timestamps.
66
73
  if (delta < -window)
67
74
  return { valid: false, reason: 'timestamp_too_far_in_future' };
68
75
  }
69
- // 4. Recompute + constant-time compare.
76
+ // 5. Recompute + constant-time compare.
70
77
  const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
71
78
  const signedBytes = `${timestamp}.${bodyStr}`;
72
79
  const expectedHex = createHmac('sha256', secret).update(signedBytes, 'utf8').digest('hex');
@@ -82,16 +89,24 @@ export function verifyWebhookSignature(secret, signatureHeader, timestampHeader,
82
89
  }
83
90
  /**
84
91
  * Compute the canonical webhook signature for a payload — useful when
85
- * implementing a host (forward direction) OR when generating test
86
- * fixtures. Receivers verify via `verifyWebhookSignature`; this is the
87
- * inverse.
92
+ * implementing a host (forward direction) OR when generating test fixtures.
93
+ * Receivers verify via `verifyWebhookSignature`; this is the inverse.
88
94
  */
89
95
  export function signWebhookDelivery(secret, timestamp, rawBody) {
90
96
  const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
91
97
  const hex = createHmac('sha256', secret).update(`${timestamp}.${bodyStr}`, 'utf8').digest('hex');
92
98
  return {
93
- signatureHeader: `v1=${hex}`,
99
+ signatureHeader: `sha256=${hex}`,
94
100
  timestampHeader: String(timestamp),
101
+ headers: {
102
+ 'OpenWOP-Signature': `sha256=${hex}`,
103
+ 'OpenWOP-Timestamp': String(timestamp),
104
+ 'OpenWOP-Signature-Algorithm': 'v1',
105
+ 'X-openwop-Signature': `sha256=${hex}`,
106
+ 'X-openwop-Timestamp': String(timestamp),
107
+ 'X-openwop-Signature-Algorithm': 'v1',
108
+ },
95
109
  };
96
110
  }
111
+ export { WEBHOOK_HEADER_FAMILIES, WEBHOOK_SIGNATURE_ALGORITHMS, parseSignatureValue, readWebhookHeaders, } from './webhook-header-families.js';
97
112
  //# sourceMappingURL=webhook-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,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mBAAmB,EACnB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@openwop/openwop",
3
- "version": "1.8.0",
4
- "description": "Production-ready TypeScript reference SDK for OpenWOP v1.0 compliant servers.",
3
+ "version": "2.0.0",
4
+ "description": "TypeScript reference SDK for OpenWOP v2 hosts — bare-origin unversioned paths, OpenWOP-Version negotiation, the closed discovery root, and the generated error-code registry.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/openwop/openwop-sdks.git",
8
- "directory": "sdk/typescript"
8
+ "directory": "sdk/typescript-v2"
9
9
  },
10
10
  "license": "Apache-2.0",
11
11
  "type": "module",
@@ -33,8 +33,10 @@
33
33
  "scripts": {
34
34
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
35
35
  "typecheck": "tsc --noEmit",
36
+ "generate": "node scripts/generate.mjs",
37
+ "generate:check": "node scripts/generate.mjs --check",
36
38
  "test": "vitest run",
37
- "prepublishOnly": "npm run build"
39
+ "prepublishOnly": "npm run generate:check && npm run build"
38
40
  },
39
41
  "engines": {
40
42
  "node": ">=20"