@cero-base/cero 2.9.0 → 2.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cero-base/cero",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "The ideal p2p API — everything is a handle, handles contain refs, refs contain rows.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -113,7 +113,7 @@
113
113
  "test:node": "find test -name '*.test.js' | sort | xargs -P4 -n1 brittle-node"
114
114
  },
115
115
  "dependencies": {
116
- "@cero-base/core": "^2.9.0",
116
+ "@cero-base/core": "^2.10.0",
117
117
  "b4a": "^1.9.0",
118
118
  "bare-abort-controller": "^1.1.2",
119
119
  "bare-crypto": "^1.15.4",
package/src/index.js CHANGED
@@ -43,6 +43,8 @@ export { t, schema } from './lib/spec.js'
43
43
  * @property {string | null} [name] Friendly device name persisted on the identity claim.
44
44
  * @property {boolean} [isMobile] Marks this device as mobile.
45
45
  * @property {Array<{ host: string, port: number }>} [bootstrap] Custom DHT bootstrap nodes.
46
+ * @property {Array<string | Uint8Array>} [relayThrough] Blind relay public keys. Two devices that cannot connect direct, as on mobile carriers, connect through one; the relay forwards encrypted bytes and reads nothing. Direct connections stay direct.
47
+ * @property {(remotePublicKey: Uint8Array, payload: unknown) => boolean} [firewall] Incoming-connection filter: `true` refuses the connection.
46
48
  * @property {number[]} [backoffs] Swarm reconnect backoff tiers in ms (testing/tuning).
47
49
  * @property {string} [channel] Optional network-isolation label; only same-channel peers connect.
48
50
  * @property {Array<string | Uint8Array>} [mirrors] Blind-peer public keys. Handles and files are mirrored through them so peers sync even when never online at the same time. Mirrors hold only encrypted blocks — they never read your data.
@@ -133,6 +135,8 @@ async function start(dir, spec, opts = {}) {
133
135
 
134
136
  network = new Network({
135
137
  bootstrap: opts.bootstrap,
138
+ relayThrough: opts.relayThrough,
139
+ firewall: opts.firewall,
136
140
  backoffs: opts.backoffs,
137
141
  channel: opts.channel,
138
142
  store,
package/types/index.d.ts CHANGED
@@ -41,6 +41,14 @@ export type CeroOpts = {
41
41
  host: string;
42
42
  port: number;
43
43
  }>;
44
+ /**
45
+ * Blind relay public keys. Two devices that cannot connect direct, as on mobile carriers, connect through one; the relay forwards encrypted bytes and reads nothing. Direct connections stay direct.
46
+ */
47
+ relayThrough?: Array<string | Uint8Array>;
48
+ /**
49
+ * Incoming-connection filter: `true` refuses the connection.
50
+ */
51
+ firewall?: (remotePublicKey: Uint8Array, payload: unknown) => boolean;
44
52
  /**
45
53
  * Swarm reconnect backoff tiers in ms (testing/tuning).
46
54
  */
@@ -101,6 +109,8 @@ export type CeroOpts = {
101
109
  * @property {string | null} [name] Friendly device name persisted on the identity claim.
102
110
  * @property {boolean} [isMobile] Marks this device as mobile.
103
111
  * @property {Array<{ host: string, port: number }>} [bootstrap] Custom DHT bootstrap nodes.
112
+ * @property {Array<string | Uint8Array>} [relayThrough] Blind relay public keys. Two devices that cannot connect direct, as on mobile carriers, connect through one; the relay forwards encrypted bytes and reads nothing. Direct connections stay direct.
113
+ * @property {(remotePublicKey: Uint8Array, payload: unknown) => boolean} [firewall] Incoming-connection filter: `true` refuses the connection.
104
114
  * @property {number[]} [backoffs] Swarm reconnect backoff tiers in ms (testing/tuning).
105
115
  * @property {string} [channel] Optional network-isolation label; only same-channel peers connect.
106
116
  * @property {Array<string | Uint8Array>} [mirrors] Blind-peer public keys. Handles and files are mirrored through them so peers sync even when never online at the same time. Mirrors hold only encrypted blocks — they never read your data.