@gethashd/bytecave-browser 1.0.35 → 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-PMRP2UEN.js → chunk-544OXLKK.js} +14 -11
- package/dist/client.d.ts +3 -2
- package/dist/contracts/ContentRegistry.d.ts +1 -1
- package/dist/index.cjs +14 -11
- package/dist/index.js +1 -1
- package/dist/p2p-protocols.d.ts +2 -1
- package/dist/provider.d.ts +2 -2
- package/dist/react/index.cjs +2 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +6 -3
- package/src/contracts/ContentRegistry.ts +2 -2
- package/src/p2p-protocols.ts +4 -1
- package/src/provider.tsx +6 -6
|
@@ -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");
|
|
@@ -6168,8 +6169,8 @@ var StorageWebSocketClient = class {
|
|
|
6168
6169
|
|
|
6169
6170
|
// src/contracts/ContentRegistry.ts
|
|
6170
6171
|
var CONTENT_REGISTRY_ABI = [
|
|
6171
|
-
"function registerContent(bytes32 cid, address owner, bytes32 appId) external",
|
|
6172
|
-
"function registerContent(string cid, string appId) external",
|
|
6172
|
+
"function registerContent(bytes32 cid, address owner, bytes32 appId, uint256 hashIdToken) external",
|
|
6173
|
+
"function registerContent(string cid, string appId, uint256 hashIdToken) external",
|
|
6173
6174
|
"function isContentRegistered(bytes32 cid) external view returns (bool)",
|
|
6174
6175
|
"function getContentRecord(bytes32 cid) external view returns (tuple(address owner, bytes32 appId, uint256 timestamp))"
|
|
6175
6176
|
];
|
|
@@ -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);
|
|
@@ -6659,7 +6662,7 @@ Nonce: ${nonce}`;
|
|
|
6659
6662
|
* Register content in ContentRegistry contract (on-chain)
|
|
6660
6663
|
* This must be called before storing content that requires on-chain verification
|
|
6661
6664
|
*/
|
|
6662
|
-
async registerContent(cid, appId, signer) {
|
|
6665
|
+
async registerContent(cid, appId, hashIdToken, signer) {
|
|
6663
6666
|
if (!this.config.contentRegistryAddress) {
|
|
6664
6667
|
return {
|
|
6665
6668
|
success: false,
|
|
@@ -6679,7 +6682,7 @@ Nonce: ${nonce}`;
|
|
|
6679
6682
|
CONTENT_REGISTRY_ABI,
|
|
6680
6683
|
signer
|
|
6681
6684
|
);
|
|
6682
|
-
const tx = await contract.registerContent(cid, appId);
|
|
6685
|
+
const tx = await contract.registerContent(cid, appId, hashIdToken);
|
|
6683
6686
|
console.log("[ByteCave] ContentRegistry transaction sent:", tx.hash);
|
|
6684
6687
|
const receipt = await tx.wait();
|
|
6685
6688
|
console.log("[ByteCave] ContentRegistry registration confirmed:", receipt.hash);
|
|
@@ -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) {
|
|
@@ -7105,11 +7108,11 @@ function ByteCaveProvider({
|
|
|
7105
7108
|
}
|
|
7106
7109
|
return globalClient.getNodeHealth(peerId);
|
|
7107
7110
|
};
|
|
7108
|
-
const registerContent = async (cid, appId2, signer) => {
|
|
7111
|
+
const registerContent = async (cid, appId2, hashIdToken, signer) => {
|
|
7109
7112
|
if (!globalClient) {
|
|
7110
7113
|
return { success: false, error: "Client not initialized" };
|
|
7111
7114
|
}
|
|
7112
|
-
return globalClient.registerContent(cid, appId2, signer);
|
|
7115
|
+
return globalClient.registerContent(cid, appId2, hashIdToken, signer);
|
|
7113
7116
|
};
|
|
7114
7117
|
const value = {
|
|
7115
7118
|
connectionState,
|
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
|
*/
|
|
@@ -45,7 +46,7 @@ export declare class ByteCaveClient {
|
|
|
45
46
|
* Register content in ContentRegistry contract (on-chain)
|
|
46
47
|
* This must be called before storing content that requires on-chain verification
|
|
47
48
|
*/
|
|
48
|
-
registerContent(cid: string, appId: string, signer: ethers.Signer): Promise<{
|
|
49
|
+
registerContent(cid: string, appId: string, hashIdToken: string, signer: ethers.Signer): Promise<{
|
|
49
50
|
success: boolean;
|
|
50
51
|
txHash?: string;
|
|
51
52
|
error?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CONTENT_REGISTRY_ABI: readonly ["function registerContent(bytes32 cid, address owner, bytes32 appId) external", "function registerContent(string cid, string appId) external", "function isContentRegistered(bytes32 cid) external view returns (bool)", "function getContentRecord(bytes32 cid) external view returns (tuple(address owner, bytes32 appId, uint256 timestamp))"];
|
|
1
|
+
export declare const CONTENT_REGISTRY_ABI: readonly ["function registerContent(bytes32 cid, address owner, bytes32 appId, uint256 hashIdToken) external", "function registerContent(string cid, string appId, uint256 hashIdToken) external", "function isContentRegistered(bytes32 cid) external view returns (bool)", "function getContentRecord(bytes32 cid) external view returns (tuple(address owner, bytes32 appId, uint256 timestamp))"];
|
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");
|
|
@@ -6221,8 +6222,8 @@ var StorageWebSocketClient = class {
|
|
|
6221
6222
|
|
|
6222
6223
|
// src/contracts/ContentRegistry.ts
|
|
6223
6224
|
var CONTENT_REGISTRY_ABI = [
|
|
6224
|
-
"function registerContent(bytes32 cid, address owner, bytes32 appId) external",
|
|
6225
|
-
"function registerContent(string cid, string appId) external",
|
|
6225
|
+
"function registerContent(bytes32 cid, address owner, bytes32 appId, uint256 hashIdToken) external",
|
|
6226
|
+
"function registerContent(string cid, string appId, uint256 hashIdToken) external",
|
|
6226
6227
|
"function isContentRegistered(bytes32 cid) external view returns (bool)",
|
|
6227
6228
|
"function getContentRecord(bytes32 cid) external view returns (tuple(address owner, bytes32 appId, uint256 timestamp))"
|
|
6228
6229
|
];
|
|
@@ -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);
|
|
@@ -6712,7 +6715,7 @@ Nonce: ${nonce}`;
|
|
|
6712
6715
|
* Register content in ContentRegistry contract (on-chain)
|
|
6713
6716
|
* This must be called before storing content that requires on-chain verification
|
|
6714
6717
|
*/
|
|
6715
|
-
async registerContent(cid, appId, signer) {
|
|
6718
|
+
async registerContent(cid, appId, hashIdToken, signer) {
|
|
6716
6719
|
if (!this.config.contentRegistryAddress) {
|
|
6717
6720
|
return {
|
|
6718
6721
|
success: false,
|
|
@@ -6732,7 +6735,7 @@ Nonce: ${nonce}`;
|
|
|
6732
6735
|
CONTENT_REGISTRY_ABI,
|
|
6733
6736
|
signer
|
|
6734
6737
|
);
|
|
6735
|
-
const tx = await contract.registerContent(cid, appId);
|
|
6738
|
+
const tx = await contract.registerContent(cid, appId, hashIdToken);
|
|
6736
6739
|
console.log("[ByteCave] ContentRegistry transaction sent:", tx.hash);
|
|
6737
6740
|
const receipt = await tx.wait();
|
|
6738
6741
|
console.log("[ByteCave] ContentRegistry registration confirmed:", receipt.hash);
|
|
@@ -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) {
|
|
@@ -7158,11 +7161,11 @@ function ByteCaveProvider({
|
|
|
7158
7161
|
}
|
|
7159
7162
|
return globalClient.getNodeHealth(peerId);
|
|
7160
7163
|
};
|
|
7161
|
-
const registerContent = async (cid, appId2, signer) => {
|
|
7164
|
+
const registerContent = async (cid, appId2, hashIdToken, signer) => {
|
|
7162
7165
|
if (!globalClient) {
|
|
7163
7166
|
return { success: false, error: "Client not initialized" };
|
|
7164
7167
|
}
|
|
7165
|
-
return globalClient.registerContent(cid, appId2, signer);
|
|
7168
|
+
return globalClient.registerContent(cid, appId2, hashIdToken, signer);
|
|
7166
7169
|
};
|
|
7167
7170
|
const value = {
|
|
7168
7171
|
connectionState,
|
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,9 +35,9 @@ 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
|
-
registerContent: (cid: string, appId: string, signer: any) => Promise<{
|
|
40
|
+
registerContent: (cid: string, appId: string, hashIdToken: string, signer: any) => Promise<{
|
|
41
41
|
success: boolean;
|
|
42
42
|
txHash?: string;
|
|
43
43
|
error?: string;
|
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) {
|
|
@@ -647,6 +649,7 @@ Nonce: ${nonce}`;
|
|
|
647
649
|
async registerContent(
|
|
648
650
|
cid: string,
|
|
649
651
|
appId: string,
|
|
652
|
+
hashIdToken: string,
|
|
650
653
|
signer: ethers.Signer
|
|
651
654
|
): Promise<{ success: boolean; txHash?: string; error?: string }> {
|
|
652
655
|
if (!this.config.contentRegistryAddress) {
|
|
@@ -672,7 +675,7 @@ Nonce: ${nonce}`;
|
|
|
672
675
|
signer
|
|
673
676
|
);
|
|
674
677
|
|
|
675
|
-
const tx = await contract.registerContent(cid, appId);
|
|
678
|
+
const tx = await contract.registerContent(cid, appId, hashIdToken);
|
|
676
679
|
console.log('[ByteCave] ContentRegistry transaction sent:', tx.hash);
|
|
677
680
|
|
|
678
681
|
const receipt = await tx.wait();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const CONTENT_REGISTRY_ABI = [
|
|
2
|
-
"function registerContent(bytes32 cid, address owner, bytes32 appId) external",
|
|
3
|
-
"function registerContent(string cid, string appId) external",
|
|
2
|
+
"function registerContent(bytes32 cid, address owner, bytes32 appId, uint256 hashIdToken) external",
|
|
3
|
+
"function registerContent(string cid, string appId, uint256 hashIdToken) external",
|
|
4
4
|
"function isContentRegistered(bytes32 cid) external view returns (bool)",
|
|
5
5
|
"function getContentRecord(bytes32 cid) external view returns (tuple(address owner, bytes32 appId, uint256 timestamp))"
|
|
6
6
|
] as const;
|
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,9 +39,9 @@ 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
|
-
registerContent: (cid: string, appId: string, signer: any) => Promise<{ success: boolean; txHash?: string; error?: string }>;
|
|
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>;
|
|
46
46
|
error: string | null;
|
|
47
47
|
}
|
|
@@ -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> => {
|
|
@@ -245,11 +245,11 @@ export function ByteCaveProvider({
|
|
|
245
245
|
return (globalClient as any).getNodeHealth(peerId);
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
-
const registerContent = async (cid: string, appId: string, signer: any): Promise<{ success: boolean; txHash?: string; error?: string }> => {
|
|
248
|
+
const registerContent = async (cid: string, appId: string, hashIdToken: string, signer: any): Promise<{ success: boolean; txHash?: string; error?: string }> => {
|
|
249
249
|
if (!globalClient) {
|
|
250
250
|
return { success: false, error: 'Client not initialized' };
|
|
251
251
|
}
|
|
252
|
-
return globalClient.registerContent(cid, appId, signer);
|
|
252
|
+
return globalClient.registerContent(cid, appId, hashIdToken, signer);
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
const value: ByteCaveContextValue = {
|