index.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ///<reference path="index.d.ts"/>
  2. import {
  3. sampleCID,
  4. CID,
  5. MemoryBlockStore,
  6. Sha256BlockStore,
  7. Rng,
  8. createSharerDir,
  9. createRecipientExchangeRoot,
  10. PrivateKey,
  11. ExchangeKey,
  12. } from "../mock";
  13. const setup = async () => {
  14. const {
  15. PublicDirectory,
  16. PublicFile,
  17. PublicNode,
  18. PrivateDirectory,
  19. PrivateForest,
  20. PrivateFile,
  21. PrivateNode,
  22. Name,
  23. NameAccumulator,
  24. AccessKey,
  25. setPanicHook,
  26. share,
  27. createShareName,
  28. receiveShare,
  29. findLatestShareCounter,
  30. } = await import("../../dist/bundler/wnfs_wasm");
  31. const mock = {
  32. sampleCID,
  33. CID,
  34. MemoryBlockStore,
  35. Sha256BlockStore,
  36. Rng,
  37. createSharerDir,
  38. createRecipientExchangeRoot,
  39. PrivateKey,
  40. ExchangeKey,
  41. };
  42. const wnfs = {
  43. PublicDirectory,
  44. PublicFile,
  45. PublicNode,
  46. PrivateDirectory,
  47. PrivateForest,
  48. PrivateFile,
  49. PrivateNode,
  50. Name,
  51. NameAccumulator,
  52. AccessKey,
  53. share,
  54. createShareName,
  55. receiveShare,
  56. findLatestShareCounter,
  57. };
  58. return { mock, wnfs, setPanicHook };
  59. };
  60. window.setup = setup;