mlabs-haskell / godot-cardano

Integrated light wallet and off-chain SDK for the Godot engine and Cardano blockchain
https://mlabs-haskell.github.io/godot-cardano/
MIT License
3 stars 0 forks source link

Find a way to decrypt wallets without using threads #55

Open rmgaray opened 4 months ago

rmgaray commented 4 months ago

Background

GDExt provides a synchronous interface. This means any function implemented in Rust using the GDExt framework can only be called as a sync function. In the context of decrypting a wallet's contents, this is problematic, because this task takes some time and if run synchronously it can freeze a game while it is being executed.

Current state of things

To avoid freezing the UI while decrypting a wallet, we spawn a Godot thread to run this task asynchronously. When the task finishes, we emit a signal that a developer can then use to hook a callback. In this way, the use of threads is transparent to a user.

Unfortunately, this complicates things for Paima integration (#53). Threads support in browsers is complicated, so a workaround for wallet decryption would be ideal. Until this is not solved, Paima integration is effectively blocked.