bagindo / tauri-plugin-keygen

Tauri plugin for Keygen.sh licensing
MIT License
11 stars 4 forks source link

Is there a way to get the license key from rust side? #3

Closed lucabrini closed 2 weeks ago

lucabrini commented 2 months ago

Hello @bagindo, I would like to get the license from rust side 'cause I need to use the key in order to ask for updates but I noticed that the tauri_keygen_plugin rust functions are not "exported" to the external of the package.

Am I missing something or does it needs any actual change to the codebase?

bagindo commented 2 months ago

Hi Luca, you don't miss anything. I intentionally made the plugin api to only be accessible from the tauri commands. But I can expose it on the rust side too this weekend. What else do you need other than the license key?

As for auto update, I thought about implementing it here on this plugin. But on Tauri v2 launch, there's an official plugin for auto updates. So I thought why re-invent the wheel.

If you're using the official updater plugin from Tauri, which is accessible from JavaScript, you can pass the license key from JavaScript front-end to implement auto updates.

This is why I didn't think I need to expose this plugin api on the rust side. But I'll do it anyway this weekend 👌🏾

lucabrini commented 2 months ago

Hello,

No worries, I’ve found a workaround for my use case! I’m now passing the license key from Javascript to the Rust side using events.

I attempted to make these changes myself, I wanted to make the LicensedState public so I could access it from the app handle. However, this led to other errors that were a bit too complex for me as a Rust newbie to troubleshoot.

Thank you for your effort! I appreciate it!