@fileverse/api 0.0.18 → 0.0.19

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/worker.js CHANGED
@@ -2380,9 +2380,9 @@ var init_aes = __esm({
2380
2380
  const nonceLen = EMPTY_BLOCK.slice();
2381
2381
  const view = createView(nonceLen);
2382
2382
  view.setBigUint64(8, BigInt(nonce.length * 8), false);
2383
- const g2 = ghash.create(authKey).update(nonce).update(nonceLen);
2384
- g2.digestInto(counter);
2385
- g2.destroy();
2383
+ const g = ghash.create(authKey).update(nonce).update(nonceLen);
2384
+ g.digestInto(counter);
2385
+ g.destroy();
2386
2386
  }
2387
2387
  const tagMask = ctr32(xk, false, counter, EMPTY_BLOCK);
2388
2388
  return { xk, authKey, counter, tagMask };
@@ -2738,25 +2738,6 @@ var init_file_utils = __esm({
2738
2738
  }
2739
2739
  });
2740
2740
 
2741
- // src/sdk/dom-globals.ts
2742
- function removeDOMGlobals() {
2743
- delete g.window;
2744
- delete g.document;
2745
- }
2746
- function restoreDOMGlobals() {
2747
- if (!savedGlobals) return;
2748
- Object.assign(g, savedGlobals);
2749
- }
2750
- var g, savedGlobals;
2751
- var init_dom_globals = __esm({
2752
- "src/sdk/dom-globals.ts"() {
2753
- "use strict";
2754
- init_esm_shims();
2755
- g = globalThis;
2756
- savedGlobals = null;
2757
- }
2758
- });
2759
-
2760
2741
  // src/sdk/file-manager.ts
2761
2742
  import { fromUint8Array as fromUint8Array2, toUint8Array as toUint8Array3 } from "js-base64";
2762
2743
  import { generateAESKey, exportAESKey } from "@fileverse/crypto/webcrypto";
@@ -2769,7 +2750,6 @@ var init_file_manager = __esm({
2769
2750
  init_file_utils();
2770
2751
  init_constants();
2771
2752
  init_constants3();
2772
- init_dom_globals();
2773
2753
  init_infra();
2774
2754
  FileManager = class {
2775
2755
  keyStore;
@@ -2778,14 +2758,6 @@ var init_file_manager = __esm({
2778
2758
  this.keyStore = keyStore;
2779
2759
  this.agentClient = agentClient;
2780
2760
  }
2781
- convertMarkdown(content) {
2782
- restoreDOMGlobals();
2783
- try {
2784
- return markdownToYjs(content);
2785
- } finally {
2786
- removeDOMGlobals();
2787
- }
2788
- }
2789
2761
  createLocks(key, encryptedSecretKey, commentKey) {
2790
2762
  const appLock = {
2791
2763
  lockedFileKey: this.keyStore.encryptData(toUint8Array3(key)),
@@ -2829,7 +2801,7 @@ var init_file_manager = __esm({
2829
2801
  const nonce = toUint8Array3(file.linkKeyNonce);
2830
2802
  const secretKey = toUint8Array3(file.secretKey);
2831
2803
  console.log("Got encrypted secret key, nonce, and secret key");
2832
- const yJSContent = this.convertMarkdown(file.content);
2804
+ const yJSContent = markdownToYjs(file.content);
2833
2805
  console.log("Generated yjs content");
2834
2806
  const { encryptedFile, key } = await createEncryptedContentFile(yJSContent);
2835
2807
  console.log("Generated encrypted content file");
@@ -2889,7 +2861,7 @@ var init_file_manager = __esm({
2889
2861
  const encryptedSecretKey = file.linkKey;
2890
2862
  const nonce = toUint8Array3(file.linkKeyNonce);
2891
2863
  const secretKey = toUint8Array3(file.secretKey);
2892
- const yjsContent = this.convertMarkdown(file.content);
2864
+ const yjsContent = markdownToYjs(file.content);
2893
2865
  const { encryptedFile, key } = await createEncryptedContentFile(yjsContent);
2894
2866
  const commentKey = toUint8Array3(file.commentKey);
2895
2867
  const { appLock, ownerLock } = this.createLocks(key, encryptedSecretKey, commentKey);
@@ -2938,7 +2910,7 @@ var init_file_manager = __esm({
2938
2910
  const nonce = toUint8Array3(file.linkKeyNonce);
2939
2911
  const secretKey = toUint8Array3(file.secretKey);
2940
2912
  logger.debug(`Generating encrypted content file for file ${file.ddocId} with onChainFileId ${file.onChainFileId}`);
2941
- const yjsContent = this.convertMarkdown(file.content);
2913
+ const yjsContent = markdownToYjs(file.content);
2942
2914
  const { encryptedFile, key } = await createEncryptedContentFile(yjsContent);
2943
2915
  const commentKey = toUint8Array3(file.commentKey);
2944
2916
  const { appLock, ownerLock } = this.createLocks(key, encryptedSecretKey, commentKey);