@forgezero/providers 0.1.36 → 0.1.38

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/billing.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/billing.ts
342
342
  var PAYMENT_PROVIDER_KEYS = ["stripe:v1", "paypal:v1", "razorpay:v1"];
package/dist/database.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/database.ts
342
342
  var pools = new Map;
package/dist/email.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/email.ts
342
342
  var recipients = (to) => Array.isArray(to) ? [...to] : [to];
package/dist/git.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/git.ts
342
342
  var githubAppConfigSchema = {
package/dist/http.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/http.ts
342
342
  class BudgetExhausted extends ProviderError {
package/dist/index.d.ts CHANGED
@@ -303,5 +303,5 @@ export interface EmailBatchResult {
303
303
  };
304
304
  results: readonly EmailBatchItemResult[];
305
305
  }
306
- export declare const VERSION = "0.1.36";
306
+ export declare const VERSION = "0.1.38";
307
307
  export {};
package/dist/index.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
  export {
341
341
  staticConfig,
342
342
  serviceMethod,
package/dist/pool.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/http.ts
342
342
  class BudgetExhausted extends ProviderError {
@@ -1,10 +1,11 @@
1
- import { type RealtimeBatch } from '@forgezero/runtime/realtime';
1
+ import { type RealtimeBatch, type RealtimePublishResponse } from '@forgezero/runtime/realtime';
2
2
  import { type NodeKeyPair } from '@forgezero/runtime/identity';
3
3
  export interface RealtimeProviderOptions {
4
4
  endpoint: string;
5
- /** Legacy v2 compatibility credential. Removed after every edge reports v3. */
6
- secret?: string;
7
- identity?: Readonly<{
5
+ /** Worker inbound credential. Required in addition to the hybrid proof. */
6
+ secret: string;
7
+ /** Ed25519 + ML-DSA producer identity. Both signatures are mandatory. */
8
+ identity: Readonly<{
8
9
  nodeKey: string;
9
10
  keys: NodeKeyPair;
10
11
  }>;
@@ -18,8 +19,5 @@ export declare class RealtimeProviderError extends Error {
18
19
  }
19
20
  /** One external request per batch; Worker/DO bindings own the internal fan-out. */
20
21
  export declare function cloudflareRealtime(options: RealtimeProviderOptions): {
21
- publish(input: RealtimeBatch): Promise<{
22
- delivered: number;
23
- shards: number;
24
- }>;
22
+ publish(input: RealtimeBatch): Promise<RealtimePublishResponse>;
25
23
  };
package/dist/realtime.js CHANGED
@@ -1,5 +1,11 @@
1
1
  // src/realtime.ts
2
- import { realtimeBatchBytes, realtimeHmac, validateRealtimeBatch } from "@forgezero/runtime/realtime";
2
+ import {
3
+ realtimeBatchBytes,
4
+ realtimeHmac,
5
+ realtimePublishMessage,
6
+ validateRealtimeBatch,
7
+ validateRealtimePublishResponse
8
+ } from "@forgezero/runtime/realtime";
3
9
  import { encodeSignatureHeader, signRequest } from "@forgezero/runtime/identity";
4
10
 
5
11
  class RealtimeProviderError extends Error {
@@ -13,7 +19,7 @@ class RealtimeProviderError extends Error {
13
19
  var producerPattern = /^[A-Za-z0-9][A-Za-z0-9_.:@/-]{0,127}$/;
14
20
  function cloudflareRealtime(options) {
15
21
  const endpoint = new URL(options.endpoint);
16
- if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || !producerPattern.test(options.producer) || !options.identity && new TextEncoder().encode(options.secret ?? "").byteLength < 32 || options.identity && options.identity.nodeKey !== options.producer) {
22
+ if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.search || endpoint.hash || !producerPattern.test(options.producer) || new TextEncoder().encode(options.secret).byteLength < 32 || options.identity.nodeKey !== options.producer) {
17
23
  throw new RealtimeProviderError("INVALID_CONFIG", "Realtime endpoint, producer, or secret is invalid.");
18
24
  }
19
25
  endpoint.pathname = "/__fz/realtime/publish";
@@ -27,10 +33,8 @@ function cloudflareRealtime(options) {
27
33
  const batch = validateRealtimeBatch(input);
28
34
  const body = realtimeBatchBytes(batch);
29
35
  const timestamp = Math.floor(Date.now() / 1000).toString();
30
- const signature = options.identity ? encodeSignatureHeader(signRequest(options.identity.keys, options.identity.nodeKey, { method: "POST", path: endpoint.pathname, query: "", body })) : await realtimeHmac(options.secret, `publish
31
- ${options.producer}
32
- ${timestamp}
33
- ${body}`);
36
+ const proof = encodeSignatureHeader(signRequest(options.identity.keys, options.identity.nodeKey, { method: "POST", path: endpoint.pathname, query: "", body }));
37
+ const signature = await realtimeHmac(options.secret, realtimePublishMessage(options.producer, timestamp, body));
34
38
  let response;
35
39
  try {
36
40
  response = await fetcher(endpoint, {
@@ -43,7 +47,8 @@ ${body}`);
43
47
  "x-fz-realtime-producer": options.producer,
44
48
  "x-fz-realtime-timestamp": timestamp,
45
49
  "x-fz-realtime-signature": signature,
46
- ...options.identity ? { "x-fz-node-key": options.identity.nodeKey } : {},
50
+ "x-fz-realtime-proof": proof,
51
+ "x-fz-node-key": options.identity.nodeKey,
47
52
  "idempotency-key": batch.batchId
48
53
  }
49
54
  });
@@ -54,11 +59,11 @@ ${body}`);
54
59
  await response.body?.cancel();
55
60
  throw new RealtimeProviderError(response.status >= 500 ? "UNAVAILABLE" : "REFUSED", `Realtime edge returned HTTP ${response.status}.`);
56
61
  }
57
- const result = await response.json();
58
- if (!Number.isSafeInteger(result.delivered) || !Number.isSafeInteger(result.shards)) {
62
+ try {
63
+ return validateRealtimePublishResponse(await response.json());
64
+ } catch {
59
65
  throw new RealtimeProviderError("UNAVAILABLE", "Realtime edge returned malformed evidence.");
60
66
  }
61
- return { delivered: result.delivered, shards: result.shards };
62
67
  }
63
68
  };
64
69
  }
package/dist/storage.js CHANGED
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/storage.ts
342
342
  var encoder = new TextEncoder;
@@ -336,7 +336,7 @@ function createService(definition, methods, options = {}) {
336
336
  }
337
337
  };
338
338
  }
339
- var VERSION = "0.1.36";
339
+ var VERSION = "0.1.38";
340
340
 
341
341
  // src/translation.ts
342
342
  var GOOGLE_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/models";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgezero/providers",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -85,7 +85,7 @@
85
85
  "LICENSE"
86
86
  ],
87
87
  "dependencies": {
88
- "@forgezero/runtime": "^0.1.27",
88
+ "@forgezero/runtime": "^0.1.29",
89
89
  "@noble/curves": "2.2.0",
90
90
  "@noble/hashes": "2.2.0",
91
91
  "@noble/post-quantum": "0.6.1"