Give plugins an API/location to store persistent data
It would be useful for plugins to be able to store persistent data, either via an API controlled by Yaak, or simply by providing them a path to a standard filesystem location for doing such.
My use case is that I’m working on a plugin to help authenticate calls via AWS Cognito (I need to support user-password authentication as well as federated IdP). I need to store the access and refresh tokens somewhere so I can handle token expiration and not have to request a new token every time the access is expired or yaak is restarted (especially important for federated IdP, which opens up the user’s browser so they can log in through their configured IdP).
I’m currently using a global variable in the plugin module, which works fine until Yaak is restarted.
I see Tauri has a key-value store available to the frontend. I don’t know if it’s also exposed to the backend, but a simple wrapper around that would work perfectly for me.
Thanks!
This is a good one to add the list as I work on more plugin APIs.
As a workaround for now, your plugin can write the filesystem at a location of your choosing using
import fs from ‘node:fs’.I think this has been done? The oauth2 auth plugin uses
ctx.storewhich looks like it would solve this use case.https://github.com/mountain-loop/yaak/blob/master/packages/plugin-runtime-types/src/plugins/Context.ts#L28-L31
Yeah I think that’s right. Doesn’t look like I can close the issue but it is no longer relevant.