@gethashd/bytecave-browser 1.0.26 → 1.0.27
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/{chunk-XMU2N2NN.js → chunk-AETVOZYQ.js} +28 -33
- package/dist/index.cjs +28 -33
- package/dist/index.js +1 -1
- package/dist/react/index.cjs +28 -33
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/src/p2p-protocols.ts +31 -36
|
@@ -5726,41 +5726,36 @@ var P2PProtocolClient = class {
|
|
|
5726
5726
|
} catch (e) {
|
|
5727
5727
|
console.warn("[ByteCave P2P] Could not get peer info from peerStore:", e);
|
|
5728
5728
|
}
|
|
5729
|
-
console.log("[ByteCave P2P] Step 2:
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
let lastError;
|
|
5733
|
-
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
5734
|
-
try {
|
|
5735
|
-
console.log(`[ByteCave P2P] Dial attempt ${attempt}/3...`);
|
|
5736
|
-
stream = await this.node.dialProtocol(peerIdObj, "/bytecave/store/1.0.0");
|
|
5737
|
-
const dialDuration = Date.now() - dialStart;
|
|
5738
|
-
console.log("[ByteCave P2P] Step 3: Stream established in", dialDuration, "ms");
|
|
5739
|
-
console.log("[ByteCave P2P] Stream details:", {
|
|
5740
|
-
protocol: stream.protocol,
|
|
5741
|
-
direction: stream.direction,
|
|
5742
|
-
timeline: stream.timeline
|
|
5743
|
-
});
|
|
5744
|
-
break;
|
|
5745
|
-
} catch (dialError) {
|
|
5746
|
-
lastError = dialError;
|
|
5747
|
-
const dialDuration = Date.now() - dialStart;
|
|
5748
|
-
console.warn(`[ByteCave P2P] Dial attempt ${attempt} failed after ${dialDuration}ms:`, dialError.message);
|
|
5749
|
-
if (attempt < 3) {
|
|
5750
|
-
console.log("[ByteCave P2P] Waiting 1s before retry (node may still be registering handlers)...");
|
|
5751
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
5752
|
-
}
|
|
5753
|
-
}
|
|
5729
|
+
console.log("[ByteCave P2P] Step 2: Opening protocol stream on existing connection...");
|
|
5730
|
+
if (existingConns.length === 0) {
|
|
5731
|
+
throw new Error("No connection to peer - cannot open protocol stream");
|
|
5754
5732
|
}
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5733
|
+
const connection = existingConns[0];
|
|
5734
|
+
console.log("[ByteCave P2P] Using connection:", connection.remoteAddr.toString());
|
|
5735
|
+
const streamStart = Date.now();
|
|
5736
|
+
let stream;
|
|
5737
|
+
try {
|
|
5738
|
+
console.log("[ByteCave P2P] Calling connection.newStream with protocol /bytecave/store/1.0.0...");
|
|
5739
|
+
stream = await connection.newStream("/bytecave/store/1.0.0");
|
|
5740
|
+
const streamDuration = Date.now() - streamStart;
|
|
5741
|
+
console.log("[ByteCave P2P] Step 3: Protocol stream opened in", streamDuration, "ms");
|
|
5742
|
+
console.log("[ByteCave P2P] Stream details:", {
|
|
5743
|
+
protocol: stream.protocol,
|
|
5744
|
+
direction: stream.direction,
|
|
5745
|
+
id: stream.id,
|
|
5746
|
+
timeline: stream.timeline
|
|
5747
|
+
});
|
|
5748
|
+
} catch (streamError) {
|
|
5749
|
+
const streamDuration = Date.now() - streamStart;
|
|
5750
|
+
console.error("[ByteCave P2P] Failed to open protocol stream after", streamDuration, "ms:", {
|
|
5751
|
+
error: streamError.message,
|
|
5752
|
+
code: streamError.code,
|
|
5753
|
+
name: streamError.name,
|
|
5754
|
+
connectionStatus: connection.status,
|
|
5755
|
+
connectionStreams: connection.streams.length,
|
|
5756
|
+
stack: streamError.stack?.split("\n").slice(0, 3)
|
|
5762
5757
|
});
|
|
5763
|
-
throw
|
|
5758
|
+
throw streamError;
|
|
5764
5759
|
}
|
|
5765
5760
|
const dataCopy = new Uint8Array(ciphertext);
|
|
5766
5761
|
const hashBuffer = await crypto.subtle.digest("SHA-256", dataCopy);
|
package/dist/index.cjs
CHANGED
|
@@ -5794,41 +5794,36 @@ var P2PProtocolClient = class {
|
|
|
5794
5794
|
} catch (e) {
|
|
5795
5795
|
console.warn("[ByteCave P2P] Could not get peer info from peerStore:", e);
|
|
5796
5796
|
}
|
|
5797
|
-
console.log("[ByteCave P2P] Step 2:
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
let lastError;
|
|
5801
|
-
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
5802
|
-
try {
|
|
5803
|
-
console.log(`[ByteCave P2P] Dial attempt ${attempt}/3...`);
|
|
5804
|
-
stream = await this.node.dialProtocol(peerIdObj, "/bytecave/store/1.0.0");
|
|
5805
|
-
const dialDuration = Date.now() - dialStart;
|
|
5806
|
-
console.log("[ByteCave P2P] Step 3: Stream established in", dialDuration, "ms");
|
|
5807
|
-
console.log("[ByteCave P2P] Stream details:", {
|
|
5808
|
-
protocol: stream.protocol,
|
|
5809
|
-
direction: stream.direction,
|
|
5810
|
-
timeline: stream.timeline
|
|
5811
|
-
});
|
|
5812
|
-
break;
|
|
5813
|
-
} catch (dialError) {
|
|
5814
|
-
lastError = dialError;
|
|
5815
|
-
const dialDuration = Date.now() - dialStart;
|
|
5816
|
-
console.warn(`[ByteCave P2P] Dial attempt ${attempt} failed after ${dialDuration}ms:`, dialError.message);
|
|
5817
|
-
if (attempt < 3) {
|
|
5818
|
-
console.log("[ByteCave P2P] Waiting 1s before retry (node may still be registering handlers)...");
|
|
5819
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
5820
|
-
}
|
|
5821
|
-
}
|
|
5797
|
+
console.log("[ByteCave P2P] Step 2: Opening protocol stream on existing connection...");
|
|
5798
|
+
if (existingConns.length === 0) {
|
|
5799
|
+
throw new Error("No connection to peer - cannot open protocol stream");
|
|
5822
5800
|
}
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5801
|
+
const connection = existingConns[0];
|
|
5802
|
+
console.log("[ByteCave P2P] Using connection:", connection.remoteAddr.toString());
|
|
5803
|
+
const streamStart = Date.now();
|
|
5804
|
+
let stream;
|
|
5805
|
+
try {
|
|
5806
|
+
console.log("[ByteCave P2P] Calling connection.newStream with protocol /bytecave/store/1.0.0...");
|
|
5807
|
+
stream = await connection.newStream("/bytecave/store/1.0.0");
|
|
5808
|
+
const streamDuration = Date.now() - streamStart;
|
|
5809
|
+
console.log("[ByteCave P2P] Step 3: Protocol stream opened in", streamDuration, "ms");
|
|
5810
|
+
console.log("[ByteCave P2P] Stream details:", {
|
|
5811
|
+
protocol: stream.protocol,
|
|
5812
|
+
direction: stream.direction,
|
|
5813
|
+
id: stream.id,
|
|
5814
|
+
timeline: stream.timeline
|
|
5815
|
+
});
|
|
5816
|
+
} catch (streamError) {
|
|
5817
|
+
const streamDuration = Date.now() - streamStart;
|
|
5818
|
+
console.error("[ByteCave P2P] Failed to open protocol stream after", streamDuration, "ms:", {
|
|
5819
|
+
error: streamError.message,
|
|
5820
|
+
code: streamError.code,
|
|
5821
|
+
name: streamError.name,
|
|
5822
|
+
connectionStatus: connection.status,
|
|
5823
|
+
connectionStreams: connection.streams.length,
|
|
5824
|
+
stack: streamError.stack?.split("\n").slice(0, 3)
|
|
5830
5825
|
});
|
|
5831
|
-
throw
|
|
5826
|
+
throw streamError;
|
|
5832
5827
|
}
|
|
5833
5828
|
const dataCopy = new Uint8Array(ciphertext);
|
|
5834
5829
|
const hashBuffer = await crypto.subtle.digest("SHA-256", dataCopy);
|
package/dist/index.js
CHANGED
package/dist/react/index.cjs
CHANGED
|
@@ -6049,41 +6049,36 @@ var P2PProtocolClient = class {
|
|
|
6049
6049
|
} catch (e) {
|
|
6050
6050
|
console.warn("[ByteCave P2P] Could not get peer info from peerStore:", e);
|
|
6051
6051
|
}
|
|
6052
|
-
console.log("[ByteCave P2P] Step 2:
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
let lastError;
|
|
6056
|
-
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
6057
|
-
try {
|
|
6058
|
-
console.log(`[ByteCave P2P] Dial attempt ${attempt}/3...`);
|
|
6059
|
-
stream = await this.node.dialProtocol(peerIdObj, "/bytecave/store/1.0.0");
|
|
6060
|
-
const dialDuration = Date.now() - dialStart;
|
|
6061
|
-
console.log("[ByteCave P2P] Step 3: Stream established in", dialDuration, "ms");
|
|
6062
|
-
console.log("[ByteCave P2P] Stream details:", {
|
|
6063
|
-
protocol: stream.protocol,
|
|
6064
|
-
direction: stream.direction,
|
|
6065
|
-
timeline: stream.timeline
|
|
6066
|
-
});
|
|
6067
|
-
break;
|
|
6068
|
-
} catch (dialError) {
|
|
6069
|
-
lastError = dialError;
|
|
6070
|
-
const dialDuration = Date.now() - dialStart;
|
|
6071
|
-
console.warn(`[ByteCave P2P] Dial attempt ${attempt} failed after ${dialDuration}ms:`, dialError.message);
|
|
6072
|
-
if (attempt < 3) {
|
|
6073
|
-
console.log("[ByteCave P2P] Waiting 1s before retry (node may still be registering handlers)...");
|
|
6074
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
6075
|
-
}
|
|
6076
|
-
}
|
|
6052
|
+
console.log("[ByteCave P2P] Step 2: Opening protocol stream on existing connection...");
|
|
6053
|
+
if (existingConns.length === 0) {
|
|
6054
|
+
throw new Error("No connection to peer - cannot open protocol stream");
|
|
6077
6055
|
}
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6056
|
+
const connection = existingConns[0];
|
|
6057
|
+
console.log("[ByteCave P2P] Using connection:", connection.remoteAddr.toString());
|
|
6058
|
+
const streamStart = Date.now();
|
|
6059
|
+
let stream;
|
|
6060
|
+
try {
|
|
6061
|
+
console.log("[ByteCave P2P] Calling connection.newStream with protocol /bytecave/store/1.0.0...");
|
|
6062
|
+
stream = await connection.newStream("/bytecave/store/1.0.0");
|
|
6063
|
+
const streamDuration = Date.now() - streamStart;
|
|
6064
|
+
console.log("[ByteCave P2P] Step 3: Protocol stream opened in", streamDuration, "ms");
|
|
6065
|
+
console.log("[ByteCave P2P] Stream details:", {
|
|
6066
|
+
protocol: stream.protocol,
|
|
6067
|
+
direction: stream.direction,
|
|
6068
|
+
id: stream.id,
|
|
6069
|
+
timeline: stream.timeline
|
|
6070
|
+
});
|
|
6071
|
+
} catch (streamError) {
|
|
6072
|
+
const streamDuration = Date.now() - streamStart;
|
|
6073
|
+
console.error("[ByteCave P2P] Failed to open protocol stream after", streamDuration, "ms:", {
|
|
6074
|
+
error: streamError.message,
|
|
6075
|
+
code: streamError.code,
|
|
6076
|
+
name: streamError.name,
|
|
6077
|
+
connectionStatus: connection.status,
|
|
6078
|
+
connectionStreams: connection.streams.length,
|
|
6079
|
+
stack: streamError.stack?.split("\n").slice(0, 3)
|
|
6085
6080
|
});
|
|
6086
|
-
throw
|
|
6081
|
+
throw streamError;
|
|
6087
6082
|
}
|
|
6088
6083
|
const dataCopy = new Uint8Array(ciphertext);
|
|
6089
6084
|
const hashBuffer = await crypto.subtle.digest("SHA-256", dataCopy);
|
package/dist/react/index.js
CHANGED
package/package.json
CHANGED
package/src/p2p-protocols.ts
CHANGED
|
@@ -148,46 +148,41 @@ export class P2PProtocolClient {
|
|
|
148
148
|
console.warn('[ByteCave P2P] Could not get peer info from peerStore:', e);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
// Step 2:
|
|
152
|
-
console.log('[ByteCave P2P] Step 2:
|
|
153
|
-
const dialStart = Date.now();
|
|
154
|
-
let stream;
|
|
155
|
-
let lastError;
|
|
151
|
+
// Step 2: Open protocol stream on existing connection (relay circuits require explicit stream creation)
|
|
152
|
+
console.log('[ByteCave P2P] Step 2: Opening protocol stream on existing connection...');
|
|
156
153
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
console.log(`[ByteCave P2P] Dial attempt ${attempt}/3...`);
|
|
161
|
-
stream = await this.node!.dialProtocol(peerIdObj, '/bytecave/store/1.0.0');
|
|
162
|
-
const dialDuration = Date.now() - dialStart;
|
|
163
|
-
console.log('[ByteCave P2P] Step 3: Stream established in', dialDuration, 'ms');
|
|
164
|
-
console.log('[ByteCave P2P] Stream details:', {
|
|
165
|
-
protocol: stream.protocol,
|
|
166
|
-
direction: stream.direction,
|
|
167
|
-
timeline: stream.timeline
|
|
168
|
-
});
|
|
169
|
-
break; // Success!
|
|
170
|
-
} catch (dialError: any) {
|
|
171
|
-
lastError = dialError;
|
|
172
|
-
const dialDuration = Date.now() - dialStart;
|
|
173
|
-
console.warn(`[ByteCave P2P] Dial attempt ${attempt} failed after ${dialDuration}ms:`, dialError.message);
|
|
174
|
-
|
|
175
|
-
if (attempt < 3) {
|
|
176
|
-
console.log('[ByteCave P2P] Waiting 1s before retry (node may still be registering handlers)...');
|
|
177
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
154
|
+
if (existingConns.length === 0) {
|
|
155
|
+
throw new Error('No connection to peer - cannot open protocol stream');
|
|
180
156
|
}
|
|
181
157
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
158
|
+
const connection = existingConns[0]; // Use first available connection
|
|
159
|
+
console.log('[ByteCave P2P] Using connection:', connection.remoteAddr.toString());
|
|
160
|
+
|
|
161
|
+
const streamStart = Date.now();
|
|
162
|
+
let stream;
|
|
163
|
+
try {
|
|
164
|
+
// Open a new stream on the existing connection with the protocol
|
|
165
|
+
console.log('[ByteCave P2P] Calling connection.newStream with protocol /bytecave/store/1.0.0...');
|
|
166
|
+
stream = await connection.newStream('/bytecave/store/1.0.0');
|
|
167
|
+
const streamDuration = Date.now() - streamStart;
|
|
168
|
+
console.log('[ByteCave P2P] Step 3: Protocol stream opened in', streamDuration, 'ms');
|
|
169
|
+
console.log('[ByteCave P2P] Stream details:', {
|
|
170
|
+
protocol: stream.protocol,
|
|
171
|
+
direction: stream.direction,
|
|
172
|
+
id: stream.id,
|
|
173
|
+
timeline: stream.timeline
|
|
174
|
+
});
|
|
175
|
+
} catch (streamError: any) {
|
|
176
|
+
const streamDuration = Date.now() - streamStart;
|
|
177
|
+
console.error('[ByteCave P2P] Failed to open protocol stream after', streamDuration, 'ms:', {
|
|
178
|
+
error: streamError.message,
|
|
179
|
+
code: streamError.code,
|
|
180
|
+
name: streamError.name,
|
|
181
|
+
connectionStatus: connection.status,
|
|
182
|
+
connectionStreams: connection.streams.length,
|
|
183
|
+
stack: streamError.stack?.split('\n').slice(0, 3)
|
|
189
184
|
});
|
|
190
|
-
throw
|
|
185
|
+
throw streamError;
|
|
191
186
|
}
|
|
192
187
|
|
|
193
188
|
// Generate CID using SHA-256 (matches bytecave-core format: 64-char hex)
|