@openwop/openwop 1.9.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 -18
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +26 -56
  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 +22 -13
  32. package/dist/webhook-header-families.d.ts.map +1 -1
  33. package/dist/webhook-header-families.js +30 -27
  34. package/dist/webhook-header-families.js.map +1 -1
  35. package/dist/webhook-helpers.browser.d.ts +15 -29
  36. package/dist/webhook-helpers.browser.d.ts.map +1 -1
  37. package/dist/webhook-helpers.browser.js +16 -31
  38. package/dist/webhook-helpers.browser.js.map +1 -1
  39. package/dist/webhook-helpers.d.ts +41 -41
  40. package/dist/webhook-helpers.d.ts.map +1 -1
  41. package/dist/webhook-helpers.js +40 -47
  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 -110
  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 +41 -29
  54. package/src/webhook-helpers.browser.ts +23 -32
  55. package/src/webhook-helpers.ts +67 -53
  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,82 +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 (`webhooks.md` §"Headers"):
7
+ * The signing recipe (webhooks.md §Headers):
8
8
  *
9
9
  * hmac = HMAC-SHA256(secret, `${timestamp}.${rawBody}`)
10
- * header `X-openwop-Signature: sha256=<hmac-hex>` (v1 canonical)
11
- * header `OpenWOP-Signature: sha256=<hmac-hex>` (RFC 0165 §C.1, dual-emitted)
12
- * header `X-openwop-Timestamp` / `OpenWOP-Timestamp: <unix-seconds>`
10
+ * header `OpenWOP-Signature: sha256=<hmac-hex>`
11
+ * header `OpenWOP-Timestamp: <unix-seconds>`
12
+ * header `OpenWOP-Signature-Algorithm: v1`
13
13
  *
14
- * History (RFC 0165 §C.3): until 1.9.0 this helper read a header named
15
- * `openwop-Webhook-Signature` carrying `v1=<hex>` a name and value shape
16
- * that appear in no spec file. A spec-conformant `sha256=` delivery failed
17
- * verification outright. The helper now accepts BOTH value forms, and
18
- * `readWebhookHeaders` picks the first present header family in spec order
19
- * (`OpenWOP-*`, then `X-openwop-*`, then the legacy `openwop-Webhook-*`).
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).
20
18
  *
21
19
  * Verification:
22
20
  *
