@fileverse/api 0.0.12 → 0.0.13
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/cli/index.js.map +1 -1
- package/dist/cloudflare.js +21 -0
- package/dist/cloudflare.js.map +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/worker.js +17 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2881,20 +2881,28 @@ var init_file_manager = __esm({
|
|
|
2881
2881
|
return this.agentClient.getAuthParams();
|
|
2882
2882
|
}
|
|
2883
2883
|
async submitAddFileTrx(file2) {
|
|
2884
|
+
console.log("Submitting add file trx");
|
|
2884
2885
|
logger.debug(`Preparing to add file ${file2.ddocId}`);
|
|
2885
2886
|
const encryptedSecretKey = file2.linkKey;
|
|
2886
2887
|
const nonce = toUint8Array2(file2.linkKeyNonce);
|
|
2887
2888
|
const secretKey = toUint8Array2(file2.secretKey);
|
|
2889
|
+
console.log("Got encrypted secret key, nonce, and secret key");
|
|
2888
2890
|
const yJSContent = markdownToYjs(file2.content);
|
|
2891
|
+
console.log("Generated yjs content");
|
|
2889
2892
|
const { encryptedFile, key } = await createEncryptedContentFile(yJSContent);
|
|
2893
|
+
console.log("Generated encrypted content file");
|
|
2890
2894
|
logger.debug(`Generated encrypted content file for file ${file2.ddocId}`);
|
|
2891
2895
|
const commentKey = await exportAESKey(await generateAESKey(128));
|
|
2896
|
+
console.log("Generated comment key");
|
|
2892
2897
|
const { appLock, ownerLock } = this.createLocks(key, encryptedSecretKey, commentKey);
|
|
2898
|
+
console.log("Built app lock and owner lock");
|
|
2893
2899
|
const linkLock = buildLinklock(secretKey, toUint8Array2(key), commentKey);
|
|
2900
|
+
console.log("Built link lock");
|
|
2894
2901
|
const encryptedTitle = await encryptTitleWithFileKey({
|
|
2895
2902
|
title: file2.title || "Untitled",
|
|
2896
2903
|
key
|
|
2897
2904
|
});
|
|
2905
|
+
console.log("Built encrypted title");
|
|
2898
2906
|
const metadata = buildFileMetadata({
|
|
2899
2907
|
encryptedTitle,
|
|
2900
2908
|
encryptedFileSize: encryptedFile.size,
|
|
@@ -2904,11 +2912,15 @@ var init_file_manager = __esm({
|
|
|
2904
2912
|
nonce: fromUint8Array2(nonce),
|
|
2905
2913
|
owner: this.agentClient.getAgentAddress()
|
|
2906
2914
|
});
|
|
2915
|
+
console.log("Built metadata");
|
|
2907
2916
|
const authParams = await this.getAuthParams();
|
|
2917
|
+
console.log("Got auth params");
|
|
2918
|
+
console.log("Uploading files to IPFS");
|
|
2908
2919
|
const { metadataHash, contentHash, gateHash } = await uploadAllFilesToIPFS(
|
|
2909
2920
|
{ metadata, encryptedFile, linkLock, ddocId: file2.ddocId },
|
|
2910
2921
|
authParams
|
|
2911
2922
|
);
|
|
2923
|
+
console.log("Uploaded files to IPFS");
|
|
2912
2924
|
logger.debug(`Uploaded files to IPFS for file ${file2.ddocId}`);
|
|
2913
2925
|
const callData = prepareCallData({
|
|
2914
2926
|
metadataHash,
|
|
@@ -2917,8 +2929,10 @@ var init_file_manager = __esm({
|
|
|
2917
2929
|
appFileId: file2.ddocId,
|
|
2918
2930
|
fileId: file2.fileId
|
|
2919
2931
|
});
|
|
2932
|
+
console.log("Prepared call data");
|
|
2920
2933
|
logger.debug(`Prepared call data for file ${file2.ddocId}`);
|
|
2921
2934
|
const userOpHash = await this.sendFileOperation(callData);
|
|
2935
|
+
console.log("Submitted user op");
|
|
2922
2936
|
logger.debug(`Submitted user op for file ${file2.ddocId}`);
|
|
2923
2937
|
return {
|
|
2924
2938
|
userOpHash,
|
|
@@ -3118,14 +3132,17 @@ var init_publish = __esm({
|
|
|
3118
3132
|
};
|
|
3119
3133
|
handleNewFileOp = async (fileId) => {
|
|
3120
3134
|
const { file: file2, portalDetails, apiKey } = await getPortalData(fileId);
|
|
3135
|
+
console.log("Got portal data");
|
|
3121
3136
|
const apiKeySeed = toUint8Array3(apiKey);
|
|
3122
3137
|
const { privateAccountKey, ucanSecret } = deriveCollaboratorKeys(apiKeySeed);
|
|
3138
|
+
console.log("Derived collaborator keys");
|
|
3123
3139
|
const fileManager = await createFileManager(
|
|
3124
3140
|
portalDetails.portalSeed,
|
|
3125
3141
|
portalDetails.portalAddress,
|
|
3126
3142
|
ucanSecret,
|
|
3127
3143
|
privateAccountKey
|
|
3128
3144
|
);
|
|
3145
|
+
console.log("Created file manager");
|
|
3129
3146
|
return fileManager.submitAddFileTrx(file2);
|
|
3130
3147
|
};
|
|
3131
3148
|
getProxyAuthParams = async (fileId) => {
|