ltonetwork / universal-wallet

0 stars 0 forks source link

Access Ownable package files in webview #86

Open jasny opened 1 year ago

jasny commented 1 year ago

An Ownable can be imported as zip file. The zip file contains the files of the Ownable package, plus the event chain (as json file). The Ownable service unzips the zip to a temporary directory.

https://github.com/ltonetwork/universal-wallet/blob/502db9fd3505cba11b3d7aaceede28b1ac39cab6/src/services/Ownables/Ownable.service.ts#L43

The chain is stored in memory, while the package files are copied to the final path on the file system (should be using the CID as directory name, but see #83).

https://github.com/ltonetwork/universal-wallet/blob/502db9fd3505cba11b3d7aaceede28b1ac39cab6/src/services/Ownables/Package.service.ts#L82

In the SDK wallet, the React application inlines all assets into the HTML and loads the Wasm file. This is posted to the Ownable iframe.

In universal wallet, each ownable is loaded inside a Webview (see #85). Preferably the webview has access to the package file, so we can inline the HTML and load the wasm within the Webview, rather than the top application. That way we can use the functionality of the browser like DOMParser.

jasny commented 1 year ago

The Webview doesn't need to be sandboxed. The worker it spawns and the iframe it creates do need to be sandboxed.