23
- * 1. Parse the `sha256=<hex>` (or legacy `v1=<hex>`) value from the signature header.
24
- * 2. Recompute `expected = HMAC-SHA256(secret, `${timestamp}.${rawBody}`)`.
25
- * 3. Compare using **constant-time** equality (timing-safe).
26
- * 4. Reject when `|now - timestamp|` exceeds the freshness window
27
- * (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.
28
26
  *
29
- * Implementation note: this helper uses `node:crypto`'s `timingSafeEqual`
30
- * for the comparison. The browser-side equivalent (Web Crypto's
31
- * `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`).
32
30
  *
33
31
  * @module @openwop/openwop/webhook-helpers
34
32
  */
35
33
  import { createHmac, timingSafeEqual } from 'node:crypto';
36
- import { parseSignatureValue } from './webhook-header-families.js';
37
- /** 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). */
38
36
  export const DEFAULT_WEBHOOK_FRESHNESS_WINDOW_SECONDS = 300;
39
37
  /**
40
- * Verify a webhook delivery per `spec/v1/webhooks.md` §"Signature
41
- * recipe". Returns `{ valid: true }` on success; otherwise
38
+ * Verify a webhook delivery. Returns `{ valid: true }` on success; otherwise
42
39
  * `{ valid: false, reason }` so callers can log + alert appropriately.
43
40
  *
44
- * Callers MUST pass the **raw** body bytes — JSON-parsed-then-
45
- * re-serialized bodies will fail verification because the host
46
- * 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.
47
44
  *
48
- * @param secret The pre-shared secret returned from `webhooks.register`.
49
- * @param signatureHeader The value of the signature header — `OpenWOP-Signature` / `X-openwop-Signature` (`"sha256=abc123…"`) or the legacy `openwop-Webhook-Signature` (`"v1=abc123…"`); see `readWebhookHeaders`.
50
- * @param timestampHeader The value of the matching 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).
51
48
  * @param rawBody The exact request body bytes the host POSTed.
52
49
  */
53
50
  export function verifyWebhookSignature(secret, signatureHeader, timestampHeader, rawBody, options = {}) {
54
- // 1. Parse the signature header — spec form `sha256=<hex>` (webhooks.md
55
- // §"Headers") or the legacy SDK form `v1=<hex>` (RFC 0165 §C.3).
51
+ // 1. Parse the signature header — `sha256=<hex>` only.
56
52
  const providedHex = parseSignatureValue(signatureHeader);
57
53
  if (providedHex === null) {
58
54
  return { valid: false, reason: 'malformed_signature_header' };
59
55
  }
60
- if (!/^[0-9a-f]+$/i.test(providedHex)) {
61
- 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' };
62
60
  }
63
- // 2. Parse the timestamp.
61
+ // 3. Parse the timestamp.
64
62
  const timestamp = Number(timestampHeader);
65
63
  if (!Number.isInteger(timestamp) || timestamp <= 0) {
66
64
  return { valid: false, reason: 'malformed_timestamp_header' };
67
65
  }
68
- // 3. Freshness check.
66
+ // 4. Freshness check.
69
67
  const window = options.freshnessWindowSeconds ?? DEFAULT_WEBHOOK_FRESHNESS_WINDOW_SECONDS;
70
68
  if (window > 0) {
71
69
  const now = options.nowSeconds ?? Math.floor(Date.now() / 1000);
72
70
  const delta = now - timestamp;
73
71
  if (delta > window)
74
72
  return { valid: false, reason: 'timestamp_expired' };
75
- // Allow small future skew (within the window) but reject far-future timestamps.
76
73
  if (delta < -window)
77
74
  return { valid: false, reason: 'timestamp_too_far_in_future' };
78
75
  }
79
- // 4. Recompute + constant-time compare.
76
+ // 5. Recompute + constant-time compare.
80
77
  const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
81
78
  const signedBytes = `${timestamp}.${bodyStr}`;
82
79
  const expectedHex = createHmac('sha256', secret).update(signedBytes, 'utf8').digest('hex');
@@ -92,16 +89,14 @@ export function verifyWebhookSignature(secret, signatureHeader, timestampHeader,
92
89
  }
93
90
  /**
94
91
  * Compute the canonical webhook signature for a payload — useful when
95
- * implementing a host (forward direction) OR when generating test
96
- * fixtures. Receivers verify via `verifyWebhookSignature`; this is the
97
- * inverse.
92
+ * implementing a host (forward direction) OR when generating test fixtures.
93
+ * Receivers verify via `verifyWebhookSignature`; this is the inverse.
98
94
  */
99
95
  export function signWebhookDelivery(secret, timestamp, rawBody) {
100
96
  const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
101
97
  const hex = createHmac('sha256', secret).update(`${timestamp}.${bodyStr}`, 'utf8').digest('hex');
102
98
  return {
103
99
  signatureHeader: `sha256=${hex}`,
104
- legacySignatureHeader: `v1=${hex}`,
105
100
  timestampHeader: String(timestamp),
106
101
  headers: {
107
102
  'OpenWOP-Signature': `sha256=${hex}`,
@@ -110,10 +105,8 @@ export function signWebhookDelivery(secret, timestamp, rawBody) {
110
105
  'X-openwop-Signature': `sha256=${hex}`,
111
106
  'X-openwop-Timestamp': String(timestamp),
112
107
  'X-openwop-Signature-Algorithm': 'v1',
113
- 'openwop-Webhook-Signature': `v1=${hex}`,
114
- 'openwop-Webhook-Timestamp': String(timestamp),
115
108
  },
116
109
  };
117
110
  }
118
- export { WEBHOOK_HEADER_FAMILIES, parseSignatureValue, readWebhookHeaders } from './webhook-header-families.js';
111
+ export { WEBHOOK_HEADER_FAMILIES, WEBHOOK_SIGNATURE_ALGORITHMS, parseSignatureValue, readWebhookHeaders, } from './webhook-header-families.js';
119
112
  //# sourceMappingURL=webhook-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook-helpers.js","sourceRoot":"","sources":["../src/webhook-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,sFAAsF;AACtF,MAAM,CAAC,MAAM,wCAAwC,GAAG,GAAG,CAAC;AAoB5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc,EACd,eAAuB,EACvB,eAAuB,EACvB,OAAwB,EACxB,UAAyC,EAAE;IAE3C,wEAAwE;IACxE,oEAAoE;IACpE,MAAM,WAAW,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IAChE,CA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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"