@gethashd/bytecave-browser 1.0.36 → 1.0.37
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-6WXUCYSA.js → chunk-544OXLKK.js} +8 -5
- package/dist/client.d.ts +2 -1
- package/dist/index.cjs +8 -5
- package/dist/index.js +1 -1
- package/dist/p2p-protocols.d.ts +2 -1
- package/dist/provider.d.ts +1 -1
- package/dist/react/index.cjs +2 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +4 -2
- package/src/p2p-protocols.ts +4 -1
- package/src/provider.tsx +3 -3
|
@@ -5695,7 +5695,7 @@ var P2PProtocolClient = class {
|
|
|
5695
5695
|
/**
|
|
5696
5696
|
* Store a blob on a peer via P2P stream
|
|
5697
5697
|
*/
|
|
5698
|
-
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain) {
|
|
5698
|
+
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain, hashIdToken) {
|
|
5699
5699
|
if (!this.node) {
|
|
5700
5700
|
return { success: false, error: "P2P node not initialized" };
|
|
5701
5701
|
}
|
|
@@ -5791,6 +5791,7 @@ var P2PProtocolClient = class {
|
|
|
5791
5791
|
shouldVerifyOnChain: shouldVerifyOnChain ?? false,
|
|
5792
5792
|
sender: authorization?.sender,
|
|
5793
5793
|
timestamp: authorization?.timestamp || Date.now(),
|
|
5794
|
+
hashIdToken,
|
|
5794
5795
|
authorization
|
|
5795
5796
|
};
|
|
5796
5797
|
console.log("[ByteCave P2P] Step 5: Request prepared, size:", JSON.stringify(request).length, "bytes");
|
|
@@ -6491,8 +6492,9 @@ var ByteCaveClient = class {
|
|
|
6491
6492
|
* @param data - Data to store
|
|
6492
6493
|
* @param mimeType - MIME type (optional, defaults to 'application/octet-stream')
|
|
6493
6494
|
* @param signer - Ethers signer for authorization (optional, but required for most nodes)
|
|
6495
|
+
* @param hashIdToken - HashID NFT token ID (optional, for content attribution)
|
|
6494
6496
|
*/
|
|
6495
|
-
async store(data, mimeType, signer) {
|
|
6497
|
+
async store(data, mimeType, signer, hashIdToken) {
|
|
6496
6498
|
const dataArray = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
6497
6499
|
const MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
6498
6500
|
if (dataArray.length > MAX_FILE_SIZE) {
|
|
@@ -6585,8 +6587,9 @@ Nonce: ${nonce}`;
|
|
|
6585
6587
|
dataArray,
|
|
6586
6588
|
mimeType || "application/octet-stream",
|
|
6587
6589
|
authorization,
|
|
6588
|
-
false
|
|
6590
|
+
false,
|
|
6589
6591
|
// shouldVerifyOnChain - false for browser test storage
|
|
6592
|
+
hashIdToken
|
|
6590
6593
|
);
|
|
6591
6594
|
if (result.success && result.cid) {
|
|
6592
6595
|
console.log("[ByteCave] \u2713 P2P store successful:", result.cid);
|
|
@@ -7087,11 +7090,11 @@ function ByteCaveProvider({
|
|
|
7087
7090
|
setError(err.message);
|
|
7088
7091
|
}
|
|
7089
7092
|
};
|
|
7090
|
-
const store = async (data, mimeType, signer) => {
|
|
7093
|
+
const store = async (data, mimeType, signer, hashIdToken) => {
|
|
7091
7094
|
if (!globalClient) {
|
|
7092
7095
|
return { success: false, error: "Client not initialized" };
|
|
7093
7096
|
}
|
|
7094
|
-
return globalClient.store(data, mimeType, signer);
|
|
7097
|
+
return globalClient.store(data, mimeType, signer, hashIdToken);
|
|
7095
7098
|
};
|
|
7096
7099
|
const retrieve = async (cid) => {
|
|
7097
7100
|
if (!globalClient) {
|
package/dist/client.d.ts
CHANGED
|
@@ -35,8 +35,9 @@ export declare class ByteCaveClient {
|
|
|
35
35
|
* @param data - Data to store
|
|
36
36
|
* @param mimeType - MIME type (optional, defaults to 'application/octet-stream')
|
|
37
37
|
* @param signer - Ethers signer for authorization (optional, but required for most nodes)
|
|
38
|
+
* @param hashIdToken - HashID NFT token ID (optional, for content attribution)
|
|
38
39
|
*/
|
|
39
|
-
store(data: Uint8Array | ArrayBuffer, mimeType?: string, signer?: any): Promise<StoreResult>;
|
|
40
|
+
store(data: Uint8Array | ArrayBuffer, mimeType?: string, signer?: any, hashIdToken?: number): Promise<StoreResult>;
|
|
40
41
|
/**
|
|
41
42
|
* Retrieve ciphertext from a node via P2P only (no HTTP fallback)
|
|
42
43
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -5763,7 +5763,7 @@ var P2PProtocolClient = class {
|
|
|
5763
5763
|
/**
|
|
5764
5764
|
* Store a blob on a peer via P2P stream
|
|
5765
5765
|
*/
|
|
5766
|
-
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain) {
|
|
5766
|
+
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain, hashIdToken) {
|
|
5767
5767
|
if (!this.node) {
|
|
5768
5768
|
return { success: false, error: "P2P node not initialized" };
|
|
5769
5769
|
}
|
|
@@ -5859,6 +5859,7 @@ var P2PProtocolClient = class {
|
|
|
5859
5859
|
shouldVerifyOnChain: shouldVerifyOnChain ?? false,
|
|
5860
5860
|
sender: authorization?.sender,
|
|
5861
5861
|
timestamp: authorization?.timestamp || Date.now(),
|
|
5862
|
+
hashIdToken,
|
|
5862
5863
|
authorization
|
|
5863
5864
|
};
|
|
5864
5865
|
console.log("[ByteCave P2P] Step 5: Request prepared, size:", JSON.stringify(request).length, "bytes");
|
|
@@ -6544,8 +6545,9 @@ var ByteCaveClient = class {
|
|
|
6544
6545
|
* @param data - Data to store
|
|
6545
6546
|
* @param mimeType - MIME type (optional, defaults to 'application/octet-stream')
|
|
6546
6547
|
* @param signer - Ethers signer for authorization (optional, but required for most nodes)
|
|
6548
|
+
* @param hashIdToken - HashID NFT token ID (optional, for content attribution)
|
|
6547
6549
|
*/
|
|
6548
|
-
async store(data, mimeType, signer) {
|
|
6550
|
+
async store(data, mimeType, signer, hashIdToken) {
|
|
6549
6551
|
const dataArray = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
6550
6552
|
const MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
6551
6553
|
if (dataArray.length > MAX_FILE_SIZE) {
|
|
@@ -6638,8 +6640,9 @@ Nonce: ${nonce}`;
|
|
|
6638
6640
|
dataArray,
|
|
6639
6641
|
mimeType || "application/octet-stream",
|
|
6640
6642
|
authorization,
|
|
6641
|
-
false
|
|
6643
|
+
false,
|
|
6642
6644
|
// shouldVerifyOnChain - false for browser test storage
|
|
6645
|
+
hashIdToken
|
|
6643
6646
|
);
|
|
6644
6647
|
if (result.success && result.cid) {
|
|
6645
6648
|
console.log("[ByteCave] \u2713 P2P store successful:", result.cid);
|
|
@@ -7140,11 +7143,11 @@ function ByteCaveProvider({
|
|
|
7140
7143
|
setError(err.message);
|
|
7141
7144
|
}
|
|
7142
7145
|
};
|
|
7143
|
-
const store = async (data, mimeType, signer) => {
|
|
7146
|
+
const store = async (data, mimeType, signer, hashIdToken) => {
|
|
7144
7147
|
if (!globalClient) {
|
|
7145
7148
|
return { success: false, error: "Client not initialized" };
|
|
7146
7149
|
}
|
|
7147
|
-
return globalClient.store(data, mimeType, signer);
|
|
7150
|
+
return globalClient.store(data, mimeType, signer, hashIdToken);
|
|
7148
7151
|
};
|
|
7149
7152
|
const retrieve = async (cid) => {
|
|
7150
7153
|
if (!globalClient) {
|
package/dist/index.js
CHANGED
package/dist/p2p-protocols.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export interface StoreRequest {
|
|
|
65
65
|
shouldVerifyOnChain?: boolean;
|
|
66
66
|
sender?: string;
|
|
67
67
|
timestamp?: number;
|
|
68
|
+
hashIdToken?: number;
|
|
68
69
|
metadata?: Record<string, any>;
|
|
69
70
|
authorization?: any;
|
|
70
71
|
}
|
|
@@ -82,7 +83,7 @@ export declare class P2PProtocolClient {
|
|
|
82
83
|
/**
|
|
83
84
|
* Store a blob on a peer via P2P stream
|
|
84
85
|
*/
|
|
85
|
-
storeToPeer(peerId: string, ciphertext: Uint8Array, mimeType: string, authorization?: any, shouldVerifyOnChain?: boolean): Promise<StoreResponse>;
|
|
86
|
+
storeToPeer(peerId: string, ciphertext: Uint8Array, mimeType: string, authorization?: any, shouldVerifyOnChain?: boolean, hashIdToken?: number): Promise<StoreResponse>;
|
|
86
87
|
/**
|
|
87
88
|
* Retrieve a blob from a peer via P2P stream
|
|
88
89
|
*/
|
package/dist/provider.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface ByteCaveContextValue {
|
|
|
35
35
|
appId: string;
|
|
36
36
|
connect: () => Promise<void>;
|
|
37
37
|
disconnect: () => Promise<void>;
|
|
38
|
-
store: (data: Uint8Array, mimeType?: string, signer?: any) => Promise<StoreResult>;
|
|
38
|
+
store: (data: Uint8Array, mimeType?: string, signer?: any, hashIdToken?: number) => Promise<StoreResult>;
|
|
39
39
|
retrieve: (cid: string) => Promise<RetrieveResult>;
|
|
40
40
|
registerContent: (cid: string, appId: string, hashIdToken: string, signer: any) => Promise<{
|
|
41
41
|
success: boolean;
|
package/dist/react/index.cjs
CHANGED
|
@@ -6018,7 +6018,7 @@ var P2PProtocolClient = class {
|
|
|
6018
6018
|
/**
|
|
6019
6019
|
* Store a blob on a peer via P2P stream
|
|
6020
6020
|
*/
|
|
6021
|
-
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain) {
|
|
6021
|
+
async storeToPeer(peerId, ciphertext, mimeType, authorization, shouldVerifyOnChain, hashIdToken) {
|
|
6022
6022
|
if (!this.node) {
|
|
6023
6023
|
return { success: false, error: "P2P node not initialized" };
|
|
6024
6024
|
}
|
|
@@ -6114,6 +6114,7 @@ var P2PProtocolClient = class {
|
|
|
6114
6114
|
shouldVerifyOnChain: shouldVerifyOnChain ?? false,
|
|
6115
6115
|
sender: authorization?.sender,
|
|
6116
6116
|
timestamp: authorization?.timestamp || Date.now(),
|
|
6117
|
+
hashIdToken,
|
|
6117
6118
|
authorization
|
|
6118
6119
|
};
|
|
6119
6120
|
console.log("[ByteCave P2P] Step 5: Request prepared, size:", JSON.stringify(request).length, "bytes");
|
package/dist/react/index.js
CHANGED
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -423,8 +423,9 @@ export class ByteCaveClient {
|
|
|
423
423
|
* @param data - Data to store
|
|
424
424
|
* @param mimeType - MIME type (optional, defaults to 'application/octet-stream')
|
|
425
425
|
* @param signer - Ethers signer for authorization (optional, but required for most nodes)
|
|
426
|
+
* @param hashIdToken - HashID NFT token ID (optional, for content attribution)
|
|
426
427
|
*/
|
|
427
|
-
async store(data: Uint8Array | ArrayBuffer, mimeType?: string, signer?: any): Promise<StoreResult> {
|
|
428
|
+
async store(data: Uint8Array | ArrayBuffer, mimeType?: string, signer?: any, hashIdToken?: number): Promise<StoreResult> {
|
|
428
429
|
const dataArray = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
429
430
|
|
|
430
431
|
// Validate file size (5MB limit)
|
|
@@ -551,7 +552,8 @@ Nonce: ${nonce}`;
|
|
|
551
552
|
dataArray,
|
|
552
553
|
mimeType || 'application/octet-stream',
|
|
553
554
|
authorization,
|
|
554
|
-
false // shouldVerifyOnChain - false for browser test storage
|
|
555
|
+
false, // shouldVerifyOnChain - false for browser test storage
|
|
556
|
+
hashIdToken
|
|
555
557
|
);
|
|
556
558
|
|
|
557
559
|
if (result.success && result.cid) {
|
package/src/p2p-protocols.ts
CHANGED
|
@@ -78,6 +78,7 @@ export interface StoreRequest {
|
|
|
78
78
|
shouldVerifyOnChain?: boolean;
|
|
79
79
|
sender?: string;
|
|
80
80
|
timestamp?: number;
|
|
81
|
+
hashIdToken?: number;
|
|
81
82
|
metadata?: Record<string, any>;
|
|
82
83
|
authorization?: any;
|
|
83
84
|
}
|
|
@@ -106,7 +107,8 @@ export class P2PProtocolClient {
|
|
|
106
107
|
ciphertext: Uint8Array,
|
|
107
108
|
mimeType: string,
|
|
108
109
|
authorization?: any,
|
|
109
|
-
shouldVerifyOnChain?: boolean
|
|
110
|
+
shouldVerifyOnChain?: boolean,
|
|
111
|
+
hashIdToken?: number
|
|
110
112
|
): Promise<StoreResponse> {
|
|
111
113
|
if (!this.node) {
|
|
112
114
|
return { success: false, error: 'P2P node not initialized' };
|
|
@@ -227,6 +229,7 @@ export class P2PProtocolClient {
|
|
|
227
229
|
shouldVerifyOnChain: shouldVerifyOnChain ?? false,
|
|
228
230
|
sender: authorization?.sender,
|
|
229
231
|
timestamp: authorization?.timestamp || Date.now(),
|
|
232
|
+
hashIdToken,
|
|
230
233
|
authorization
|
|
231
234
|
};
|
|
232
235
|
console.log('[ByteCave P2P] Step 5: Request prepared, size:', JSON.stringify(request).length, 'bytes');
|
package/src/provider.tsx
CHANGED
|
@@ -39,7 +39,7 @@ interface ByteCaveContextValue {
|
|
|
39
39
|
appId: string;
|
|
40
40
|
connect: () => Promise<void>;
|
|
41
41
|
disconnect: () => Promise<void>;
|
|
42
|
-
store: (data: Uint8Array, mimeType?: string, signer?: any) => Promise<StoreResult>;
|
|
42
|
+
store: (data: Uint8Array, mimeType?: string, signer?: any, hashIdToken?: number) => Promise<StoreResult>;
|
|
43
43
|
retrieve: (cid: string) => Promise<RetrieveResult>;
|
|
44
44
|
registerContent: (cid: string, appId: string, hashIdToken: string, signer: any) => Promise<{ success: boolean; txHash?: string; error?: string }>;
|
|
45
45
|
getNodeHealth: (peerId: string) => Promise<NodeHealth | null>;
|
|
@@ -224,11 +224,11 @@ export function ByteCaveProvider({
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
const store = async (data: Uint8Array, mimeType?: string, signer?: any): Promise<StoreResult> => {
|
|
227
|
+
const store = async (data: Uint8Array, mimeType?: string, signer?: any, hashIdToken?: number): Promise<StoreResult> => {
|
|
228
228
|
if (!globalClient) {
|
|
229
229
|
return { success: false, error: 'Client not initialized' };
|
|
230
230
|
}
|
|
231
|
-
return (globalClient as any).store(data, mimeType, signer);
|
|
231
|
+
return (globalClient as any).store(data, mimeType, signer, hashIdToken);
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
const retrieve = async (cid: string): Promise<RetrieveResult> => {
|